Function: preview-make-clickable

preview-make-clickable is a macro defined in preview.el.

Signature

(preview-make-clickable &optional MAP GLYPH HELPSTRING CLICK1 CLICK2)

Documentation

Generate a clickable string or keymap.

If MAP is non-nil, it specifies a keymap to add to, otherwise a new one is created. If GLYPH is given, the result is made to display it wrapped in a string. In that case, HELPSTRING is a format string with one or two %s specifiers for preview's clicks, displayed as a help-echo. CLICK1 and CLICK2 are functions to call on preview's clicks.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/preview.el
(defmacro preview-make-clickable (&optional map glyph helpstring click1 click2)
  "Generate a clickable string or keymap.
If MAP is non-nil, it specifies a keymap to add to, otherwise
a new one is created.  If GLYPH is given, the result is made
to display it wrapped in a string.  In that case,
HELPSTRING is a format string with one or two %s specifiers
for preview's clicks, displayed as a help-echo.  CLICK1 and CLICK2
are functions to call on preview's clicks."
  `(let ((resmap ,(or map '(make-sparse-keymap))))
     ,@(if click1
           `((define-key resmap preview-button-1 ,click1)))
     ,@(if click2
           `((define-key resmap preview-button-2 ,click2)))
     ,(if glyph
          `(propertize
            "x"
            'display ,glyph
            'mouse-face 'highlight
            'help-echo
            ,(if (stringp helpstring)
                 (format helpstring (key-description preview-button-1)
                         (key-description preview-button-2))
               `(format ,helpstring (key-description preview-button-1)
                        (key-description preview-button-2)))
            'keymap resmap)
        'resmap)))