Hot answers tagged

23 votes
Accepted

How to find out what command I just accidentally ran with a keyboard shortcut?

When some key sequence triggers an unexpected command, use view-lossage (bound to C-h l by default) to see what keystrokes Emacs has recently received. This is most useful since Emacs 25 as it now ...
glucas's user avatar
  • 20.6k
12 votes

How to find out what command I just accidentally ran with a keyboard shortcut?

As @glucas has mentioned, view-lossage helps. Unfortunately, it displays relatively few events, and users have no control over the number. As C-h k C-h l tells you, you can record all keyboard ...
Drew's user avatar
  • 77.3k
9 votes
Accepted

open files at last-edited position

The built-in library saveplace.el contains a commentary that states: ;; Automatically save place in files, so that visiting them later ;; (even during a different Emacs session) automatically moves ...
lawlist's user avatar
  • 19.1k
6 votes
Accepted

Save *Messages* history

You can use kill-buffer-query-functions to prevent certain buffers from being killed inadvertently. I use something like this: (defcustom buffer-protect-buffers '("*scratch*" "*Messages*") "List of ...
glucas's user avatar
  • 20.6k
6 votes
Accepted

Why does the member function return a list's tail rather than t?

This is a general Lisp question - a question about Lisp lists. It is not special to Emacs Lisp. The answers you are getting are all correct, and they say the same thing, so far. You apparently don't ...
Drew's user avatar
  • 77.3k
5 votes
Accepted

Save *everything* across sessions

It sounds like you should start, as others have said, by getting to know (well) desktop.el. Add to that savehist.el and saveplace.el. Others may have other suggestions. savehist.el will take care of ...
Drew's user avatar
  • 77.3k
4 votes
Accepted

emacs history (invalid-read-syntax "#")

Lisp error: (invalid-read-syntax "#") At the core it is obvious what is happening here. Something reads a string from a Magit buffer and does not remove properties. That string is given to ...
tarsius's user avatar
  • 25.7k
4 votes

use isearch to search the search-ring?

When you use the minibuffer, C-r is not bound to isearch-backward. You are not using Isearch at that time, and Isearch does not use the minibuffer, even though it might look like it does. Perhaps ...
Drew's user avatar
  • 77.3k
4 votes
Accepted

What's the unfortunate historical accident to name 'kill' rather than 'clip'?

Emacs is a derivative of TECO. The history is long and complicated, and I don't have much first-hand knowledge of it, but TECO had a Kill command for removing text from the buffer. This is documented ...
db48x's user avatar
  • 17.9k
3 votes

Shell mode: moving through the command history

M-p and M-n let you navigate through the shell history. You can try C-up and C-down too. There are other ways, as explained in Shell History on the manual.
Manuel Uberti's user avatar
3 votes
Accepted

How to scroll back through the command line history in the Emacs interactive subshell?

For cycling the command history in Shell use: M-n and M-p have a look at Gnu Emacs Manual for the Shell ring
manandearth's user avatar
  • 2,118
3 votes
Accepted

Make the emacs command history size unlimited so I can keep track of files?

I don't know if there's a command history proper, but there's a minibuffer history. The manual says the following about it: Every argument that you enter with the minibuffer is saved in a “...
JeanPierre's user avatar
  • 7,423
3 votes

Save *Messages* history

You should be able to save it to a file just like any other buffer - switch to it with C-h e and then save it to a named file with C-x C-w. This will save the current contents of the buffer but note ...
stevoooo's user avatar
  • 737
3 votes

Why does the member function return a list's tail rather than t?

I wasn't in their head when the original coders of those Lisp primitives made this choice, but my guess is that it seemed like the most useful non-nil value to return among those that were available ...
Stefan's user avatar
  • 26.4k
3 votes

How to see recently opened files in helm

There's a helm-ff-file-name-history command that displays recently opened files. By default this one is bound to C-c h when in helm-find-files mode. Also there is a C-h m command that displays help ...
Cheshire Rat's user avatar
3 votes

What sort of terminal did the guy who wrote emacs have?

(Your question must be about the keyboard, not the terminal, I think.) Emacs was written by multiple people, from the outset. And at that time there were multiple kinds of keyboards (but they were ...
Drew's user avatar
  • 77.3k
2 votes

How to access search history?

To enable this feature in Spacemacs add (setq-default evil-search-module 'evil-search) in dotspacemacs/user-init () section.
Iryston's user avatar
  • 121
2 votes

Why does the member function return a list's tail rather than t?

It's not a side effect, it's the return value of the function. Every function returns something. In elisp, every non-nil value (and (eq nil '()) returns t) is treated as a boolean true. So rather ...
Dan's user avatar
  • 32.9k
2 votes
Accepted

How is the history.el file written? Why did this change happen?

It seems like transient save its history to transient/history.el. I don't think you need to care too much about how it's stored. I suggest you use no-littering and add no-littering-var-directory into ....
Tianshu Wang's user avatar
  • 1,754
2 votes
Accepted

How to use "arrow-up" button to scroll in searched words history immediately after using isearch-forward

OK, after further investigation I actually found a solution that seems to achieve what I was looking for. I added the following to my init.el: (progn (define-key isearch-mode-map (kbd "<up&...
Omer Zimerman's user avatar
2 votes

Preventing shell mode from treating ! as a history reference

Figured it out: (setq shell-input-autoexpand nil). I spent a long while looking at comint-input-autoexpand which was getting mysteriously set to 'history: this is done by shell-mode based on shell-...
Nick Barnes's user avatar
2 votes

How to stop ivy-switch-buffer from trying to connect

Ok, I found this file : # cat ~/.emacs.d/tramp ;; -*- emacs-lisp -*- <21/02/05 12:48:54 /home/xxxxxx/.emacs.d/tramp> ;; Tramp connection history. Don't change this file. ;; You can delete it, ...
yPhil's user avatar
  • 973
2 votes
Accepted

“Obarray” Got Its Name From ...?

Obarray seems to be a property unique to Elisp that is not found in other Lisp-like languages This isn't correct. Emacs Lisp is similar to / inspired by MacLisp which also includes an obarray data ...
phils's user avatar
  • 50.8k
1 vote
Accepted

Retrieve past command from Emacs history using first letter of command

You can use minibuffer history search to find a matching item via M-r. For example, to find the previous history item beginning with the letter 'a': M-x M-r ^a Enter Note that this is a regexp ...
Steve Vinoski's user avatar
1 vote
Accepted

How to save a file history?

By default, Emacs keeps just one older "backup" of every file you edit. If you edit a file called foo, then the backup file is called foo~. Whenever you save a new version of the file foo, the ...
jch's user avatar
  • 5,720
1 vote

How show and filter search text interactively in separate buffer?

C-M-i in Isearch is pretty lame, as you indicate. In general, in vanilla Emacs completion is not incremental, in the sense that it does not continue completing (updating the possible completions) as ...
Drew's user avatar
  • 77.3k
1 vote
Accepted

Navigate cursor position history with line-based jumps

I've tried to modify point-undo. It seems to work. However I included the first jump on the current line. That's intended behaviour. (defvar point-undo-ring-length 20) (defvar point-undo-ring (make-...
bertfred's user avatar
  • 1,729
1 vote
Accepted

Can I exclude .git/COMMIT_EDITMSG from file-name-history?

These files (COMMIT_EDITMSG, git-rebase-todo and others) are added to file-name-history by server-visit-files. It is possible to undo that by advising that function, and I have implemented that. But ...
tarsius's user avatar
  • 25.7k
1 vote

High CPU/memory usage and abnormally large savehist file?

Phils' answer is great and put me on the right track to solve my similar issue. However, I found that directly locating long lines in the history file gave more specific results. cat $...
RockyRoad's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible