GNU bug report logs - #77326
[PATCH] Add symbol-mode

Previous Next

Package: emacs;

Reported by: Gabriel Santos <gabriel.santos.smtp <at> gmail.com>

Date: Fri, 28 Mar 2025 04:42:02 UTC

Severity: normal

Tags: patch

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gabriel Santos <gabrielsantosdesouza <at> disroot.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gabriel.santos.smtp <at> gmail.com, 77326 <at> debbugs.gnu.org, stefankangas <at> gmail.com, acorallo <at> gnu.org, monnier <at> iro.umontreal.ca, shipmints <at> gmail.com
Subject: bug#77326: [PATCH] Add symbol-mode
Date: Sun, 13 Apr 2025 07:12:31 -0300
>So what do you suggest we do with this issue?  Are you still offering
>this mode for addition to Emacs?

Since superword-mode already does what this mode does, I think the mode
should be dropped.

Sorry about this, I just had subword-mode in mind instead so I didn't
look into it-despite them residing in the same file.

What I'm doing right now (the convention cycling function Ship
Mints mentioned) is only loosely related to this, so I don't
think this issue should remain open for that. Again, sorry
for wasting your maintainer time on discussing something
that is already built-in in Emacs.

If you want to read up on my progress with the convention
function, the below paragraphs are just on that.

I'm using kebab-case and PascalCase as tests. I managed to get
it working for the symbol at point and the region, but the logic
is inside a single function, so it's in
need of
some refactoring.

I also need to think of how to get the cycling working, but I
had another idea: a 
(major-mode . convention-function) alist to define the preferred
convention of a language, falling back to the function preferred
by the user if the mode doesn't have one. But seeing the changes that will be done to
eglot-server-programs, namely, to make it a "mode-local" variable,
maybe that doesn't seem like the correct approach.

There's also the integration with tree-sitter that Ship
Mints mentioned. Tree-sitter could be used in multiple applications
here. Maybe, instead of relying on the "symbol" regexp, the
mode's definition of an identifier would be used, if it were
to be found in the grammar? Or, perhaps, a tree-sitter-"conventionalize"
function that changes the convention of every identifier in the
buffer? I don't think the latter should exist before a
tree-sitter-rename does, in the likes of eglot-rename.

Other conventions, viz. pascalCase, SCREAMING_SNAKE_CASE
(I got the name from the Rust book, really like this one) would
require different logic, but shouldn't be difficult to implement.

And I think that was it on the convention function, so I'm signing this message off.

Regards,

-- 
Gabriel Santos




This bug report was last modified 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.