[Top][All Lists]

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

Re: Any objection to adding completing-read-function?

From: Leo
Subject: Re: Any objection to adding completing-read-function?
Date: Wed, 29 Dec 2010 08:16:38 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.91 (Mac OS X 10.6.5)

On 2010-12-29 02:51 +0000, Stefan Monnier wrote:
>> Is the following patch (against 24, not touching ido.el yet) something
>> people have in mind? - Leo
> I think so, tho it's hard to tell since the diff shows a big removal and
> a big addition: if you place read-file-name-default after
> read-file-name, then the diff will be more readable, I think.
>         Stefan

I thought C-c C-w in diff ignore all spaces but it turned out only for a
hunk. Here is the diff again:

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 8d09d5d..4b006c7 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1474,8 +1474,9 @@
   "Internal subroutine for `read-file-name'.  Do not call this.")
-(defvar read-file-name-function nil
-  "If this is non-nil, `read-file-name' does its work by calling this 
+(defvar read-file-name-function 'read-file-name-default
+  "The function called by `read-file-name' to do its work.
+It should accept the same arguments as `read-file-name'.")
 (defcustom read-file-name-completion-ignore-case
   (if (memq system-type '(ms-dos windows-nt darwin cygwin))
@@ -1513,7 +1514,7 @@ such as making the current buffer visit no file in the 
case of
 (declare-function x-file-dialog "xfns.c"
                   (prompt dir &optional default-filename mustmatch only-dir-p))
-(defun read-file-name-defaults (&optional dir initial)
+(defun read-file-name--defaults (&optional dir initial)
   (let ((default
           ;; With non-nil `initial', use `dir' as the first default.
@@ -1580,6 +1580,12 @@
 See also `read-file-name-completion-ignore-case'
 and `read-file-name-function'."
+  (funcall read-file-name-function
+           prompt dir default-filename mustmatch initial predicate))
+(defun read-file-name-default (prompt &optional dir default-filename mustmatch 
initial predicate)
+  "Default method for reading file names.
+See `read-file-name' for the meaning of the arguments."
   (unless dir (setq dir default-directory))
   (unless (file-name-absolute-p dir) (setq dir (expand-file-name dir)))
   (unless default-filename
@@ -1601,9 +1601,6 @@
                     (minibuffer--double-dollars dir)))
                  (initial (cons (minibuffer--double-dollars initial) 0)))))
-    (if read-file-name-function
-        (funcall read-file-name-function
-                 prompt dir default-filename mustmatch initial predicate)
       (let ((completion-ignore-case read-file-name-completion-ignore-case)
             (minibuffer-completing-file-name t)
             (pred (or predicate 'file-exists-p))
@@ -1639,7 +1636,7 @@
                                 (lambda ()
-                                    (read-file-name-defaults dir initial)))))
+                                  (read-file-name--defaults dir initial)))))
                         (completing-read prompt 'read-file-name-internal
                                          pred mustmatch insdef
                                          'file-name-history default-filename)))
@@ -1713,7 +1713,7 @@
                                 (if history-delete-duplicates
                                     (delete val1 file-name-history)
-          val)))))
+       val))))
 (defun internal-complete-buffer-except (&optional buffer)
   "Perform completion on all buffers excluding BUFFER.

reply via email to

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