aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul W. Rankin <pwr@skeletons.cc>2020-12-12 18:25:11 +1000
committerPaul W. Rankin <pwr@skeletons.cc>2020-12-12 18:25:11 +1000
commit95db829bd12be11d263950316227e55a3d7ec784 (patch)
treec4d46365298cd06b681b6add9b21feafe0961b23
parentbc63f9fdfe10fcf799abab3f8d8deb38c51e9f80 (diff)
downloadbinder-95db829bd12be11d263950316227e55a3d7ec784.zip
Add binder-sidebar-clear-filters command
Added to binder-sidebar-help. Remove clear-filters arg from binder-sidebar-refresh and update docstrings, tutoriall, README/Commentary.
-rw-r--r--NEWS2
-rw-r--r--README.md2
-rw-r--r--binder-tutorial.el3
-rw-r--r--binder.el28
4 files changed, 21 insertions, 14 deletions
diff --git a/NEWS b/NEWS
index b29126e..3c0667d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
* current
+- Add binder-sidebar-clear-filters (|) and remove clear-filters arg from
+ binder-sidebar-refresh
- Set project file to use lisp-data-mode
- Revert change of sidebar selection face
- Use a single-line prompt when switching project directory
diff --git a/README.md b/README.md
index 103cd75..dca3873 100644
--- a/README.md
+++ b/README.md
@@ -147,7 +147,7 @@ tag with `binder-sidebar-narrow-by-tag (/)` and/or only show items
without a certain tag with `binder-sidebar-exclude-by-tag (\)`. Each of
these commands can be called multiple times with additional tags.
-Reset the sidebar filters with `binder-sidebar-refresh (g)`.
+Clear the sidebar filters with `binder-sidebar-clear-filters (|)`.
Marking
diff --git a/binder-tutorial.el b/binder-tutorial.el
index 3043f68..6697222 100644
--- a/binder-tutorial.el
+++ b/binder-tutorial.el
@@ -164,8 +164,7 @@ project files you want to work with in the sidebar.
When the sidebar items are filtered, navigating backward/forward only
considers those items.
-Type g to clear the tag filters and refresh the sidebar, then C-c ] to
-go to the next file.")
+Type | to clear the sidebar filters, then C-c ] to go to the next file.")
(cons "concat.txt" "\
Notice that the tutorial items for navigating, sidebar and marking are
marked with an x? These items are included when you concatenate the
diff --git a/binder.el b/binder.el
index 29016cf..eb45643 100644
--- a/binder.el
+++ b/binder.el
@@ -175,7 +175,7 @@
;; without a certain tag with binder-sidebar-exclude-by-tag (\). Each of
;; these commands can be called multiple times with additional tags.
-;; Reset the sidebar filters with binder-sidebar-refresh (g).
+;; Clear the sidebar filters with binder-sidebar-clear-filters (|).
;; Marking
@@ -876,11 +876,9 @@ Used by `binder-sidebar-shrink-window' and `binder-sidebar-enlarge-window'."
(list :propertize (abbreviate-file-name binder-project-directory)
'face 'bold)))
-(defun binder-sidebar-refresh (&optional clear-filter)
- "Redraw binder sidebar, reading from cache.
-When called interactively (or with optional CLEAR-FILTER) clear
-filter by tags."
- (interactive "p")
+(defun binder-sidebar-refresh ()
+ "Redraw binder sidebar, reading from cache."
+ (interactive)
(with-silent-modifications
(setq default-directory binder-project-directory)
;;
@@ -891,8 +889,6 @@ filter by tags."
;;
;; (hack-local-variables)
(binder-sidebar-format-header-line)
- (when clear-filter (setq binder-narrow-tags nil
- binder-exclude-tags nil))
(let ((x (point)))
(erase-buffer)
(mapc
@@ -1239,6 +1235,14 @@ To reset filtering call `binder-sidebar-refresh' (\\[binder-sidebar-refresh])."
(push tag binder-exclude-tags)
(binder-sidebar-refresh)))
+(defun binder-sidebar-clear-filters ()
+ "Clear all sidebar tag filters."
+ (interactive)
+ (setq binder-narrow-tags nil
+ binder-exclude-tags nil)
+ (binder-sidebar-refresh)
+ (message "Sidebar filters cleared"))
+
(defun binder-highlight-in-sidebar ()
"Highlight the current file in sidebar.
@@ -1267,11 +1271,12 @@ Calls `enlarge-window-horizontally' with `binder-sidebar-resize-window-step'."
(declare (interactive-only t))
(interactive
(list (read-char-choice "\
-? = describe-mode, g = refresh (clear filters), q = quit-window, C-g = cancel: "
- '(?? ?g ?q))))
+? = describe-mode, g = refresh, | = clear filters, q = quit-window, C-g = cancel: "
+ '(?? ?g ?| ?q))))
(cl-case char
(?q (quit-window))
- (?g (binder-sidebar-refresh t))
+ (?g (binder-sidebar-refresh))
+ (?| (binder-sidebar-clear-filters))
(?? (describe-mode))))
(defun binder-reveal-in-sidebar ()
@@ -1308,6 +1313,7 @@ Unconditionally activates `binder-mode'."
(define-key map (kbd "{") #'binder-sidebar-shrink-window)
(define-key map (kbd "}") #'binder-sidebar-enlarge-window)
(define-key map (kbd "g") #'binder-sidebar-refresh)
+ (define-key map (kbd "|") #'binder-sidebar-clear-filters)
(define-key map (kbd "j") #'binder-sidebar-jump-to-current)
(define-key map (kbd "C") #'binder-sidebar-change-directory)
(define-key map (kbd "n") #'next-line)