From de5ae0c964135dd3b1247b91b76a6581b5d8a47c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 8 Jul 2021 15:25:34 +0200 Subject: [PATCH] Make ido-mode override ffap-file-finder * lisp/ffap.el: Autoload so that we can override in ido (bug#21980). * lisp/ido.el (ido-everywhere): Override ffap-file-finder. --- etc/NEWS | 17 +++++++++++------ lisp/ffap.el | 1 + lisp/ido.el | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index b9522c069db..da5524a5553 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2410,12 +2410,6 @@ leak information from the reporting user. *** 'count-windows' now takes an optional parameter ALL-FRAMES. The semantics are as with 'walk-windows'. ---- -*** Killing virtual ido buffers interactively will make them go away. -Previously, killing a virtual ido buffer with 'ido-kill-buffer' didn't -do anything. This has now been changed, and killing virtual buffers -with that command will remove the buffer from recentf. - --- *** New variable 'ffap-file-name-with-spaces'. If non-nil, 'find-file-at-point' and friends will try to guess more @@ -2490,6 +2484,17 @@ height of lines or width of chars. When non-nil, use a new xwidget webkit session after bookmark jump. Otherwise, it will use 'xwidget-webkit-last-session'. +** ido + +--- +*** Switching on 'ido-mode' now also overrides 'ffap-file-finder'. + +--- +*** Killing virtual ido buffers interactively will make them go away. +Previously, killing a virtual ido buffer with 'ido-kill-buffer' didn't +do anything. This has now been changed, and killing virtual buffers +with that command will remove the buffer from recentf. + ** Flymake mode +++ diff --git a/lisp/ffap.el b/lisp/ffap.el index 6faf8d50b26..c31926eb299 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -260,6 +260,7 @@ ffap most of the time." :type 'boolean :group 'ffap) +;;;###autoload (defcustom ffap-file-finder 'find-file "The command called by `find-file-at-point' to find a file." :type 'function diff --git a/lisp/ido.el b/lisp/ido.el index 93629046801..ea5ff32b8d7 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1521,6 +1521,10 @@ Removes badly formatted data and ignored directories." :global t (remove-function read-file-name-function #'ido-read-file-name) (remove-function read-buffer-function #'ido-read-buffer) + (when (boundp 'ffap-file-finder) + (remove-function ffap-file-finder #'ido-find-file) + (when ido-mode + (add-function :override ffap-file-finder #'ido-find-file))) (when ido-everywhere (if (not ido-mode) (ido-mode 'both) -- 2.39.2