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
253 stars 90 forks source link

Feature request: Allow user to break movement on '_' symbols #1283

Open veripoolbot opened 6 years ago

veripoolbot commented 6 years ago

Author Name: Rupert Swarbrick (@rswarbrick) Original Redmine Issue: 1283 from https://www.veripool.org


The default behaviour of verilog-mode is that '_' is a word constituent (syntax class 'w'). This means that M-f and M-b jump over entire symbols, so hitting M-f when point is at the start of "my_long_symbol_name" jumps to the end.

It would be nice to make this configurable. I thought that I could do this without any hacking on the internals of verilog-mode with this snippet in my .emacs:

(defun rjs/verilog-mode-hook ()
  (set-syntax-table
    (let ((table (make-syntax-table verilog-mode-syntax-table)))
      (modify-syntax-entry ?_ "_" table)
      table)))

(add-hook 'verilog-mode-hook #'rjs/verilog-mode-hook)

This kind of works, but now the font locking gets a little weird if you have a variable like "get_a_from_b" because "from" gets highlighted as a keyword.

To fix this, please could you change the regexps for defining verilog-font-lock-keywords to use \< and \_> instead of \< and \>? This is lines starting at verilog-mode.el:3246 in the checkout I have. I think this will have no effect if the user has "" as a word constituent, but it fixes font locking if "_" is given the syntax of a symbol (which is more compatible with how other emacs major modes work).

Many thanks,

Rupert

veripoolbot commented 6 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2018-03-07T01:01:33Z


I agree this doesn't work, however it's more pervasive, for example many places the AUTOs assume _ has it's present syntax. Unfortunately I don't presently have time to work on this, if you want to contribute a patch that audits all occurrences, makes all the relevant changes and passes the current test, it would be welcome.

veripoolbot commented 6 years ago

Original Redmine Comment Author Name: Rupert Swarbrick (@rswarbrick) Original Date: 2018-03-08T07:32:04Z


Ok, I can do that. Do I need FSF papers on file? (I have from my past employer, but have actually moved jobs since then).

veripoolbot commented 6 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2018-03-08T14:25:15Z


As long as the edits are small and I commit them you are fine. If you start making major contributions (which would be great!) you should update the GNU forms. Thanks.