all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: teirllm@dms.auburn.edu, emacs-devel@gnu.org
Subject: Re: bug in file-name-shadow-mode
Date: Mon, 21 Mar 2005 22:34:21 -0500	[thread overview]
Message-ID: <E1DDa9t-0007pp-8q@fencepost.gnu.org> (raw)
In-Reply-To: <jwveke9q8cn.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Mon, 21 Mar 2005 11:20:43 -0500)

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?

      parent reply	other threads:[~2005-03-22  3:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-19 20:12 bug in file-name-shadow-mode Luc Teirlinck
2005-03-20 12:59 ` Richard Stallman
2005-03-20 16:26   ` Luc Teirlinck
2005-03-21  1:19     ` Richard Stallman
2005-03-21 16:20       ` Stefan Monnier
2005-03-22  0:04         ` Luc Teirlinck
2005-03-22  3:34         ` Richard Stallman [this message]

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

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

  git send-email \
    --in-reply-to=E1DDa9t-0007pp-8q@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=teirllm@dms.auburn.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.