forked from mirrors/org-mode
org-persist--gc-orphan-p: Fix Emacs 26.1 compatibility
* lisp/org-compat: Add org-assoc-delete-all from compat/compat-27.el. * lisp/org-persist.el (org-persist--gc-orphan-p): Use org-assoc-delete-all. TINYCHANGE
This commit is contained in:
parent
80ce6152ba
commit
684aff8eeb
|
@ -348,6 +348,24 @@ Execute BODY, and unwind connection-local variables."
|
||||||
`(with-connection-local-profiles (connection-local-get-profiles nil)
|
`(with-connection-local-profiles (connection-local-get-profiles nil)
|
||||||
,@body)))
|
,@body)))
|
||||||
|
|
||||||
|
;; assoc-delete-all missing from 26.1
|
||||||
|
(if (fboundp 'assoc-delete-all)
|
||||||
|
(defalias 'org-assoc-delete-all 'assoc-delete-all)
|
||||||
|
;; from compat/compat-27.el
|
||||||
|
(defun org-assoc-delete-all (key alist &optional test)
|
||||||
|
"Delete all matching key from alist, default test equal"
|
||||||
|
(unless test (setq test #'equal))
|
||||||
|
(while (and (consp (car alist))
|
||||||
|
(funcall test (caar alist) key))
|
||||||
|
(setq alist (cdr alist)))
|
||||||
|
(let ((tail alist) tail-cdr)
|
||||||
|
(while (setq tail-cdr (cdr tail))
|
||||||
|
(if (and (consp (car tail-cdr))
|
||||||
|
(funcall test (caar tail-cdr) key))
|
||||||
|
(setcdr tail (cdr tail-cdr))
|
||||||
|
(setq tail tail-cdr))))
|
||||||
|
alist))
|
||||||
|
|
||||||
|
|
||||||
;;; Emacs < 26.1 compatibility
|
;;; Emacs < 26.1 compatibility
|
||||||
|
|
||||||
|
|
|
@ -1216,7 +1216,7 @@ Remove expired sessions timestamps."
|
||||||
Remove current sessions from `org-persist-gc-lock-file'."
|
Remove current sessions from `org-persist-gc-lock-file'."
|
||||||
(let* ((file (org-file-name-concat org-persist-directory org-persist-gc-lock-file))
|
(let* ((file (org-file-name-concat org-persist-directory org-persist-gc-lock-file))
|
||||||
(alist (when (file-exists-p file) (org-persist--read-elisp-file file))))
|
(alist (when (file-exists-p file) (org-persist--read-elisp-file file))))
|
||||||
(setq alist (assoc-delete-all before-init-time alist))
|
(setq alist (org-assoc-delete-all before-init-time alist))
|
||||||
(org-persist--write-elisp-file file alist)
|
(org-persist--write-elisp-file file alist)
|
||||||
;; Only GC orphan files when there are no active sessions.
|
;; Only GC orphan files when there are no active sessions.
|
||||||
(not alist)))
|
(not alist)))
|
||||||
|
|
Loading…
Reference in New Issue