From 2379d6392826fee86f38d6d0e42eb152d22fa9e3 Mon Sep 17 00:00:00 2001 From: dickmao Date: Tue, 3 Aug 2021 12:02:48 -0400 Subject: [PATCH] ffap ido accommodation Now that ffap-file-finder can be ido-find-file, the noninteractive portion of find-file-at-point cannot assume ffap-file-finder always takes an argument (ido-find-file does not). * lisp/ffap.el (find-file-at-point): Do not call ffap-file-finder. * test/lisp/ffap-tests.el (ffap-ido-mode): Test it. --- lisp/ffap.el | 6 +++--- test/lisp/ffap-tests.el | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lisp/ffap.el b/lisp/ffap.el index b398d1c9f2..9be9c2906e 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1670,9 +1670,9 @@ find-file-at-point ((or (not ffap-newfile-prompt) (file-exists-p filename) (y-or-n-p "File does not exist, create buffer? ")) - (funcall ffap-file-finder - ;; expand-file-name fixes "~/~/.emacs" bug sent by CHUCKR. - (expand-file-name filename))) + (find-file + ;; expand-file-name fixes "~/~/.emacs" bug sent by CHUCKR. + (expand-file-name filename))) ;; User does not want to find a non-existent file: ((signal 'file-missing (list "Opening file buffer" "No such file or directory" diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el index 3ceb392d7f..4fb4c90e76 100644 --- a/test/lisp/ffap-tests.el +++ b/test/lisp/ffap-tests.el @@ -123,6 +123,21 @@ ffap-test-no-newlines (save-excursion (insert "type=")) (ffap-guess-file-name-at-point)))) +(ert-deftest ffap-ido-mode () + (require 'ido) + (with-temp-buffer + (let ((ido-mode t) + (read-filename-function read-file-name-function) + (read-buffer-function read-buffer-function)) + (ido-everywhere) + (let ((read-file-name-function (lambda (&rest args) + (expand-file-name + (nth 4 args) + (nth 1 args))))) + (save-excursion (insert "ffap-tests.el")) + (let (kill-buffer-query-functions) + (kill-buffer (call-interactively #'find-file-at-point))))))) + (provide 'ffap-tests) ;;; ffap-tests.el ends here -- 2.26.2