Merge branch 'bugfix' into emacs-sync

This commit is contained in:
Kyle Meyer 2021-10-16 13:59:01 -04:00
commit 0b8be90f15
6 changed files with 45 additions and 27 deletions

View File

@ -98,6 +98,15 @@ latest stable version of Org should be compatible with Emacs 28.x,
See [[https://orgmode.org/worg/org-maintenance.html#emacs-compatibility][this note on Worg]] and [[git::519947e508e081e71bf67db99e27b1c171ba4dfe][this commit]].
*** The keybinding for ~org-table-blank-field~ has been removed
If you prefer to keep the keybinding, you can add it back to
~org-mode-map~ like so:
#+begin_src emacs-lisp
(define-key org-mode-map (kbd "C-c SPC") #'org-table-blank-field)
#+end_src
** New features
*** New citation engine

View File

@ -69,7 +69,6 @@
(require 'bibtex)
(require 'json)
(require 'oc)
(require 'org)
(require 'seq)
(declare-function org-open-at-point "org" (&optional arg))

View File

@ -213,8 +213,8 @@ PROPS is the local properties of the bibliography, as a property list."
(defun org-cite-biblatex-export-citation (citation style _ info)
"Export CITATION object.
STYLE is the citation style, as a string or nil. INFO is the export state, as
a property list."
STYLE is the citation style, as a pair of either strings or nil.
INFO is the export state, as a property list."
(apply
#'org-cite-biblatex--command citation info
(pcase style

View File

@ -248,11 +248,11 @@ If nil then the Chicago author-date style is used as a fallback.")
("paras." . "paragraph")
("" . "paragraph")
("¶¶" . "paragraph")
("§" . "paragraph")
("§§" . "paragraph")
("part" . "part")
("pt." . "part")
("pts." . "part")
("§" . "section")
("§§" . "section")
("section" . "section")
("sec." . "section")
("secs." . "section")
@ -270,11 +270,12 @@ If nil then the Chicago author-date style is used as a fallback.")
(defconst org-cite-csl--label-regexp
;; Prior to Emacs-27.1 argument of `regexp' form must be a string literal.
;; It is the reason why `rx' is avoided here.
(rx-to-string `(seq word-start
(regexp ,(regexp-opt (mapcar #'car org-cite-csl--label-alist) t))
(0+ digit)
(or word-start line-end (any ?\s ?\t)))
t)
(rx-to-string
`(seq (or line-start space)
(regexp ,(regexp-opt (mapcar #'car org-cite-csl--label-alist) t))
(0+ digit)
(or word-end line-end space " "))
t)
"Regexp matching a label in a citation reference suffix.
Label is in match group 1.")
@ -371,7 +372,7 @@ or raise an error if the variable is unset."
((and (guard org-cite-csl-styles-dir) file)
(expand-file-name file org-cite-csl-styles-dir))
(other
(user-error "Cannot handle relative style file name" other))))
(user-error "Cannot handle relative style file name: %S" other))))
(defun org-cite-csl--locale-getter ()
"Return a locale getter.
@ -425,7 +426,9 @@ The result is a association list. Keys are: `id', `prefix',`suffix',
((re-search-forward org-cite-csl--label-regexp nil t)
(setq location-start (match-beginning 0))
(setq label (cdr (assoc (match-string 1) org-cite-csl--label-alist)))
(setq locator-start (match-end 1)))
(goto-char (match-end 1))
(skip-chars-forward "[:space:] ")
(setq locator-start (point)))
((re-search-forward (rx digit) nil t)
(setq location-start (match-beginning 0))
(setq label "page")

View File

@ -789,6 +789,20 @@ Citations are ordered by appearance in the document, when following footnotes.
INFO is the export communication channel, as a property list."
(or (plist-get info :citations)
(letrec ((cites nil)
(tree (plist-get info :parse-tree))
(find-definition
;; Find definition for standard reference LABEL. At
;; this point, it is impossible to rely on
;; `org-export-get-footnote-definition' because the
;; function caches results that could contain
;; un-processed citation objects. So we use
;; a simplified version of the function above.
(lambda (label)
(org-element-map tree 'footnote-definition
(lambda (d)
(and (equal label (org-element-property :label d))
(or (org-element-contents d) "")))
info t)))
(search-cites
(lambda (data)
(org-element-map data '(citation footnote-reference)
@ -798,22 +812,13 @@ INFO is the export communication channel, as a property list."
;; Do not force entering inline definitions, since
;; `org-element-map' is going to enter it anyway.
((guard (eq 'inline (org-element-property :type datum))))
;; Find definition for current standard
;; footnote reference. Unlike to
;; `org-export-get-footnote-definition', do
;; not cache results as they would contain
;; un-processed citation objects.
;; Walk footnote definition.
(_
(let ((label (org-element-property :label datum)))
(funcall
search-cites
(org-element-map data 'footnote-definition
(lambda (d)
(and
(equal label (org-element-property :label d))
(or (org-element-contents d) "")))))))))
(funcall search-cites
(funcall find-definition label))))))
info nil 'footnote-definition t))))
(funcall search-cites (plist-get info :parse-tree))
(funcall search-cites tree)
(let ((result (nreverse cites)))
(plist-put info :citations result)
result))))
@ -1593,8 +1598,9 @@ The generated function inserts or edit a citation at point. More specifically,
(concat "/" style)
""))
"")
(mapconcat (lambda (k) (concat "@" k)) keys ";"))))))))
(mapconcat (lambda (k) (concat "@" k)) keys "; "))))))))
;;;###autoload
(defun org-cite-insert (arg)
"Insert a citation at point.
Insertion is done according to the processor set in `org-cite-insert-processor'.
@ -1603,7 +1609,7 @@ ARG is the prefix argument received when calling interactively the function."
(let ((name org-cite-insert-processor))
(cond
((null name)
(user-error "No processor set to follow citations"))
(user-error "No processor set to insert citations"))
((not (org-cite--get-processor name))
(user-error "Unknown processor %S" name))
((not (org-cite-processor-has-capability-p name 'insert))

View File

@ -95,6 +95,7 @@
(require 'org-keys)
(require 'ol)
(require 'oc)
(require 'oc-basic)
(require 'org-table)
;; `org-outline-regexp' ought to be a defconst but is let-bound in