summaryrefslogtreecommitdiff
path: root/eww-conf.el
diff options
context:
space:
mode:
Diffstat (limited to 'eww-conf.el')
-rw-r--r--eww-conf.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/eww-conf.el b/eww-conf.el
index 2be4c9b..157dded 100644
--- a/eww-conf.el
+++ b/eww-conf.el
@@ -422,6 +422,14 @@ Intended for use with `eww-mode-hook'."
;;;; Jumping
+;; HACK: Use an advice to temporarily override the definition of
+;; pop-to-buffer.
+
+(defun durand-pop-to-buffer-advice (buffer &rest args)
+ "Set BUFFER and ignore ARGS.
+Just a temporary advice to override `pop-to-buffer'."
+ (set-buffer buffer))
+
;; NOTE: It works with jumping in another window.
;;;###autoload
@@ -486,15 +494,15 @@ Otherwise, fetch URL and afterwards try to restore the point."
(t
;; HACK, GIANT HACK!
- ;; I think I don't need to explain how hacky it is to define
- ;; a built-in function here. Haha.
- (defun pop-to-buffer (x &rest _args) (set-buffer x))
+ (advice-add #'pop-to-buffer :override
+ #'durand-pop-to-buffer-advice)
(eww location 4)
;; after the `set-buffer' in `eww', the current buffer is
;; the buffer we want
(setq buffer (current-buffer))
;; restore the definition of pop-to-buffer...
- (load "window.el" nil t)
+ (advice-remove
+ #'pop-to-buffer #'durand-pop-to-buffer-advice)
;; add a hook to restore the position
;; make sure each hook function is unique, so that different