aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ffap.el11
-rw-r--r--test/lisp/ffap-tests.el13
2 files changed, 16 insertions, 8 deletions
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 1ea32b75f12..87531110b86 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1768,14 +1768,9 @@ Return value:
1768 "Like `ffap', but put buffer in another window. 1768 "Like `ffap', but put buffer in another window.
1769Only intended for interactive use." 1769Only intended for interactive use."
1770 (interactive) 1770 (interactive)
1771 (let (value) 1771 (pcase (save-window-excursion (call-interactively 'ffap))
1772 (switch-to-buffer-other-window 1772 ((or (and (pred bufferp) b) `(,(and (pred bufferp) b) . ,_))
1773 (save-window-excursion 1773 (switch-to-buffer-other-window b))))
1774 (setq value (call-interactively 'ffap))
1775 (unless (or (bufferp value) (bufferp (car-safe value)))
1776 (setq value (current-buffer)))
1777 (current-buffer)))
1778 value))
1779 1774
1780(defun ffap-other-frame () 1775(defun ffap-other-frame ()
1781 "Like `ffap', but put buffer in another frame. 1776 "Like `ffap', but put buffer in another frame.
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index 827d751be69..1862c6c3277 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -23,6 +23,7 @@
23 23
24;;; Code: 24;;; Code:
25 25
26(require 'cl-lib)
26(require 'ert) 27(require 'ert)
27(require 'ffap) 28(require 'ffap)
28 29
@@ -66,6 +67,18 @@ Host = example.com\n")
66 (let ((ffap-gopher-regexp nil)) 67 (let ((ffap-gopher-regexp nil))
67 (should-not (ffap-gopher-at-point))))) 68 (should-not (ffap-gopher-at-point)))))
68 69
70(ert-deftest ffap-other-window--bug-25352 ()
71 "Test for Bug#25352. Checks that the window configuration is
72left alone when opening a URL in an external browser."
73 (cl-letf* ((old (current-window-configuration))
74 ((symbol-function 'ffap-prompter)
75 (lambda () "http://www.gnu.org"))
76 (urls nil)
77 (ffap-url-fetcher (lambda (url) (push url urls) nil)))
78 (should-not (ffap-other-window))
79 (should (equal (current-window-configuration) old))
80 (should (equal urls '("http://www.gnu.org")))))
81
69(provide 'ffap-tests) 82(provide 'ffap-tests)
70 83
71;;; ffap-tests.el ends here 84;;; ffap-tests.el ends here