EWW: Only read bookmarks if modified since last time
parent
580b3214f0
commit
24dd3f80c3
|
@ -236,13 +236,20 @@ With prefix argument, prompt for bookmark title."
|
|||
(message "Bookmarked %s (%s)" url title))))
|
||||
(advice-add 'eww-add-bookmark :override 'ambrevar/eww-add-bookmark)
|
||||
|
||||
(defvar ambrevar/eww-bookmark-timestamp nil)
|
||||
(defun ambrevar/eww-read-bookmarks ()
|
||||
(let ((file (expand-file-name "eww-bookmarks.gpg" eww-bookmarks-directory)))
|
||||
(setq eww-bookmarks
|
||||
(unless (zerop (or (nth 7 (file-attributes file)) 0))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(read (current-buffer)))))))
|
||||
(let* ((file (expand-file-name "eww-bookmarks.gpg" eww-bookmarks-directory))
|
||||
(mtime (file-attribute-modification-time (file-attributes file))))
|
||||
(when (or (null ambrevar/eww-bookmark-timestamp)
|
||||
(null eww-bookmarks)
|
||||
(time-less-p ambrevar/eww-bookmark-timestamp
|
||||
mtime))
|
||||
(setq ambrevar/eww-bookmark-timestamp mtime)
|
||||
(setq eww-bookmarks
|
||||
(unless (zerop (or (file-attribute-size (file-attributes file)) 0))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(read (current-buffer))))))))
|
||||
(advice-add 'eww-read-bookmarks :override 'ambrevar/eww-read-bookmarks)
|
||||
|
||||
(defun ambrevar/eww-write-bookmarks ()
|
||||
|
|
Loading…
Reference in New Issue