unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: era@iki.fi
Subject: Re: Emacs Improvement
Date: 12 Jan 2004 13:44:14 +0200	[thread overview]
Message-ID: <87vfnhquny.fsf@era.iki.fi> (raw)
In-Reply-To: 20040110004309.GA593@pikatoste.homeip.net

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	other threads:[~2004-01-12 11:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.229.1073581027.928.bug-gnu-emacs@gnu.org>
2004-01-08 16:45 ` Emacs Improvement Klaus Uhl
2004-01-09 13:04   ` era
2004-01-10  0:43     ` Arturo García Ares
2004-01-12 11:44       ` era [this message]
2004-01-12 17:27         ` Arturo García Ares
2004-01-13  7:33           ` era
2004-01-13 21:21             ` Arturo García Ares
2004-01-08 15:36 Adam Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vfnhquny.fsf@era.iki.fi \
    --to=era@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).