* bug#25352: 26.0.50; ffap-other-window should not change window configuration when not displaying a buffer
@ 2017-01-04 10:57 Philipp
2017-03-26 19:45 ` Philipp Stephani
0 siblings, 1 reply; 3+ messages in thread
From: Philipp @ 2017-01-04 10:57 UTC (permalink / raw)
To: 25352
Insert some URL, e.g. "http://www.gnu.org".
Move point inside the URL.
M-x load-library RET ffap RET
M-x ffap-other-window RET RET
The URL is now opened in the default browser, as expected. However, the
window is also split, even if the default browser is external (not
EWW). ffap-other-window should not change the window configuration
unless it has to display a buffer.
In GNU Emacs 26.0.50.25 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
of 2017-01-04 built on unknown
Repository revision: 44c588a25ce231ce05fb535cd6d7162e91214f45
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04 LTS
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
delete-backward-char: Text is read-only
Loading ffap...done
Configured using:
'configure --with-modules --enable-checking
--enable-check-lisp-object-type 'CFLAGS=-ggdb3 -O0''
Configured features:
XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message subr-x puny seq dired
dired-loaddefs format-spec rfc822 mml mml-sec epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils browse-url url-util
url-handlers ffap thingatpt url-parse auth-source cl-seq eieio byte-opt
bytecomp byte-compile cl-extra help-mode easymenu cconv eieio-core
cl-macs gv eieio-loaddefs cl-loaddefs pcase cl-lib password-cache
url-vars time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 16 108530 9458)
(symbols 48 21129 1)
(miscs 40 350 192)
(strings 32 21442 4660)
(string-bytes 1 687435)
(vectors 16 16174)
(vector-slots 8 493808 4095)
(floats 8 218 41)
(intervals 56 227 0)
(buffers 976 12)
(heap 1024 38629 920))
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen
Sie die E-Mail und alle Anhänge. Vielen Dank.
This e-mail is confidential. If you are not the right addressee please do not
forward it, please inform the sender, and please erase this e-mail including
any attachments. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#25352: 26.0.50; ffap-other-window should not change window configuration when not displaying a buffer
2017-01-04 10:57 bug#25352: 26.0.50; ffap-other-window should not change window configuration when not displaying a buffer Philipp
@ 2017-03-26 19:45 ` Philipp Stephani
2017-04-22 16:34 ` Philipp Stephani
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Stephani @ 2017-03-26 19:45 UTC (permalink / raw)
To: 25352
[-- Attachment #1.1: Type: text/plain, Size: 490 bytes --]
Philipp <p.stephani2@gmail.com> schrieb am Mi., 4. Jan. 2017 um 11:58 Uhr:
>
> Insert some URL, e.g. "http://www.gnu.org".
> Move point inside the URL.
> M-x load-library RET ffap RET
> M-x ffap-other-window RET RET
> The URL is now opened in the default browser, as expected. However, the
> window is also split, even if the default browser is external (not
> EWW). ffap-other-window should not change the window configuration
> unless it has to display a buffer.
>
>
Attached a patch.
[-- Attachment #1.2: Type: text/html, Size: 1073 bytes --]
[-- Attachment #2: 0001-ffap-Don-t-switch-window-unless-needed.txt --]
[-- Type: text/plain, Size: 2411 bytes --]
From d0982ad65bdce2838777c8dcd62bfe2986b4e872 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sun, 8 Jan 2017 19:44:22 +0100
Subject: [PATCH] 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.
---
lisp/ffap.el | 11 +++--------
test/lisp/ffap-tests.el | 13 +++++++++++++
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 1ea32b75f1..87531110b8 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1768,14 +1768,9 @@ ffap-other-window
"Like `ffap', but put buffer in another window.
Only intended for interactive use."
(interactive)
- (let (value)
- (switch-to-buffer-other-window
- (save-window-excursion
- (setq value (call-interactively 'ffap))
- (unless (or (bufferp value) (bufferp (car-safe value)))
- (setq value (current-buffer)))
- (current-buffer)))
- value))
+ (pcase (save-window-excursion (call-interactively 'ffap))
+ ((or (and (pred bufferp) b) `(,(and (pred bufferp) b) . ,_))
+ (switch-to-buffer-other-window b))))
(defun ffap-other-frame ()
"Like `ffap', but put buffer in another frame.
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index 827d751be6..1862c6c327 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -23,6 +23,7 @@
;;; Code:
+(require 'cl-lib)
(require 'ert)
(require 'ffap)
@@ -66,6 +67,18 @@
(let ((ffap-gopher-regexp nil))
(should-not (ffap-gopher-at-point)))))
+(ert-deftest ffap-other-window--bug-25352 ()
+ "Test for Bug#25352. Checks that the window configuration is
+left alone when opening a URL in an external browser."
+ (cl-letf* ((old (current-window-configuration))
+ ((symbol-function 'ffap-prompter)
+ (lambda () "http://www.gnu.org"))
+ (urls nil)
+ (ffap-url-fetcher (lambda (url) (push url urls) nil)))
+ (should-not (ffap-other-window))
+ (should (equal (current-window-configuration) old))
+ (should (equal urls '("http://www.gnu.org")))))
+
(provide 'ffap-tests)
;;; ffap-tests.el ends here
--
2.12.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#25352: 26.0.50; ffap-other-window should not change window configuration when not displaying a buffer
2017-03-26 19:45 ` Philipp Stephani
@ 2017-04-22 16:34 ` Philipp Stephani
0 siblings, 0 replies; 3+ messages in thread
From: Philipp Stephani @ 2017-04-22 16:34 UTC (permalink / raw)
To: 25352-done
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 26. März 2017 um
21:45 Uhr:
> Philipp <p.stephani2@gmail.com> schrieb am Mi., 4. Jan. 2017 um 11:58 Uhr:
>
>>
>> Insert some URL, e.g. "http://www.gnu.org".
>> Move point inside the URL.
>> M-x load-library RET ffap RET
>> M-x ffap-other-window RET RET
>> The URL is now opened in the default browser, as expected. However, the
>> window is also split, even if the default browser is external (not
>> EWW). ffap-other-window should not change the window configuration
>> unless it has to display a buffer.
>>
>>
> Attached a patch.
>
Pushed as ace38bafa6.
[-- Attachment #2: Type: text/html, Size: 1760 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-22 16:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 10:57 bug#25352: 26.0.50; ffap-other-window should not change window configuration when not displaying a buffer Philipp
2017-03-26 19:45 ` Philipp Stephani
2017-04-22 16:34 ` Philipp Stephani
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).