org-persist.el: Do not use hook depth unnecessarily
* lisp/org-persist.el: Do not use hook depth to define the order of `org-persist-gc' and `org-persist-write-all'. Rely on default behaviour of `add-hook' instead. (org-persist-register): Use default hook depth.
This commit is contained in:
parent
350fa065b4
commit
b9d0d06ca5
|
@ -123,7 +123,7 @@ dependency means that data shared between variables will be preserved
|
||||||
(cons var (plist-get inherited-index :variable)))))))
|
(cons var (plist-get inherited-index :variable)))))))
|
||||||
(org-persist--get-index var buffer)
|
(org-persist--get-index var buffer)
|
||||||
(when buffer
|
(when buffer
|
||||||
(add-hook 'kill-buffer-hook #'org-persist-write-all-buffer 1000 'local)))
|
(add-hook 'kill-buffer-hook #'org-persist-write-all-buffer 'local)))
|
||||||
|
|
||||||
(defun org-persist-unregister (var &optional buffer)
|
(defun org-persist-unregister (var &optional buffer)
|
||||||
"Unregister VAR in BUFFER to be persistent.
|
"Unregister VAR in BUFFER to be persistent.
|
||||||
|
@ -285,8 +285,10 @@ When BUFFER is `all', unregister VAR in all buffers."
|
||||||
(if (not (file-writable-p dir))
|
(if (not (file-writable-p dir))
|
||||||
(message "Missing write access rights to org-persist-directory: %S"
|
(message "Missing write access rights to org-persist-directory: %S"
|
||||||
org-persist-directory)
|
org-persist-directory)
|
||||||
(add-hook 'kill-emacs-hook #'org-persist-gc)
|
(add-hook 'kill-emacs-hook #'org-persist-write-all)
|
||||||
(add-hook 'kill-emacs-hook #'org-persist-write-all 100)))
|
;; `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)))
|
||||||
|
|
||||||
(add-hook 'after-init-hook #'org-persist-read-all)
|
(add-hook 'after-init-hook #'org-persist-read-all)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue