update packages
This commit is contained in:
@@ -16,11 +16,11 @@
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;; Persistence of treemacs' workspaces into an org-mode compatible file.
|
||||
|
||||
;; Persistence of treemacs' workspaces into an org-mode compatible file.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'f)
|
||||
(require 's)
|
||||
(require 'dash)
|
||||
(require 'treemacs-workspaces)
|
||||
@@ -40,19 +40,13 @@
|
||||
"The name of the buffer used to edit treemacs' workspace.")
|
||||
|
||||
(defconst treemacs--last-error-persist-file
|
||||
(f-join user-emacs-directory ".cache" "treemacs-persist-at-last-error")
|
||||
(treemacs-join-path user-emacs-directory ".cache" "treemacs-persist-at-last-error")
|
||||
"File that stores the treemacs state as it was during the last load error.")
|
||||
|
||||
(make-obsolete-variable 'treemacs--last-error-persist-file 'treemacs-last-error-persist-file "v2.7")
|
||||
|
||||
(defconst treemacs--persist-kv-regex
|
||||
(rx bol
|
||||
(? " ")
|
||||
"- "
|
||||
(or "path")
|
||||
" :: "
|
||||
(1+ (or (syntax word) (syntax symbol) (syntax punctuation) space))
|
||||
eol)
|
||||
(rx bol (? " ") "- path :: " (1+ any) eol)
|
||||
"The regular expression to match org's \"key :: value\" lines.")
|
||||
|
||||
(defconst treemacs--persist-workspace-name-regex
|
||||
@@ -201,7 +195,9 @@ ITER: Treemacs-Iter Struct"
|
||||
"Read the relevant lines from given TXT or `treemacs-persist-file'.
|
||||
Will read all lines, except those that start with # or contain only whitespace."
|
||||
(-some->> (or txt (when (file-exists-p treemacs-persist-file)
|
||||
(f-read treemacs-persist-file)))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents treemacs-persist-file)
|
||||
(buffer-string))))
|
||||
(s-trim)
|
||||
(s-lines)
|
||||
(--reject (or (s-blank-str? it)
|
||||
@@ -345,7 +341,7 @@ PROJ-COUNT: Int"
|
||||
(apply #'concat (--map (concat it "\n") lines)))]
|
||||
(unless (file-exists-p treemacs-last-error-persist-file)
|
||||
(make-directory (file-name-directory treemacs-last-error-persist-file) :with-parents))
|
||||
(f-write txt 'utf-8 treemacs-last-error-persist-file)))
|
||||
(write-region txt nil treemacs-last-error-persist-file nil :silent)))
|
||||
|
||||
(add-hook 'kill-emacs-hook #'treemacs--persist)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user