[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 7b79b1a: Fix two issues around help-window-select.
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] master 7b79b1a: Fix two issues around help-window-select. (Bug#11039) (Bug#19012) |
Date: |
Fri, 28 Nov 2014 17:14:27 +0000 |
branch: master
commit 7b79b1abad4b697e4f08c5011d346bdb9b219059
Author: Martin Rudalics <address@hidden>
Date: Fri Nov 28 18:12:32 2014 +0100
Fix two issues around help-window-select. (Bug#11039) (Bug#19012)
* help.el (help-window-old-frame): New variable.
(help-window-select): Default to nil (Bug#11039). Rewrite
doc-string.
(help-window-setup): When the help window appears on another
frame and `help-window-select' is non-nil, give that frame input
focus too (Bug#19012).
(with-help-window): Store selected frame in
help-window-old-frame.
---
lisp/ChangeLog | 12 ++++++++++++
lisp/help.el | 53 ++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3037012..45ba279 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2014-11-28 Martin Rudalics <address@hidden>
+
+ Fix two issues around help-window-select. (Bug#11039) (Bug#19012)
+ * help.el (help-window-old-frame): New variable.
+ (help-window-select): Default to nil (Bug#11039). Rewrite
+ doc-string.
+ (help-window-setup): When the help window appears on another
+ frame and `help-window-select' is non-nil, give that frame input
+ focus too (Bug#19012).
+ (with-help-window): Store selected frame in
+ help-window-old-frame.
+
2014-11-28 Ulf Jasper <address@hidden>
* net/newst-treeview.el (newsticker--treeview-load): Take care of
diff --git a/lisp/help.el b/lisp/help.el
index eaee6d1..44716a5 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -46,6 +46,9 @@
(defvar help-window-point-marker (make-marker)
"Marker to override default `window-point' in help windows.")
+(defvar help-window-old-frame nil
+ "Frame selected at the time `with-help-window' is invoked.")
+
(defvar help-map
(let ((map (make-sparse-keymap)))
(define-key map (char-to-string help-char) 'help-for-help)
@@ -1155,17 +1158,27 @@ provided `fit-frame-to-buffer' is non-nil."
(fit-window-to-buffer window height nil width))))
;;; Help windows.
-(defcustom help-window-select 'other
- "Non-nil means select help window for viewing.
+(defcustom help-window-select nil
+ "Non-nil means select help window for viewing.
Choices are:
+
never (nil) Select help window only if there is no other window
on its frame.
- other Select help window unless the selected window is the
- only other window on the help window's frame.
+
+ other Select help window if and only if it appears on the
+ previously selected frame, that frame contains at
+ least two other windows and the help window is
+ either new or showed a different buffer before.
+
always (t) Always select the help window.
+If this option is non-nil and the help window appears on another
+frame, then give that frame input focus too. Note also that if
+the help window appears on another frame, it may get selected and
+its frame get input focus even if this option is nil.
+
This option has effect if and only if the help window was created
-by `with-help-window'"
+by `with-help-window'."
:type '(choice (const :tag "never (nil)" nil)
(const :tag "other" other)
(const :tag "always (t)" t))
@@ -1212,7 +1225,9 @@ Return VALUE."
(let* ((help-buffer (when (window-live-p window)
(window-buffer window)))
(help-setup (when (window-live-p window)
- (car (window-parameter window 'quit-restore)))))
+ (car (window-parameter window 'quit-restore))))
+ (frame (window-frame window)))
+
(when help-buffer
;; Handle `help-window-point-marker'.
(when (eq (marker-buffer help-window-point-marker) help-buffer)
@@ -1220,13 +1235,27 @@ Return VALUE."
;; Reset `help-window-point-marker'.
(set-marker help-window-point-marker nil))
+ ;; If the help window appears on another frame, select it if
+ ;; `help-window-select' is non-nil and give that frame input focus
+ ;; too. See also Bug#19012.
+ (when (and help-window-select
+ (frame-live-p help-window-old-frame)
+ (not (eq frame help-window-old-frame)))
+ (select-window window)
+ (select-frame-set-input-focus frame))
+
(cond
((or (eq window (selected-window))
- (and (or (eq help-window-select t)
- (eq help-setup 'frame)
+ ;; If the help window is on the selected frame, select
+ ;; it if `help-window-select' is t or `help-window-select'
+ ;; is 'other, the frame contains at least three windows, and
+ ;; the help window did show another buffer before. See also
+ ;; Bug#11039.
+ (and (eq frame (selected-frame))
+ (or (eq help-window-select t)
(and (eq help-window-select 'other)
- (eq (window-frame window) (selected-frame))
- (> (length (window-list nil 'no-mini)) 2)))
+ (> (length (window-list nil 'no-mini)) 2)
+ (not (eq help-setup 'same))))
(select-window window)))
;; The help window is or gets selected ...
(help-window-display-message
@@ -1235,12 +1264,13 @@ Return VALUE."
;; ... and is new, ...
"Type \"q\" to delete help window")
((eq help-setup 'frame)
+ ;; ... on a new frame, ...
"Type \"q\" to quit the help frame")
((eq help-setup 'other)
;; ... or displayed some other buffer before.
"Type \"q\" to restore previous buffer"))
window t))
- ((and (eq (window-frame window) (selected-frame))
+ ((and (eq (window-frame window) help-window-old-frame)
(= (length (window-list nil 'no-mini)) 2))
;; There are two windows on the help window's frame and the
;; other one is the selected one.
@@ -1297,6 +1327,7 @@ the help window if the current value of the user option
(cons 'help-mode-setup temp-buffer-window-setup-hook))
(temp-buffer-window-show-hook
(cons 'help-mode-finish temp-buffer-window-show-hook)))
+ (setq help-window-old-frame (selected-frame))
(with-temp-buffer-window
,buffer-name nil 'help-window-setup (progn ,@body)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 7b79b1a: Fix two issues around help-window-select. (Bug#11039) (Bug#19012),
Martin Rudalics <=