aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/help.el
diff options
context:
space:
mode:
authorJoakim Verona2011-09-15 16:11:02 +0200
committerJoakim Verona2011-09-15 16:11:02 +0200
commitb728e88fdffdd34065f996682113b072bbc7008c (patch)
treec0622d02a303baaf2d6c4db2b50866305ca960e0 /lisp/help.el
parent8d07d23ecd32b9e9f07234313c2e712a8c42b524 (diff)
parent39b3d70b17789e237021787ab80ccdd123b97312 (diff)
downloademacs-b728e88fdffdd34065f996682113b072bbc7008c.tar.gz
emacs-b728e88fdffdd34065f996682113b072bbc7008c.zip
upstream
Diffstat (limited to 'lisp/help.el')
-rw-r--r--lisp/help.el58
1 files changed, 32 insertions, 26 deletions
diff --git a/lisp/help.el b/lisp/help.el
index ca8f76515cf..0c8d67106d3 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1060,14 +1060,13 @@ window."
1060 (message "%s" 1060 (message "%s"
1061 (substitute-command-keys (concat quit-part scroll-part))))) 1061 (substitute-command-keys (concat quit-part scroll-part)))))
1062 1062
1063(defun help-window-setup () 1063(defun help-window-setup (help-window)
1064 "Set up help window for `with-help-window'. 1064 "Set up help window for `with-help-window'.
1065This relies on `display-buffer-window' being correctly set up by 1065HELP-WINDOW is the window used for displaying the help buffer."
1066`display-buffer'." 1066 (let* ((help-buffer (when (window-live-p help-window)
1067 (let* ((help-window (car-safe display-buffer-window))
1068 (help-buffer (when (window-live-p help-window)
1069 (window-buffer help-window))) 1067 (window-buffer help-window)))
1070 (help-value (cdr-safe display-buffer-window))) 1068 (help-setup (when (window-live-p help-window)
1069 (window-parameter help-window 'help-setup))))
1071 (when help-buffer 1070 (when help-buffer
1072 ;; Handle `help-window-point-marker'. 1071 ;; Handle `help-window-point-marker'.
1073 (when (eq (marker-buffer help-window-point-marker) help-buffer) 1072 (when (eq (marker-buffer help-window-point-marker) help-buffer)
@@ -1078,6 +1077,7 @@ This relies on `display-buffer-window' being correctly set up by
1078 (cond 1077 (cond
1079 ((or (eq help-window (selected-window)) 1078 ((or (eq help-window (selected-window))
1080 (and (or (eq help-window-select t) 1079 (and (or (eq help-window-select t)
1080 (eq help-setup 'new-frame)
1081 (and (eq help-window-select 'other) 1081 (and (eq help-window-select 'other)
1082 (eq (window-frame help-window) (selected-frame)) 1082 (eq (window-frame help-window) (selected-frame))
1083 (> (length (window-list nil 'no-mini)) 2))) 1083 (> (length (window-list nil 'no-mini)) 2)))
@@ -1085,13 +1085,12 @@ This relies on `display-buffer-window' being correctly set up by
1085 ;; The help window is or gets selected ... 1085 ;; The help window is or gets selected ...
1086 (help-window-display-message 1086 (help-window-display-message
1087 (cond 1087 (cond
1088 ((eq help-value 'new-window) 1088 ((eq help-setup 'new-window)
1089 ;; ... and is new, ... 1089 ;; ... and is new, ...
1090 "Type \"q\" to delete this window") 1090 "Type \"q\" to delete help window")
1091 ((eq help-value 'new-frame) 1091 ((eq help-setup 'new-frame)
1092 ;; ... is on a new frame ... 1092 "Type \"q\" to delete help frame")
1093 "Type \"q\" to delete this frame") 1093 ((eq help-setup 'reuse-other)
1094 ((eq help-value 'reuse-other-window)
1095 ;; ... or displayed some other buffer before. 1094 ;; ... or displayed some other buffer before.
1096 "Type \"q\" to restore previous buffer")) 1095 "Type \"q\" to restore previous buffer"))
1097 help-window t)) 1096 help-window t))
@@ -1101,15 +1100,22 @@ This relies on `display-buffer-window' being correctly set up by
1101 ;; other one is the selected one. 1100 ;; other one is the selected one.
1102 (help-window-display-message 1101 (help-window-display-message
1103 (cond 1102 (cond
1104 ((eq help-value 'new-window) 1103 ((eq help-setup 'new-window)
1105 "Type \\[delete-other-windows] to delete the help window") 1104 "Type \\[delete-other-windows] to delete the help window")
1106 ((eq help-value 'reuse-other-window) 1105 ((eq help-setup 'reuse-other)
1107 "Type \"q\" in other window to quit")) 1106 "Type \"q\" in help window to restore its previous buffer"))
1108 help-window 'other)) 1107 help-window 'other))
1109 (t 1108 (t
1110 ;; Not much to say here. 1109 ;; The help window is not selected ...
1111 (help-window-display-message 1110 (help-window-display-message
1112 "Type \"q\" in help window to quit" help-window)))))) 1111 (cond
1112 ((eq help-setup 'new-window)
1113 ;; ... and is new, ...
1114 "Type \"q\" in help window to delete it")
1115 ((eq help-setup 'reuse-other)
1116 ;; ... or displayed some other buffer before.
1117 "Type \"q\" in help window to restore previous buffer"))
1118 help-window))))))
1113 1119
1114;; `with-help-window' is a wrapper for `with-output-to-temp-buffer' 1120;; `with-help-window' is a wrapper for `with-output-to-temp-buffer'
1115;; providing the following additional twists: 1121;; providing the following additional twists:
@@ -1134,18 +1140,18 @@ You can specify where and how to show the buffer by binding the
1134variable `temp-buffer-show-specifiers' to an appropriate value." 1140variable `temp-buffer-show-specifiers' to an appropriate value."
1135 (declare (indent 1) (debug t)) 1141 (declare (indent 1) (debug t))
1136 `(progn 1142 `(progn
1137 ;; Reset `display-buffer-window': `display-buffer' is
1138 ;; supposed to set this to the window displaying the buffer plus
1139 ;; some additional information.
1140 (setq display-buffer-window nil)
1141 ;; Make `help-window-point-marker' point nowhere. The only place 1143 ;; Make `help-window-point-marker' point nowhere. The only place
1142 ;; where this should be set to a buffer position is within BODY. 1144 ;; where this should be set to a buffer position is within BODY.
1143 (set-marker help-window-point-marker nil) 1145 (set-marker help-window-point-marker nil)
1144 (prog1 1146 (let* (help-window
1145 ;; Return value returned by `with-output-to-temp-buffer'. 1147 (temp-buffer-show-hook
1146 (with-output-to-temp-buffer ,buffer-name 1148 (cons (lambda () (setq help-window (selected-window)))
1147 (progn ,@body)) 1149 temp-buffer-show-hook)))
1148 (when display-buffer-window (help-window-setup))))) 1150 ;; Return value returned by `with-output-to-temp-buffer'.
1151 (prog1
1152 (with-output-to-temp-buffer ,buffer-name
1153 (progn ,@body))
1154 (help-window-setup help-window)))))
1149 1155
1150;; Called from C, on encountering `help-char' when reading a char. 1156;; Called from C, on encountering `help-char' when reading a char.
1151;; Don't print to *Help*; that would clobber Help history. 1157;; Don't print to *Help*; that would clobber Help history.