emacs-diffs
[Top][All Lists]
Advanced

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

master 253b36b: ffap ido accommodation


From: Lars Ingebrigtsen
Subject: master 253b36b: ffap ido accommodation
Date: Wed, 4 Aug 2021 03:22:55 -0400 (EDT)

branch: master
commit 253b36bd40d1b342cdda09b0bee183788120f67e
Author: dickmao <none>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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 b398d1c..9be9c29 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1670,9 +1670,9 @@ See also the variables `ffap-dired-wildcards', 
`ffap-newfile-prompt',
        ((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 3ceb392..4fb4c90 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -123,6 +123,21 @@ left alone when opening a URL in an external browser."
      (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]