diff options
| author | Lars Ingebrigtsen | 2015-01-26 12:48:44 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2015-01-26 12:50:01 +1100 |
| commit | c3d4505b5a8bf55044a1f40da5018e83a43157ff (patch) | |
| tree | d807dbd690b41efc130b81766596380007344fbb | |
| parent | 03a20dc9519616359bfa1b77fd4b31e1963c8bd4 (diff) | |
| download | emacs-c3d4505b5a8bf55044a1f40da5018e83a43157ff.tar.gz emacs-c3d4505b5a8bf55044a1f40da5018e83a43157ff.zip | |
* lisp/net/eww.el (eww-add-bookmark): Fix prompt
And clean up the code slightly.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/net/eww.el | 25 |
2 files changed, 17 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70293af2725..044c2999396 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2015-01-26 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * net/eww.el (eww-add-bookmark): Fix prompt and clean up the code | ||
| 4 | slightly. | ||
| 5 | |||
| 1 | 2015-01-25 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2015-01-25 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * emacs-lisp/cl-generic.el (cl--generic-no-next-method-function): New fun. | 8 | * emacs-lisp/cl-generic.el (cl--generic-no-next-method-function): New fun. |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 879eb53115e..ec7a0baacf6 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -1430,24 +1430,23 @@ Differences in #targets are ignored." | |||
| 1430 | (defvar eww-bookmarks nil) | 1430 | (defvar eww-bookmarks nil) |
| 1431 | 1431 | ||
| 1432 | (defun eww-add-bookmark () | 1432 | (defun eww-add-bookmark () |
| 1433 | "Add the current page to the bookmarks." | 1433 | "Bookmark the current page." |
| 1434 | (interactive) | 1434 | (interactive) |
| 1435 | (eww-read-bookmarks) | 1435 | (eww-read-bookmarks) |
| 1436 | (dolist (bookmark eww-bookmarks) | 1436 | (dolist (bookmark eww-bookmarks) |
| 1437 | (when (equal (plist-get eww-data :url) (plist-get bookmark :url)) | 1437 | (when (equal (plist-get eww-data :url) (plist-get bookmark :url)) |
| 1438 | (user-error "Already bookmarked"))) | 1438 | (user-error "Already bookmarked"))) |
| 1439 | (if (y-or-n-p "bookmark this page? ") | 1439 | (when (y-or-n-p "Bookmark this page?") |
| 1440 | (progn | 1440 | (let ((title (replace-regexp-in-string "[\n\t\r]" " " |
| 1441 | (let ((title (replace-regexp-in-string "[\n\t\r]" " " | 1441 | (plist-get eww-data :title)))) |
| 1442 | (plist-get eww-data :title)))) | 1442 | (setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title)) |
| 1443 | (setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title)) | 1443 | (push (list :url (plist-get eww-data :url) |
| 1444 | (push (list :url (plist-get eww-data :url) | 1444 | :title title |
| 1445 | :title title | 1445 | :time (current-time-string)) |
| 1446 | :time (current-time-string)) | 1446 | eww-bookmarks)) |
| 1447 | eww-bookmarks)) | 1447 | (eww-write-bookmarks) |
| 1448 | (eww-write-bookmarks) | 1448 | (message "Bookmarked %s (%s)" (plist-get eww-data :url) |
| 1449 | (message "Bookmarked %s (%s)" (plist-get eww-data :url) | 1449 | (plist-get eww-data :title)))) |
| 1450 | (plist-get eww-data :title))))) | ||
| 1451 | 1450 | ||
| 1452 | (defun eww-write-bookmarks () | 1451 | (defun eww-write-bookmarks () |
| 1453 | (with-temp-file (expand-file-name "eww-bookmarks" eww-bookmarks-directory) | 1452 | (with-temp-file (expand-file-name "eww-bookmarks" eww-bookmarks-directory) |