Questions tagged [syntax-table]

is an Emacs Lisp data structure in which each character's syntactic role is defined. Other Emacs facilities, such as font lock, navigation, parsing, etc., scan these syntax tables to determine where words, symbols, and other syntactic constructs begin and end. Syntax tables are unique to every major mode. They are customizable and even overridable with text properties.

Filter by
Sorted by
Tagged with
1 vote
1 answer
34 views

Can replace-regexp-lax-whitespace manage "~" as a whitespace?

I have this function: (defvar biblio-publishers-info-list '(("Cambridge University Press" . "Cambridge, U.K.")) "DOCSTRING") (defun biblio-publishers-info-complete ()...
user avatar
0 votes
0 answers
23 views

Syntax classes in character alternative regex group

I want to build a regex to match a group of characters which belong either to word (\sw) or to symbol (\s_) syntax groups. Is it possible to use syntax classes in the character alternative group regex ...
user avatar
  • 249
1 vote
1 answer
38 views

After setting syntax-propertize-function, comment is not being fontified with comment face

I'm trying to build a major mode for xwiki, where I'm defining {{{ verbatim }}} as a comment. So far, I've done (eval-when-compile (defconst xwiki-syntax-propertize-rules (syntax-...
user avatar
0 votes
0 answers
14 views

What could prevent put-text-property to succeed in setting a syntax-table text property?

Sorry for the long description before the actual question at the end (and in the title). I need to provide context details... I am trying to use syntax-propertize-rules to enhance the syntax support ...
user avatar
  • 621
0 votes
0 answers
15 views

Extend list syntax in scheme-mode

The standard scheme-mode allows lists to be written with curved brackets () and box brackets []. Is it even possible to use curly brackets {} although the Scheme standard does not allow this. Is it ...
user avatar
  • 1,154
2 votes
0 answers
14 views

Make a set of characters act as open/close syntax?

Is there a way to make a set of characters act syntactically as open/close brackets? For example, {a> as an opening bracket, and <a} as a closing bracket? I know how to do this with single ...
user avatar
5 votes
1 answer
80 views

How to use a particular syntax table with arbitrary functions?

I have an Elisp function which takes a string and performs capitalization (capitalize) on it, and then inserts it into a file. Apparently capitalize doesn't consider the single quote as a "word ...
user avatar
  • 93
3 votes
1 answer
175 views

How do I hook fundamental-mode and all modes derived from it for modifying syntax for underscores

Here is the definition of fundamental-mode: (defun fundamental-mode () "Major mode not specialized for anything in particular. Other major modes are defined by comparison with this one." ...
user avatar
  • 269
1 vote
1 answer
109 views

Tex indentation with TAB

Recently, when editing files in LaTex, upon pressing TAB, I get a huge indentation. Instead, the default behavior used to be to align with respect to previous environment definition. : I start with ...
user avatar
  • 131
0 votes
1 answer
73 views

Treat hyphens as part of a word?

I use: (global-superword-mode t) in my init.el because I don't want Emacs to treat _ as a word delimiter. How do I do the same thing for -? I'd like to enable this globally.
user avatar
1 vote
1 answer
51 views

Making Emacs see ♥ as punctuation

I'm trying to get emacs to understand ♥ as punctuation. (modify-syntax-entry ?♥ "." text-mode-syntax-table) I'm not sure what the issue is. (That is a unicode heart.) (modify-syntax-entry ?\...
user avatar
  • 185
2 votes
0 answers
20 views

Evil text objects on kebab-case behave differently on dw and cw

I would like my evil text objects to work on kebab-case words, so that dw or cw act on the "whole-kebab-word" and not just on "whole". Therefor I have put (modify-syntax-entry ?- "w" clojure-mode-...
user avatar
  • 242
2 votes
2 answers
146 views

How to use underscores as word boundary for moving cursor?

Python mode annoyingly sets underscore (_) to be part of a word, making editing very tedious. How can one reset this to Emacs's original behaviour?
user avatar
  • 21
7 votes
2 answers
876 views

How to 'modify-syntax-entry' for a major mode?

Following this answer, when I type (modify-syntax-entry ?_ "w") and do M-x eval-region, it has the effect I'm looking for, albeit only for that buffer. I've put (modify-syntax-entry ?_ "w") in my ....
user avatar
0 votes
2 answers
94 views

How do I get Emacs to accept a # (hash) sign as a comment starter in a new mode?

I am attempting to develop an Emacs major mode for writing Tecplot macros. The Tecplot macro language has lots of peculiar constructs, such as a # sign for comments and $! for the beginning of a macro ...
user avatar
3 votes
1 answer
101 views

What are the downsides of changing the syntax class of quotes in text-mode and backslash in AUCTeX?

It bothered me that sexp navigation commands didn't treat a quoted string as a single expression in text-mode. This is because the quote character " is in the punctuation syntax class in the text-mode ...
user avatar
  • 4,612
1 vote
1 answer
40 views

How to run a command with 'modify-syntax-entry' reset?

I have used modify-syntax-entry to remove underscores from being delimiting characters. e.g: (modify-syntax-entry ?_ "w") However I would like to temporary allow underscores to be used as a ...
user avatar
  • 7,179
1 vote
1 answer
73 views

forward-word and non-letter "words"

Using forward-word with this line: foo *** *** bar, I want to have the folowing behavior: foo| ***| ***| bar|, Not: foo| *** *** bar|, So, if between spaces there are only non-letter symbols, ...
user avatar
  • 21
0 votes
1 answer
134 views

font-lock keywords and syntax-table mutually interfering

I would like to define something that font-locks a bit like a new sort of string-literal/comment. I might write: (font-lock-add-keywords 'emacs-lisp-mode (list '("<<.*>>" 0 'my-custom-...
user avatar
3 votes
1 answer
314 views

Simplest Pattern for matching Identifiers in complex Regular Expressions?

I frequently need a regular expression, that approximately matches identifiers in a given environment. Ignoring the "must not start with a number" requirement, this would mean e.g. [[:alnum:]_]+ ...
user avatar
  • 1,481
0 votes
1 answer
678 views

Syntax/indentation problems with Vue mode in Emacs 27 nightly

I'm using vue-mode, based on mmm-mode with Emacs 27 nightly from 10/10/2019. Since that Emacs update, I don't get any indentation support in the script section of a Vue file. Try this file with emacs -...
user avatar
  • 406
0 votes
1 answer
58 views

How can I fix shift-select-mode with own syntax-table

So I have modified syntax table for moving with C-<left>. (defvar my-wacky-syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?\( "w" table) (modify-...
user avatar
  • 308
1 vote
0 answers
50 views

Test if I am inside a paired delimiter

I have been having a problem where I want an up-sexp command that treats paired delimiters like $ in LaTeX-mode just as if they were pairs of balanced parentheses. There are hacks I can use that get ...
user avatar
  • 778
2 votes
1 answer
42 views

What do the spaces in the NEWENTRY parameter to modify-syntax-entry mean?

I am looking to set up a syntax table for a major mode, and many of the examples, such as lisp-mode-syntax-table have entries like the following: (modify-syntax-entry ?\[ "_ " table) My question ...
user avatar
2 votes
1 answer
199 views

How to set backslash character "\" to be a word constituent in LaTeX-mode syntax tables

In LaTeX-mode (AUCTeX) buffers, the backslash "\" is treated as an escape character. I'd like it to be treated as word constituent (syntax class "w") instead, but only in LaTeX-mode buffers. The main ...
user avatar
  • 183
1 vote
1 answer
94 views

`eval-after-load` gets executed, but syntax-table is missing [duplicate]

In the course of using Emacs I got a dozen of lines that simply make underscore part of a word, and most of them upon byte-compilation are causing warnings like reference to free variable ‘php-mode-...
user avatar
  • 483
2 votes
2 answers
77 views

syntax table malfunction

my-test.el contains the following: (defun test01 () "scan for end of entry, trapping error." (interactive) (condition-case nil (setq my-pt (scan-lists (point) 1 0)) (error ...
user avatar
  • 309
1 vote
1 answer
29 views

TeX Mode : making backward-word behaviour take into account Backslashes (\)

In TeX Mode, backward-word (M-b) stops when it encounters a backslash character (\). For example, when the cursor point is after a \begin and I type M-b, the cursor point ends up between the \ (...
user avatar
  • 121
3 votes
1 answer
95 views

Move point to just before end of a comment

Given that the point is right in front of a comment, how do I move it to the end of the comment, but before the comment end markers? For example: for a C++ // xxx comment, I would like to move the ...
user avatar
  • 5,775
1 vote
1 answer
74 views

extend/customize Makefile syntax table

I work with a Makefile-like infrastructure that allows having lists as variables and appending values to them. For this, the += operator is used. However, I'm having incorrect highlighting using this ...
user avatar
1 vote
2 answers
173 views

how to make emacs think semicolon and brackets are words?

i've came on emacs from Sublime Text, and there ;[]{}()., etc are counts as word, and when you move in your document with Ctrl+Arrow you never skip these characters. I want make emacs recognize all ...
user avatar
1 vote
0 answers
71 views

how to treat underscore as part of word in auctex? [duplicate]

I'm using auctex, and trying to make underscores count as part of a word. There are numerous answers to this question, and I've tried the following (modify-syntax-entry ?_ "w") (modify-syntax-entry ?...
user avatar
  • 153
2 votes
2 answers
281 views

Make `thing-at-point` treat dot as a symbol-constituent character?

Is there a way to tweak thing-at-point symbol regexp, so that it ignore dots as separators? Right now foo.bar in my Emacs is recognized as two different symbols, where I wish it was one.
user avatar
  • 1,151
2 votes
1 answer
188 views

How can I make syntax-propertize skip part of the buffer?

In SPARQL, comments starts with a # and follows to the end of the line. The problem is that URI's, which is a big part of SPARQL, can also contain #, but then they are not the start of a comment. Like ...
user avatar
  • 131
7 votes
0 answers
101 views

What was syntax-begin-function obsoleted in favour of?

Since Emacs 25.1, syntax-begin-function is obsolete: syntax-begin-function is a variable defined in ‘syntax.el’. Its value is nil This variable is obsolete since 25.1. This variable may be risky ...
user avatar
1 vote
1 answer
98 views

Complex comment-start (and end) sequence

As far as I understand there is syntax flags only for comment delimiters made up of two characters but if I have comment delimiters of length greater than two characters is it possible to change ...
user avatar
  • 171
2 votes
2 answers
335 views

Rx: Skip commented out lines

I'm trying to make an expression that would match the text foo if it's not on a commented out line. ;; foo ; <= not this bar ; <= not this foo ; <= this Now rx.el can exclude ...
user avatar
  • 821
1 vote
0 answers
77 views

How can I activate my syntax-table?

I'm using SampleMode and the ModeTutorial to create my own mode. I have a problem with the syntax table. As I understand, // and # start one-line comments like this: (defvar my-mode-syntax-table (...
user avatar
  • 461
1 vote
1 answer
168 views

How to know what chars are "word constituents" in latex-mode-syntax-table

In some of my query-replecements I need to have only alphabetic characters as word constituents in a local defined syntax-table. My approach is this: (with-syntax-table (let ((my-syntax-table (make-...
user avatar
2 votes
1 answer
277 views

modify syntax entry globally?

I'd like to treat underscores (_) as word characters everywhere (prog-mode, text, comments, etc.). I'm currently doing so in specific modes, like this: (add-hook ruby-mode-hook #'ivan-treat-...
user avatar
  • 1,764
0 votes
1 answer
56 views

How come newline does not match [[:space:]] in tex-mode and bibtex-mode?

I was debugging some of my elisp code and realized that, in a tex-mode buffer, the newline character at end of line did not match [[:space:]]. In most other textmodes or progmodes, ie, the few I ...
user avatar
  • 1,085
2 votes
1 answer
166 views

specifying a syntax-table for use with TAGS file for etags

It would be convenient if I could arrange for visit-tags-table to open the TAGS file automatically with the correct syntax table for the language of the files being indexed in it. That way regular ...
user avatar
1 vote
1 answer
220 views

Get thing-at-point to include periods

I'm using avy to select and insert symbols on screen with the help of thing-at-point. Is there an obvious way to get this to include periods? At the moment if I select self.blah I get just self (or ...
user avatar
  • 537
1 vote
0 answers
57 views

Setting syntax table leads to high CPU load

I want to set - as a word character for all reStructuredText files. In order to do this, I acted according to the wiki and added the following to my .emacs file: (require 'misc) (defvar my-...
user avatar
2 votes
1 answer
395 views

add a rule to syntax-propertize-rules

I have an issue outlined here that I was able to find a partial solution for. The problem involved changing perl-modes syntax table. One of the commenters pointed me to the function syntax-propertize-...
user avatar
3 votes
1 answer
238 views

modify syntax table for strings in perl modes

My company uses a version of Perl where you can define by binary number using something like my $var = 'b010110110; etc. Problem is both perl-mode and cperl-mode interpret ' as the start of the string ...
user avatar
0 votes
1 answer
104 views

Locally modify the syntax-table via text-properties

I’m trying to make a particular exclamation point behave like a word constituent (from the point of view of the syntax table), using the syntax-table text property, but I can’t get it to work. In an ...
user avatar
2 votes
0 answers
65 views

Emacs Syntax Table Modifications [closed]

I am looking to write my own major mode. The programming language that I need to write it for has //... and /* ... */ style comments. I am having a very hard time getting the syntax tables working ...
user avatar
  • 21
1 vote
1 answer
57 views

how to change C-mode syntax so that the token @' is ignored?

I edit some files that are mostly C code but include a few special extension tokens. The tokens that give c-mode a problem are @' and @". I essentially want c-mode to ignore these two bigrams. The ...
user avatar
0 votes
0 answers
33 views

Can't define a glyph as a word constituent

I'd like Emacs to treat this dollar$sign as one word. So I evaluated this line (modify-syntax-entry ?$ "w") to have Emacs treat dollar sign as a word constituent rather than a symbol. However, ...
user avatar
  • 1,517