[Emacs] Put use-package around custom org-export-get-reference
This prevents it from getting clobbered when org-export is loaded.
This commit is contained in:
parent
21f59c1d54
commit
766c6338e1
@ -3111,27 +3111,30 @@ as its link target.
|
|||||||
This function replaces the default naming scheme with a call to
|
This function replaces the default naming scheme with a call to
|
||||||
~imalison:generate-name~, and uses a slightly different uniquify approach.
|
~imalison:generate-name~, and uses a slightly different uniquify approach.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun org-export-get-reference (datum info)
|
(use-package org-export
|
||||||
"Return a unique reference for DATUM, as a string.
|
:ensure nil
|
||||||
|
:config
|
||||||
|
(defun org-export-get-reference (datum info)
|
||||||
|
"Return a unique reference for DATUM, as a string.
|
||||||
DATUM is either an element or an object. INFO is the current
|
DATUM is either an element or an object. INFO is the current
|
||||||
export state, as a plist. Returned reference consists of
|
export state, as a plist. Returned reference consists of
|
||||||
alphanumeric characters only."
|
alphanumeric characters only."
|
||||||
(let ((type (org-element-type datum))
|
(let ((type (org-element-type datum))
|
||||||
(cache (or (plist-get info :internal-references)
|
(cache (or (plist-get info :internal-references)
|
||||||
(let ((h (make-hash-table :test #'eq)))
|
(let ((h (make-hash-table :test #'eq)))
|
||||||
(plist-put info :internal-references h)
|
(plist-put info :internal-references h)
|
||||||
h)))
|
h)))
|
||||||
(reverse-cache (or (plist-get info :taken-internal-references)
|
(reverse-cache (or (plist-get info :taken-internal-references)
|
||||||
(let ((h (make-hash-table :test 'equal)))
|
(let ((h (make-hash-table :test 'equal)))
|
||||||
(plist-put info :taken-internal-references h)
|
(plist-put info :taken-internal-references h)
|
||||||
h))))
|
h))))
|
||||||
(or (gethash datum cache)
|
(or (gethash datum cache)
|
||||||
(let* ((name (imalison:generate-name datum cache))
|
(let* ((name (imalison:generate-name datum cache))
|
||||||
(number (+ 1 (gethash name reverse-cache -1)))
|
(number (+ 1 (gethash name reverse-cache -1)))
|
||||||
(new-name (format "%s%s" name (if (< 0 number) number ""))))
|
(new-name (format "%s%s" name (if (< 0 number) number ""))))
|
||||||
(puthash name number reverse-cache)
|
(puthash name number reverse-cache)
|
||||||
(puthash datum new-name cache)
|
(puthash datum new-name cache)
|
||||||
new-name))))
|
new-name)))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
**** org-projectile
|
**** org-projectile
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
Loading…
Reference in New Issue
Block a user