Skip to main content

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
0 votes
2 answers
47 views

When writing utilities that operate on "strings", the syntax-table can be used along with the parse state (syntax-ppss), however some major modes (such as text-mode) won't treat quoted text ...
ideasman42's user avatar
  • 9,513
2 votes
3 answers
140 views

I have a keyboard layout that has keys that insert characters such as ∀, which I would like to define abbrevs for, but I can't. I tracked down the cause and it is that character ∀ is not recognized by ...
Alexander Praehauser's user avatar
1 vote
1 answer
80 views

The elisp manual info node 35.3.1.3 Backslash Constructs in Regular Expressions says that ‘\<’ matches the empty string, but only at the beginning of a word.... ‘\>’ matches the empty ...
Mike Shulman's user avatar
1 vote
1 answer
53 views

I have the following text in a (fundamental-mode) buffer: helloαworld and forward-word stops both before and after the alpha: |helloαworld hello|αworld helloα|world helloαworld| However, when I do C-...
Mike Shulman's user avatar
1 vote
0 answers
29 views

Say we open a scratch buffer with the following contents: abc_xyz# abc xyz# We run (modify-syntax-entry ?_ " ") (modify-category-entry ?_ ?r nil t) Now (describe-syntax) shows _ ...
Post Self's user avatar
  • 163
1 vote
2 answers
79 views

$ emacs file.html We have one long line, with no ASCII whitespace to break on. Before: weeklyOSM 的想法是蒐集來自世界各地,與 OSM 相關的新聞,處理這些新聞並將其翻譯成盡可能多種語言。這應該有助於讓社群知道所有消息並克服語言障礙。 Do M-q (fill-paragraph), getting:...
Dan Jacobson's user avatar
1 vote
0 answers
37 views

I'm using a lot of bra-ket-like notation in LaTeX-mode, meaning things like ⟨f|, so I put (modify-syntax-entry ?\⟨ "(|" LaTeX-mode-syntax-table) (modify-syntax-entry ?\⟩ ")|" LaTeX-...
Alexander Praehauser's user avatar
0 votes
1 answer
55 views

I am trying to define another comment style, similar to what we can do with modify-syntax-entry: (modify-syntax-entry ?/ ". 124b") (modify-syntax-entry ?* ". 23") (modify-syntax-...
Jake Ireland's user avatar
0 votes
1 answer
49 views

The special file format of my software uses angle brackets as a delimiter and # / # as comment markers (note the whitespace after the first # and before the last #). I try to make a major mode to ...
Lalylulelo's user avatar
0 votes
1 answer
115 views

I ran into this behavior by accident and it seems quite unusual to me. Why do Emacs Lisp regular expressions match the percentage and dollar sign as word characters? One theory I had was that this is ...
fap's user avatar
  • 161
0 votes
0 answers
103 views

I'm writing a document with AUCTeX using the songs package. It all works well, but it requires to input chords like in the sequence \[La]. The problem is, AUCTeX ignores the first bracket (since it is ...
Alessandro Bertulli's user avatar
1 vote
1 answer
48 views

I have this function: (defvar biblio-publishers-info-list '(("Cambridge University Press" . "Cambridge, U.K.")) "DOCSTRING") (defun biblio-publishers-info-complete ()...
Gabriele's user avatar
  • 1,720
1 vote
1 answer
166 views

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-...
ackerleytng's user avatar
2 votes
0 answers
25 views

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 ...
John Kitchin's user avatar
  • 12.2k
5 votes
1 answer
209 views

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 ...
sixter's user avatar
  • 113
3 votes
1 answer
703 views

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." ...
bgoodr's user avatar
  • 401
1 vote
1 answer
297 views

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 ...
Yair Daon's user avatar
  • 131
1 vote
1 answer
318 views

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.
WickedJargon's user avatar
1 vote
1 answer
84 views

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 ?\...
Sandra's user avatar
  • 196
2 votes
0 answers
58 views

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-...
Witek's user avatar
  • 379
2 votes
2 answers
271 views

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?
diemo's user avatar
  • 21
9 votes
2 answers
2k views

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 ....
Swiss Frank's user avatar
0 votes
2 answers
163 views

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 ...
Stephen Alter's user avatar
3 votes
1 answer
181 views

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 ...
Omar's user avatar
  • 4,892
1 vote
1 answer
71 views

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 ...
ideasman42's user avatar
  • 9,513
1 vote
1 answer
138 views

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, let's ...
A.King's user avatar
  • 53
1 vote
1 answer
250 views

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-...
Michael Norrish's user avatar
3 votes
1 answer
382 views

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:]_]+ ...
kdb's user avatar
  • 1,591
1 vote
2 answers
925 views

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 -...
GaryO's user avatar
  • 516
0 votes
1 answer
86 views

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-...
Pfedj's user avatar
  • 358
1 vote
0 answers
74 views

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 ...
Zorgoth's user avatar
  • 850
2 votes
1 answer
73 views

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 ...
JalapenoGremlin's user avatar
3 votes
1 answer
347 views

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 ...
pglpm's user avatar
  • 397
1 vote
1 answer
138 views

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-...
Hi-Angel's user avatar
  • 1,292
2 votes
2 answers
106 views

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 ...
zugzwang's user avatar
  • 341
1 vote
1 answer
36 views

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 \ (...
ghilesZ's user avatar
  • 121
3 votes
1 answer
187 views

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 ...
Lindydancer's user avatar
  • 6,300
1 vote
1 answer
148 views

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 ...
Felipe Lema's user avatar
1 vote
2 answers
294 views

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 ...
justicecurcian's user avatar
1 vote
0 answers
75 views

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 ?...
funklute's user avatar
  • 153
3 votes
2 answers
452 views

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.
sandric's user avatar
  • 1,291
2 votes
1 answer
225 views

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 ...
ljos's user avatar
  • 131
7 votes
0 answers
120 views

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 ...
Tim Landscheidt's user avatar
1 vote
1 answer
128 views

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 ...
vonaka's user avatar
  • 171
2 votes
2 answers
505 views

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 ...
yPhil's user avatar
  • 1,033
2 votes
0 answers
100 views

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 (...
Markus's user avatar
  • 481
1 vote
1 answer
224 views

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-...
Gabriele's user avatar
  • 1,720
3 votes
1 answer
382 views

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-...
ivan's user avatar
  • 2,008
0 votes
1 answer
91 views

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 ...
phs's user avatar
  • 1,259
2 votes
1 answer
184 views

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 ...
Dan Grayson's user avatar