[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/logview 8e020b9296 244/259: Make it possible to toggle "se
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/logview 8e020b9296 244/259: Make it possible to toggle "search only in messages" directly from isearch. |
Date: |
Fri, 31 Jan 2025 07:02:20 -0500 (EST) |
branch: elpa/logview
commit 8e020b9296b8e1adc810ebc9d36985f64d93dbc2
Author: Paul Pogonyshev <pogonyshev@gmail.com>
Commit: Paul Pogonyshev <pogonyshev@gmail.com>
Make it possible to toggle "search only in messages" directly from isearch.
---
logview.el | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/logview.el b/logview.el
index 8f903e4b41..2cde2f3cfe 100644
--- a/logview.el
+++ b/logview.el
@@ -1248,6 +1248,8 @@ successfully.")
(add-hook 'after-change-functions #'logview--invalidate-region-entries nil t)
(add-hook 'change-major-mode-hook #'logview--exiting-mode nil t)
(add-hook 'pre-command-hook #'logview--pre-command nil t)
+ (add-hook 'isearch-mode-hook #'logview--starting-isearch nil t)
+ (add-hook 'isearch-mode-end-hook #'logview--ending-isearch nil t)
(logview--guess-submode)
(logview--update-invisibility-spec)
(unless (logview-initialized-p)
@@ -2667,7 +2669,8 @@ argument is positive, disable it otherwise."
(interactive (list (or current-prefix-arg 'toggle)))
(logview--toggle-option-locally 'logview-search-only-in-messages arg
(called-interactively-p 'interactive)
"Incremental search will find matches only
in messages"
- "Incremental search will behave normally"))
+ "Incremental search will behave normally")
+ (logview--isearch-update-if-running))
(defun logview-toggle-filter-preview (&optional arg)
"Toggle `logview-preview-filter-changes' just for this buffer.
@@ -2755,7 +2758,12 @@ These are:
(unless (eq new-value (symbol-value variable))
(set (make-local-variable variable) new-value)
(when show-message
- (message (if (symbol-value variable) message-if-true
message-if-false)))
+ (let ((message (if (symbol-value variable) message-if-true
message-if-false)))
+ (if (and isearch-mode
+ ;; Private function, as always. At least don't die if they
rename it.
+ (fboundp 'isearch--momentary-message))
+ (isearch--momentary-message message)
+ (message message))))
t)))
@@ -4186,6 +4194,46 @@ This list is preserved across Emacs session in
(logview--save-views-if-needed))
+
+;;; Advanced integration with isearch.
+
+(defvar logview-isearch-map
+ (let ((map (make-sparse-keymap)))
+ (dolist (binding '(("M-m" logview-toggle-search-only-in-messages)))
+ (define-key map (kbd (car binding)) (cadr binding)))
+ map)
+ "Keymap used when isearching in a Logview buffer.")
+
+(defvar logview--isearch-mode-map-original-parent t)
+
+;; According to own source code of Emacs, this snot-glued hack is the standard
way of
+;; altering isearch behavior, i.e. with hooks. Oh well. A lot of code also
modifies
+;; `isearch-map' bindings directly, but this feels very dirty: e.g. what if
this conflicts
+;; with a user's private binding?
+(defun logview--starting-isearch ()
+ (let ((parent (keymap-parent isearch-mode-map)))
+ ;; Need to make commands findable in `isearch-mode-map' (via its parent),
else isearch
+ ;; will abort on any of our extension commands.
+ (set-keymap-parent isearch-mode-map (if parent
+ (make-composed-keymap
logview-isearch-map parent)
+ logview-isearch-map))
+ (setf logview--isearch-mode-map-original-parent parent)))
+
+(defun logview--ending-isearch ()
+ (unless (eq logview--isearch-mode-map-original-parent t)
+ (set-keymap-parent isearch-mode-map
logview--isearch-mode-map-original-parent)
+ (setf logview--isearch-mode-map-original-parent t)))
+
+(defun logview--isearch-update-if-running ()
+ (when isearch-mode
+ ;; This is what `isearch-define-mode-toggle' does. Let's assume it's
needed.
+ (setf isearch-success t
+ isearch-adjusted 'toggle)
+ ;; Otherwise it won't update lazy highlighting.
+ (setf isearch-lazy-highlight-last-string nil)
+ (isearch-update)))
+
+
;;; Logview Filter Edit mode.
- [nongnu] elpa/logview 7243579358 179/259: Nice, Asciidoctor deprecated some semantically loaded syntax without providing a way to upgrade., (continued)
- [nongnu] elpa/logview 7243579358 179/259: Nice, Asciidoctor deprecated some semantically loaded syntax without providing a way to upgrade., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 58b6c107ee 183/259: Fix a bug where Logview won't recognize entries where the message immediately starts with a linefeed., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 856ebf1aa9 182/259: Post-release version bump, ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 84ccfa8315 181/259: Release Logview 0.16.1, ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 32d8335591 193/259: Post-release version bump., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview d754e657cc 197/259: Experimentally use a GitHub action to install Eldev instead of shell command., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview fb7762b0a9 203/259: Add support for "really special" log entry parts, where format string specifies full regexp for a subpart (only name, thread or "ignored"); issue #48., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview cabaf93f1d 209/259: Post-release version bump., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview d5a71b6540 237/259: Fix certain changes from commit e6d5a0a added to a block where modification of buffer faces was not yet allowed; there were hardly any practical consequences, that's why the error went unnoticed., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 090fd9a581 236/259: Post-release version bump., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 8e020b9296 244/259: Make it possible to toggle "search only in messages" directly from isearch.,
ELPA Syncer <=
- [nongnu] elpa/logview 76bc432af3 256/259: Avoid byte-compilation warning caused by the last commit., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 034c240c81 259/259: Post-release version bump., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 65b1e6cb0b 037/259: Fix the highest level for JUL: it should be "SEVERE", not "ERROR"., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview d96302c36b 093/259: Implement current entry pulsing (brief highlighting) so that it is easier to locate the point and entry bounds., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 5d5fbb25b5 036/259: Replace 'error' with 'user-error' where applicable., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview ece9715615 033/259: Merge pull request #1 from syohex/fix-pcase, ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview a9f97ef241 035/259: Add a TODO file., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 5b517de7ac 009/259: Improve log editing possibilities and simplify submode option customization a bit., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 0694f5c0fb 081/259: Fix several byte-compilation warnings., ELPA Syncer, 2025/01/31
- [nongnu] elpa/logview 4176580a60 090/259: Require Emacs 24 at least because of `add-face-text-property' and `filter-buffer-substring-function'; use a different PPA for Emacs 24 testing., ELPA Syncer, 2025/01/31