Function: elisp-context-menu

elisp-context-menu is a byte-compiled function defined in elisp-mode.el.gz.

Signature

(elisp-context-menu MENU CLICK)

Documentation

Populate MENU with symbol help commands at CLICK.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun elisp-context-menu (menu click)
  "Populate MENU with symbol help commands at CLICK."
  (when (thing-at-mouse click 'symbol)
    (define-key-after menu [elisp-separator] menu-bar-separator
      'middle-separator)

    (let* ((string (thing-at-mouse click 'symbol t))
           (symbol (when (stringp string) (intern string)))
           (title (cond
                   ((not (symbolp symbol)) nil)
                   ((and (facep symbol) (not (fboundp symbol)))
                    "Face")
                   ((and (fboundp symbol)
                         (not (or (boundp symbol) (facep symbol))))
                    "Function")
                   ((and (boundp symbol)
                         (not (or (fboundp symbol) (facep symbol))))
                    "Variable")
                   ((or (fboundp symbol) (boundp symbol) (facep symbol))
                    "Symbol"))))
      (when title
        (define-key-after menu [info-lookup-symbol]
          `(menu-item "Look up in Manual"
                      (lambda (_click) (interactive "e")
                        (info-lookup-symbol ',symbol))
                      :help ,(format "Find `%s' in relevant manual" symbol))
          'elisp-separator)
        (define-key-after menu [describe-symbol]
          `(menu-item (format "Describe %s" ,title)
                      (lambda (_click) (interactive "e")
                        (describe-symbol ',symbol))
                      :help ,(format "Display the documentation of `%s'" symbol))
          'elisp-separator))))
  menu)