From b1e68a33d89de34b432d6f39464f31a565604f3f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 25 Dec 2022 11:36:36 -0500 Subject: [PATCH] Update to Org 9.6-61-g63e073f --- lisp/org/ob-core.el | 10 ++++++--- lisp/org/ob-tangle.el | 3 ++- lisp/org/oc-basic.el | 18 ++++++++-------- lisp/org/org-element.el | 16 ++++++++++++-- lisp/org/org-persist.el | 46 ++++++++++++++++++++++++++++++----------- lisp/org/org-version.el | 2 +- lisp/org/org.el | 5 ++++- lisp/org/ox-html.el | 2 +- 8 files changed, 72 insertions(+), 30 deletions(-) diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index f69538f78c9..c2a3673752e 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el @@ -2464,7 +2464,11 @@ INFO may provide the values of these header arguments (in the (cons 'unordered (mapcar (lambda (e) - (list (if (stringp e) e (format "%S" e)))) + (cond + ((stringp e) (list e)) + ((listp e) + (mapcar (lambda (x) (format "%S" x)) e)) + (t (list (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) @@ -3183,8 +3187,8 @@ situations in which is it not appropriate." (if (and (memq (string-to-char cell) '(?\( ?`)) (not (org-babel-confirm-evaluate ;; See `org-babel-get-src-block-info'. - (list "emacs-lisp" (format "%S" cell) - '((:eval . yes)) nil (format "%S" cell) + (list "emacs-lisp" cell + '((:eval . yes)) nil (format "%s" cell) nil nil)))) ;; Not allowed. (user-error "Evaluation of elisp code %S aborted." cell) diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index bd17bda32ba..fd6b6f3b943 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el @@ -500,7 +500,8 @@ The PARAMS are the 3rd element of the info for the same src block." (cl-letf (((symbol-function 'org-store-link-functions) (lambda () nil))) (org-store-link nil)))) - (bare (and (string-match org-link-bracket-re l) + (bare (and l + (string-match org-link-bracket-re l) (match-string 1 l)))) (when bare (if (and org-babel-tangle-use-relative-file-links diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index 3ef7a37e3b3..01e314bfdba 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -162,17 +162,17 @@ Return a hash table with citation references as keys and fields alist as values. (puthash (cdr (assq 'id item)) (mapcar (pcase-lambda (`(,field . ,value)) (pcase field - ('author - ;; Author is an array of objects, each - ;; of them designing a person. These - ;; objects may contain multiple - ;; properties, but for this basic - ;; processor, we'll focus on `given' and - ;; `family'. + ((or 'author 'editors) + ;; Author and editors are arrays of + ;; objects, each of them designing a + ;; person. These objects may contain + ;; multiple properties, but for this + ;; basic processor, we'll focus on + ;; `given' and `family'. ;; ;; For compatibility with BibTeX, add - ;; "and" between authors. - (cons 'author + ;; "and" between authors and editors. + (cons field (mapconcat (lambda (alist) (concat (alist-get 'family alist) diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index 71c242ea658..e049c65d6bf 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -1365,7 +1365,16 @@ Assume point is at beginning of the inline task." (priority (and (looking-at "\\[#.\\][ \t]*") (progn (goto-char (match-end 0)) (aref (match-string 0) 2)))) - (title-start (point)) + (commentedp + (and (let ((case-fold-search nil)) + (looking-at org-element-comment-string)) + (goto-char (match-end 0)) + (when (looking-at-p "\\(?:[ \t]\\|$\\)") + (point)))) + (title-start (prog1 (point) + (unless (or todo priority commentedp) + ;; Headline like "* :tag:" + (skip-chars-backward " \t")))) (tags (when (re-search-forward "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$" (line-end-position) @@ -1375,6 +1384,7 @@ Assume point is at beginning of the inline task." (title-end (point)) (raw-value (org-trim (buffer-substring-no-properties title-start title-end))) + (archivedp (member org-element-archive-tag tags)) (task-end (save-excursion (end-of-line) (and (re-search-forward org-element-headline-re limit t) @@ -1410,7 +1420,9 @@ Assume point is at beginning of the inline task." :todo-keyword todo :todo-type todo-type :post-blank (1- (count-lines (or task-end begin) end)) - :post-affiliated begin) + :post-affiliated begin + :archivedp archivedp + :commentedp commentedp) time-props standard-props)))) (org-element-put-property diff --git a/lisp/org/org-persist.el b/lisp/org/org-persist.el index 6ccf357784e..60291e5187f 100644 --- a/lisp/org/org-persist.el +++ b/lisp/org/org-persist.el @@ -874,15 +874,21 @@ When IGNORE-RETURN is non-nil, just return t on success without calling When ASSOCIATED is non-nil, only save the matching data." (unless org-persist--index (org-persist--load-index)) (setq associated (org-persist--normalize-associated associated)) - (unless + (if (and (equal 1 (length org-persist--index)) ;; The single collection only contains a single container ;; in the container list. (equal 1 (length (plist-get (car org-persist--index) :container))) ;; The container is an `index' container. (eq 'index (caar (plist-get (car org-persist--index) :container))) - ;; No `org-persist-directory' exists yet. - (not (file-exists-p org-persist-directory))) + (or (not (file-exists-p org-persist-directory)) + (org-directory-empty-p org-persist-directory))) + ;; Do not write anything, and clear up `org-persist-directory' to reduce + ;; clutter. + (when (and (file-exists-p org-persist-directory) + (org-directory-empty-p org-persist-directory)) + (delete-directory org-persist-directory)) + ;; Write the data. (let (all-containers) (dolist (collection org-persist--index) (if associated @@ -963,6 +969,30 @@ Also, remove containers associated with non-existing files." (push collection new-index))))) (setq org-persist--index (nreverse new-index)))) +(defun org-persist-clear-storage-maybe () + "Clear `org-persist-directory' according to `org-persist--disable-when-emacs-Q'. + +When `org-persist--disable-when-emacs-Q' is non-nil and Emacs is called with -Q +command line argument, `org-persist-directory' is created in potentially public +system temporary directory. Remove everything upon existing Emacs in +such scenario." + (when (and org-persist--disable-when-emacs-Q + ;; FIXME: This is relying on undocumented fact that + ;; Emacs sets `user-init-file' to nil when loaded with + ;; "-Q" argument. + (not user-init-file) + (file-exists-p org-persist-directory)) + (delete-directory org-persist-directory 'recursive))) + +;; Point to temp directory when `org-persist--disable-when-emacs-Q' is set. +(when (and org-persist--disable-when-emacs-Q + ;; FIXME: This is relying on undocumented fact that + ;; Emacs sets `user-init-file' to nil when loaded with + ;; "-Q" argument. + (not user-init-file)) + (setq org-persist-directory + (make-temp-file "org-persist-" 'dir))) + ;; Automatically write the data, but only when we have write access. (let ((dir (directory-file-name (file-name-as-directory org-persist-directory)))) @@ -972,20 +1002,12 @@ Also, remove containers associated with non-existing files." (if (not (file-writable-p dir)) (message "Missing write access rights to org-persist-directory: %S" org-persist-directory) + (add-hook 'kill-emacs-hook #'org-persist-clear-storage-maybe) ; Run last. (add-hook 'kill-emacs-hook #'org-persist-write-all) ;; `org-persist-gc' should run before `org-persist-write-all'. ;; So we are adding the hook after `org-persist-write-all'. (add-hook 'kill-emacs-hook #'org-persist-gc))) -;; Point to temp directory when `org-persist--disable-when-emacs-Q' is set. -(if (and org-persist--disable-when-emacs-Q - ;; FIXME: This is relying on undocumented fact that - ;; Emacs sets `user-init-file' to nil when loaded with - ;; "-Q" argument. - (not user-init-file)) - (setq org-persist-directory - (make-temp-file "org-persist-" 'dir))) - (add-hook 'after-init-hook #'org-persist-load-all) (provide 'org-persist) diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 8de0d1a4a97..a0016265f02 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.6-49-g47d129")) + (let ((org-git-version "release_9.6-61-g63e073f")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 6aa2a16219d..ab8b76b926a 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -20213,7 +20213,10 @@ interactive command with similar behavior." (defun org-back-to-heading (&optional invisible-ok) "Go back to beginning of heading." (beginning-of-line) - (or (org-at-heading-p (not invisible-ok)) + (or (and (org-at-heading-p (not invisible-ok)) + (not (and (featurep 'org-inlinetask) + (fboundp 'org-inlinetask-end-p) + (org-inlinetask-end-p)))) (if (org-element--cache-active-p) (let ((heading (org-element-lineage (org-element-at-point) '(headline inlinetask) diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 86b10cbf785..19cdf4c5a26 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -3337,7 +3337,7 @@ INFO is a plist holding contextual information. See ((org-html-standalone-image-p destination info) (org-export-get-ordinal (org-element-map destination 'link #'identity info t) - info 'link 'org-html-standalone-image-p)) + info '(link) 'org-html-standalone-image-p)) (t (org-export-get-ordinal destination info nil counter-predicate)))) (desc -- 2.39.2