org-footnote: add speedups when prompted for a label
* lisp/org-footnote.el (org-footnote-new): use ido or iswitchb when available when prompted for a label. Also rename a local variable to avoid confusion with an existing function.
This commit is contained in:
parent
a41541c033
commit
795b7c5ca0
|
@ -424,9 +424,9 @@ or new, let the user edit the definition of the footnote."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (and (not (bolp)) (org-footnote-in-valid-context-p))
|
(unless (and (not (bolp)) (org-footnote-in-valid-context-p))
|
||||||
(error "Cannot insert a footnote here"))
|
(error "Cannot insert a footnote here"))
|
||||||
(let* ((labels (and (not (equal org-footnote-auto-label 'random))
|
(let* ((lbls (and (not (equal org-footnote-auto-label 'random))
|
||||||
(org-footnote-all-labels)))
|
(org-footnote-all-labels)))
|
||||||
(propose (org-footnote-unique-label labels))
|
(propose (org-footnote-unique-label lbls))
|
||||||
(label
|
(label
|
||||||
(org-footnote-normalize-label
|
(org-footnote-normalize-label
|
||||||
(cond
|
(cond
|
||||||
|
@ -436,15 +436,15 @@ or new, let the user edit the definition of the footnote."
|
||||||
(require 'org-id)
|
(require 'org-id)
|
||||||
(substring (org-id-uuid) 0 8))
|
(substring (org-id-uuid) 0 8))
|
||||||
(t
|
(t
|
||||||
(completing-read
|
(org-icompleting-read
|
||||||
"Label (leave empty for anonymous): "
|
"Label (leave empty for anonymous): "
|
||||||
(mapcar 'list labels) nil nil
|
(mapcar 'list lbls) nil nil
|
||||||
(if (eq org-footnote-auto-label 'confirm) propose nil)))))))
|
(if (eq org-footnote-auto-label 'confirm) propose nil)))))))
|
||||||
(cond
|
(cond
|
||||||
((not label)
|
((not label)
|
||||||
(insert "[fn:: ]")
|
(insert "[fn:: ]")
|
||||||
(backward-char 1))
|
(backward-char 1))
|
||||||
((member label labels)
|
((member label lbls)
|
||||||
(insert "[" label "]")
|
(insert "[" label "]")
|
||||||
(message "New reference to existing note"))
|
(message "New reference to existing note"))
|
||||||
(org-footnote-define-inline
|
(org-footnote-define-inline
|
||||||
|
|
Loading…
Reference in New Issue