How do I get list of recent files in GNU Emacs?

From Joe Grossberg’s blog (no longer available): But if you’re using GNU Emacs 21.2 (the latest version, which includes this as part of the standard distro), you can just put the following lines into your .emacs file ;; recentf stuff (require ‘recentf) (recentf-mode 1) (setq recentf-max-menu-items 25) (global-set-key “\C-x\ \C-r” ‘recentf-open-files) Then, when you launch … Read more

How to keep indentation with Emacs + org-mode + visual-line-mode?

Activate org-indent-mode. One way is to add a hook (add-hook ‘org-mode-hook (lambda () (org-indent-mode t)) t) but the easier way is to customize org-startup-indented to be non-nil. Note that even when org-indent-mode is non-nil, headlines still don’t enjoy auto-fill treatment. It’s only the body of an entry that will be both filled and indented left-justified … Read more

Emacs doesn’t recognize C-/ in shell over ssh

The problem here is that Emacs believes any modifier key (control, shift, meta etc) can be applied to any regular key. This is true when Emacs is talking directly to the OS, but not when it’s running inside a traditional (pseudo-)terminal, which is what you’ve got when you’re using emacs inside ssh. In that case, … Read more

Setting Emacs 24 color theme from .emacs

Emacs 24 has built-in theming, which doesn’t use statements like (require ‘color-theme). As Drew points out in the comments, there are differences between color themes and custom themes, and the new direction is towards the latter. Try M-x customize-themes to take a look. From .emacs, you can do things like (load-theme ‘wombat t). But… It … Read more

What does (interactive) mean in an Emacs Lisp function?

Just to clarify (it is in the quoted docs that Charlie cites) (interactive) is not just for key-bound functions, but for any function. Without (interactive), it can only be called programmatically, not from M-x (or via key-binding). EDIT: Note that just adding “(interactive)” to a function won’t necessarily make it work that way, either — … Read more

How to add a hook to only run in a particular mode?

If you take a look at the documentation for add-hook (or C-h f add-hook RET), you’ll see that one possible solution is to make the hook local to the major modes you want. This is slightly more involved than vderyagin’s answer, and looks like this: (add-hook ‘org-mode-hook (lambda () (add-hook ‘after-save-hook ‘a-test-save-hook nil ‘make-it-local))) The … Read more

tech