Skip to content

Commit

Permalink
remove org-cite content (#212)
Browse files Browse the repository at this point in the history
With recent enhancements to org-cite and the ecosystem around it, this 
content is no longer necessary.
  • Loading branch information
bdarcus authored Aug 5, 2021
1 parent 1119f98 commit 12f61cf
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions bibtex-actions.el
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ display and for search."
:group 'bibtex-actions
:type '(alist :key-type symbol :value-type function))

(defcustom bibtex-actions-org-cite-styles
'("text" "noauthor" "title" "author" "locators" "nocite")
"Org citation styles."
:group 'bibtex-actions
:type '(repeat string))

(defcustom bibtex-actions-link-symbol "🔗"
"Symbol to indicate a DOI or URL link is available for a publication.
This should be a single character."
Expand All @@ -112,14 +106,6 @@ may be indicated with the same icon but a different face."
:group 'bibtex-actions
:type 'string)

(setq bibtex-completion-format-citation-functions
'((org-mode . bibtex-actions--format-citation-org)
(latex-mode . bibtex-completion-format-citation-cite)
(markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
(python-mode . bibtex-completion-format-citation-sphinxcontrib-bibtex)
(rst-mode . bibtex-completion-format-citation-sphinxcontrib-bibtex)
(default . bibtex-completion-format-citation-pandoc-citeproc)))

(defcustom bibtex-actions-force-refresh-hook nil
"Hook run when user forces a (re-) building of the candidates cache.
This hook is only called when the user explicitly requests the
Expand Down Expand Up @@ -194,20 +180,6 @@ means no action."
map)
"Keymap for Embark citation-key actions.")

;;; Org-cite citation function

(defun bibtex-actions--format-citation-org (keys)
"Format org-cite citations for the entries in KEYS."
(let* ((prefix (if bibtex-completion-cite-prompt-for-optional-arguments (read-from-minibuffer "Prefix: ") ""))
(styles bibtex-actions-org-cite-styles)
(style (if bibtex-completion-cite-prompt-for-optional-arguments
(ido-completing-read "Style: " styles nil nil nil nil "default")
"default"))
(prefix (if (string= "" prefix) "" (concat prefix " ;")))
(style (if (string-equal style "default") "" (concat "/" style))))
;; this is derived from the pandoc syntax function, but this has two-levels of affixes
(format "[cite%s:%s%s]" style prefix (s-join ";" (--map (concat "@" it) keys)))))

;;; Completion functions
(cl-defun bibtex-actions-read (&optional &key rebuild-cache)
"Read bibtex-completion entries.
Expand Down Expand Up @@ -315,24 +287,6 @@ If FORCE-REBUILD-CACHE is t, force reloading the cache."
(bibtex-actions-refresh force-rebuild-cache))
bibtex-actions--candidates-cache)

(defun bibtex-actions-complete-key-at-point ()
"Complete org-cite or pandoc citation key at point."
; FIX
(when (and (or (eq major-mode 'org-mode)
(eq major-mode 'markdown-mode))
(eq ?@ (char-before)))
(let* ((candidates (bibtex-actions--get-candidates))
;; set both begin and end to point so we use capf UI to narrow and
;; select
(begin (point))
(end (point)))
(list begin end candidates
:exit-function
(lambda (str _status)
;; take completion str and replace with key
(delete-char (- (length str)))
(insert (cdr (assoc str candidates))))))))

;;;###autoload
(defun bibtex-actions-refresh (&optional force-rebuild-cache)
"Reload the candidates cache.
Expand Down

0 comments on commit 12f61cf

Please sign in to comment.