emacs-devel
[Top][All Lists]
Advanced

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

Re: bug in file-name-shadow-mode


From: Richard Stallman
Subject: Re: bug in file-name-shadow-mode
Date: Mon, 21 Mar 2005 22:34:21 -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?




reply via email to

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