Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
1answer
71 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 ...
1
vote
1answer
30 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-...
0
votes
0answers
43 views

Limitations of latex mode inline math syntax highlighting

My Problems: In latex major mode (not Latex major mode), syntax highlighting works okay for line 1, but not for line 2. line 1 : my hypothesis is $a^2 + b^2 = c^2.$ line 2 : my hypothesis is \(a^2 ...
2
votes
2answers
42 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 ...
1
vote
1answer
22 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 \ (...
0
votes
0answers
23 views

fill style for block comments (lean-mode)

lean-mode (available on MELPA) defines two kinds of comments: -- like this and /- like this -/ I've noticed that when filling long lines, the behavior is sometimes not optimal. E.g., /- xxx ...
1
vote
0answers
33 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 ...
0
votes
1answer
32 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 ...
1
vote
2answers
74 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 ...
1
vote
0answers
47 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 ?...
2
votes
2answers
81 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.
0
votes
1answer
52 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 ...
7
votes
0answers
74 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 ...
1
vote
1answer
69 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 ...
1
vote
2answers
151 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 ...
1
vote
0answers
50 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 (...
1
vote
1answer
64 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 (...
2
votes
1answer
126 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-...
0
votes
1answer
40 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 ...
3
votes
1answer
94 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 ...
0
votes
1answer
97 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 ...
1
vote
0answers
47 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-...
1
vote
1answer
237 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-...
4
votes
1answer
151 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 ...
0
votes
1answer
67 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 ...
2
votes
0answers
44 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 ...
1
vote
1answer
44 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 ...
0
votes
0answers
24 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, ...
8
votes
3answers
1k views

How can I make emacs support javascript ES6 template string literals?

I want to use ES6 template string literals e.g.: `string text line 1 string text line 2 string text ${expression}` However emacs doesn't recognize that their contents are a string, so syntax ...
2
votes
1answer
115 views

Treat shebang as a comment

I am trying to get js-mode to highlight a "shebang" (#!/usr/bin/env node) as a comment, but my code is not working. Instead, the entire buffer is colored like a comment. I've read the documentation ...
2
votes
0answers
43 views

Treating \[…] nicely in Wolfram mode

In the Wolfram language, special characters such as ∂, ∫ and ζ can be displayed nicely in Mathematica and in the source, appear as \[PartialD], \[Integral] and \[Zeta]. In wolfram mode, the special ...
1
vote
1answer
33 views

How to fix coffee mode symbol?

While trying to use highlight-symbol in coffee mode (especially, cjsx), it interprets Something and <Something as two different symbols, while I expect < to be not part of a symbol. Tried to ...
0
votes
1answer
157 views

Changing evil-forward-word behavior by modifying a syntax table

Currently in Emacs Lisp files I have the following behavior when I run evil-forward-word-begin |some-lisp-function some|-lisp-function some-|lisp-function some-lisp|-function some-lisp-|function In ...
1
vote
1answer
588 views

Highlighting YAML comments correctly

See https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg01046.html for more background. YAML defines a comment as a # either preceded by the beginning of the line or whitespace (more ...
1
vote
1answer
141 views

Is there a way to set arbitrary characters as the word boundary?

I know I can do this kind of thing with the sentence boundary, using (setq sentence-end "[regexp]"), but how can I do this with the word boundary? I'd like to add capital letters to the default word ...
4
votes
0answers
48 views

Help with advanced syntax rules

How can I express syntax rules like "[0-9/.:*+!_'?-] are valid symbol constituent, but not as the first char"? Or "/ is a valid symbol constituent, but can only appear once and in the middle of a ...
3
votes
0answers
60 views

Paired string delimiters?

Red and Rebol have multiline strings that start with { and end with }. Reading through Elisp docs I don't see any simple way to define this in the syntax table. The string quotes class matches the ...
3
votes
1answer
207 views

Adding tilde to electric pairs in org mode

I am trying to add the verbatim character ~ (tilde) as an electric-pair character in org-mode. Here is my attempt: (with-eval-after-load 'org (modify-syntax-entry ?/ "(/" org-mode-syntax-table) (...
5
votes
2answers
498 views

How to keep underscores in Python within a word boundary?

When writing code in python-mode my preference would be to include underscores within a word boundary, so variable_with_underscores is treated as a single word. How would I limit my word preference ...
2
votes
2answers
300 views

Why do we have [:word:] but not [:symbol:]?

I'd like to use [[:symbol:]]+ in a regular expression but this does not exist in Emacs, see ad-hoc section in the manual. Q1: what is the rationale behind this? I'm always happy to understand the ...
2
votes
0answers
50 views

Is it possible to detect C/C++/Java variable declarations.?

I'm writing a minor mode to handle automatic spacing of operator characters, but I'm having some trouble with C/C++. The problem is that I can't figure out how to tell in general whether a * is a ...
8
votes
2answers
183 views

What is a string fence or comment fence?

The docstring for modify-syntax-entry says the following: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) ... The first character of NEWENTRY should be one of the following: ... / ...
0
votes
1answer
84 views

remove delimiter and comment typing from [Ljava.lang.String; in clojure-mode

Parsing parentheses: smie vs syntax table gives one example of how to use syntax-propertize-function but I wonder if someone could help me with another example. I'm working with clojure-mode. Here's ...
1
vote
1answer
94 views

Is there a possibility to close the right syntax for another languages?

When I was watching Emacs Rocks, there was a feature showed, called sgml-close-tag. You can see an example here. When called that command, he will close the tag for you if there is a tag missing. I ...
4
votes
1answer
169 views

Change character syntax temporarily?

Q: how can I change the syntax of a character for a single function? In text-mode and its derivatives, the ' character has word syntax rather than, say punctuation or string quote syntax. That's a ...
4
votes
2answers
531 views

Three-characters comment syntax

Emacs supports syntax flags for 1- and 2-characters comment delimiters. Can it be made to recognize and properly highlight 3-characters delimiters? For example: In Emacs Lisp: ;;; Headings In C#...
6
votes
2answers
2k views

How to change comment character from # (hash) to % (percent sign) for Octave major mode

By default, comment-region inserts # for comments in Octave major mode: # foo I want to modify the behavior so that it inserts the percent sign % foo I used the following (setq octave-mode-hook ...
0
votes
1answer
366 views

Word delimiters in standard syntax table

I'm trying to configure other programs to emulate Emacs. I know Emacs' word delimiters are: User configurable Mode dependent But I'd still like to know what the default word boundary characters ...
30
votes
5answers
6k views

How to treat underscore as part of the word?

I use Emacs + evil mode. When I position the cursor on e (in normal state) in a chunk of text such as abc_def_ghi, ciw (change inner word) changes only the def part of the string, while Vim would ...
1
vote
0answers
84 views

How does forward-list work for “<>” in c++-mode?

I am trying to understand how forward-list matches template delimiters <> in c++-mode. forward-list in lisp.el calls scan-lists with the appropriate arguments. The documentation for scan-lists ...