unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* A new command to apply changes to lines referenced in compilation buffers
       [not found] <m1a6u67mj0.fsf.ref@yahoo.es>
@ 2020-12-21 23:43 ` Daniel Martín
  2020-12-21 23:59   ` Clément Pit-Claudel
  2020-12-22  3:34   ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Martín @ 2020-12-21 23:43 UTC (permalink / raw)
  To: emacs-devel


Today I thought about the following use case: Imagine a user that is
working in a C codebase and wants to rename some function without using
a TAGS file (or maybe the language is not C and there's no good TAGS
support for it).  One possible way to do that in a more or less reliable
way (ie, without changing unrelated matches in documentation files, for
example) is to simply change the definition and compile the code so that
the compiler will refer to each callsite that needs to be renamed.

Compilation-mode already knows about the location (file and line number,
at least) of each error message, so I wonder if we could add a command
to compilation-mode that performs a search and replace over each error
line in a compilation buffer.  The command would be similar to
xref-query-replace-in-results, which does this for results produced by
TAGS or any other Xref backend.

Before I think more about the design of this command, is there potential
interest in having it in Emacs? Is there something available in Emacs
that already implements this use case in a simple way?

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A new command to apply changes to lines referenced in compilation buffers
  2020-12-21 23:43 ` A new command to apply changes to lines referenced in compilation buffers Daniel Martín
@ 2020-12-21 23:59   ` Clément Pit-Claudel
  2020-12-22  3:34   ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Clément Pit-Claudel @ 2020-12-21 23:59 UTC (permalink / raw)
  To: emacs-devel

On 12/21/20 6:43 PM, Daniel Martín wrote:
> Before I think more about the design of this command, is there potential
> interest in having it in Emacs? Is there something available in Emacs
> that already implements this use case in a simple way?

I tend to use macros for this



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A new command to apply changes to lines referenced in compilation buffers
  2020-12-21 23:43 ` A new command to apply changes to lines referenced in compilation buffers Daniel Martín
  2020-12-21 23:59   ` Clément Pit-Claudel
@ 2020-12-22  3:34   ` Eli Zaretskii
  2020-12-23 11:24     ` Daniel Martín
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-12-22  3:34 UTC (permalink / raw)
  To: Daniel Martín; +Cc: emacs-devel

> From: Daniel Martín <mardani29@yahoo.es>
> Date: Tue, 22 Dec 2020 00:43:47 +0100
> 
> Today I thought about the following use case: Imagine a user that is
> working in a C codebase and wants to rename some function without using
> a TAGS file (or maybe the language is not C and there's no good TAGS
> support for it).

There are very few languages that etags doesn't support.  C definitely
isn't the only language it does support.  Try "etags --help".

And I don't think I understand the rationale for trying not to use
TAGS.  Can you explain why you want to avoid that?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A new command to apply changes to lines referenced in compilation buffers
  2020-12-22  3:34   ` Eli Zaretskii
@ 2020-12-23 11:24     ` Daniel Martín
  2020-12-23 15:57       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Martín @ 2020-12-23 11:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:
>
> And I don't think I understand the rationale for trying not to use
> TAGS.  Can you explain why you want to avoid that?

Nothing against TAGS, the new feature can be an alternative for people
that prefer to perform mass renames using the edit-compile-edit cycle.

Also, M-x compile can be used to run any tool that outputs errors in the
form "file:line_number" (for example, a code style linter).  Having a
way to perform search and replace on those lines could help in some
workflows without the user needing to record a macro or similar
automation.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A new command to apply changes to lines referenced in compilation buffers
  2020-12-23 11:24     ` Daniel Martín
@ 2020-12-23 15:57       ` Eli Zaretskii
  2020-12-23 17:03         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-12-23 15:57 UTC (permalink / raw)
  To: Daniel Martín; +Cc: emacs-devel

> From: Daniel Martín <mardani29@yahoo.es>
> Cc: emacs-devel@gnu.org
> Date: Wed, 23 Dec 2020 12:24:18 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> >
> > And I don't think I understand the rationale for trying not to use
> > TAGS.  Can you explain why you want to avoid that?
> 
> Nothing against TAGS, the new feature can be an alternative for people
> that prefer to perform mass renames using the edit-compile-edit cycle.

Generating TAGS can be part of that cycle.  'etags' is very fast, so
you can run it when and if needed.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A new command to apply changes to lines referenced in compilation buffers
  2020-12-23 15:57       ` Eli Zaretskii
@ 2020-12-23 17:03         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2020-12-23 17:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, Daniel Martín

> Generating TAGS can be part of that cycle.  'etags' is very fast, so
> you can run it when and if needed.

Hmm... while the original message mentioned TAGS, I don't understand
what it has to do with the feature: AFAIK the TAGS file only contains
the places where a given identifier is *defined*, whereas the feature is
mostly intended to be applied to all the places where the identifier is
*used* (typically after changing the definition).


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-23 17:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m1a6u67mj0.fsf.ref@yahoo.es>
2020-12-21 23:43 ` A new command to apply changes to lines referenced in compilation buffers Daniel Martín
2020-12-21 23:59   ` Clément Pit-Claudel
2020-12-22  3:34   ` Eli Zaretskii
2020-12-23 11:24     ` Daniel Martín
2020-12-23 15:57       ` Eli Zaretskii
2020-12-23 17:03         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).