From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: bug in file-name-shadow-mode Date: Mon, 21 Mar 2005 22:34:21 -0500 Message-ID: References: <200503192012.j2JKCSJ02066@raven.dms.auburn.edu> <200503201626.j2KGQIw04956@raven.dms.auburn.edu> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1111462441 10530 80.91.229.2 (22 Mar 2005 03:34:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Mar 2005 03:34:01 +0000 (UTC) Cc: teirllm@dms.auburn.edu, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 22 04:34:01 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DDa9W-0004bW-WF for ged-emacs-devel@m.gmane.org; Tue, 22 Mar 2005 04:33:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DDaQk-0001HU-Eq for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2005 22:51:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DDaPv-0000ai-0W for emacs-devel@gnu.org; Mon, 21 Mar 2005 22:50:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DDaPr-0000Za-TF for emacs-devel@gnu.org; Mon, 21 Mar 2005 22:50:53 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DDaPr-0000Ym-ON for emacs-devel@gnu.org; Mon, 21 Mar 2005 22:50:51 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DDa9t-0006cO-JW for emacs-devel@gnu.org; Mon, 21 Mar 2005 22:34:21 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1DDa9t-0007pp-8q; Mon, 21 Mar 2005 22:34:21 -0500 Original-To: Stefan Monnier In-reply-to: (message from Stefan Monnier on Mon, 21 Mar 2005 11:20:43 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34937 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34937 The use of fset makes this rather ugly. If the idea is to put a function onto minibuffer-setup-hook just to execute once, I see no reason to bind anything. Just add the function and design it to remove itself when run. For safety's sake, use an unwind-protect to remove the function from the list in the case where an error prevented it from being run. So how about this? (defun find-file-read-args (prompt mustmatch) (list (let ((find-file-default (and buffer-file-name (abbreviate-file-name buffer-file-name))) (find-file-read-args-hook-fn (lambda () ;; Clear out this hook so it does not interfere ;; with any recursive minibuffer usage. (remove-hook 'minibuffer-setup-hook find-file-read-args-hook-fn) (setq minibuffer-default find-file-default)))) (unwind-protect (progn (add-hook 'minibuffer-setup-hook find-file-read-args-hook-fn) (read-file-name prompt nil default-directory mustmatch)) (remove-hook 'minibuffer-setup-hook find-file-read-args-hook-fn))) t)) Meanwhile, do you understand what the purpose of this function is? Is this what arranges to make M-n bring in the default file name?