From: Leo <sdl.web@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Drew Adams <drew.adams@oracle.com>, emacs-devel@gnu.org
Subject: Re: Any objection to adding completing-read-function?
Date: Wed, 29 Dec 2010 08:16:38 +0000 [thread overview]
Message-ID: <m1ei919eop.fsf@cam.ac.uk> (raw)
In-Reply-To: <jwvtyhxjnsj.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 28 Dec 2010 21:51:09 -0500")
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 @@
'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))
@@ -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
(cond
;; 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 ()
(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)))
@@ -1713,7 +1713,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.
next prev parent reply other threads:[~2010-12-29 8:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-28 8:03 Any objection to adding completing-read-function? Leo
2010-12-28 14:34 ` Stefan Monnier
2010-12-28 16:17 ` Drew Adams
2010-12-28 19:39 ` Stefan Monnier
2010-12-28 19:45 ` Drew Adams
2010-12-28 22:03 ` Stefan Monnier
2010-12-28 23:27 ` Leo
2010-12-29 2:51 ` Stefan Monnier
2010-12-29 8:16 ` Leo [this message]
2010-12-29 15:39 ` Stefan Monnier
2010-12-29 16:12 ` Leo
2011-03-20 13:07 ` Leo
2011-03-21 14:22 ` Stefan Monnier
2011-03-21 15:01 ` Leo
2010-12-28 19:02 ` Leo
2010-12-28 19:45 ` Stefan Monnier
2011-05-31 15:27 ` Drew Adams
2011-05-31 15:51 ` Stefan Monnier
2011-06-01 19:03 ` Leo
2011-06-09 11:53 ` Leo
2011-06-09 15:16 ` Stefan Monnier
2011-06-21 9:11 ` Leo
2011-06-22 1:50 ` Stefan Monnier
2011-06-22 4:15 ` Leo
2011-06-22 21:19 ` Stefan Monnier
2011-06-23 3:42 ` Leo
2010-12-28 16:17 ` Drew Adams
2010-12-28 19:07 ` Leo
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=m1ei919eop.fsf@cam.ac.uk \
--to=sdl.web@gmail.com \
--cc=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.