[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/el-search b8e3812 144/332: Improve half-baked introduct
From: |
Stefan Monnier |
Subject: |
[elpa] externals/el-search b8e3812 144/332: Improve half-baked introduction of key bindings |
Date: |
Tue, 1 Dec 2020 15:48:31 -0500 (EST) |
branch: externals/el-search
commit b8e3812d9133977931dae8777b7bf51e73e3dfa5
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>
Improve half-baked introduction of key bindings
Define a helper function installing the suggested key bindings. Don't
bind any keys by default, even not in `el-search-map'.
---
el-search.el | 57 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 46 insertions(+), 11 deletions(-)
diff --git a/el-search.el b/el-search.el
index 70b1acf..e9ac389 100644
--- a/el-search.el
+++ b/el-search.el
@@ -32,9 +32,10 @@
;; Suggested key bindings
;; ======================
;;
-;; After loading this file, you can eval the following key definitions
-;; to try things out while reading this introduction. These are the
-;; bindings I use personally:
+;; After loading this file, you can eval
+;; (el-search-install-shift-bindings) to try things out while reading
+;; this introduction. This will install the following bindings - all
+;; are of the form Control-Shift-Letter:
;;
;; (define-key emacs-lisp-mode-map [(control ?S)] #'el-search-pattern)
;; (define-key emacs-lisp-mode-map [(control ?%)] #'el-search-query-replace)
@@ -42,18 +43,29 @@
;; (define-key global-map [(control ?N)]
#'el-search-continue-in-next-buffer)
;; (define-key global-map [(control ?O)] #'el-search-overview)
;; (define-key global-map [(control ?A)] #'el-search-from-beginning)
+;; (define-key emacs-lisp-mode-map [(control ?R)] #'el-search-previous-match)
;;
;; (define-key el-search-read-expression-map [(control ?S)]
#'exit-minibuffer)
;;
+;; (define-key el-search-map [(control ?D)] #'el-search-skip-directory)
+;; (define-key el-search-map [(control ?N)]
#'el-search-continue-in-next-buffer)
+;;
;; (define-key isearch-mode-map [(control ?S)]
#'el-search-search-from-isearch)
;; (define-key isearch-mode-map [(control ?%)]
#'el-search-replace-from-isearch)
;;
+;; (define-key global-map [(control ?E)] #'el-search-emacs-elisp-sources)
+;; (define-key global-map [(control ?L)] #'el-search-load-path)
+;; (define-key global-map [(control ?B)] #'el-search-buffers)
+;;
;; (with-eval-after-load 'dired
;; (define-key dired-mode-map [(control ?S)]
#'el-search-dired-marked-files))
;;
;; These bindings may not work in a console (if you have an idea for
;; official bindings that fit better into the Emacs ecosystem, please
-;; mail me).
+;; mail me). You can either just copy
+;; (el-search-install-shift-bindings) to your init file to use these
+;; bindings automatically in the future, or use its definition for a
+;; template for your own key bindings.
;;
;; The bindings in `isearch-mode-map' let you switch to "el-search"
;; commands from isearch reusing already given input. The binding in
@@ -428,13 +440,8 @@ directory searches like `el-search-directory' or
:type '(choice (repeat :tag "Regexps for ignored directories" regexp)
(const :tag "No ignored directories" nil)))
-(defvar el-search-map
- (let ((map (make-sparse-keymap)))
- (define-key map [(control ?D)] #'el-search-skip-directory)
- (define-key map [(control ?N)] #'el-search-continue-in-next-buffer)
- (define-key map [(control ?R)] #'el-search-previous-match)
- map)
- "Used by search commands as transient-map.")
+(defvar el-search-map (make-sparse-keymap)
+ "Used by search commands as transient map.")
(defvar el-search-read-expression-map
(let ((map (make-sparse-keymap)))
@@ -1152,6 +1159,34 @@ non-nil unless their name is matched by one of the
el-search-ignored-directory-regexps))))
t #'el-search--elisp-file-name-p))
+;;;###autoload
+(defun el-search-install-shift-bindings ()
+ (interactive)
+ (define-key emacs-lisp-mode-map [(control ?S)] #'el-search-pattern)
+ (define-key emacs-lisp-mode-map [(control ?%)] #'el-search-query-replace)
+ (define-key global-map [(control ?J)]
#'el-search-jump-to-search-head)
+ (define-key global-map [(control ?N)]
#'el-search-continue-in-next-buffer)
+ (define-key global-map [(control ?O)] #'el-search-overview)
+ (define-key global-map [(control ?A)] #'el-search-from-beginning)
+ (define-key emacs-lisp-mode-map [(control ?R)] #'el-search-previous-match)
+
+ (define-key el-search-read-expression-map [(control ?S)] #'exit-minibuffer)
+
+ (define-key el-search-map [(control ?D)] #'el-search-skip-directory)
+ (define-key el-search-map [(control ?N)] #'el-search-continue-in-next-buffer)
+
+ (define-key isearch-mode-map [(control ?S)] #'el-search-search-from-isearch)
+ (define-key isearch-mode-map [(control ?%)] #'el-search-replace-from-isearch)
+
+ (define-key global-map [(control ?E)] #'el-search-emacs-elisp-sources)
+ (define-key global-map [(control ?L)] #'el-search-load-path)
+ (define-key global-map [(control ?B)] #'el-search-buffers)
+
+ (defvar dired-mode-map)
+
+ (with-eval-after-load 'dired
+ (define-key dired-mode-map [(control ?S)] #'el-search-dired-marked-files)))
+
;;;; Additional pattern type definitions
- [elpa] externals/el-search f26277b 117/332: Rewrite of el-search for version 1.0, (continued)
- [elpa] externals/el-search f26277b 117/332: Rewrite of el-search for version 1.0, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 1ef4266 114/332: Make el-search--make-docstring require a NAME argument, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 278a930 125/332: Speed up multi searching; version 1.1, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 0c2f0e5 127/332: Don't use the non-word "heuristical", Stefan Monnier, 2020/12/01
- [elpa] externals/el-search a38665c 115/332: Add section "Patterns for stylistic rewriting" and pattern `iffy-if', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 8fdb91d 124/332: New command `el-search-load-path', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 4202501 148/332: el-search version 1.3: Lots of fixes and improvements, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search d54491c 147/332: Add a FILE argument to `el-search-dired-marked-files', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search a26b6e0 152/332: Reset wrap flag even when no match, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 6919e8d 141/332: Also count pattern types starting with "_" as internal, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search b8e3812 144/332: Improve half-baked introduction of key bindings,
Stefan Monnier <=
- [elpa] externals/el-search e96c054 156/332: Handle read errors when reading and validating replacement, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 6f0f22c 155/332: Some details, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 6e6013a 159/332: Fix and speed up the `change' pattern type, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search c878a24 173/332: Fix "Make amount of context around occur matches adjustable", Stefan Monnier, 2020/12/01
- [elpa] externals/el-search f6b1aec 180/332: Some details, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 8583d46 191/332: Fix resuming a single-buffer query-replace, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 365f93f 197/332: * el-search/el-search.el: Some buffer display related minor tweaks, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search c69dd52 205/332: * el-search/el-search.el: Some minor tweaks, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search c41288f 208/332: Make el-search key binding installation more flexible, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 8d20f8a 217/332: Add face `el-search-highlight-in-prompt-face', Stefan Monnier, 2020/12/01