Function: org-cite-basic--set-keymap

org-cite-basic--set-keymap is a byte-compiled function defined in oc-basic.el.gz.

Signature

(org-cite-basic--set-keymap BEG END SUGGESTIONS)

Documentation

Set keymap on citation key between BEG and END positions.

When the key is know, SUGGESTIONS is nil. Otherwise, it may be a list of replacement keys, as strings, which will be offered as substitutes for the unknown key. Finally, it may be the symbol all.

Source Code

;; Defined in /usr/src/emacs/lisp/org/oc-basic.el.gz
(defun org-cite-basic--set-keymap (beg end suggestions)
  "Set keymap on citation key between BEG and END positions.

When the key is know, SUGGESTIONS is nil.  Otherwise, it may be
a list of replacement keys, as strings, which will be offered as
substitutes for the unknown key.  Finally, it may be the symbol
`all'."
  (let ((km (make-sparse-keymap)))
    (define-key km (kbd "<mouse-1>")
      (pcase suggestions
        ('nil #'org-open-at-point)
        ('all #'org-cite-insert)
        (_
         (lambda ()
           (interactive)
           (save-excursion
             (goto-char beg)
             (delete-region beg end)
             (insert
              "@"
              (if (= 1 (length suggestions))
                  (car suggestions)
                (completing-read "Did you mean: "
                                 suggestions nil t))))))))
    (put-text-property beg end 'keymap km)))