From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: =?iso-8859-1?Q?Arturo_Garc=EDa_Ares?= Newsgroups: gmane.emacs.bugs Subject: Re: Emacs Improvement Date: Mon, 12 Jan 2004 18:27:51 +0100 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20040112172750.GB593@pikatoste.homeip.net> References: <87u136s81m.fsf@ulm.my.lan> <87zncxtgvo.fsf@era.iki.fi> <20040110004309.GA593@pikatoste.homeip.net> <87vfnhquny.fsf@era.iki.fi> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1073931604 18681 80.91.224.253 (12 Jan 2004 18:20:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 12 Jan 2004 18:20:04 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 12 19:19:58 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ag6fN-0005QU-00 for ; Mon, 12 Jan 2004 19:19:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Ag78S-0005X5-JS for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Jan 2004 13:50:00 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Ag785-0005Qr-84 for bug-gnu-emacs@gnu.org; Mon, 12 Jan 2004 13:49:37 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Ag77X-0005DI-1b for bug-gnu-emacs@gnu.org; Mon, 12 Jan 2004 13:49:35 -0500 Original-Received: from [81.36.29.178] (helo=cuervo.local) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Ag6ou-0007lm-KD for bug-gnu-emacs@gnu.org; Mon, 12 Jan 2004 13:29:48 -0500 Original-Received: from arturo by cuervo.local with local (Exim 3.35 #1 (Debian)) id 1Ag5qy-0000yM-00; Mon, 12 Jan 2004 18:27:52 +0100 Original-To: era@iki.fi Mail-Followup-To: era@iki.fi, bug-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <87vfnhquny.fsf@era.iki.fi> User-Agent: Mutt/1.3.28i X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:6544 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:6544 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?)