Subject: bug#70820: [PATCH] Editable grep buffers

From: Eli Zaretskii <[email-masked]>
Date: Sat, 18 May 2024 12:28:24 +0300

> From: Visuwesh <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 12 May 2024 10:15:33 +0530
> 
> [வியாழன் மே 09, 2024] Visuwesh wrote:
> 
> >>> > I don't think I understand this difficulty, either: with
> >>> > occur-edit-mode it is solved by making occur-edit-mode be derived from
> >>> > occur-mode.  Couldn't you do the same with your mode?
> >>> 
> >>> No because occur-mode makes occur-revert-arguments permanent-local so
> >>> `g' survives the major-mode changes.
> >>> 
> >>> For revert-buffer alone, compilation-arguments needs to be marked
> >>> permanent-local.  As it is a part of compile.el, I am not sure if
> >>> marking it as such is safe.  This is why I think having a minor-mode is
> >>> better.
> >>
> >> It sounds like a minor issue which shouldn't have such grave
> >> consequences.  Why do you think making compilation-arguments
> >> permanent-local would be a problem?  We could ask people who
> >> frequently contribute to compile.e land grep.el if they see any
> >> problem with doing that.
> >
> > It feels like a potential far-fetching change.  But in any case, I will
> > give a shot at recreating the required markers, etc. for
> > occur-after-change-function to work.  Will send a patch once I have a
> > working prototype.
> 
> OK, please find attached patch.  I am still not using a major-mode
> because of the change-major-mode-hook in compilation-setup:
> 
>     (add-hook 'change-major-mode-hook #'compilation--remove-properties nil t)
> 
> that strips off all the text-properties.  And there seem to be too many
> important local variables that is set up by both grep.el and compile.el
> so I think it is easier to use a minor-mode here.

Any reason not to modify compilation--remove-properties not to remove
all the text properties in this particular case?  AFAIU,
change-major-mode-hook is run by kill-all-local-variables, which the
major mode should call, so just before that you could remove
compilation--remove-properties from change-major-mode-hook, and that
would disable this face removal, no?

(I must admit that unconditionally removing the faces is not very
friendly on the part of compilation-mode.  Stefan, are there better
ways of doing that, perhaps?)