emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103704: Default read-file-name-funct


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103704: Default read-file-name-function to a non-nil value
Date: Mon, 21 Mar 2011 22:55:00 +0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103704
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Mon 2011-03-21 22:55:00 +0800
message:
  Default read-file-name-function to a non-nil value
  
  See discussion thread:
  http://thread.gmane.org/gmane.emacs.devel/134000
modified:
  lisp/ChangeLog
  lisp/minibuffer.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-21 06:42:23 +0000
+++ b/lisp/ChangeLog    2011-03-21 14:55:00 +0000
@@ -1,3 +1,10 @@
+2011-03-21  Leo Liu  <address@hidden>
+
+       * minibuffer.el (read-file-name-function): Change default value.
+       (read-file-name--defaults): Rename from read-file-name-defaults.
+       (read-file-name-default): Rename from read-file-name.
+       (read-file-name): Call read-file-name-function.
+
 2011-03-21  Glenn Morris  <address@hidden>
 
        * eshell/esh-opt.el (eshell-eval-using-options, eshell-process-args):

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-03-17 00:43:54 +0000
+++ b/lisp/minibuffer.el        2011-03-21 14:55:00 +0000
@@ -1486,8 +1486,9 @@
                             'completion--file-name-table)
   "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 
function.")
+(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))
@@ -1525,7 +1526,7 @@
 (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
          (cond
           ;; With non-nil `initial', use `dir' as the first default.
@@ -1592,6 +1593,12 @@
 
 See also `read-file-name-completion-ignore-case'
 and `read-file-name-function'."
+  (funcall (or read-file-name-function #'read-file-name-default)
+           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
@@ -1613,9 +1620,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))
@@ -1651,7 +1655,7 @@
                                 (lambda ()
                                   (with-current-buffer
                                       (window-buffer 
(minibuffer-selected-window))
-                                    (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)))
@@ -1725,7 +1729,7 @@
                                 (if history-delete-duplicates
                                     (delete val1 file-name-history)
                                   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]