diff options
| author | Lars Ingebrigtsen | 2013-12-24 08:25:27 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2013-12-24 08:25:27 +0100 |
| commit | 58f2b9a5583b998a94c40847fb8a7eba8474bcf6 (patch) | |
| tree | 0452bf3a7e759aed15231c5338f1ec67f53e4a4f | |
| parent | 0b52b61dd0061966d68d52fe0f56bb72c13a2e8c (diff) | |
| download | emacs-58f2b9a5583b998a94c40847fb8a7eba8474bcf6.tar.gz emacs-58f2b9a5583b998a94c40847fb8a7eba8474bcf6.zip | |
Fix eww bookmark window configuration
* net/eww.el (eww-bookmark-quit): Remove.
(eww-bookmark-browse): Restore the window configuration when you
choose a bookmark.
Fixes: debbugs:16144
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/net/eww.el | 19 |
2 files changed, 14 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 35920095e7a..79244ec160c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-12-24 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * net/eww.el (eww-bookmark-quit): Remove. | ||
| 4 | (eww-bookmark-browse): Restore the window configuration when you | ||
| 5 | choose a bookmark (bug#16144). | ||
| 6 | |||
| 1 | 2013-12-24 Daniel Colascione <dancol@dancol.org> | 7 | 2013-12-24 Daniel Colascione <dancol@dancol.org> |
| 2 | 8 | ||
| 3 | * icomplete.el: Remove redundant :group arguments to `defcustom' | 9 | * icomplete.el: Remove redundant :group arguments to `defcustom' |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 89a7eb9e050..b7f50c19321 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -1083,6 +1083,8 @@ Differences in #targets are ignored." | |||
| 1083 | ;;; Bookmarks code | 1083 | ;;; Bookmarks code |
| 1084 | 1084 | ||
| 1085 | (defvar eww-bookmarks nil) | 1085 | (defvar eww-bookmarks nil) |
| 1086 | (defvar eww-previous-window-configuration nil) | ||
| 1087 | (make-variable-buffer-local 'eww-previous-window-configuration) | ||
| 1086 | 1088 | ||
| 1087 | (defun eww-add-bookmark () | 1089 | (defun eww-add-bookmark () |
| 1088 | "Add the current page to the bookmarks." | 1090 | "Add the current page to the bookmarks." |
| @@ -1127,6 +1129,7 @@ Differences in #targets are ignored." | |||
| 1127 | (unless eww-bookmarks | 1129 | (unless eww-bookmarks |
| 1128 | (user-error "No bookmarks are defined")) | 1130 | (user-error "No bookmarks are defined")) |
| 1129 | (set-buffer (get-buffer-create "*eww bookmarks*")) | 1131 | (set-buffer (get-buffer-create "*eww bookmarks*")) |
| 1132 | (setq eww-previous-window-configuration (current-window-configuration)) | ||
| 1130 | (eww-bookmark-mode) | 1133 | (eww-bookmark-mode) |
| 1131 | (let ((format "%-40s %s") | 1134 | (let ((format "%-40s %s") |
| 1132 | (inhibit-read-only t) | 1135 | (inhibit-read-only t) |
| @@ -1178,21 +1181,15 @@ Differences in #targets are ignored." | |||
| 1178 | (cons bookmark (nthcdr line eww-bookmarks))))) | 1181 | (cons bookmark (nthcdr line eww-bookmarks))))) |
| 1179 | (eww-write-bookmarks))) | 1182 | (eww-write-bookmarks))) |
| 1180 | 1183 | ||
| 1181 | (defun eww-bookmark-quit () | ||
| 1182 | "Kill the current buffer." | ||
| 1183 | (interactive) | ||
| 1184 | (kill-buffer (current-buffer))) | ||
| 1185 | |||
| 1186 | (defun eww-bookmark-browse () | 1184 | (defun eww-bookmark-browse () |
| 1187 | "Browse the bookmark under point in eww." | 1185 | "Browse the bookmark under point in eww." |
| 1188 | (interactive) | 1186 | (interactive) |
| 1189 | (let ((bookmark (get-text-property (line-beginning-position) 'eww-bookmark))) | 1187 | (let ((bookmark (get-text-property (line-beginning-position) 'eww-bookmark))) |
| 1190 | (unless bookmark | 1188 | (unless bookmark |
| 1191 | (user-error "No bookmark on the current line")) | 1189 | (user-error "No bookmark on the current line")) |
| 1192 | ;; We wish to leave this window, but if it's the only window here, | 1190 | (quit-window) |
| 1193 | ;; just let it remain. | 1191 | (when eww-previous-window-configuration |
| 1194 | (ignore-errors | 1192 | (set-window-configuration eww-previous-window-configuration)) |
| 1195 | (delete-window)) | ||
| 1196 | (eww-browse-url (plist-get bookmark :url)))) | 1193 | (eww-browse-url (plist-get bookmark :url)))) |
| 1197 | 1194 | ||
| 1198 | (defun eww-next-bookmark () | 1195 | (defun eww-next-bookmark () |
| @@ -1238,7 +1235,7 @@ Differences in #targets are ignored." | |||
| 1238 | (defvar eww-bookmark-mode-map | 1235 | (defvar eww-bookmark-mode-map |
| 1239 | (let ((map (make-sparse-keymap))) | 1236 | (let ((map (make-sparse-keymap))) |
| 1240 | (suppress-keymap map) | 1237 | (suppress-keymap map) |
| 1241 | (define-key map "q" 'eww-bookmark-quit) | 1238 | (define-key map "q" 'quit-window) |
| 1242 | (define-key map [(control k)] 'eww-bookmark-kill) | 1239 | (define-key map [(control k)] 'eww-bookmark-kill) |
| 1243 | (define-key map [(control y)] 'eww-bookmark-yank) | 1240 | (define-key map [(control y)] 'eww-bookmark-yank) |
| 1244 | (define-key map "\r" 'eww-bookmark-browse) | 1241 | (define-key map "\r" 'eww-bookmark-browse) |
| @@ -1246,7 +1243,7 @@ Differences in #targets are ignored." | |||
| 1246 | (easy-menu-define nil map | 1243 | (easy-menu-define nil map |
| 1247 | "Menu for `eww-bookmark-mode-map'." | 1244 | "Menu for `eww-bookmark-mode-map'." |
| 1248 | '("Eww Bookmark" | 1245 | '("Eww Bookmark" |
| 1249 | ["Exit" eww-bookmark-quit t] | 1246 | ["Exit" quit-window t] |
| 1250 | ["Browse" eww-bookmark-browse | 1247 | ["Browse" eww-bookmark-browse |
| 1251 | :active (get-text-property (line-beginning-position) 'eww-bookmark)] | 1248 | :active (get-text-property (line-beginning-position) 'eww-bookmark)] |
| 1252 | ["Kill" eww-bookmark-kill | 1249 | ["Kill" eww-bookmark-kill |