comparison lisp/ehelp.el @ 75839:e71b1d9b5c5e

(with-electric-help, electric-help-exit, electric-help-retain): Doc fixes.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 13 Feb 2007 12:47:00 +0000
parents e3694f1cb928
children 9355f9b7bbff dd7c098af727
comparison
equal deleted inserted replaced
75838:404cd4b4fb09 75839:e71b1d9b5c5e
111 ) 111 )
112 112
113 ;;;###autoload 113 ;;;###autoload
114 (defun with-electric-help (thunk &optional buffer noerase minheight) 114 (defun with-electric-help (thunk &optional buffer noerase minheight)
115 "Pop up an \"electric\" help buffer. 115 "Pop up an \"electric\" help buffer.
116 The arguments are THUNK &optional BUFFER NOERASE MINHEIGHT.
117 THUNK is a function of no arguments which is called to initialize the 116 THUNK is a function of no arguments which is called to initialize the
118 contents of BUFFER. BUFFER defaults to `*Help*'. BUFFER will be 117 contents of BUFFER. BUFFER defaults to `*Help*'. BUFFER will be
119 erased before THUNK is called unless NOERASE is non-nil. THUNK will 118 erased before THUNK is called unless NOERASE is non-nil. THUNK will
120 be called while BUFFER is current and with `standard-output' bound to 119 be called while BUFFER is current and with `standard-output' bound to
121 the buffer specified by BUFFER. 120 the buffer specified by BUFFER.
123 If THUNK returns nil, we display BUFFER starting at the top, and 122 If THUNK returns nil, we display BUFFER starting at the top, and
124 shrink the window to fit. If THUNK returns non-nil, we don't do those things. 123 shrink the window to fit. If THUNK returns non-nil, we don't do those things.
125 124
126 After THUNK has been called, this function \"electrically\" pops up a window 125 After THUNK has been called, this function \"electrically\" pops up a window
127 in which BUFFER is displayed and allows the user to scroll through that buffer 126 in which BUFFER is displayed and allows the user to scroll through that buffer
128 in electric-help-mode. The window's height will be at least MINHEIGHT if 127 in `electric-help-mode'. The window's height will be at least MINHEIGHT if
129 this value is non-nil. 128 this value is non-nil.
130 129
131 If THUNK returns nil, we display BUFFER starting at the top, and 130 If THUNK returns nil, we display BUFFER starting at the top, and
132 shrink the window to fit if `electric-help-shrink-window' is non-nil. 131 shrink the window to fit if `electric-help-shrink-window' is non-nil.
133 If THUNK returns non-nil, we don't do those things. 132 If THUNK returns non-nil, we don't do those things.
134 133
135 When the user exits (with `electric-help-exit', or otherwise), the help 134 When the user exits (with `electric-help-exit', or otherwise), the help
136 buffer's window disappears (i.e., we use `save-window-excursion'), and 135 buffer's window disappears (i.e., we use `save-window-excursion'), and
137 BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit." 136 BUFFER is put into `default-major-mode' (or `fundamental-mode')."
138 (setq buffer (get-buffer-create (or buffer "*Help*"))) 137 (setq buffer (get-buffer-create (or buffer "*Help*")))
139 (let ((one (one-window-p t)) 138 (let ((one (one-window-p t))
140 (config (current-window-configuration)) 139 (config (current-window-configuration))
141 (bury nil) 140 (bury nil)
142 (electric-help-form-to-execute nil)) 141 (electric-help-form-to-execute nil))
244 ; (if (and (null arg) (pos-visible-in-window-p (point-max))) 243 ; (if (and (null arg) (pos-visible-in-window-p (point-max)))
245 ; (electric-help-exit) 244 ; (electric-help-exit)
246 ; (scroll-up arg))) 245 ; (scroll-up arg)))
247 246
248 (defun electric-help-exit () 247 (defun electric-help-exit ()
249 "Exit `electric-help', restoring the previous window/buffer configuration. 248 "Exit `with-electric-help', restoring the previous window/buffer configuration.
250 \(The *Help* buffer will be buried.)" 249 \(The *Help* buffer will be buried.)"
251 (interactive) 250 (interactive)
252 ;; Make sure that we don't throw twice, even if two events cause 251 ;; Make sure that we don't throw twice, even if two events cause
253 ;; calling this function: 252 ;; calling this function:
254 (if (memq 'electric-help-retain mouse-leave-buffer-hook) 253 (if (memq 'electric-help-retain mouse-leave-buffer-hook)
255 (progn 254 (progn
256 (remove-hook 'mouse-leave-buffer-hook 'electric-help-retain) 255 (remove-hook 'mouse-leave-buffer-hook 'electric-help-retain)
257 (throw 'exit t)))) 256 (throw 'exit t))))
258 257
259 (defun electric-help-retain () 258 (defun electric-help-retain ()
260 "Exit `electric-help', retaining the current window/buffer configuration. 259 "Exit `with-electric-help', retaining the current window/buffer configuration.
261 \(The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET 260 \(The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET
262 will select it.)" 261 will select it.)"
263 (interactive) 262 (interactive)
264 ;; Make sure that we don't throw twice, even if two events cause 263 ;; Make sure that we don't throw twice, even if two events cause
265 ;; calling this function: 264 ;; calling this function: