unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
@ 2024-02-27 12:59 Chmouel Boudjnah
  2024-02-27 13:29 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-27 13:33 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Chmouel Boudjnah @ 2024-02-27 12:59 UTC (permalink / raw)
  To: 69426

When using eglot-rename it asks for a new name (for the variable for
example) to rename to, it would be nice if there was a way to have the
current thing-at-point suggested as the new name.

Usually when renaming a variable you want to rename it to something that
is related to the current name with the defautl behavior you have to
type the current name manually.

I have a function like this that does it:

  (defun my-eglot-rename (newname)
    "Rename the current symbol to NEWNAME with initial input a."
    (interactive
     (list (read-from-minibuffer
            (format "Rename`%s' to: " (or (thing-at-point 'symbol t)
                                          "unknown symbol"))
            (or (thing-at-point 'symbol t) "") nil nil nil
            (symbol-name (symbol-at-point)))))
    (eglot--server-capable-or-lose :renameProvider)
    (eglot--apply-workspace-edit
     (jsonrpc-request (eglot--current-server-or-lose)
                      :textDocument/rename
`(,@(eglot--TextDocumentPositionParams)
                                             :newName ,newname))


which probably can work as advice to eglot-rename but it would be nice
if we can have this builtin.





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

* bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
  2024-02-27 12:59 bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming Chmouel Boudjnah
@ 2024-02-27 13:29 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-27 13:32   ` Chmouel Boudjnah
  2024-02-27 13:33 ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-02-27 13:29 UTC (permalink / raw)
  To: Chmouel Boudjnah; +Cc: 69426

Hello Chmouel,

Chmouel Boudjnah <chmouel@chmouel.com> writes:

> When using eglot-rename it asks for a new name (for the variable for
> example) to rename to, it would be nice if there was a way to have the
> current thing-at-point suggested as the new name.

AFAICT, that is more or less already the case: eglot-rename uses the
name of the symbol at point as the minibuffer default value.

> Usually when renaming a variable you want to rename it to something that
> is related to the current name with the defautl behavior you have to
> type the current name manually.

Just hit M-n and it's there :)


Best,

Eshel





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

* bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
  2024-02-27 13:29 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-02-27 13:32   ` Chmouel Boudjnah
  2024-02-27 15:59     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Chmouel Boudjnah @ 2024-02-27 13:32 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: 69426

On Tue, Feb 27, 2024 at 2:29 PM Eshel Yaron <me@eshelyaron.com> wrote:

> > Usually when renaming a variable you want to rename it to something that
> > is related to the current name with the defautl behavior you have to
> > type the current name manually.
>
> Just hit M-n and it's there :)

Thanks Eshel, I always forget about that one! I guess we can close this then!

Cheers,
Chmouel





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

* bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
  2024-02-27 12:59 bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming Chmouel Boudjnah
  2024-02-27 13:29 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-02-27 13:33 ` Eli Zaretskii
  2024-02-27 13:37   ` Chmouel Boudjnah
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-02-27 13:33 UTC (permalink / raw)
  To: Chmouel Boudjnah; +Cc: 69426

> From: Chmouel Boudjnah <chmouel@chmouel.com>
> Date: Tue, 27 Feb 2024 13:59:26 +0100
> 
> When using eglot-rename it asks for a new name (for the variable for
> example) to rename to, it would be nice if there was a way to have the
> current thing-at-point suggested as the new name.
> 
> Usually when renaming a variable you want to rename it to something that
> is related to the current name with the defautl behavior you have to
> type the current name manually.

You don't need to type the current name manually, you can instead
press <DOWN> arrow or M-n, and Emacs will "type" the current name for
you.  So after that you only need to edit the current name to the new
name.  Isn't that what you wanted?





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

* bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
  2024-02-27 13:33 ` Eli Zaretskii
@ 2024-02-27 13:37   ` Chmouel Boudjnah
  0 siblings, 0 replies; 6+ messages in thread
From: Chmouel Boudjnah @ 2024-02-27 13:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69426

On Tue, Feb 27, 2024 at 2:33 PM Eli Zaretskii <eliz@gnu.org> wrote:
> You don't need to type the current name manually, you can instead
> press <DOWN> arrow or M-n, and Emacs will "type" the current name for
> you.  So after that you only need to edit the current name to the new
> name.  Isn't that what you wanted?

Yes that's correct, I forgot this was something minibuffer via
next-history-element offers across emacs, thank you!

Chmouel,





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

* bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
  2024-02-27 13:32   ` Chmouel Boudjnah
@ 2024-02-27 15:59     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-02-27 15:59 UTC (permalink / raw)
  To: Chmouel Boudjnah; +Cc: me, 69426-done

> Cc: 69426@debbugs.gnu.org
> From: Chmouel Boudjnah <chmouel@chmouel.com>
> Date: Tue, 27 Feb 2024 14:32:25 +0100
> 
> On Tue, Feb 27, 2024 at 2:29 PM Eshel Yaron <me@eshelyaron.com> wrote:
> 
> > > Usually when renaming a variable you want to rename it to something that
> > > is related to the current name with the defautl behavior you have to
> > > type the current name manually.
> >
> > Just hit M-n and it's there :)
> 
> Thanks Eshel, I always forget about that one! I guess we can close this then!

Done.





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

end of thread, other threads:[~2024-02-27 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 12:59 bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming Chmouel Boudjnah
2024-02-27 13:29 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-27 13:32   ` Chmouel Boudjnah
2024-02-27 15:59     ` Eli Zaretskii
2024-02-27 13:33 ` Eli Zaretskii
2024-02-27 13:37   ` Chmouel Boudjnah

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).