(define-key help-map "F" 'view-emacs-FAQ)
(define-key help-map "i" 'info)
+(define-key help-map "4i" 'info-other-window)
(define-key help-map "\C-f" 'Info-goto-emacs-command-node)
(define-key help-map "\C-k" 'Info-goto-emacs-key-command-node)
(define-key help-map "\C-i" 'info-lookup-symbol)
"Print the name of the function KEY invokes. KEY is a string.
If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
(interactive "kDescribe key briefly: \nP")
- ;; If this key seq ends with a down event, discard the
- ;; following click or drag event. Otherwise that would
- ;; erase the message.
- (let ((type (aref key (1- (length key)))))
- (if (listp type) (setq type (car type)))
- (and (symbolp type)
- (memq 'down (event-modifiers type))
- (read-event)))
(save-excursion
(let ((modifiers (event-modifiers (aref key 0)))
(standard-output (if insert (current-buffer) t))
(defun describe-key (key)
"Display documentation of the function invoked by KEY. KEY is a string."
(interactive "kDescribe key: ")
- ;; If this key seq ends with a down event, discard the
- ;; following click or drag event. Otherwise that would
- ;; erase the message.
- (let ((type (aref key (1- (length key)))))
- (if (listp type) (setq type (car type)))
- (and (symbolp type)
- (memq 'down (event-modifiers type))
- (read-event)))
(save-excursion
(let ((modifiers (event-modifiers (aref key 0)))
window position)
((byte-code-function-p def)
(concat beg "compiled Lisp function"))
((symbolp def)
+ (while (symbolp (symbol-function def))
+ (setq def (symbol-function def)))
(format "alias for `%s'" def))
((eq (car-safe def) 'lambda)
(concat beg "Lisp function"))
(help-xref-button 1 #'(lambda (arg)
(let ((location
(find-function-noselect arg)))
- (display-buffer (nth 0 location))
- (goto-char (nth 1 location))))
+ (pop-to-buffer (car location))
+ (goto-char (cdr location))))
function)))))
(if need-close (princ ")"))
(princ ".")
(terpri)
- (let* ((inner-function (if (and (listp def) 'macro)
- (cdr def)
- def))
- (arglist (cond ((byte-code-function-p inner-function)
- (car (append inner-function nil)))
- ((eq (car-safe inner-function) 'lambda)
- (nth 1 inner-function))
- (t t))))
+ ;; Handle symbols aliased to other symbols.
+ (setq def (indirect-function def))
+ ;; If definition is a macro, find the function inside it.
+ (if (eq (car-safe def) 'macro)
+ (setq def (cdr def)))
+ (let ((arglist (cond ((byte-code-function-p def)
+ (car (append def nil)))
+ ((eq (car-safe def) 'lambda)
+ (nth 1 def))
+ (t t))))
(if (listp arglist)
(progn
(princ (cons function
(help-setup-xref (list #'describe-variable variable) (interactive-p))
;; Make a link to customize if this variable can be customized.
- (if (or (get variable 'custom-type)
- (user-variable-p variable))
+ ;; Note, it is not reliable to test for a custom-type property
+ ;; because those are only present after the var's definition
+ ;; has been loaded.
+ (if (user-variable-p variable)
(let ((customize-label "customize"))
(terpri)
(terpri)
(help-xref-button 1 #'describe-function sym)))))
;; Look for commands in whole keymap substitutions:
(save-excursion
+ ;; Make sure to find the first keymap.
+ (goto-char (point-min))
;; Find a header and the column at which the command
;; name will be found.
(while (re-search-forward "^key +binding\n\\(-+ +\\)-+\n\n"
(defun help-follow-mouse (click)
"Follow the cross-reference that you click on."
(interactive "e")
- (save-excursion
- (let* ((start (event-start click))
- (window (car start))
- (pos (car (cdr start))))
- (set-buffer (window-buffer window))
+ (let* ((start (event-start click))
+ (window (car start))
+ (pos (car (cdr start))))
+ (with-current-buffer (window-buffer window)
(help-follow pos))))
(defun help-xref-go-back (buffer)