[OS X Emacs] How to rebind the "recentf" key (C-x C-r)?

Alan Schmitt alan.schmitt at polytechnique.org
Thu Nov 24 11:17:41 EST 2011


Hello,

I'm trying to rebind the key to access the recent files (C-x C-r) so that it calls a function that lets me access them through ido.

I tried putting the following in both my .emacs or my Preferences.el, but when I start Aquamacs, C-x C-r is always bound to the default value (I think it's recentf-open-files).

(defun recentf-ido-find-file ()
  "Find a recent file using Ido."
  (interactive)
  (let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
    (when file
      (find-file file))))

(global-set-key "\C-x\C-r" 'recentf-ido-find-file)

If I evaluate the last line, then everything goes well.

Where should I put the rebinding so that it overrides the default one?

Thanks,

Alan


More information about the MacOSX-Emacs mailing list