bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Improvement


From: era
Subject: Re: Emacs Improvement
Date: 12 Jan 2004 13:44:14 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

On Sat, 10 Jan 2004 01:43:09 +0100, Arturo García Ares
<arturo@pikatoste.homeip.net> posted to bug-gnu-emacs:
 > On Fri, Jan 09, 2004 at 03:04:17PM +0200, era@iki.fi wrote:
 >> Or maybe he just wants whatever file(s) he specified on the command
 >> line to also be added to the minibuffer history. I don't see a good
 >> reason for that, but it shouldn't be hard to do. (It's not a very
 >> intuitive thing to do so it should probably not be made the default,
 >> and probably not even a feature shipped with Emacs, but somebody could
 >> easily hook up a snippet to put in your .emacs.)
 > 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).

I'd imagine something like emacs-startup-hook could be used to add the
contents of command-line-args-left or some such to file-name-history.
(Correction: I couldn't quickly figure out how to get a list of the
files which were passed in as command-line arguments.)

Oh heck, here:

  (require 'cl)
  (add-hook 'emacs-startup-hook
            (lambda ()
              (mapc (lambda (buf)
                      (let ((file (buffer-file-name buf)))
                        (when file
                          (add-to-list 'file-name-history file)) ))
                    (buffer-list) ) ))

It's probably not sufficiently tested.

Oh, and feel free to add abbreviate-file-name back on.

/* era */

-- 
The email address era     the contact information   Just for kicks, imagine
at iki dot fi is heavily  link on my home page at   what it's like to get
spam filtered.  If you    <http://www.iki.fi/era/>  500 pieces of spam for
want to reach me, see     instead.                  each wanted message.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]