[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bufferlo 1987ce6210 156/192: Add bookmark handler post-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/bufferlo 1987ce6210 156/192: Add bookmark handler post-load callback functions and docs |
Date: |
Sat, 19 Apr 2025 15:58:18 -0400 (EDT) |
branch: externals/bufferlo
commit 1987ce621037552c4ed5f9a46e7612f16d71ecda
Author: shipmints <shipmints@gmail.com>
Commit: Flo Rommel <mail@florommel.de>
Add bookmark handler post-load callback functions and docs
---
README.org | 17 +++++++++++++++++
bufferlo.el | 46 ++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index 09140ffbb6..16d463dbdb 100644
--- a/README.org
+++ b/README.org
@@ -637,6 +637,23 @@ bookmark set is loaded.
(setq bufferlo-set-restore-tabs-reuse-init-frame nil) ; always make new
frames
#+end_src
+*** Bookmark handler hooks
+
+You can add your own functions to the following abnormal hooks to be
+called upon successful loading of tab, frame, and set bookmarks. See
+the docstrings for each function for its calling conventions.
+
+Example: You could use a tab handler function to set the tab-bar group
+for each loaded tab to its source bookmark name. While tab-bar does
+have ~tab-bar-tab-post-open-functions~, the bookmark context will not
+be available when those functions are called.
+
+#+begin_src emacs-lisp
+ (add-hook 'bufferlo-bookmark-tab-handler-functions #'tab-bookmark-fun)
+ (add-hook 'bufferlo-bookmark-frame-handler-functions #'frame-bookmark-fun)
+ (add-hook 'bufferlo-bookmark-set-handler-functions #'set-bookmark-fun)
+#+end_src
+
*** Frame geometry options
Bufferlo provides wrappers around Emacs frame functions to provide
diff --git a/bufferlo.el b/bufferlo.el
index 6561cd829e..3cff1722a2 100644
--- a/bufferlo.el
+++ b/bufferlo.el
@@ -515,6 +515,30 @@ These functions are also called when creating a frame
bookmark, since a
frame bookmark is a collection of tab bookmarks."
:type 'hook)
+(defcustom bufferlo-bookmark-tab-handler-functions nil
+ "Abnormal hooks to call after a bookmark tab is handled.
+Each function takes the following arguments:
+ bookmark-name: source bookmark name
+ effective-bookmark-name: nil, if tab bookmark cleared
+ tab: the handled tab"
+ :type 'hook)
+
+(defcustom bufferlo-bookmark-frame-handler-functions nil
+ "Abnormal hooks to call after a bookmark frame is handled.
+Each function takes the following arguments:
+ bookmark-name: source bookmark name
+ effective-bookmark-name: nil, if frame bookmark cleared
+ new-frame-p: t if this is a new frame, nil if a reused frame
+ frame: the handled frame"
+ :type 'hook)
+
+(defcustom bufferlo-bookmark-set-handler-functions nil
+ "Abnormal hooks to call after a bookmark set is handled.
+Each function takes the following arguments:
+ bookmark-name: source bookmark name
+ set-bookmark-names: bookmark names handled"
+ :type 'hook)
+
(defvar bufferlo--desktop-advice-active nil)
(defvar bufferlo--desktop-advice-active-force nil)
@@ -2331,7 +2355,13 @@ this bookmark is embedded in a frame bookmark."
(set-frame-parameter nil 'buried-buffer-list nil)
(setf (alist-get 'bufferlo-bookmark-tab-name
(cdr (bufferlo--current-tab)))
- (unless disconnect-tbm-p bookmark-name)))
+ (unless disconnect-tbm-p bookmark-name))
+
+ (run-hook-with-args
+ 'bufferlo-bookmark-tab-handler-functions
+ bookmark-name
+ (unless disconnect-tbm-p bookmark-name)
+ (bufferlo--current-tab)))
;; Log message
(unless (or no-message bufferlo--bookmark-handler-no-message)
@@ -2494,7 +2524,14 @@ the message after successfully restoring the bookmark."
;; Select and raise the restored frame outside the context
;; of with-selected-frame
- (select-frame-set-input-focus frame)))
+ (select-frame-set-input-focus frame)
+
+ (run-hook-with-args
+ 'bufferlo-bookmark-frame-handler-functions
+ bookmark-name
+ fbm
+ new-frame-p
+ frame)))
(unless (or new-frame-p pop-up-frames)
;; Switch to the to-be-selected buffer in the current frame.
@@ -2844,6 +2881,11 @@ the message after successfully restoring the bookmark."
(push `(,bookmark-name (bufferlo-bookmark-names .
,bufferlo-bookmark-names))
bufferlo--active-sets)
+ (run-hook-with-args
+ 'bufferlo-bookmark-set-handler-functions
+ bookmark-name
+ bufferlo-bookmark-names)
+
(unless (or no-message bufferlo--bookmark-handler-no-message)
(message "Restored bufferlo bookmark set %s %s"
bookmark-name bufferlo-bookmark-names))))
- [elpa] externals/bufferlo f9113a6e7e 134/192: Add bookmark handler post-load callback functions and docs, (continued)
- [elpa] externals/bufferlo f9113a6e7e 134/192: Add bookmark handler post-load callback functions and docs, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 1b7ed15387 135/192: Ignore tab-bar--tab advice on Emacs 31, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 37192fc6a7 136/192: Wrap 'bufferlo--bookmark-tab-handler' 'tab-bar-new-tab-to', ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 0f08341f43 137/192: Synchronize tab bookmark entries bookmark list and buffer list, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 9e4e1efa73 142/192: Quiet flymake and byte-compiler warnings, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo db02b09c93 141/192: Tab bookmarks now save/restore the tab's explicit-name and group, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 8e3011e64c 145/192: Change idle timer to regular timer (BREAKING CHANGE), ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 3e8e528abd 146/192: Fix bufferlo--bookmark-completing-read for vanilla Emacs completion, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 76d3dbdf0f 147/192: Add completing-read-multiple and enhance completing-reads, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo c000d9fa13 150/192: Use numeric equality for prefix-numeric-value's, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 1987ce6210 156/192: Add bookmark handler post-load callback functions and docs,
ELPA Syncer <=
- [elpa] externals/bufferlo b431ec33cf 159/192: Synchronize tab bookmark entries bookmark list and buffer list, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 82bb850da9 163/192: Tab bookmarks now save/restore the tab's explicit-name and group, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo febbdfb9ee 161/192: Improve 'bufferlo-mode-line' and mode on/off behavior, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo e7041c36a3 160/192: Silence byte-compiler, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 812892ec92 164/192: Allow both old and new define-ibuffer-op macro references to coexist, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 8f1d0c395f 165/192: Merge branch 'florommel:xp-sess' into xp-sess, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo d93d6ed0ff 183/192: Update documentation, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo b941f7fe12 171/192: Fix and simplify undo-tab and undelete-frame, ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo c2424a1c1f 180/192: Big bang: dupe handling, Emacs workarounds, package-versions, misc., ELPA Syncer, 2025/04/19
- [elpa] externals/bufferlo 512723ec41 178/192: Wrap bookmark--jump-via to ignore display-func for bufferlo bookmarks, ELPA Syncer, 2025/04/19