[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/mheerdegen-preview 3f656ab 11/33: WIP [el-search] Add qui
From: |
Michael Heerdegen |
Subject: |
[elpa] scratch/mheerdegen-preview 3f656ab 11/33: WIP [el-search] Add quick help command |
Date: |
Wed, 24 Oct 2018 18:30:48 -0400 (EDT) |
branch: scratch/mheerdegen-preview
commit 3f656abfb7f11e49b47efb2f3545a5f61e01e3b6
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
WIP [el-search] Add quick help command
---
packages/el-search/el-search.el | 41 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 9728039..4faba21 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -43,6 +43,11 @@
;; later. Finally, it allows you to define your own kinds of search
;; patterns and your own multi-search commands.
;;
+;; The following text is an exhaustive introduction to this package.
+;; After having learned the basics, hitting C-? or ?
+;; (el-search-toggle-quick-help) should suffice to refresh your
+;; memory.
+;;
;;
;; Key bindings
;; ============
@@ -83,6 +88,11 @@
;; hit RET to exit, or hit C-g to abort and jump back to where you
;; started.
;;
+;; C-?, M-s e ? (el-search-toggle-quick-help)
+;;
+;; While an el-search is active, popup (or close) quick help
+;; window.
+;;
;; C-R, M-s e r (el-search-pattern-backward)
;; Search backward.
;;
@@ -415,8 +425,6 @@
;;
;; TODO:
;;
-;; - Add a help command that can be called while searching.
-;;
;; - Make searching work in comments, too? (->
;; `parse-sexp-ignore-comments'). Related: should the pattern
;; `symbol' also match strings that contain matches for a symbol so
@@ -579,6 +587,7 @@ from the prompt."
;; explicitly install the transient map themselves.
'(el-search-pattern
el-search-pattern-backward
+ el-search-toggle-quick-help
el-search-from-beginning
el-search-last-buffer-match
el-search-continue-in-next-buffer
@@ -1181,6 +1190,27 @@ be specified as fourth argument, and COUNT becomes the
fifth argument."
(funcall fail)
match-beg)))))))
+(defvar el-search-quick-help-buffer-name "*El-search help*" )
+(defvar el-search-quick-help "...
+...
+...")
+
+(defun el-search-close-quick-help-maybe ()
+ (when-let ((help-buffer (get-buffer el-search-quick-help-buffer-name))
+ (help-wins (get-buffer-window-list help-buffer)))
+ (mapc #'delete-window help-wins)
+ t))
+
+(defun el-search-toggle-quick-help ()
+ "Doc..."
+ (interactive)
+ (setq this-command 'el-search-pattern)
+ (unless (el-search-close-quick-help-maybe)
+ (with-current-buffer (get-buffer-create el-search-quick-help-buffer-name)
+ (erase-buffer)
+ (insert el-search-quick-help)
+ (display-buffer (current-buffer)))))
+
(defun el-search-forward (pattern &optional bound noerror count)
"Search for el-search PATTERN in current buffer from point.
Set point to the beginning of the occurrence found and return point.
@@ -1734,6 +1764,7 @@ in, in order, when called with no arguments."
;;;###autoload
(defun el-search-loop-over-bindings (function)
+ (defvar el-search-basic-transient-map) ;defined later
(cl-flet ((keybind (apply-partially #'funcall function)))
(keybind emacs-lisp-mode-map ?s #'el-search-pattern)
@@ -1763,6 +1794,8 @@ in, in order, when called with no arguments."
(keybind global-map ?l #'el-search-load-path)
(keybind global-map ?b #'el-search-buffers)
+ (keybind el-search-basic-transient-map ?? #'el-search-toggle-quick-help)
+
(defvar dired-mode-map)
(defvar ibuffer-mode-map)
@@ -1798,6 +1831,7 @@ any case."
(define-key transient-map [return] #'el-search-pause-search)
(define-key transient-map (kbd "RET") #'el-search-pause-search)
(define-key transient-map [(control ?g)] #'el-search-keyboard-quit)
+ (define-key transient-map [??] #'el-search-toggle-quick-help)
transient-map))
(defvar el-search-prefix-key-transient-map
@@ -2440,7 +2474,8 @@ local binding of `window-scroll-functions'."
(el-search-hl-remove)
(remove-hook 'post-command-hook 'el-search-hl-post-command-fun t)
(setq el-search--temp-buffer-flag nil)
- (el-search-kill-left-over-search-buffers)))))
+ (el-search-kill-left-over-search-buffers)
+ (el-search-close-quick-help-maybe)))))
(defun el-search--pending-search-p ()
(memq #'el-search-hl-post-command-fun post-command-hook))
- [elpa] branch scratch/mheerdegen-preview created (now 0d07bb8), Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview a006107 02/33: WIP: Add diverse "sloppy" pattern types, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 0107628 04/33: WIP: New package "gnus-article-notes", Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview efe4f41 01/33: WIP: [el-search] Fix nested match issues in *El Occur*, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 3c43b86 08/33: WIP: New command 'el-search-repository', Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview c88c4c1 27/33: WIP: Include leading comments in occur defun context, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 3f656ab 11/33: WIP [el-search] Add quick help command,
Michael Heerdegen <=
- [elpa] scratch/mheerdegen-preview 2d15aa7 22/33: WIP: [el-search] Fine tune separator for splicing replace, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 9cfe823 32/33: WIP: [el-search] Enhance doc of el-search-occur-mode, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview d774bfe 24/33: WIP: Test: Make mouse clicks not abort the search, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 1020ca9 16/33: WIP: Optimize caching, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview fadf6f9 05/33: WIP: New :key arg for "filename" and new pattern types "file" and "dir", Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 1fcb333 03/33: WIP: Add package "sscell", Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 35be4f8 12/33: WIP [el-search] Fix more "redundant _ pattern" cases, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview fa8dbb8 07/33: WIP: New file el-search/el-search-pp.el, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview ffd1bb1 13/33: WIP [el-search] Discourage using symbols as LPATS in `append' and `l', Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview aca1cea 10/33: WIP [el-search] Implement 'el-search-keyboard-quit', Michael Heerdegen, 2018/10/24