veripool / verilog-mode

Verilog-Mode for Emacs with Indentation, Hightlighting and AUTOs. Master repository for pushing to GNU, verilog.com and veripool.org.
http://veripool.org/verilog-mode
GNU General Public License v3.0
247 stars 90 forks source link

Make '_' a symbol character #1737

Closed smithzvk closed 2 years ago

smithzvk commented 2 years ago

Fixes #724 Fixes #277

wsnyder commented 2 years ago

The issues you note I think asked for it to be a word character. It currently is a word character, so those were fixed (for better or worse). Your fix makes it not be a word character, or even a symbol. Also at this point this will change what forward and backward word does, which may confuse many long-time users. Finally, note this breaks the test.

So can you describe the motivation behind this?

smithzvk commented 2 years ago

This is motivated by the desire to restore word navigation in verilog-mode. This also affects all operations that work using word navigation, most notably backward-kill-word, but it likely breaks much more that I haven't been bitten by. When using underscores, you would expect backward-kill-word to delete up to the first underscore either in normal mode or in subword-mode and to delete the entire symbol in superword-mode.

The way I had read those issues was that the designation of ? as a word character was done in order to achieve proper syntax highlighting. I am relatively unfamiliar to these facilities but after some investigation I found how to designate a character as a word character for only the purposes of font-lock, which seemed like just the solution. Rereading the issues it seems that my assumption that designating ? as a word in the syntax table was just used for syntax highlight was incorrect.

I may have also erroneously assumed that ?_ would default to a symbol character if left unspecified. I assumed it would inherit from some default syntax table as fundamental-mode has it designated as such.

I thought I found a quick fix for a longstanding small problem, but it is looking more like I'm just retreading a fruitless path from long ago.

wsnyder commented 2 years ago

I appreciate the efforts/thoughts. The right thing long ago probably would have been for _ to be a symbol but not word character. I guess we need to leave this as-is for code and consistency sake.

smithzvk commented 2 years ago

Is it worth me looking into this further, e.g. updating the parsing to look for symbols rather than words? I'm willing, but I think the critical issue is whether the test suite can be trusted to catch any potential breakage caused. I see that xemacs is supported which I'm not planning to test against.

On Wed, Sep 1, 2021, 06:10 Wilson Snyder @.***> wrote:

I appreciate the efforts/thoughts. The right thing long ago probably would have been for _ to be a symbol but not word character. I guess we need to leave this as-is for code and consistency sake.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/veripool/verilog-mode/pull/1737#issuecomment-910179391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACIUR4W3RNIVFEDD3NPOHLT7YC2PANCNFSM5DDE5TBA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

wsnyder commented 2 years ago

See above - thanks for the offer but think we'll leave it as-is.