aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhilipp Stephani2017-01-08 19:44:22 +0100
committerPhilipp Stephani2017-04-22 18:33:38 +0200
commitace38bafa6ae0d40bf3fac9f998c8ecbe36d5f41 (patch)
tree606bda0d44d6206a1ac1b00272632b2c5ee544f4 /test
parentd354fc38286cba05b3ba2fefb9d9cd6d30deac3d (diff)
downloademacs-ace38bafa6ae0d40bf3fac9f998c8ecbe36d5f41.tar.gz
emacs-ace38bafa6ae0d40bf3fac9f998c8ecbe36d5f41.zip
ffap: Don't switch window unless needed
When using ffap-other-window, don't change the window configuration unless a new buffer has actually been created (Bug#25352). * lisp/ffap.el (ffap-other-frame): Don't change the window configuration if no new buffer has been created. * test/lisp/ffap-tests.el (ffap-other-window--bug-25352): Add unit test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/ffap-tests.el13
1 files changed, 13 insertions, 0 deletions
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