[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs Improvement
From: |
Arturo García Ares |
Subject: |
Re: Emacs Improvement |
Date: |
Mon, 12 Jan 2004 18:27:51 +0100 |
User-agent: |
Mutt/1.3.28i |
On Mon, Jan 12, 2004 at 01:44:14PM +0200, era@iki.fi wrote:
> > This is such a snippet:
> > (add-hook 'find-file-hooks
> > (lambda ()
> > (add-to-list 'file-name-history
> > (abbreviate-file-name (buffer-file-name)))))
>
> This modifies what happens when you M-x find-file within Emacs, not
> what happens with file name arguments passed in on the command line.
> Also it duplicates what Emacs already does by itself (you don't get
> duplicates on file-name-history because add-to-list won't add a file
> name which is there already).
File names passed as arguments to emacs are opened via find-file, so in
effect the above code adds those files to file-name-history.
Yes: duplicates are (intentionally) avoided by add-to-list, and it's
not optimal to let the hook execute for every visited file when it's
only required for non-interactive (by interactive I mean those opened
via C-x C-f) file opens. Nevertheless, it's harmless, except for the
extra cpu cycles. It's just a quick hack tu put in your .emacs, but it
does the job (have you tried it?)