8

Each major mode has its own syntax and syntax table. If you just put (modify-syntax-entry ?_ "w") in your init file, it gets evaluated in the buffer that is current when your init file is loaded -- not in a C/C++ buffer. To evaluate that sexp when in a C/C++ buffer you can put it in a function, which you add to the mode hook. For example (untested): (add-...


3

Rather than modifying the syntax tables, you can instead use the built-in superword-mode: Superword mode is a buffer-local minor mode. Enabling it changes the definition of words such that symbols characters are treated as parts of words: e.g., in ‘superword-mode’, "this_is_a_symbol" counts as one word. You can enable it per mode using a a hook: (...


3

I do not know a shortcut for identifier regexps. Maybe, that is due to the complicated rules that exist for identifiers of some languages. Nevertheless you can define your own format strings and convert them by format-spec to regexps with identifiers. The following lisp code defines a function my-re for transforming extended regular expressions with %i as ...


1

Stefan beat me with his answer. Nevertheless, I have got a basis for you where you can start with: (defconst tecplot-macro-mode-syntax-table (let ((table (make-syntax-table))) ;; ' is a string delimiter (modify-syntax-entry ?' "\"" table) ;; " is a string delimiter too (modify-syntax-entry ?\" "\"" table) ;; |...| delimits variable ...


1

Use ?\# instead of ?#. This won't be needed for ! nor $ because these chars happen not be special for Elisp, whereas # is special (e.g. it is used for hexadecimal numbers like #xFF), but you can also use ?\! and it won't hurt. BTW, if |...| is a string, you can use "\"" rather than "|" as its syntax (BTW, there's a copy&paste error in your comment ...


1

You can create a new syntax table, then run the command in a with-syntax-table block: This is an example of delete forward/backward word, with a modified syntax table. (defun kill-word-sans-delimiter-impl (arg) (let ((table (make-syntax-table))) (dolist (ch (list ?- ?_)) (modify-syntax-entry ch "_" table)) (with-syntax-table table (kill-...


1

Just use forward-sexp instead (bound to C-M-f). Likewise, backward-sexp (C-M-b). See (elisp) List Motion. If you don't want to do that then you'll need to change the syntax for character * in your buffer to be word syntax: (modify-syntax-entry ?* "w") Or for a given syntax table, my-table: (modify-syntax-entry ?* "w" my-table)


1

The problem has been reported as #99 and already fixed in master of mmm-mode, but since there is no new release, you have to install the newest mmm-mode manually, or add the missing setting to mmm-save-local-variables -- for example with use-package: (use-package vue-mode :mode "\\.vue$" :config (add-to-list 'mmm-save-local-variables '(syntax-ppss-...


1

You need to say that this command is a navigation command, by replacing your (interactive) with (interactive "^") C-h o interactive RET explains that: [...] If the string begins with ^ and shift-select-mode is non-nil, Emacs first calls the function handle-shift-selection. [...]


1

In the above code, "_ " does exactly the same as "_". The second char in that string holds the matching "paren-like char" when the first char is ( or ) but for symbol constituents it's unused. The subsequent chars can contain any combination of the characters 1234bcnp which are used for comment delimiters and to mark the char as a possible "prefix" but ...


Only top voted, non community-wiki answers of a minimum length are eligible