EWW: Use eww-bookmarks-file
parent
24dd3f80c3
commit
d2fe03e37f
|
@ -19,6 +19,9 @@
|
|||
eww-download-directory "~/temp")
|
||||
;; (add-to-list 'auto-mode-alist '("eww-bookmarks$" . emacs-lisp-mode))
|
||||
|
||||
(defvar ambrevar/eww-bookmarks-file (expand-file-name "eww-bookmarks.gpg"
|
||||
eww-bookmarks-directory))
|
||||
|
||||
(defun ambrevar/eww-copy-page-title ()
|
||||
"Copy the URL of the current page into the kill ring."
|
||||
(interactive)
|
||||
|
@ -238,7 +241,7 @@ With prefix argument, prompt for bookmark title."
|
|||
|
||||
(defvar ambrevar/eww-bookmark-timestamp nil)
|
||||
(defun ambrevar/eww-read-bookmarks ()
|
||||
(let* ((file (expand-file-name "eww-bookmarks.gpg" eww-bookmarks-directory))
|
||||
(let* ((file ambrevar/eww-bookmarks-file)
|
||||
(mtime (file-attribute-modification-time (file-attributes file))))
|
||||
(when (or (null ambrevar/eww-bookmark-timestamp)
|
||||
(null eww-bookmarks)
|
||||
|
@ -262,8 +265,7 @@ With prefix argument, prompt for bookmark title."
|
|||
(replace-regexp-in-string "^[a-zA-Z]+://" "" (plist-get a :url))
|
||||
(replace-regexp-in-string "^[a-zA-Z]+://" "" (plist-get b :url))))))
|
||||
;; PATCH: Remove newline for tags.
|
||||
(with-current-buffer (find-file-noselect
|
||||
(expand-file-name "eww-bookmarks.gpg" eww-bookmarks-directory))
|
||||
(with-current-buffer (find-file-noselect ambrevar/eww-bookmarks-file)
|
||||
(erase-buffer)
|
||||
(insert
|
||||
(replace-regexp-in-string
|
||||
|
@ -273,6 +275,8 @@ With prefix argument, prompt for bookmark title."
|
|||
(pp eww-bookmarks (current-buffer))
|
||||
(buffer-string))))
|
||||
(save-buffer))
|
||||
(setq ambrevar/eww-bookmark-timestamp
|
||||
(file-attribute-modification-time ambrevar/eww-bookmark-timestamp))
|
||||
;; TODO: Kill buffer if it wasn't opened?
|
||||
)
|
||||
(advice-add 'eww-write-bookmarks :override 'ambrevar/eww-write-bookmarks)
|
||||
|
|
Loading…
Reference in New Issue