summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-09-19 17:35:47 +0800
committerJSDurand <mmemmew@gmail.com>2021-09-19 17:35:47 +0800
commitea1dc729170149e67c399bc6db500b54d32b84df (patch)
tree5cd7325e5cfac1396c453634d5991a413487d29e
parent207299cfdef23cf9f15acb43b1e5d819b9c58670 (diff)
Fit the annotation buffer to window
* bookmark-conf.el: (durand-bookmark-jump-fit-to-window, bookmark-jump): Add an :after advice to fit the annotation buffer to its window. For some reason this is not done by default.
-rw-r--r--bookmark-conf.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/bookmark-conf.el b/bookmark-conf.el
index 1af7641..9de3d8d 100644
--- a/bookmark-conf.el
+++ b/bookmark-conf.el
@@ -131,5 +131,20 @@
(blist-define-criterion "elisp" "ELisp"
(string-match-p "\\.el$" (blist-get-location bookmark)))
+;;; Fit annotations buffer to window
+
+(defun durand-bookmark-jump-fit-to-window (&rest _args)
+ "Fit the annotations buffer to its window, if needed.
+ARGS are ignored."
+ (let ((window (get-buffer-window "*Bookmark Annotation*")))
+ (cond
+ ((and window (windowp window) (window-live-p window))
+ (durand-fit-window-to-buffer-with-max
+ window)))))
+
+(advice-add #'bookmark-jump
+ :after
+ #'durand-bookmark-jump-fit-to-window)
+
(provide 'bookmark-conf)
;;; bookmark-conf.el ends here