From 65c04e7115f329a083a16a364a8400e1685def61 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 17 Apr 2022 15:30:39 -0400 Subject: [PATCH] Update to Org 9.5.2-38-g682ccd --- doc/misc/org.org | 2 +- lisp/org/oc-basic.el | 42 ++++++++++++++++++++++++++--------------- lisp/org/oc-biblatex.el | 7 +------ lisp/org/org-agenda.el | 17 +++++++++-------- lisp/org/org-compat.el | 29 ++++++++++++++++++++++++++++ lisp/org/org-table.el | 4 ++-- lisp/org/org-version.el | 2 +- lisp/org/org.el | 10 ++++++++-- lisp/org/ox-html.el | 2 +- 9 files changed, 79 insertions(+), 36 deletions(-) diff --git a/doc/misc/org.org b/doc/misc/org.org index 60af81ea2cf..3dce83c936b 100644 --- a/doc/misc/org.org +++ b/doc/misc/org.org @@ -6405,7 +6405,7 @@ special repeaters =++= and =.+=. For example: Marking this DONE shifts the date to one month after today. ,** TODO Wash my hands - DEADLINE: <2019-04-05 08:00 Sun .+1h> + DEADLINE: <2019-04-05 08:00 Fri .+1h> Marking this DONE shifts the date to exactly one hour from now. #+end_example diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index 81b7e4471fd..775690f1767 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -233,6 +233,8 @@ Return a hash table with citation references as keys and fields alist as values. entries))) entries)) +(defvar org-cite-basic--file-id-cache nil + "Hash table linking files to their hash.") (defun org-cite-basic--parse-bibliography (&optional info) "List all entries available in the buffer. @@ -245,14 +247,19 @@ table where keys are references and values are association lists between fields, as symbols, and values as strings or nil. Optional argument INFO is the export state, as a property list." + (unless (hash-table-p org-cite-basic--file-id-cache) + (setq org-cite-basic--file-id-cache (make-hash-table :test #'equal))) (if (plist-member info :cite-basic/bibliography) (plist-get info :cite-basic/bibliography) (let ((results nil)) (dolist (file (org-cite-list-bibliography-files)) (when (file-readable-p file) (with-temp-buffer - (insert-file-contents file) - (let* ((file-id (cons file (org-buffer-hash))) + (when (or (org-file-has-changed-p file) + (not (gethash file org-cite-basic--file-id-cache))) + (insert-file-contents file) + (puthash file (org-buffer-hash) org-cite-basic--file-id-cache)) + (let* ((file-id (cons file (gethash file org-cite-basic--file-id-cache))) (entries (or (cdr (assoc file-id org-cite-basic--bibliography-cache)) (let ((table @@ -727,19 +734,24 @@ Return nil if there are no bibliography files or no entries." (t (clrhash org-cite-basic--completion-cache) (dolist (key (org-cite-basic--all-keys)) - (let ((completion - (concat - (let ((author (org-cite-basic--get-field 'author key nil t))) - (if author - (truncate-string-to-width - (replace-regexp-in-string " and " "; " author) - org-cite-basic-author-column-end nil ?\s) - (make-string org-cite-basic-author-column-end ?\s))) - org-cite-basic-column-separator - (let ((date (org-cite-basic--get-year key nil 'no-suffix))) - (format "%4s" (or date ""))) - org-cite-basic-column-separator - (org-cite-basic--get-field 'title key nil t)))) + (let* ((entry (org-cite-basic--get-entry + key + ;; Supply pre-calculated bibliography to avoid + ;; performance degradation. + (list :cite-basic/bibliography entries))) + (completion + (concat + (let ((author (org-cite-basic--get-field 'author entry nil 'raw))) + (if author + (truncate-string-to-width + (replace-regexp-in-string " and " "; " author) + org-cite-basic-author-column-end nil ?\s) + (make-string org-cite-basic-author-column-end ?\s))) + org-cite-basic-column-separator + (let ((date (org-cite-basic--get-year entry nil 'no-suffix))) + (format "%4s" (or date ""))) + org-cite-basic-column-separator + (org-cite-basic--get-field 'title entry nil t)))) (puthash completion key org-cite-basic--completion-cache))) (unless (map-empty-p org-cite-basic--completion-cache) ;no key (puthash entries t org-cite-basic--completion-cache) diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el index 3cc157ec937..174725b4244 100644 --- a/lisp/org/oc-biblatex.el +++ b/lisp/org/oc-biblatex.el @@ -164,12 +164,7 @@ INFO is the export state, as a property list." (mapconcat (lambda (r) (org-cite-biblatex--atomic-arguments (list r) info)) (org-cite-get-references citation) - "") - ;; According to BibLaTeX manual, left braces or brackets - ;; following a multicite command could be parsed as other - ;; arguments. So we stop any further parsing by inserting - ;; a \relax unconditionally. - "\\relax"))) + "")))) (defun org-cite-biblatex--command (citation info base &optional multi no-opt) "Return biblatex command using BASE name for CITATION object. diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index ae0058e037e..71aac271f7b 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -4859,7 +4859,7 @@ Press `\\[org-agenda-manipulate-query-add]', \ ;;;###autoload (defun org-todo-list (&optional arg) - "Show all (not done) TODO entries from all agenda file in a single list. + "Show all (not done) TODO entries from all agenda files in a single list. The prefix arg can be used to select a specific TODO keyword and limit the list to these. When using `\\[universal-argument]', you will be prompted for a keyword. A numeric prefix directly selects the Nth keyword in @@ -5732,7 +5732,7 @@ displayed in agenda view." (org-before-first-heading-p) (and org-agenda-include-inactive-timestamps (org-at-clock-log-p)) - (not (eq 'timestamp (org-element-type (org-element-context))))) + (not (org-at-timestamp-p 'agenda))) (throw :skip nil)) (org-agenda-skip)) (let* ((pos (match-beginning 0)) @@ -7180,12 +7180,13 @@ The optional argument TYPE tells the agenda type." (concat (substring x 0 (match-end 1)) (unless (string= org-agenda-todo-keyword-format "") - (format org-agenda-todo-keyword-format - (match-string 2 x))) - ;; Remove `display' property as the icon could leak - ;; on the white space. - (org-add-props " " (org-plist-delete (text-properties-at 0 x) - 'display)) + (format org-agenda-todo-keyword-format + (match-string 2 x))) + (unless (string= org-agenda-todo-keyword-format "") + ;; Remove `display' property as the icon could leak + ;; on the white space. + (org-add-props " " (org-plist-delete (text-properties-at 0 x) + 'display))) (substring x (match-end 3))))))) x))) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 4ad87c84d03..c26eb6f10ab 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -71,6 +71,35 @@ (defvar org-table-tab-recognizes-table.el) (defvar org-table1-hline-regexp) + +;;; Emacs < 29 compatibility + +(defvar org-file-has-changed-p--hash-table (make-hash-table :test #'equal) + "Internal variable used by `org-file-has-changed-p'.") + +(if (fboundp 'file-has-changed-p) + (defalias 'org-file-has-changed-p #'file-has-changed-p) + (defun org-file-has-changed-p (file &optional tag) + "Return non-nil if FILE has changed. +The size and modification time of FILE are compared to the size +and modification time of the same FILE during a previous +invocation of `org-file-has-changed-p'. Thus, the first invocation +of `org-file-has-changed-p' always returns non-nil when FILE exists. +The optional argument TAG, which must be a symbol, can be used to +limit the comparison to invocations with identical tags; it can be +the symbol of the calling function, for example." + (let* ((file (directory-file-name (expand-file-name file))) + (remote-file-name-inhibit-cache t) + (fileattr (file-attributes file 'integer)) + (attr (and fileattr + (cons (file-attribute-size fileattr) + (file-attribute-modification-time fileattr)))) + (sym (concat (symbol-name tag) "@" file)) + (cachedattr (gethash sym org-file-has-changed-p--hash-table))) + (when (not (equal attr cachedattr)) + (puthash sym attr org-file-has-changed-p--hash-table))))) + + ;;; Emacs < 28.1 compatibility diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index c4daed16656..860fd6e5608 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -462,14 +462,14 @@ This may be useful when columns have been shrunk." (when pos (goto-char pos)) (goto-char (line-beginning-position)) (let ((end (line-end-position)) str) - (backward-char) + (goto-char (1- pos)) (while (progn (forward-char 1) (< (point) end)) (let ((ov (car (overlays-at (point))))) (if (not ov) (push (char-to-string (char-after)) str) (push (overlay-get ov 'display) str) (goto-char (1- (overlay-end ov)))))) - (format "%s" (mapconcat #'identity (reverse str) ""))))) + (format "|%s" (mapconcat #'identity (reverse str) ""))))) (defvar-local org-table-header-overlay nil) (defun org-table-header-set-header () diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index e82dbbf398c..5cc98e38066 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." (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.5.2-25-gaf6f12")) + (let ((org-git-version "release_9.5.2-38-g682ccd")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index d656a51591e..4524812c55f 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -199,6 +199,7 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-update-radio-target-regexp "ol" ()) (defvar org-element-paragraph-separate) +(defvar org-element--timestamp-regexp) (defvar org-indent-indentation-per-level) (defvar org-radio-target-regexp) (defvar org-target-link-regexp) @@ -15020,7 +15021,11 @@ When matching, the match groups are the following: group 4: day name group 5: hours, if any group 6: minutes, if any" - (let* ((regexp (if extended org-ts-regexp3 org-ts-regexp2)) + (let* ((regexp (if extended + (if (eq extended 'agenda) + org-element--timestamp-regexp + org-ts-regexp3) + org-ts-regexp2)) (pos (point)) (match? (let ((boundaries (org-in-regexp regexp))) @@ -15051,7 +15056,8 @@ When matching, the match groups are the following: ((org-pos-in-match-range pos 8) 'minute) ((or (org-pos-in-match-range pos 4) (org-pos-in-match-range pos 5)) 'day) - ((and (> pos (or (match-end 8) (match-end 5))) + ((and (or (match-end 8) (match-end 5)) + (> pos (or (match-end 8) (match-end 5))) (< pos (match-end 0))) (- pos (or (match-end 8) (match-end 5)))) (t 'day)))) diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 5de0b5d675c..81ef002a052 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -442,7 +442,7 @@ property on the headline itself.") { font-size: 10px; font-weight: bold; white-space: nowrap; } .org-info-js_search-highlight { background-color: #ffff00; color: #000000; font-weight: bold; } - .org-svg { width: 90%; } + .org-svg { } " "The default style specification for exported HTML files. You can use `org-html-head' and `org-html-head-extra' to add to -- 2.39.2