• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +defs:help +defs:map

1 ;;; ehelp.el --- bindings for electric-help mode
7 ;; Keywords: help, extensions
29 ;; browsing on-line help screens. There is one entry point,
30 ;; `with-electric-help'; all you have to give it is a no-argument
31 ;; function that generates the actual text of the help into the current
36 ;; (define-key global-map "\C-h" 'ehelp-command)
37 ;; (define-key global-map [help] 'ehelp-command)
38 ;; (define-key global-map [f1] 'ehelp-command)
43 (defvar electric-help-map ()
44 "Keymap defining commands available in `electric-help-mode'.")
46 (defvar electric-help-form-to-execute nil)
48 (defgroup electric-help ()
49 "Electric help facility."
51 :group 'help)
53 (defcustom electric-help-shrink-window t
54 "If set, adjust help window sizes to buffer sizes when displaying help."
56 :group 'electric-help)
58 (defcustom electric-help-mode-hook nil
59 "Hook run by `with-electric-help' after initializing the buffer."
61 :group 'electric-help)
63 (put 'electric-help-undefined 'suppress-keymap t)
64 (if electric-help-map
66 (let ((map (make-keymap)))
69 (suppress-keymap map)
70 (define-key map "\C-u" 'electric-help-undefined)
71 (define-key map [?\C-0] 'electric-help-undefined)
72 (define-key map [?\C-1] 'electric-help-undefined)
73 (define-key map [?\C-2] 'electric-help-undefined)
74 (define-key map [?\C-3] 'electric-help-undefined)
75 (define-key map [?\C-4] 'electric-help-undefined)
76 (define-key map [?\C-5] 'electric-help-undefined)
77 (define-key map [?\C-6] 'electric-help-undefined)
78 (define-key map [?\C-7] 'electric-help-undefined)
79 (define-key map [?\C-8] 'electric-help-undefined)
80 (define-key map [?\C-9] 'electric-help-undefined)
81 (define-key map (char-to-string help-char) 'electric-help-help)
82 (define-key map "?" 'electric-help-help)
83 (define-key map " " 'scroll-up)
84 (define-key map "\^?" 'scroll-down)
85 (define-key map "." 'beginning-of-buffer)
86 (define-key map "<" 'beginning-of-buffer)
87 (define-key map ">" 'end-of-buffer)
88 ;(define-key map "\C-g" 'electric-help-exit)
89 (define-key map "Q" 'electric-help-exit)
90 (define-key map "q" 'electric-help-exit)
92 (define-key map "R" 'electric-help-retain)
93 (define-key map "r" 'electric-help-retain)
94 (define-key map "\ex" 'electric-help-execute-extended)
95 (define-key map "\C-x" 'electric-help-ctrl-x-prefix)
97 (setq electric-help-map map)))
99 (defun electric-help-mode ()
100 "`with-electric-help' temporarily places its buffer in this mode.
101 \(On exit from `with-electric-help', the buffer is put in `default-major-mode'.)"
104 (setq major-mode 'help)
106 (use-local-map electric-help-map)
107 (add-hook 'mouse-leave-buffer-hook 'electric-help-retain)
109 ;; this is done below in with-electric-help
110 ;(run-hooks 'electric-help-mode-hook)
114 (defun with-electric-help (thunk &optional buffer noerase minheight)
115 "Pop up an \"electric\" help buffer.
127 in `electric-help-mode'. The window's height will be at least MINHEIGHT if
131 shrink the window to fit if `electric-help-shrink-window' is non-nil.
134 When the user exits (with `electric-help-exit', or otherwise), the help
141 (electric-help-form-to-execute nil))
152 (electric-help-mode)
161 (when (and one electric-help-shrink-window)
164 (run-hooks 'electric-help-mode-hook)
166 (if (eq (car-safe (electric-help-command-loop)) 'retain)
170 (when (memq 'electric-help-retain mouse-leave-buffer-hook)
171 (remove-hook 'mouse-leave-buffer-hook 'electric-help-retain)))
178 ;; call to help-mode won't cut it; at least RET is bound wrong
179 ;; afterwards. It's also not clear that `help-mode' is always
192 (eval electric-help-form-to-execute))))
194 (defun electric-help-command-loop ()
197 (progn (message "%s" (substitute-command-keys "<<< Press Space to bury the help buffer, Press \\[electric-help-retain] to retain it >>>"))
208 'electric-help-exit)
210 'electric-help-retain))))
223 (t (setq neither (substitute-command-keys "Press \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
227 (t (setq up (substitute-command-keys "Press \\[scroll-up] to scroll, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
231 (t (setq down (substitute-command-keys "Press \\[scroll-down] to scroll back, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
235 (t (setq both (substitute-command-keys "Press \\[scroll-up] to scroll, \\[scroll-down] to scroll back, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))))))
241 ;(defun electric-help-scroll-up (arg)
245 ; (electric-help-exit)
248 (defun electric-help-exit ()
249 "Exit `with-electric-help', restoring the previous window/buffer configuration.
254 (if (memq 'electric-help-retain mouse-leave-buffer-hook)
256 (remove-hook 'mouse-leave-buffer-hook 'electric-help-retain)
259 (defun electric-help-retain ()
260 "Exit `with-electric-help', retaining the current window/buffer configuration.
266 (if (memq 'electric-help-retain mouse-leave-buffer-hook)
268 (remove-hook 'mouse-leave-buffer-hook 'electric-help-retain)
272 (defun electric-help-undefined ()
276 (if (eq (key-binding "q" nil t) 'electric-help-exit)
278 (substitute-command-keys "\\[electric-help-exit]"))))
281 ;>>> this needs to be hairified (recursive help, anybody?)
282 (defun electric-help-help ()
284 (if (and (eq (key-binding "q" nil t) 'electric-help-exit)
287 (eq (key-binding "r" nil t) 'electric-help-retain))
288 (message "SPC scrolls up, DEL scrolls down, q exits burying help buffer, r exits")
289 (message "%s" (substitute-command-keys "\\[scroll-up] scrolls up, \\[scroll-down] scrolls down, \\[electric-help-exit] exits burying help buffer, \\[electric-help-retain] exits")))
299 (let* ((p (symbol-function 'print-help-return-message))
332 (fset 'print-help-return-message 'ignore)
339 (fset 'print-help-return-message p)
344 (with-electric-help 'ignore name t))))
351 (defun electric-help-execute-extended (prefixarg)
353 (setq electric-help-form-to-execute '(execute-extended-command nil))
354 (electric-help-retain))
358 (defun electric-help-ctrl-x-prefix (prefixarg)
360 (setq electric-help-form-to-execute '(progn (message nil) (setq unread-command-char ?\C-x)))
361 (electric-help-retain))
377 ;(defun electric-help-for-help ()
378 ; "See help-for-help"
402 ;(define-key help-map "a" 'electric-command-apropos)
410 ;;;; ehelp-map
412 (defvar ehelp-map ())
413 (if ehelp-map
415 (let ((map (copy-keymap help-map)))
416 (substitute-key-definition 'apropos 'electric-apropos map)
417 (substitute-key-definition 'command-apropos 'electric-command-apropos map)
418 (substitute-key-definition 'describe-key 'electric-describe-key map)
419 (substitute-key-definition 'describe-mode 'electric-describe-mode map)
420 (substitute-key-definition 'view-lossage 'electric-view-lossage map)
421 (substitute-key-definition 'describe-function 'electric-describe-function map)
422 (substitute-key-definition 'describe-variable 'electric-describe-variable map)
423 (substitute-key-definition 'describe-bindings 'electric-describe-bindings map)
424 (substitute-key-definition 'describe-syntax 'electric-describe-syntax map)
426 (setq ehelp-map map)))
429 (defalias 'ehelp-command ehelp-map)