emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/beframe ea0794b51a 1/5: Add beframe-prefix-map and docu


From: ELPA Syncer
Subject: [elpa] externals/beframe ea0794b51a 1/5: Add beframe-prefix-map and document it
Date: Sun, 21 May 2023 01:57:20 -0400 (EDT)

branch: externals/beframe
commit ea0794b51a256f4fb4835574e75d5554f55ba4d5
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add beframe-prefix-map and document it
---
 README.org | 35 ++++++++++++++++++++++++++---------
 beframe.el | 20 +++++++++++++++++++-
 2 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/README.org b/README.org
index 3103d88e80..c36dd5f5db 100644
--- a/README.org
+++ b/README.org
@@ -112,6 +112,8 @@ buffers associated with the current frame.  This provides 
for a
 flexible workflow where buffers can be initially beframed yet
 consolidated into new lists on demand.
 
+[[#h:737253ad-f671-46df-bdb9-6be20a982470][The Beframe keymap]]
+
 ** Assuming buffers
 :PROPERTIES:
 :CUSTOM_ID: h:dc12ca87-9ba7-4d11-89c8-653bf19015a1
@@ -211,6 +213,28 @@ The ~beframe-mode~ does the following:
 Development note: ~beframe~ is in its early days.  The minor mode may
 be revised to have more features and/or greater flexibility.
 
+* The Beframe keymap
+:PROPERTIES:
+:CUSTOM_ID: h:737253ad-f671-46df-bdb9-6be20a982470
+:END:
+
+[ Part of {{{development-version}}}. ]
+
+#+vindex: beframe-prefix-map
+The ~beframe-prefix-map~ defines key bindings for the Beframe commands
+documented herein.  We call it a prefix keymap because it is not
+available from anywhere unless the user attaches it to a key sequence.
+For example:
+
+#+begin_src emacs-lisp
+(define-key global-map (kbd "C-c b") beframe-prefix-map)
+#+end_src
+
+With the above code, =C-c b= becomes the prefix key that invokes
+Beframe commands.  Type =C-c b C-h= to show the available key
+bindings (by default =C-h= as a suffix to an incomplete key sequence
+produces a Help buffer that links to all the available bindings).
+
 * Installation
 :PROPERTIES:
 :CUSTOM_ID: h:62cdea75-5d49-4f8e-a11b-83fca49fb92b
@@ -278,15 +302,8 @@ Everything is in place to set up the package.
 
 (beframe-mode 1)
 
-;; This is just an example.  We do not define any key bindings.  You
-;; do not need this command if you enable `beframe-mode', as
-;; `switch-to-buffer' only shows a list of beframed buffers.
-(define-key global-map (kbd "C-x B") #'beframe-switch-buffer)
-
-;; Replace the generic `buffer-menu'.  With a prefix argument, this
-;; commands prompts for a frame.  Call the `buffer-menu' via M-x if
-;; you absolutely need the global list of buffers.
-(define-key global-map (kbd "C-x C-b") #'beframe-buffer-menu)
+;; Bind Beframe commands to a prefix key, such as C-c b:
+(define-key global-map (kbd "C-c b") beframe-prefix-map)
 #+end_src
 
 ** Integration with Consult
diff --git a/beframe.el b/beframe.el
index 9df1fbc44d..889aeaa9b5 100644
--- a/beframe.el
+++ b/beframe.el
@@ -479,9 +479,27 @@ Keep only the `beframe-global-buffers'."
 (defvar beframe--read-buffer-function nil
   "Last value of `read-buffer-function'.")
 
+(defvar beframe-prefix-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "b") #'beframe-switch-buffer)
+    (define-key map (kbd "m") #'beframe-buffer-menu)
+    (define-key map (kbd "a f") #'beframe-assume-buffers)
+    (define-key map (kbd "a F") #'beframe-assume-frame-buffers)
+    (define-key map (kbd "a a") #'beframe-assume-buffers-all-frames)
+    (define-key map (kbd "a A") #'beframe-assume-all-buffers-no-prompts)
+    (define-key map (kbd "u f") #'beframe-unassume-buffers)
+    (define-key map (kbd "a F") #'beframe-unassume-frame-buffers)
+    (define-key map (kbd "u U") #'beframe-unassume-all-buffers-no-prompts)
+    map)
+  "Keymap with Beframe commands.
+Meant to be assigned to a prefix key, like this:
+
+    (define-key global-map (kbd \"C-c b\") beframe-prefix-map)")
+
 ;;;###autoload
 (define-minor-mode beframe-mode
-  "Make all buffer prompts limit candidates per frame."
+  "Make all buffer prompts limit candidates per frame.
+Also see the `beframe-prefix-map'."
   :global t
   (if beframe-mode
       (progn



reply via email to

[Prev in Thread] Current Thread [Next in Thread]