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

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

[elpa] externals/leaf de55bed 03/13: update document, tagged v4.4.1


From: Stefan Monnier
Subject: [elpa] externals/leaf de55bed 03/13: update document, tagged v4.4.1
Date: Wed, 17 Mar 2021 18:45:35 -0400 (EDT)

branch: externals/leaf
commit de55bed704374574e4c65e709929afcbddac30fc
Author: Naoya Yamashita <conao3@gmail.com>
Commit: Naoya Yamashita <conao3@gmail.com>

    update document, tagged v4.4.1
---
 README.md  | 119 ++++++++++++++++++++++++++++++++++-
 README.org | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 leaf.el    |   2 +-
 3 files changed, 324 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 8280cf7..f6ea083 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@
   - [:commands keyword](#commands-keyword)
   - [:after keyword](#after-keyword)
   - [:bind, :bind* keywords](#bind-bind-keywords)
+  - [:bind-keymap, :bind-keymap* keywords](#bind-keymap-bind-keymap-keywords)
 - [Configure variables keywords](#configure-variables-keywords)
   - [:custom, :custom*, :custom-face 
keywords](#custom-custom-custom-face-keywords)
   - [:pre-setq, :setq, :setq-default 
keywords](#pre-setq-setq-setq-default-keywords)
@@ -643,7 +644,7 @@ When defined globally, key bindings and their corresponding 
functions are specif
 
 To set it to a specific map, **place the map name as a keyword or symbol** at 
the top of the list.
 
-If you omit `:package`, use leaf&#x2013;name as `:package` to lazy load.
+If you omit `:package`, use leaf--name as `:package` to lazy load.
 
 ```emacs-lisp
 (cort-deftest-with-macroexpand leaf/bind
@@ -845,6 +846,122 @@ If you omit `:package`, use leaf&#x2013;name as 
`:package` to lazy load.
 
 
 
+## :bind-keymap, :bind-keymap\* keywords
+
+`:bind-keymap` and `:bind-keymap*` provide frontend for keybind manager for 
binding keymap.
+
+Basic usage is same as `:bind` and `:bind*`
+
+```emacs-lisp
+(cort-deftest-with-macroexpand leaf/bind-keymap
+  '(
+    ;; cons-cell will be accepted
+    ((leaf projectile
+       :ensure t
+       :bind-keymap ("C-c p" . projectile-command-map))
+     (prog1 'projectile
+       (leaf-handler-package projectile projectile nil)
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map))
+                              nil 'projectile)))
+
+    ;; multi cons-cell will be accepted
+    ((leaf projectile
+       :bind-keymap
+       ("C-c p" . projectile-command-map)
+       ("C-%" . ctl-x-5-map))
+     (prog1 'projectile
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map)
+                               ("C-%" . ctl-x-5-map))
+                              nil 'projectile)))
+
+    ;; multi cons-cell in list will be accepted
+    ((leaf projectile
+       :bind-keymap (("C-c p" . projectile-command-map)
+                     ("C-%" . ctl-x-5-map)))
+     (prog1 'projectile
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map)
+                               ("C-%" . ctl-x-5-map))
+                              nil 'projectile)))
+
+    ;; nested cons-cell list will be accepted
+    ((leaf projectile
+       :bind-keymap (("C-c p" . projectile-command-map)
+                     (("C-^" . ctl-x-4-map)
+                      ("C-%" . ctl-x-5-map))))
+     (prog1 'projectile
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map)
+                               ("C-^" . ctl-x-4-map)
+                               ("C-%" . ctl-x-5-map))
+                              nil 'projectile)))
+
+    ;; use keyword at first element to bind specific map
+    ((leaf projectile
+       :bind-keymap (("C-c p" . projectile-command-map)
+                     (:projectile-mode-map
+                      ("C-^" . ctl-x-4-map)
+                      ("C-%" . ctl-x-5-map))))
+     (prog1 'projectile
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map)
+                               (projectile-mode-map
+                                :package projectile
+                               ("C-^" . ctl-x-4-map)
+                               ("C-%" . ctl-x-5-map)))
+                              nil 'projectile)))
+
+    ;; specific map at top-level will be accepted
+    ((leaf projectile
+       :bind-keymap
+       ("C-c p" . projectile-command-map)
+       (:projectile-mode-map
+        ("C-^" . ctl-x-4-map)
+        ("C-%" . ctl-x-5-map)))
+     (prog1 'projectile
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map)
+                               (projectile-mode-map :package projectile
+                                                   ("C-^" . ctl-x-4-map)
+                                                   ("C-%" . ctl-x-5-map)))
+                              nil 'projectile)))
+
+    ;; use :package to deffering :iserch-mode-map declared
+    ((leaf projectile
+       :bind-keymap (("C-c p" . projectile-command-map)
+                     (:isearch-mode-map
+                      :package isearch
+                      ("C-^" . ctl-x-4-map)
+                      ("C-%" . ctl-x-5-map))))
+     (prog1 'projectile
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map)
+                               (isearch-mode-map :package isearch
+                                                ("C-^" . ctl-x-4-map)
+                                                ("C-%" . ctl-x-5-map)))
+                              nil 'projectile)))
+
+    ;; you can use symbol instead of keyword to specify map
+    ((leaf projectile
+       :bind-keymap (("C-c p" . projectile-command-map)
+                     (isearch-mode-map
+                      :package isearch
+                      ("C-^" . ctl-x-4-map)
+                      ("C-%" . ctl-x-5-map))))
+     (prog1 'projectile
+       (leaf-keys-bind-keymap (("C-c p" . projectile-command-map)
+                               (isearch-mode-map :package isearch
+                                                ("C-^" . ctl-x-4-map)
+                                                ("C-%" . ctl-x-5-map)))
+                              nil 'projectile)))
+
+    ;; you can use vectors to remap etc
+    ((leaf projectile
+       :ensure t
+       :bind-keymap (([remap isearch-forward] . projectile-command-map)))
+     (prog1 'projectile
+       (leaf-handler-package projectile projectile nil)
+       (leaf-keys-bind-keymap (([remap isearch-forward] . 
projectile-command-map))
+                              nil 'projectile)))))
+```
+
+
+
 # Configure variables keywords
 
 
diff --git a/README.org b/README.org
index 2803084..1e265bb 100644
--- a/README.org
+++ b/README.org
@@ -32,6 +32,7 @@
   - [[:commands keyword]]
   - [[:after keyword]]
   - [[:bind, :bind* keywords]]
+  - [[:bind-keymap, :bind-keymap* keywords]]
 - [[Configure variables keywords]]
   - [[:custom, :custom*, :custom-face keywords]]
   - [[:pre-setq, :setq, :setq-default keywords]]
@@ -855,6 +856,210 @@ If you omit ~:package~, use leaf--name as ~:package~ to 
lazy load.
                       ("M-O" . isearch-moccur-all)))))))
 #+end_src
 
+** :bind-keymap, :bind-keymap* keywords
+
+~:bind-keymap~ and ~:bind-keymap*~ provide frontend for keybind manager for 
binding keymap.
+
+Basic usage is same as ~:bind~ and ~:bind*~
+
+#+begin_src emacs-lisp
+  (cort-deftest-with-macroexpand leaf/bind
+    '(
+      ;; cons-cell will be accepted
+      ((leaf macrostep
+         :ensure t
+         :bind ("C-c e" . macrostep-expand))
+       (prog1 'macrostep
+         (unless (fboundp 'macrostep-expand) (autoload #'macrostep-expand 
"macrostep" nil t))
+         (declare-function macrostep-expand "macrostep")
+         (leaf-handler-package macrostep macrostep nil)
+         (leaf-keys (("C-c e" . macrostep-expand)))))
+
+      ;; multi cons-cell will be accepted
+      ((leaf color-moccur
+         :bind
+         ("M-s O" . moccur)
+         ("M-o" . isearch-moccur)
+         ("M-O" . isearch-moccur-all))
+       (prog1 'color-moccur
+         (unless (fboundp 'moccur) (autoload #'moccur "color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (declare-function moccur "color-moccur")
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (leaf-keys (("M-s O" . moccur)
+                     ("M-o" . isearch-moccur)
+                     ("M-O" . isearch-moccur-all)))))
+
+      ;; multi cons-cell in list will be accepted
+      ((leaf color-moccur
+         :bind (("M-s O" . moccur)
+                ("M-o" . isearch-moccur)
+                ("M-O" . isearch-moccur-all)))
+       (prog1 'color-moccur
+         (unless (fboundp 'moccur) (autoload #'moccur "color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (declare-function moccur "color-moccur")
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (leaf-keys (("M-s O" . moccur)
+                     ("M-o" . isearch-moccur)
+                     ("M-O" . isearch-moccur-all)))))
+
+      ;; bind to nil to unbind shortcut
+      ((leaf color-moccur
+         :bind (("M-s" . nil)
+                ("M-s o" . isearch-moccur)
+                ("M-s i" . isearch-moccur-all)))
+       (prog1 'color-moccur
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (leaf-keys (("M-s")
+                     ("M-s o" . isearch-moccur)
+                     ("M-s i" . isearch-moccur-all)))))
+
+      ;; nested cons-cell list will be accepted
+      ((leaf color-moccur
+         :bind (("M-s O" . moccur)
+                (("M-o" . isearch-moccur)
+                 (("M-O" . isearch-moccur-all))
+                 ("M-s" . isearch-moccur-some))))
+       (prog1 'color-moccur
+         (unless (fboundp 'moccur) (autoload #'moccur "color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-some) (autoload 
#'isearch-moccur-some "color-moccur" nil t))
+         (declare-function moccur "color-moccur")
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (declare-function isearch-moccur-some "color-moccur")
+         (leaf-keys (("M-s O" . moccur)
+                     ("M-o" . isearch-moccur)
+                     ("M-O" . isearch-moccur-all)
+                     ("M-s" . isearch-moccur-some)))))
+
+      ;; use keyword at first element to bind specific map
+      ((leaf color-moccur
+         :bind (("M-s O" . moccur)
+                (:isearch-mode-map
+                 ("M-o" . isearch-moccur)
+                 ("M-O" . isearch-moccur-all))))
+       (prog1 'color-moccur
+         (unless (fboundp 'moccur) (autoload #'moccur "color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (declare-function moccur "color-moccur")
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (defvar isearch-mode-map)
+         (leaf-keys (("M-s O" . moccur)
+                     (:isearch-mode-map
+                      :package color-moccur
+                      ("M-o" . isearch-moccur)
+                      ("M-O" . isearch-moccur-all))))))
+
+      ;; specific map at top-level will be accepted
+      ((leaf color-moccur
+         :bind
+         ("M-s O" . moccur)
+         (:isearch-mode-map
+          ("M-o" . isearch-moccur)
+          ("M-O" . isearch-moccur-all)))
+       (prog1 'color-moccur
+         (unless (fboundp 'moccur) (autoload #'moccur "color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (declare-function moccur "color-moccur")
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (defvar isearch-mode-map)
+         (leaf-keys (("M-s O" . moccur)
+                     (:isearch-mode-map
+                      :package color-moccur
+                      ("M-o" . isearch-moccur)
+                      ("M-O" . isearch-moccur-all))))))
+
+      ;; use :package to deffering :iserch-mode-map declared
+      ((leaf color-moccur
+         :bind (("M-s O" . moccur)
+                (:isearch-mode-map
+                 :package isearch
+                 ("M-o" . isearch-moccur)
+                 ("M-O" . isearch-moccur-all))))
+       (prog1 'color-moccur
+         (unless (fboundp 'moccur) (autoload #'moccur "color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (declare-function moccur "color-moccur")
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (defvar isearch-mode-map)
+         (leaf-keys (("M-s O" . moccur)
+                     (:isearch-mode-map
+                      :package isearch
+                      ("M-o" . isearch-moccur)
+                      ("M-O" . isearch-moccur-all))))))
+
+      ;; you can use symbol instead of keyword to specify map
+      ((leaf color-moccur
+         :bind (("M-s O" . moccur)
+                (isearch-mode-map
+                 :package isearch
+                 ("M-o" . isearch-moccur)
+                 ("M-O" . isearch-moccur-all))))
+       (prog1 'color-moccur
+         (unless (fboundp 'moccur) (autoload #'moccur "color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur) (autoload #'isearch-moccur 
"color-moccur" nil t))
+         (unless (fboundp 'isearch-moccur-all) (autoload #'isearch-moccur-all 
"color-moccur" nil t))
+         (declare-function moccur "color-moccur")
+         (declare-function isearch-moccur "color-moccur")
+         (declare-function isearch-moccur-all "color-moccur")
+         (defvar isearch-mode-map)
+         (leaf-keys (("M-s O" . moccur)
+                     (isearch-mode-map
+                      :package isearch
+                      ("M-o" . isearch-moccur)
+                      ("M-O" . isearch-moccur-all))))))
+
+      ;; you can use vectors to remap etc
+      ((leaf swiper
+          :ensure t
+          :bind (([remap isearch-forward] . swiper)))
+       (prog1 'swiper
+         (unless (fboundp 'swiper) (autoload #'swiper "swiper" nil t))
+         (declare-function swiper "swiper")
+
+         (leaf-handler-package swiper swiper nil)
+         (leaf-keys (([remap isearch-forward] . swiper)))))
+
+      ((leaf files
+          :bind (([(control ?x) (control ?f)] . find-file)))
+       (prog1 'files
+         (unless (fboundp 'find-file) (autoload #'find-file "files" nil t))
+         (declare-function find-file "files")
+         (leaf-keys (([(control ?x) (control ?f)] . find-file)))))))
+
+  (cort-deftest-with-macroexpand leaf/bind*
+    '(
+      ;; bind* to bind override any key-bind map
+      ((leaf color-moccur
+         :bind*
+         ("M-s O" . moccur)
+         ("M-o" . isearch-moccur)
+         ("M-O" . isearch-moccur-all))
+       (prog1 'color-moccur
+         (autoload #'moccur "color-moccur" nil t)
+         (autoload #'isearch-moccur "color-moccur" nil t)
+         (autoload #'isearch-moccur-all "color-moccur" nil t)
+         (leaf-keys* (("M-s O" . moccur)
+                      ("M-o" . isearch-moccur)
+                      ("M-O" . isearch-moccur-all)))))))
+#+end_src
+
 ** COMMENT :defaults keyword
 
 ~:defalts~ provide to download recommended settings for specified package.
diff --git a/leaf.el b/leaf.el
index 6007126..d88dbb8 100644
--- a/leaf.el
+++ b/leaf.el
@@ -5,7 +5,7 @@
 ;; Author: Naoya Yamashita <conao3@gmail.com>
 ;; Maintainer: Naoya Yamashita <conao3@gmail.com>
 ;; Keywords: lisp settings
-;; Version: 4.4.0
+;; Version: 4.4.1
 ;; URL: https://github.com/conao3/leaf.el
 ;; Package-Requires: ((emacs "24.1"))
 



reply via email to

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