aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Meyer2021-11-06 14:10:47 -0400
committerKyle Meyer2021-11-06 14:10:47 -0400
commitf05b8a939b7ad57e9526510d510ff24484dcb520 (patch)
tree1b4498a64600e22ef1e265038d00deb50ce795f4
parent5e9b4e70ab433fe2eb33c20a02b045c83e70d074 (diff)
downloademacs-f05b8a939b7ad57e9526510d510ff24484dcb520.tar.gz
emacs-f05b8a939b7ad57e9526510d510ff24484dcb520.zip
Update to Org 9.5-68-g77e2ec
-rw-r--r--lisp/org/oc-basic.el58
-rw-r--r--lisp/org/oc-csl.el18
-rw-r--r--lisp/org/oc-natbib.el6
-rw-r--r--lisp/org/oc.el22
-rw-r--r--lisp/org/org-macro.el2
-rw-r--r--lisp/org/org-version.el2
6 files changed, 68 insertions, 40 deletions
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index c51c7d301e4..7b09db5f8b4 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -325,15 +325,19 @@ This is used for disambiguation."
325 ((= n 27) (throw :complete (cons 0 (cons 0 result)))) 325 ((= n 27) (throw :complete (cons 0 (cons 0 result))))
326 (t nil)))))))) 326 (t nil))))))))
327 327
328(defun org-cite-basic--get-year (entry-or-key info) 328(defun org-cite-basic--get-year (entry-or-key info &optional no-suffix)
329 "Return year associated to ENTRY-OR-KEY. 329 "Return year associated to ENTRY-OR-KEY.
330 330
331ENTRY-OR-KEY is either an association list, as returned by 331ENTRY-OR-KEY is either an association list, as returned by
332`org-cite-basic--get-entry', or a string representing a citation key. INFO is 332`org-cite-basic--get-entry', or a string representing a citation
333the export state, as a property list. 333key. INFO is the export state, as a property list.
334 334
335Unlike `org-cite-basic--get-field', this function disambiguates author-year 335Year is obtained from the \"year\" field, if available, or from
336patterns." 336the \"date\" field if it starts with a year pattern.
337
338Unlike `org-cite-basic--get-field', this function disambiguates
339author-year patterns by adding a letter suffix to the year when
340necessary, unless optional argument NO-SUFFIX is non-nil."
337 ;; The cache is an association list with the following structure: 341 ;; The cache is an association list with the following structure:
338 ;; 342 ;;
339 ;; (AUTHOR-YEAR . KEY-SUFFIX-ALIST). 343 ;; (AUTHOR-YEAR . KEY-SUFFIX-ALIST).
@@ -345,7 +349,16 @@ patterns."
345 ;; the cite key, as a string, and SUFFIX is the generated suffix 349 ;; the cite key, as a string, and SUFFIX is the generated suffix
346 ;; string, or the empty string. 350 ;; string, or the empty string.
347 (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw)) 351 (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw))
348 (year (org-cite-basic--get-field 'year entry-or-key info 'raw)) 352 (year
353 (or (org-cite-basic--get-field 'year entry-or-key info 'raw)
354 (let ((date
355 (org-cite-basic--get-field 'date entry-or-key info t)))
356 (and (stringp date)
357 (string-match (rx string-start
358 (group (= 4 digit))
359 (or string-end (not digit)))
360 date)
361 (match-string 1 date)))))
349 (cache-key (cons author year)) 362 (cache-key (cons author year))
350 (key 363 (key
351 (pcase entry-or-key 364 (pcase entry-or-key
@@ -359,11 +372,13 @@ patterns."
359 (plist-put info :cite-basic/author-date-cache (cons value cache)) 372 (plist-put info :cite-basic/author-date-cache (cons value cache))
360 year)) 373 year))
361 (`(,_ . ,alist) 374 (`(,_ . ,alist)
362 (concat year 375 (let ((suffix
363 (or (cdr (assoc key alist)) 376 (or (cdr (assoc key alist))
364 (let ((new (org-cite-basic--number-to-suffix (1- (length alist))))) 377 (let ((new (org-cite-basic--number-to-suffix
365 (push (cons key new) alist) 378 (1- (length alist)))))
366 new))))))) 379 (push (cons key new) alist)
380 new))))
381 (if no-suffix year (concat year suffix)))))))
367 382
368(defun org-cite-basic--print-entry (entry style &optional info) 383(defun org-cite-basic--print-entry (entry style &optional info)
369 "Format ENTRY according to STYLE string. 384 "Format ENTRY according to STYLE string.
@@ -371,7 +386,6 @@ ENTRY is an alist, as returned by `org-cite-basic--get-entry'.
371Optional argument INFO is the export state, as a property list." 386Optional argument INFO is the export state, as a property list."
372 (let ((author (org-cite-basic--get-field 'author entry info)) 387 (let ((author (org-cite-basic--get-field 'author entry info))
373 (title (org-cite-basic--get-field 'title entry info)) 388 (title (org-cite-basic--get-field 'title entry info))
374 (year (org-cite-basic--get-field 'year entry info))
375 (from 389 (from
376 (or (org-cite-basic--get-field 'publisher entry info) 390 (or (org-cite-basic--get-field 'publisher entry info)
377 (org-cite-basic--get-field 'journal entry info) 391 (org-cite-basic--get-field 'journal entry info)
@@ -379,10 +393,12 @@ Optional argument INFO is the export state, as a property list."
379 (org-cite-basic--get-field 'school entry info)))) 393 (org-cite-basic--get-field 'school entry info))))
380 (pcase style 394 (pcase style
381 ("plain" 395 ("plain"
382 (org-cite-concat 396 (let ((year (org-cite-basic--get-year entry info 'no-suffix)))
383 author ". " title (and from (list ", " from)) ", " year ".")) 397 (org-cite-concat
398 author ". " title (and from (list ", " from)) ", " year ".")))
384 ("numeric" 399 ("numeric"
385 (let ((n (org-cite-basic--key-number (cdr (assq 'id entry)) info))) 400 (let ((n (org-cite-basic--key-number (cdr (assq 'id entry)) info))
401 (year (org-cite-basic--get-year entry info 'no-suffix)))
386 (org-cite-concat 402 (org-cite-concat
387 (format "[%d] " n) author ", " 403 (format "[%d] " n) author ", "
388 (org-cite-emphasize 'italic title) 404 (org-cite-emphasize 'italic title)
@@ -603,15 +619,7 @@ export communication channel, as a property list."
603 ;; When using this style on citations with multiple references, 619 ;; When using this style on citations with multiple references,
604 ;; use global affixes and ignore local ones. 620 ;; use global affixes and ignore local ones.
605 (`(,(or "numeric" "nb") . ,_) 621 (`(,(or "numeric" "nb") . ,_)
606 (let* ((references (org-cite-get-references citation)) 622 (pcase-let ((`(,prefix . ,suffix) (org-cite-main-affixes citation)))
607 (prefix
608 (or (org-element-property :prefix citation)
609 (and (= 1 (length references))
610 (org-element-property :prefix (car references)))))
611 (suffix
612 (or (org-element-property :suffix citation)
613 (and (= 1 (length references))
614 (org-element-property :suffix (car references))))))
615 (org-export-data 623 (org-export-data
616 (org-cite-concat 624 (org-cite-concat
617 "(" prefix (org-cite-basic--citation-numbers citation info) suffix ")") 625 "(" prefix (org-cite-basic--citation-numbers citation info) suffix ")")
@@ -712,7 +720,7 @@ reference. Values are the cite key."
712 org-cite-basic-author-column-end nil ?\s) 720 org-cite-basic-author-column-end nil ?\s)
713 (make-string org-cite-basic-author-column-end ?\s))) 721 (make-string org-cite-basic-author-column-end ?\s)))
714 org-cite-basic-column-separator 722 org-cite-basic-column-separator
715 (let ((date (org-cite-basic--get-field 'year key nil t))) 723 (let ((date (org-cite-basic--get-year key nil 'no-suffix)))
716 (format "%4s" (or date ""))) 724 (format "%4s" (or date "")))
717 org-cite-basic-column-separator 725 org-cite-basic-column-separator
718 (org-cite-basic--get-field 'title key nil t)))) 726 (org-cite-basic--get-field 'title key nil t))))
diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el
index 94de97e33a1..7cd63c3ff3a 100644
--- a/lisp/org/oc-csl.el
+++ b/lisp/org/oc-csl.el
@@ -487,21 +487,25 @@ INFO is the export state, as a property list."
487 (let ((global-prefix (org-element-property :prefix citation))) 487 (let ((global-prefix (org-element-property :prefix citation)))
488 (when global-prefix 488 (when global-prefix
489 (let* ((first (car cites)) 489 (let* ((first (car cites))
490 (prefix (org-element-property :prefix first))) 490 (prefix-item (assq 'prefix first)))
491 (org-element-put-property 491 (setcdr prefix-item
492 first :prefix (org-cite-concat global-prefix prefix))))) 492 (concat (org-element-interpret-data global-prefix)
493 " "
494 (cdr prefix-item))))))
493 ;; Global suffix is appended to the suffix of the last reference. 495 ;; Global suffix is appended to the suffix of the last reference.
494 (let ((global-suffix (org-element-property :suffix citation))) 496 (let ((global-suffix (org-element-property :suffix citation)))
495 (when global-suffix 497 (when global-suffix
496 (let* ((last (org-last cites)) 498 (let* ((last (org-last cites))
497 (suffix (org-element-property :suffix last))) 499 (suffix-item (assq 'suffix last)))
498 (org-element-put-property 500 (setcdr suffix-item
499 last :suffix (org-cite-concat suffix global-suffix))))) 501 (concat (cdr suffix-item)
502 " "
503 (org-element-interpret-data global-suffix))))))
500 ;; Check if CITATION needs wrapping, i.e., it should be wrapped in 504 ;; Check if CITATION needs wrapping, i.e., it should be wrapped in
501 ;; a footnote, but isn't yet. 505 ;; a footnote, but isn't yet.
502 (when (and (not footnote) (org-cite-csl--note-style-p info)) 506 (when (and (not footnote) (org-cite-csl--note-style-p info))
503 (org-cite-adjust-note citation info) 507 (org-cite-adjust-note citation info)
504 (org-cite-wrap-citation citation info)) 508 (setq footnote (org-cite-wrap-citation citation info)))
505 ;; Return structure. 509 ;; Return structure.
506 (apply #'citeproc-citation-create 510 (apply #'citeproc-citation-create
507 `(:note-index 511 `(:note-index
diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el
index 13cac9ed0b9..bf086f36dff 100644
--- a/lisp/org/oc-natbib.el
+++ b/lisp/org/oc-natbib.el
@@ -119,11 +119,7 @@ If \"natbib\" package is already required in the document, e.g., through
119(defun org-cite-natbib--build-optional-arguments (citation info) 119(defun org-cite-natbib--build-optional-arguments (citation info)
120 "Build optional arguments for citation command. 120 "Build optional arguments for citation command.
121CITATION is the citation object. INFO is the export state, as a property list." 121CITATION is the citation object. INFO is the export state, as a property list."
122 (let* ((origin (pcase (org-cite-get-references citation) 122 (pcase-let ((`(,prefix . ,suffix) (org-cite-main-affixes citation)))
123 (`(,reference) reference)
124 (_ citation)))
125 (suffix (org-element-property :suffix origin))
126 (prefix (org-element-property :prefix origin)))
127 (concat (and prefix (format "[%s]" (org-trim (org-export-data prefix info)))) 123 (concat (and prefix (format "[%s]" (org-trim (org-export-data prefix info))))
128 (cond 124 (cond
129 (suffix (format "[%s]" (org-trim (org-export-data suffix info)))) 125 (suffix (format "[%s]" (org-trim (org-export-data suffix info))))
diff --git a/lisp/org/oc.el b/lisp/org/oc.el
index dcda8d7d084..41fd688c060 100644
--- a/lisp/org/oc.el
+++ b/lisp/org/oc.el
@@ -638,6 +638,24 @@ in the current buffer. Positions include leading \"@\" character."
638 (re-search-forward org-element-citation-key-re end t) 638 (re-search-forward org-element-citation-key-re end t)
639 (cons (match-beginning 0) (match-end 0))))) 639 (cons (match-beginning 0) (match-end 0)))))
640 640
641(defun org-cite-main-affixes (citation)
642 "Return main affixes for CITATION object.
643
644Some export back-ends only support a single pair of affixes per
645citation, even if it contains multiple keys. This function
646decides what affixes are the most appropriate.
647
648Return a pair (PREFIX . SUFFIX) where PREFIX and SUFFIX are
649parsed data."
650 (let ((source
651 ;; When there are multiple references, use global affixes.
652 ;; Otherwise, local affixes have priority.
653 (pcase (org-cite-get-references citation)
654 (`(,reference) reference)
655 (_ citation))))
656 (cons (org-element-property :prefix source)
657 (org-element-property :suffix source))))
658
641(defun org-cite-supported-styles (&optional processors) 659(defun org-cite-supported-styles (&optional processors)
642 "List of supported citation styles and variants. 660 "List of supported citation styles and variants.
643 661
@@ -872,7 +890,9 @@ When non-nil, the return value if the footnote container."
872INFO is the export state, as a property list. 890INFO is the export state, as a property list.
873 891
874White space before the citation, if any, are removed. The parse tree is 892White space before the citation, if any, are removed. The parse tree is
875modified by side-effect." 893modified by side-effect.
894
895Return newly created footnote object."
876 (let ((footnote 896 (let ((footnote
877 (list 'footnote-reference 897 (list 'footnote-reference
878 (list :label nil 898 (list :label nil
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index 1259430ae44..c38a07b69af 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -173,7 +173,7 @@ a file, \"input-file\" and \"modification-time\"."
173 modtime)))))))) 173 modtime))))))))
174 ;; Install generic macros. 174 ;; Install generic macros.
175 '(("keyword" . (lambda (arg1 &rest _) 175 '(("keyword" . (lambda (arg1 &rest _)
176 (org-macro--find-keyword-value arg1))) 176 (org-macro--find-keyword-value arg1 t)))
177 ("n" . (lambda (&optional arg1 arg2 &rest _) 177 ("n" . (lambda (&optional arg1 arg2 &rest _)
178 (org-macro--counter-increment arg1 arg2))) 178 (org-macro--counter-increment arg1 arg2)))
179 ("property" . (lambda (arg1 &optional arg2 &rest _) 179 ("property" . (lambda (arg1 &optional arg2 &rest _)
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 55f186b4712..6427f30072e 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made."
11(defun org-git-version () 11(defun org-git-version ()
12 "The Git version of Org mode. 12 "The Git version of Org mode.
13Inserted by installing Org or when a release is made." 13Inserted by installing Org or when a release is made."
14 (let ((org-git-version "release_9.5-59-g52e6f1")) 14 (let ((org-git-version "release_9.5-68-g77e2ec"))
15 org-git-version)) 15 org-git-version))
16 16
17(provide 'org-version) 17(provide 'org-version)