(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")))
(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)
(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
(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)
(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)
(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)
: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
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
(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))))
(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)
(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))
\f
(provide 'org-version)
(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)
((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