Browse Source

oc-basic: Fix `org-cite-basic--get-author'.

* lisp/oc-basic.el (org-cite-basic--get-author): Allow optional RAW argument.
(org-cite-basic--get-year):
(org-cite-basic--key-completion-table): Make use of new argument.
Nicolas Goaziou 3 years ago
parent
commit
37d8bc801e
1 changed files with 7 additions and 8 deletions
  1. 7 8
      lisp/oc-basic.el

+ 7 - 8
lisp/oc-basic.el

@@ -340,17 +340,16 @@ This is used for disambiguation."
                         ((= n 27) (throw :complete (cons 0 (cons 0 result))))
                         ((= n 27) (throw :complete (cons 0 (cons 0 result))))
                         (t nil))))))))
                         (t nil))))))))
 
 
-(defun org-cite-basic--get-author (entry-or-key info)
+(defun org-cite-basic--get-author (entry-or-key &optional info raw)
   "Return author associated to ENTRY-OR-KEY.
   "Return author associated to ENTRY-OR-KEY.
 
 
-ENTRY-OR-KEY is either an association list, as returned by
-`org-cite-basic--get-entry', or a string representing a citation
-key.  INFO is the export state, as a property list.
+ENTRY-OR-KEY, INFO and RAW arguments are the same arguments as
+used in `org-cite-basic--get-field', which see.
 
 
 Author is obtained from the \"author\" field, if available, or
 Author is obtained from the \"author\" field, if available, or
 from the \"editor\" field otherwise."
 from the \"editor\" field otherwise."
-  (or (org-cite-basic--get-field 'author entry-or-key info 'raw)
-      (org-cite-basic--get-field 'editor entry-or-key info 'raw)))
+  (or (org-cite-basic--get-field 'author entry-or-key info raw)
+      (org-cite-basic--get-field 'editor entry-or-key info raw)))
 
 
 (defun org-cite-basic--get-year (entry-or-key info &optional no-suffix)
 (defun org-cite-basic--get-year (entry-or-key info &optional no-suffix)
   "Return year associated to ENTRY-OR-KEY.
   "Return year associated to ENTRY-OR-KEY.
@@ -375,7 +374,7 @@ necessary, unless optional argument NO-SUFFIX is non-nil."
   ;; KEY-SUFFIX-ALIST is an association (KEY . SUFFIX), where KEY is
   ;; KEY-SUFFIX-ALIST is an association (KEY . SUFFIX), where KEY is
   ;; the cite key, as a string, and SUFFIX is the generated suffix
   ;; the cite key, as a string, and SUFFIX is the generated suffix
   ;; string, or the empty string.
   ;; string, or the empty string.
-  (let* ((author (org-cite-basic--get-author entry-or-key info))
+  (let* ((author (org-cite-basic--get-author entry-or-key info 'raw))
          (year
          (year
           (or (org-cite-basic--get-field 'year entry-or-key info 'raw)
           (or (org-cite-basic--get-field 'year entry-or-key info 'raw)
               (let ((date
               (let ((date
@@ -748,7 +747,7 @@ Return nil if there are no bibliography files or no entries."
       (dolist (key (org-cite-basic--all-keys))
       (dolist (key (org-cite-basic--all-keys))
         (let ((completion
         (let ((completion
                (concat
                (concat
-                (let ((author (org-cite-basic--get-author key nil)))
+                (let ((author (org-cite-basic--get-author key nil 'raw)))
                   (if author
                   (if author
                       (truncate-string-to-width
                       (truncate-string-to-width
                        (replace-regexp-in-string " and " "; " author)
                        (replace-regexp-in-string " and " "; " author)