emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : Re: Adding refactoring capabilities to Emacs


From: Stefan Kangas
Subject: Re: [External] : Re: Adding refactoring capabilities to Emacs
Date: Sun, 1 Oct 2023 05:07:54 -0700

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> > We should "merge" `C-x C-q` and `e`, indeed, like we do for Dired.
>>> Yes, and isn't a buffer-local value for read-only-mode-hook the
>>> suitable way to fix that?
>
> I must admit I haven't looked at what the implementation
> would/should/could look like.
>
>> For context, I'm asking because I don't think rebinding `C-x C-q`
>> to a different command (like in the case of Dired) is as good
>> as using the existing hook.  It should be much more consistent
>> to use the standard facilities of the existing minor mode.
>
> In general, I agree.  There are degrees, tho.
> E.g. Dired doesn't touch `C-x C-q`, strictly speaking, instead it remaps
> `read-only-mode` which is much cleaner already.

Agreed.  But until someone cleans that up, perhaps we're already making
progress if we install this simple change?

diff --git a/lisp/replace.el b/lisp/replace.el
index 6b06e48c384..b40843da141 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1315,6 +1315,7 @@ occur-mode-map
     (define-key map "r" 'occur-rename-buffer)
     (define-key map "c" 'clone-buffer)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
+    (define-key map [remap read-only-mode] #'occur-edit-mode)
     (bindings--define-key map [menu-bar occur] (cons "Occur" occur-menu-map))
     map)
   "Keymap for `occur-mode'.")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]