comparison lisp/help.el @ 16391:5d64d742ccbb

(print-help-return-message): Use new functions `special-display-p' and `same-window-p' to determine which help message to print. (Also unquote lambda forms.)
author Erik Naggum <erik@naggum.no>
date Sun, 06 Oct 1996 16:27:39 +0000
parents 14ff4afa06ec
children 0c61b1f40de2
comparison
equal deleted inserted replaced
16390:77051008303f 16391:5d64d742ccbb
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA. 23 ;; Boston, MA 02111-1307, USA.
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;; This code implements GNU Emac's on-line help system, the one invoked by 27 ;; This code implements GNU Emacs' on-line help system, the one invoked by
28 ;;`M-x help-for-help'. 28 ;;`M-x help-for-help'.
29 29
30 ;;; Code: 30 ;;; Code:
31 31
32 ;; Get the macro make-help-screen when this is compiled, 32 ;; Get the macro make-help-screen when this is compiled,
196 "Display or return message saying how to restore windows after help command. 196 "Display or return message saying how to restore windows after help command.
197 Computes a message and applies the optional argument FUNCTION to it. 197 Computes a message and applies the optional argument FUNCTION to it.
198 If FUNCTION is nil, applies `message' to it, thus printing it." 198 If FUNCTION is nil, applies `message' to it, thus printing it."
199 (and (not (get-buffer-window standard-output)) 199 (and (not (get-buffer-window standard-output))
200 (let ((first-message 200 (let ((first-message
201 (cond ((or (member (buffer-name standard-output) 201 (cond ((special-display-p (buffer-name standard-output))
202 special-display-buffer-names)
203 (assoc (buffer-name standard-output)
204 special-display-buffer-names)
205 (let (found
206 (tail special-display-regexps)
207 (name (buffer-name standard-output)))
208 (while (and tail (not found))
209 (if (or (and (consp (car tail))
210 (string-match (car (car tail)) name))
211 (and (stringp (car tail))
212 (string-match (car tail) name)))
213 (setq found t))
214 (setq tail (cdr tail)))
215 found))
216 ;; If the help output buffer is a special display buffer, 202 ;; If the help output buffer is a special display buffer,
217 ;; don't say anything about how to get rid of it. 203 ;; don't say anything about how to get rid of it.
218 ;; First of all, the user will do that with the window 204 ;; First of all, the user will do that with the window
219 ;; manager, not with Emacs. 205 ;; manager, not with Emacs.
220 ;; Secondly, the buffer has not been displayed yet, 206 ;; Secondly, the buffer has not been displayed yet,
221 ;; so we don't know whether its frame will be selected. 207 ;; so we don't know whether its frame will be selected.
222 ;; Even the message about scrolling the help
223 ;; might be wrong, but it seems worth showing it anyway.
224 nil) 208 nil)
225 ((not (one-window-p t)) 209 ((not (one-window-p t))
226 "Type \\[switch-to-buffer-other-window] RET to restore the other window.") 210 "Type \\[switch-to-buffer-other-window] RET to restore the other window.")
227 (pop-up-windows 211 (pop-up-windows
228 "Type \\[delete-other-windows] to remove help window.") 212 "Type \\[delete-other-windows] to remove help window.")
234 (substitute-command-keys first-message) 218 (substitute-command-keys first-message)
235 "") 219 "")
236 (if first-message " " "") 220 (if first-message " " "")
237 ;; If the help buffer will go in a separate frame, 221 ;; If the help buffer will go in a separate frame,
238 ;; it's no use mentioning a command to scroll, so don't. 222 ;; it's no use mentioning a command to scroll, so don't.
239 (if (or (member (buffer-name standard-output) 223 (if (special-display-p (buffer-name standard-output))
240 special-display-buffer-names)
241 (assoc (buffer-name standard-output)
242 special-display-buffer-names)
243 (memq t (mapcar '(lambda (elt)
244 (if (consp elt)
245 (setq elt (car elt)))
246 (string-match elt (buffer-name standard-output)))
247 special-display-regexps)))
248 nil 224 nil
249 (if (or (member (buffer-name standard-output) 225 (if (same-window-p (buffer-name standard-output))
250 same-window-buffer-names)
251 (assoc (buffer-name standard-output)
252 same-window-buffer-names)
253 (memq t (mapcar '(lambda (elt)
254 (if (consp elt)
255 (setq elt (car elt)))
256 (string-match elt (buffer-name standard-output)))
257 same-window-regexps)))
258 ;; Say how to scroll this window. 226 ;; Say how to scroll this window.
259 (substitute-command-keys 227 (substitute-command-keys
260 "\\[scroll-up] to scroll the help.") 228 "\\[scroll-up] to scroll the help.")
261 ;; Say how to scroll some other window. 229 ;; Say how to scroll some other window.
262 (substitute-command-keys 230 (substitute-command-keys
679 nil nil 647 nil nil
680 t)) 648 t))
681 (let (result) 649 (let (result)
682 (catch 'answer 650 (catch 'answer
683 (mapcar 651 (mapcar
684 '(lambda (dir) 652 (lambda (dir)
685 (mapcar 653 (mapcar
686 '(lambda (suf) 654 (lambda (suf)
687 (let ((try (expand-file-name (concat library suf) dir))) 655 (let ((try (expand-file-name (concat library suf) dir)))
688 (and (file-readable-p try) 656 (and (file-readable-p try)
689 (null (file-directory-p try)) 657 (null (file-directory-p try))
690 (progn 658 (progn
691 (setq result try) 659 (setq result try)
692 (throw 'answer try))))) 660 (throw 'answer try)))))
693 (if nosuffix 661 (if nosuffix
694 '("") 662 '("")
695 (let ((basic '(".elc" ".el" "")) 663 (let ((basic '(".elc" ".el" ""))
696 (compressed '(".Z" ".gz" ""))) 664 (compressed '(".Z" ".gz" "")))
697 ;; If autocompression mode is on, 665 ;; If autocompression mode is on,
698 ;; consider all combinations of library suffixes 666 ;; consider all combinations of library suffixes
699 ;; and compression suffixes. 667 ;; and compression suffixes.
700 (if (rassq 'jka-compr-handler file-name-handler-alist) 668 (if (rassq 'jka-compr-handler file-name-handler-alist)
701 (apply 'nconc 669 (apply 'nconc
702 (mapcar '(lambda (compelt) 670 (mapcar (lambda (compelt)
703 (mapcar '(lambda (baselt) 671 (mapcar (lambda (baselt)
704 (concat baselt compelt)) 672 (concat baselt compelt))
705 basic)) 673 basic))
706 compressed)) 674 compressed))
707 basic))))) 675 basic)))))
708 (or path load-path))) 676 (or path load-path)))
709 (and interactive-call 677 (and interactive-call
710 (if result 678 (if result
711 (message "Library is file %s" result) 679 (message "Library is file %s" result)
712 (message "No library %s in search path" library))) 680 (message "No library %s in search path" library)))