From 2569ede9c496bb060e0b88428cb541088aaba1f9 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 1 Jan 2023 22:24:28 -0500 Subject: [PATCH] Update to Org 9.6-81-g563a43 --- etc/ORG-NEWS | 2 +- lisp/org/ob-core.el | 7 +- lisp/org/org-agenda.el | 13 ++-- lisp/org/org-cycle.el | 2 +- lisp/org/org-fold-core.el | 2 +- lisp/org/org-fold.el | 2 +- lisp/org/org-macs.el | 8 +- lisp/org/org-persist.el | 30 ++++---- lisp/org/org-src.el | 154 +++++++++++++++++++------------------- lisp/org/org-version.el | 2 +- 10 files changed, 118 insertions(+), 104 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 62c918564d2..d610a63b09d 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -24,7 +24,7 @@ the time being. It will be removed in the next release. See https://orgmode.org/list/87r0yk7bx8.fsf@localhost for more details. -*** Element cache is enabled by default and work for headings +*** Element cache is enabled by default and works for headings The old element cache code has been refactored. Emacs does not hang anymore when the cache is enabled. diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index dacf420bd1c..9bb77f7920b 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el @@ -2461,13 +2461,18 @@ INFO may provide the values of these header arguments (in the (insert (org-trim (org-list-to-org + ;; We arbitrarily choose to format non-strings + ;; as %S. (cons 'unordered (mapcar (lambda (e) (cond ((stringp e) (list e)) ((listp e) - (mapcar (lambda (x) (format "%S" x)) e)) + (mapcar + (lambda (x) + (if (stringp x) x (format "%S" x))) + e)) (t (list (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 3376dbc1140..66b08adf535 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -3477,14 +3477,14 @@ This ensures the export commands can easily use it." (setq props (plist-put props 'tags (mapconcat #'identity tmp ":")))) (when (setq tmp (plist-get props 'date)) (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) - (let ((calendar-date-display-form '(year "-" month "-" day))) - '((format "%4d, %9s %2s, %4s" dayname monthname day year)) - + (let ((calendar-date-display-form + '(year "-" (string-pad month 2 ?0 'left) "-" (string-pad day 2 ?0 'left)))) (setq tmp (calendar-date-string tmp))) (setq props (plist-put props 'date tmp))) (when (setq tmp (plist-get props 'day)) (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) - (let ((calendar-date-display-form '(year "-" month "-" day))) + (let ((calendar-date-display-form + '(year "-" (string-pad month 2 ?0 'left) "-" (string-pad day 2 ?0 'left)))) (setq tmp (calendar-date-string tmp))) (setq props (plist-put props 'day tmp)) (setq props (plist-put props 'agenda-day tmp))) @@ -4678,7 +4678,7 @@ is active." (org-agenda-text-search-extra-files org-agenda-text-search-extra-files) regexp rtn rtnall files file pos inherited-tags marker category level tags c neg re boolean - ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) + ee txt beg end last-search-end words regexps+ regexps- hdl-only buffer beg1 str) (unless (and (not edit-at) (stringp string) (string-match "\\S-" string)) @@ -4817,6 +4817,7 @@ is active." (throw 'nextfile t)) (goto-char (max (point-min) (1- (point)))) (while (re-search-forward regexp nil t) + (setq last-search-end (point)) (org-back-to-heading t) (while (and (not (zerop org-agenda-search-view-max-outline-level)) (> (org-reduced-level (org-outline-level)) @@ -4878,7 +4879,7 @@ is active." 'priority 1000 'type "search") (push txt ee) - (goto-char (1- end)))))))))) + (goto-char (max (1- end) last-search-end)))))))))) (setq rtn (nreverse ee)) (setq rtnall (append rtnall rtn))) (org-agenda--insert-overriding-header diff --git a/lisp/org/org-cycle.el b/lisp/org/org-cycle.el index f4d84f5058f..828c84cd0ac 100644 --- a/lisp/org/org-cycle.el +++ b/lisp/org/org-cycle.el @@ -1,6 +1,6 @@ ;;; org-cycle.el --- Visibility cycling of Org entries -*- lexical-binding: t; -*- ;; -;; Copyright (C) 2020, 2023-2020 Free Software Foundation, Inc. +;; Copyright (C) 2020-2023 Free Software Foundation, Inc. ;; ;; Maintainer: Ihor Radchenko ;; Keywords: folding, visibility cycling, invisible text diff --git a/lisp/org/org-fold-core.el b/lisp/org/org-fold-core.el index 4f737af4ef5..0855e6f39ce 100644 --- a/lisp/org/org-fold-core.el +++ b/lisp/org/org-fold-core.el @@ -1,6 +1,6 @@ ;;; org-fold-core.el --- Folding buffer text -*- lexical-binding: t; -*- ;; -;; Copyright (C) 2020, 2023-2020 Free Software Foundation, Inc. +;; Copyright (C) 2020-2023 Free Software Foundation, Inc. ;; ;; Author: Ihor Radchenko ;; Keywords: folding, invisible text diff --git a/lisp/org/org-fold.el b/lisp/org/org-fold.el index 93429bb3025..1b7ca22b044 100644 --- a/lisp/org/org-fold.el +++ b/lisp/org/org-fold.el @@ -1,6 +1,6 @@ ;;; org-fold.el --- Folding of Org entries -*- lexical-binding: t; -*- ;; -;; Copyright (C) 2020, 2023-2020 Free Software Foundation, Inc. +;; Copyright (C) 2020-2023 Free Software Foundation, Inc. ;; ;; Author: Ihor Radchenko ;; Keywords: folding, invisible text diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index b09be05b7c3..72929cdd26c 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -74,11 +74,15 @@ Version mismatch is commonly encountered in the following situations: loading of the newer Org version. It is recommended to put - (straight-use-package 'org) + + %s + early in the config. Ideally, right after the straight.el bootstrap. Moving `use-package' :straight declaration may not be sufficient if the corresponding `use-package' statement is - deferring the loading.") + deferring the loading." + ;; Avoid `warn' replacing "'" with "’" (see `format-message'). + "(straight-use-package 'org)") (error "Org version mismatch. Make sure that correct `load-path' is set early in init.el"))) ;; We rely on org-macs when generating Org version. Checking Org diff --git a/lisp/org/org-persist.el b/lisp/org/org-persist.el index 8acf678d427..c3650c167e2 100644 --- a/lisp/org/org-persist.el +++ b/lisp/org/org-persist.el @@ -161,7 +161,7 @@ (declare-function org-at-heading-p "org" (&optional invisible-not-ok)) -(defconst org-persist--storage-version "2.7" +(defconst org-persist--storage-version "3.1" "Persistent storage layout version.") (defgroup org-persist nil @@ -431,25 +431,27 @@ Return PLIST." (when key (remhash (cons cont (list :key key)) org-persist--index-hash)))) (setq org-persist--index (delq existing org-persist--index))))) -(defun org-persist--get-collection (container &optional associated &rest misc) +(defun org-persist--get-collection (container &optional associated misc) "Return or create collection used to store CONTAINER for ASSOCIATED. When ASSOCIATED is nil, it is a global CONTAINER. ASSOCIATED can also be a (:buffer buffer) or buffer, (:file file-path) or file-path, (:inode inode), (:hash hash), or or (:key key). -MISC, if non-nil will be appended to the collection." +MISC, if non-nil will be appended to the collection. It must be a plist." (unless (and (listp container) (listp (car container))) (setq container (list container))) (setq associated (org-persist--normalize-associated associated)) - (unless (equal misc '(nil)) - (setq associated (append associated misc))) + (when (and misc (or (not (listp misc)) (= 1 (% (length misc) 2)))) + (error "org-persist: Not a plist: %S" misc)) (or (org-persist--find-index `( :container ,(org-persist--normalize-container container) :associated ,associated)) (org-persist--add-to-index - (list :container (org-persist--normalize-container container) - :persist-file - (replace-regexp-in-string "^.." "\\&/" (org-id-uuid)) - :associated associated)))) + (nconc + (list :container (org-persist--normalize-container container) + :persist-file + (replace-regexp-in-string "^.." "\\&/" (org-id-uuid)) + :associated associated) + misc)))) ;;;; Reading container data. @@ -650,9 +652,10 @@ COLLECTION is the plist holding data collection." (file-copy (org-file-name-concat org-persist-directory (format "%s-%s.%s" persist-file (md5 path) ext)))) - (unless (file-exists-p (file-name-directory file-copy)) - (make-directory (file-name-directory file-copy) t)) - (copy-file path file-copy 'overwrite) + (unless (file-exists-p file-copy) + (unless (file-exists-p (file-name-directory file-copy)) + (make-directory (file-name-directory file-copy) t)) + (copy-file path file-copy 'overwrite)) (format "%s-%s.%s" persist-file (md5 path) ext))))) (defun org-persist-write:url (c collection) @@ -719,7 +722,8 @@ last access, or a function accepting a single argument - collection. EXPIRY key has no effect when INHERIT is non-nil. Optional key WRITE-IMMEDIATELY controls whether to save the container data immediately. -MISC will be appended to CONTAINER. +MISC will be appended to the collection. It must be alternating :KEY +VALUE pairs. When WRITE-IMMEDIATELY is non-nil, the return value will be the same with `org-persist-write'." (unless org-persist--index (org-persist--load-index)) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index fd0adadb7a9..9e439281118 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -629,83 +629,83 @@ Leave point in edit buffer." "Fontify code block between START and END using LANG's syntax. This function is called by Emacs' automatic fontification, as long as `org-src-fontify-natively' is non-nil." - (let ((lang-mode (org-src-get-lang-mode lang))) - (when (fboundp lang-mode) - (let ((string (buffer-substring-no-properties start end)) - (modified (buffer-modified-p)) - (org-buffer (current-buffer))) - (remove-text-properties start end '(face nil)) - (with-current-buffer - (get-buffer-create - (format " *org-src-fontification:%s*" lang-mode)) - (let ((inhibit-modification-hooks nil)) - (erase-buffer) - ;; Add string and a final space to ensure property change. - (insert string " ")) - (unless (eq major-mode lang-mode) (funcall lang-mode)) - (font-lock-ensure) - (let ((pos (point-min)) next) - (while (setq next (next-property-change pos)) - ;; Handle additional properties from font-lock, so as to - ;; preserve, e.g., composition. - ;; FIXME: We copy 'font-lock-face property explicitly because - ;; `font-lock-mode' is not enabled in the buffers starting from - ;; space and the remapping between 'font-lock-face and 'face - ;; text properties may thus not be set. See commit - ;; 453d634bc. - (dolist (prop (append '(font-lock-face face) font-lock-extra-managed-props)) - (let ((new-prop (get-text-property pos prop))) - (when new-prop - (if (not (eq prop 'invisible)) - (put-text-property - (+ start (1- pos)) (1- (+ start next)) prop new-prop - org-buffer) - ;; Special case. `invisible' text property may - ;; clash with Org folding. Do not assign - ;; `invisible' text property directly. Use - ;; property alias instead. - (let ((invisibility-spec - (or - ;; ATOM spec. - (and (memq new-prop buffer-invisibility-spec) - new-prop) - ;; (ATOM . ELLIPSIS) spec. - (assq new-prop buffer-invisibility-spec)))) - (with-current-buffer org-buffer - ;; Add new property alias. - (unless (memq 'org-src-invisible - (cdr (assq 'invisible char-property-alias-alist))) - (setq-local - char-property-alias-alist - (cons (cons 'invisible - (nconc (cdr (assq 'invisible char-property-alias-alist)) - '(org-src-invisible))) - (remove (assq 'invisible char-property-alias-alist) - char-property-alias-alist)))) - ;; Carry over the invisibility spec, unless - ;; already present. Note that there might - ;; be conflicting invisibility specs from - ;; different major modes. We cannot do much - ;; about this then. - (when invisibility-spec - (add-to-invisibility-spec invisibility-spec)) - (put-text-property - (+ start (1- pos)) (1- (+ start next)) - 'org-src-invisible new-prop - org-buffer))))))) - (setq pos next))) - (set-buffer-modified-p nil)) - ;; Add Org faces. - (let ((src-face (nth 1 (assoc-string lang org-src-block-faces t)))) - (when (or (facep src-face) (listp src-face)) - (font-lock-append-text-property start end 'face src-face)) - (font-lock-append-text-property start end 'face 'org-block)) - ;; Clear abbreviated link folding. - (org-fold-region start end nil 'org-link) - (add-text-properties - start end - '(font-lock-fontified t fontified t font-lock-multiline t)) - (set-buffer-modified-p modified))))) + (let ((modified (buffer-modified-p))) + (remove-text-properties start end '(face nil)) + (let ((lang-mode (org-src-get-lang-mode lang))) + (when (fboundp lang-mode) + (let ((string (buffer-substring-no-properties start end)) + (org-buffer (current-buffer))) + (with-current-buffer + (get-buffer-create + (format " *org-src-fontification:%s*" lang-mode)) + (let ((inhibit-modification-hooks nil)) + (erase-buffer) + ;; Add string and a final space to ensure property change. + (insert string " ")) + (unless (eq major-mode lang-mode) (funcall lang-mode)) + (font-lock-ensure) + (let ((pos (point-min)) next) + (while (setq next (next-property-change pos)) + ;; Handle additional properties from font-lock, so as to + ;; preserve, e.g., composition. + ;; FIXME: We copy 'font-lock-face property explicitly because + ;; `font-lock-mode' is not enabled in the buffers starting from + ;; space and the remapping between 'font-lock-face and 'face + ;; text properties may thus not be set. See commit + ;; 453d634bc. + (dolist (prop (append '(font-lock-face face) font-lock-extra-managed-props)) + (let ((new-prop (get-text-property pos prop))) + (when new-prop + (if (not (eq prop 'invisible)) + (put-text-property + (+ start (1- pos)) (1- (+ start next)) prop new-prop + org-buffer) + ;; Special case. `invisible' text property may + ;; clash with Org folding. Do not assign + ;; `invisible' text property directly. Use + ;; property alias instead. + (let ((invisibility-spec + (or + ;; ATOM spec. + (and (memq new-prop buffer-invisibility-spec) + new-prop) + ;; (ATOM . ELLIPSIS) spec. + (assq new-prop buffer-invisibility-spec)))) + (with-current-buffer org-buffer + ;; Add new property alias. + (unless (memq 'org-src-invisible + (cdr (assq 'invisible char-property-alias-alist))) + (setq-local + char-property-alias-alist + (cons (cons 'invisible + (nconc (cdr (assq 'invisible char-property-alias-alist)) + '(org-src-invisible))) + (remove (assq 'invisible char-property-alias-alist) + char-property-alias-alist)))) + ;; Carry over the invisibility spec, unless + ;; already present. Note that there might + ;; be conflicting invisibility specs from + ;; different major modes. We cannot do much + ;; about this then. + (when invisibility-spec + (add-to-invisibility-spec invisibility-spec)) + (put-text-property + (+ start (1- pos)) (1- (+ start next)) + 'org-src-invisible new-prop + org-buffer))))))) + (setq pos next))) + (set-buffer-modified-p nil))))) + ;; Add Org faces. + (let ((src-face (nth 1 (assoc-string lang org-src-block-faces t)))) + (when (or (facep src-face) (listp src-face)) + (font-lock-append-text-property start end 'face src-face)) + (font-lock-append-text-property start end 'face 'org-block)) + ;; Clear abbreviated link folding. + (org-fold-region start end nil 'org-link) + (add-text-properties + start end + '(font-lock-fontified t fontified t font-lock-multiline t)) + (set-buffer-modified-p modified))) (defun org-fontify-inline-src-blocks (limit) "Try to apply `org-fontify-inline-src-blocks-1'." diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index a0016265f02..dd6d92d8e58 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-61-g63e073f")) + (let ((org-git-version "release_9.6-81-g563a43")) org-git-version)) (provide 'org-version) -- 2.39.2