* net/eww.el (eww-read-bookmarks): Check file size.

This commit is contained in:
Leo Liu 2013-06-27 12:27:53 +08:00
parent 568a53f290
commit 99906aa0d9
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,7 @@
2013-06-27 Leo Liu <sdl.web@gmail.com>
* net/eww.el (eww-read-bookmarks): Check file size.
2013-06-26 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/nadvice.el (advice--defalias-fset): Move advice back to

View file

@ -965,10 +965,12 @@ The browser to used is specified by the `shr-external-browser' variable."
(pp eww-bookmarks (current-buffer))))
(defun eww-read-bookmarks ()
(with-temp-buffer
(insert-file-contents
(expand-file-name "eww-bookmarks" user-emacs-directory))
(setq eww-bookmarks (read (current-buffer)))))
(let ((file (expand-file-name "eww-bookmarks" user-emacs-directory)))
(setq eww-bookmarks
(unless (zerop (or (nth 7 (file-attributes file)) 0))
(with-temp-buffer
(insert-file-contents file)
(read (current-buffer)))))))
(defun eww-list-bookmarks ()
"Display the bookmarks."