[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/mheerdegen-preview f025458 12/35: WIP [el-search] Add qui
From: |
Michael Heerdegen |
Subject: |
[elpa] scratch/mheerdegen-preview f025458 12/35: WIP [el-search] Add quick help command |
Date: |
Mon, 29 Oct 2018 22:24:05 -0400 (EDT) |
branch: scratch/mheerdegen-preview
commit f0254582963e0cd7282c3236353a1f2c792bfef8
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
WIP [el-search] Add quick help command
---
packages/el-search/el-search.el | 46 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 90b8d04..9e55b9a 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
@@ -1180,6 +1189,15 @@ 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 "...More doc to come here...")
+
+(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-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.
@@ -1733,6 +1751,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)
@@ -1797,6 +1816,9 @@ 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 `[,help-char] #'el-search-toggle-quick-help)
+ (define-key transient-map [help] #'el-search-toggle-quick-help)
+ (define-key transient-map [f1] #'el-search-toggle-quick-help)
transient-map))
(defvar el-search-prefix-key-transient-map
@@ -1823,6 +1845,23 @@ any case."
(set-keymap-parent transient-map el-search-basic-transient-map)
transient-map))
+(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)
+ (when el-search-use-prefix-key-transient-map
+ (insert (substitute-command-keys
+ "
+
+The following bindings are available only when a search is active:
+\\{el-search-prefix-key-transient-map}")))
+ (goto-char (point-min))
+ (display-buffer (current-buffer)))))
+
(defun el-search-keep-session-command-p (command)
"Non-nil when COMMAND should not deactivate the current search."
(and
@@ -2439,7 +2478,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 cdfaec4), Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 76163ac 01/35: WIP: [el-search] Fix an infloop, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview ee441a0 03/35: WIP: Add diverse "sloppy" pattern types, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 9805060 02/35: WIP: [el-search] Fix nested match issues in *El Occur*, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 220f349 04/35: WIP: Add package "sscell", Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview bef717d 06/35: WIP: New :key arg for "filename" and new pattern types "file" and "dir", Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview d2faca2 09/35: WIP: New command 'el-search-repository', Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 2f72331 08/35: WIP: New file el-search/el-search-pp.el, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview f2ec15d 13/35: WIP [el-search] Fix more "redundant _ pattern" cases, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview f025458 12/35: WIP [el-search] Add quick help command,
Michael Heerdegen <=
- [elpa] scratch/mheerdegen-preview f23fe5e 17/35: WIP: Optimize caching, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview b4b94b0 11/35: WIP [el-search] Implement 'el-search-keyboard-quit', Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 44715aa 05/35: WIP: New package "gnus-article-notes", Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 5057b57 14/35: WIP [el-search] Discourage using symbols as LPATS in `append' and `l', Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 5e2aea1 20/35: WIP [el-search] Adjust prev/next match commands for search and occur, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 38def8b 25/35: WIP: Test: Make mouse clicks not abort the search, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview feede7d 23/35: WIP: [el-search] Fine tune separator for splicing replace, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 82abecf 16/35: WIP: Additions to "Mb hints", Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview df2132a 21/35: WIP: Improvements for change and changed, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 2ec7a9e 22/35: WIP: More colorful match count, Michael Heerdegen, 2018/10/29