From: Christophe Junke <junke.christophe@gmail.com>
To: 31783@debbugs.gnu.org
Cc: Christophe Junke <junke.christophe@gmail.com>
Subject: bug#31783: [PATCH v2] ido.el: define a special ido-fallback variable
Date: Mon, 11 Jun 2018 10:23:40 +0200 [thread overview]
Message-ID: <20180611082340.28727-1-junke.christophe@gmail.com> (raw)
In-Reply-To: <83bmcktpef.fsf@gnu.org>
- Introduce a global, special ido-fallback variable
- Rename existing occurrences of fallback to ido-fallback
This allows to retain the behaviour that was available prior to
introducing per-file lexical-scope, namely that other modules could
change what fallback command to call when ido-exit is set to
'fallback.
---
Hi,
I agree that it is simpler to rename the existing variable, and just
add a defvar declaration. Here is a different version of the patch
which does only this.
Thank you for your review and your time.
lisp/ido.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/lisp/ido.el b/lisp/ido.el
index 705e7dd630..358e856d4a 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1242,6 +1242,9 @@ Only used if `ido-use-virtual-buffers' is non-nil.")
;; Dynamically bound in ido-read-internal.
(defvar ido-completing-read)
+;; Indicates which fallback command to call when ido-exit is 'fallback.
+(defvar ido-fallback nil)
+
;;; FUNCTIONS
(defun ido-active (&optional merge)
@@ -2213,13 +2216,13 @@ If cursor is not at the end of the user input, move to end of input."
(exit-minibuffer)))
;;; MAIN FUNCTIONS
-(defun ido-buffer-internal (method &optional fallback prompt default initial switch-cmd)
+(defun ido-buffer-internal (method &optional ido-fallback prompt default initial switch-cmd)
;; Internal function for ido-switch-buffer and friends
(if (not ido-mode)
(progn
(run-hook-with-args 'ido-before-fallback-functions
- (or fallback 'switch-to-buffer))
- (call-interactively (or fallback 'switch-to-buffer)))
+ (or ido-fallback 'switch-to-buffer))
+ (call-interactively (or ido-fallback 'switch-to-buffer)))
(let* ((ido-context-switch-command switch-cmd)
(ido-current-directory nil)
(ido-directory-nonreadable nil)
@@ -2245,7 +2248,7 @@ If cursor is not at the end of the user input, move to end of input."
((eq ido-exit 'fallback)
(let ((read-buffer-function nil))
- (setq this-command (or fallback 'switch-to-buffer))
+ (setq this-command (or ido-fallback 'switch-to-buffer))
(run-hook-with-args 'ido-before-fallback-functions this-command)
(call-interactively this-command)))
@@ -2337,7 +2340,7 @@ If cursor is not at the end of the user input, move to end of input."
;; Add final slash to result in case it was missing from DEFAULT-DIRECTORY.
(ido-final-slash (expand-file-name (or dir default-directory)) t))
-(defun ido-file-internal (method &optional fallback default prompt item initial switch-cmd)
+(defun ido-file-internal (method &optional ido-fallback default prompt item initial switch-cmd)
;; Internal function for ido-find-file and friends
(unless item
(setq item 'file))
@@ -2412,7 +2415,7 @@ If cursor is not at the end of the user input, move to end of input."
;; we don't want to change directory of current buffer.
(let ((default-directory ido-current-directory)
(read-file-name-function nil))
- (setq this-command (or fallback 'find-file))
+ (setq this-command (or ido-fallback 'find-file))
(run-hook-with-args 'ido-before-fallback-functions this-command)
(call-interactively this-command)))
@@ -2496,10 +2499,10 @@ If cursor is not at the end of the user input, move to end of input."
((eq method 'read-only)
(ido-record-work-file filename)
(setq filename (concat ido-current-directory filename))
- (ido-record-command fallback filename)
+ (ido-record-command ido-fallback filename)
(ido-record-work-directory)
- (run-hook-with-args 'ido-before-fallback-functions fallback)
- (funcall fallback filename))
+ (run-hook-with-args 'ido-before-fallback-functions ido-fallback)
+ (funcall ido-fallback filename))
((eq method 'insert)
(ido-record-work-file filename)
--
2.14.1
next prev parent reply other threads:[~2018-06-11 8:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 8:39 bug#31707: [PATCH 1/1] ido: add ido-fallback special variable Christophe Junke
2018-06-09 7:00 ` Eli Zaretskii
2018-06-11 8:23 ` Christophe Junke [this message]
2018-06-11 12:19 ` bug#31783: [PATCH v2] ido.el: define a special ido-fallback variable Noam Postavsky
2018-06-11 12:54 ` Christophe Junke
2018-06-11 15:28 ` Eli Zaretskii
[not found] ` <CAFDFyRiHzxOB7Q6uV1hPYmuC3KfiqJRCmk=nrQ5wTPWUue_W4Q@mail.gmail.com>
2018-06-11 16:55 ` Eli Zaretskii
2018-06-22 0:34 ` Noam Postavsky
2018-06-22 6:34 ` Eli Zaretskii
2018-06-22 8:24 ` Christophe Junke
2018-06-22 9:02 ` Eli Zaretskii
2018-06-22 11:32 ` Noam Postavsky
2018-06-22 12:45 ` Eli Zaretskii
2018-06-24 1:52 ` bug#31707: [PATCH 1/1] ido: add ido-fallback special variable Noam Postavsky
2018-06-24 14:54 ` Eli Zaretskii
2018-06-26 0:40 ` Noam Postavsky
2018-06-11 18:52 ` bug#31783: [PATCH v2] ido.el: define a special ido-fallback variable Christophe Junke
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=20180611082340.28727-1-junke.christophe@gmail.com \
--to=junke.christophe@gmail.com \
--cc=31783@debbugs.gnu.org \
/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.