From: Juri Linkov <juri@linkov.net>
To: Evgeni Pandurski <epandurski@gmail.com>
Cc: 60815@debbugs.gnu.org
Subject: bug#60815: 28.2; Hard-coded M-sff key binding in dired-aux.el
Date: Sat, 14 Jan 2023 20:19:57 +0200 [thread overview]
Message-ID: <868ri5yo4y.fsf@mail.linkov.net> (raw)
In-Reply-To: <CA+MLsgPNV7nnHmsVeMUaqhRjp2ReXXYL4ay3RdYUOATepK4LuA@mail.gmail.com> (Evgeni Pandurski's message of "Sat, 14 Jan 2023 18:44:06 +0200")
> I have set "(dired-isearch-filenames t)", and have rebound "M-s" to
> something that is not a keymap (other-window). The problem appears
> when I try to "isearch" in a Dired buffer. Then the following code:
>
> (defun dired-isearch-filenames-end ()
> "Clean up the Dired file name search after terminating isearch."
> (define-key isearch-mode-map "\M-sff" nil)
> (dired-isearch-filenames-mode -1)
> (remove-hook 'isearch-mode-end-hook #'dired-isearch-filenames-end t)
> (unless isearch-suspended
> (kill-local-variable 'dired-isearch-filenames)))
>
> runs and fails, because it can not bind to "M-sff". It works when I
> change "M-sff" to something that starts with a keymap-binding. This is
> also a problem in Emacs 27.
Maybe it should be configurable:
```
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index c390017e190..27ab35c04d2 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -3530,6 +3530,9 @@ dired-isearch-filenames-mode
(setq isearch-success t isearch-adjusted t)
(isearch-update)))
+(defvar dired-isearch-filenames-toggle-key "\M-sff"
+ "Key to toggle `dired-isearch-filenames-setup' in `isearch-mode'.")
+
;;;###autoload
(defun dired-isearch-filenames-setup ()
"Set up isearch to search in Dired file names.
@@ -3537,13 +3540,16 @@ dired-isearch-filenames-setup
(when (or (eq dired-isearch-filenames t)
(and (eq dired-isearch-filenames 'dwim)
(get-text-property (point) 'dired-filename)))
- (define-key isearch-mode-map "\M-sff" 'dired-isearch-filenames-mode)
+ (when dired-isearch-filenames-toggle-key
+ (define-key isearch-mode-map dired-isearch-filenames-toggle-key
+ 'dired-isearch-filenames-mode))
(dired-isearch-filenames-mode 1)
(add-hook 'isearch-mode-end-hook #'dired-isearch-filenames-end nil t)))
(defun dired-isearch-filenames-end ()
"Clean up the Dired file name search after terminating isearch."
- (define-key isearch-mode-map "\M-sff" nil)
+ (when dired-isearch-filenames-toggle-key
+ (define-key isearch-mode-map dired-isearch-filenames-toggle-key nil))
(dired-isearch-filenames-mode -1)
(remove-hook 'isearch-mode-end-hook #'dired-isearch-filenames-end t)
(unless isearch-suspended
```
prev parent reply other threads:[~2023-01-14 18:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-14 16:44 bug#60815: 28.2; Hard-coded M-sff key binding in dired-aux.el Evgeni Pandurski
2023-01-14 18:14 ` Eli Zaretskii
[not found] ` <CA+MLsgOSFS0h45qMpDv3p8WFVpo3oju19uS49RvxfTMAmZRJ5Q@mail.gmail.com>
[not found] ` <CA+MLsgOj1qyYT0xrM9kWfTHuo_qxQ6czhGtUtqoc=GYV9Hwf-g@mail.gmail.com>
2023-01-14 18:52 ` Eli Zaretskii
2023-01-17 17:24 ` Juri Linkov
2023-01-17 18:30 ` Evgeni Pandurski
2023-01-17 18:43 ` Eli Zaretskii
[not found] ` <CA+MLsgMSDroUBLYfkwcDxyf6=jMSZR0NxZExuWSvrg07+uDrHA@mail.gmail.com>
2023-01-17 18:47 ` Juri Linkov
2023-01-17 19:01 ` Evgeni Pandurski
2023-01-17 19:27 ` Juri Linkov
2023-01-17 19:44 ` Evgeni Pandurski
2023-01-14 18:19 ` Juri Linkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=868ri5yo4y.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=60815@debbugs.gnu.org \
--cc=epandurski@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.