Questions tagged [match-data]
The match-data tag has no usage guidance.
12
questions
0
votes
2
answers
49
views
(string-trim (match-data 1)) wrong type argument error
If I put the code below into a new buffer and eval the code I get an wrong type argument error. It seems string-trim is called with argument nil. how come? I feel there are some fundamentals about ...
0
votes
0
answers
128
views
Highlighting all matched groups in font-lock-add-keywords rule
I'm trying to highlight variable-type in custom let-like form that looks like:
(mylet ((<variable-type> <variable-name> <variable-value>)
(...))
<some-forms>)
To do ...
3
votes
2
answers
377
views
How to count regexp in a string and use that number in replacement?
In my LaTeX code I want to replace these strings:
\left.\left.\left.
\left.\left.
\left.
with:
\left.\left.\left. \mycommand{3}
\left.\left. \mycommand{2}
\left. \mycommand{1}
where the argument ...
3
votes
1
answer
132
views
How can I identify all changes to match-data?
I have a sporadic error when running query-replace:
Args out of range: #<buffer lib.rs>, 0, 1
There are similar questions:
Match data clobbered by buffer modification hooks
(RegEx-)Replace: ...
3
votes
1
answer
105
views
Make region(s) invisible (not evaluated) to "string-match", "occur" and similar commands
In a previous question, Make region(s) invisible (not evaluated) to query-replacy and similar commands, I learned about isearch-filter-predicate. Now, I wonder if is there a similar method to make ...
5
votes
1
answer
228
views
(RegEx-)Replace: Sporadic Match data clobbered by buffer modification hooks
I know this was asked in other contexts already, but I couldn't find anything related to C++ development with my hooks that could help me.
I am working a lot with replace and query-replace and query-...
1
vote
0
answers
282
views
Match data clobbered by buffer modification hooks in tex files
I run into the error Match data clobbered by buffer modification hooks when editing tex files. The way to reproduce is as follows.
In terminal,
cd
mkdir tèst/
cd tèst/
touch test.tex
echo "\input ./...
0
votes
1
answer
63
views
How to bypass lines matching some regexp, when searching forward
I've written the following function to go from an error line to the next one:
(defconst mylog-mode-error-regexp
"\\(\\[ERROR\\]\\|rule did fail\\)"
"Regexp to recognize errors in my log file.")
(...
1
vote
2
answers
345
views
match-data fails to consider only last search with string-match and persists across sessions [duplicate]
Using emacs 25.3.1, I am trying to access the match data after I search a string with string-match. But the match data is wrong. To find out why I tried out the manual's simple example.
(string-...
3
votes
1
answer
92
views
Strange behaviour of match-string/string-match
I have this code
(defun string-match-test ()
(interactive)
(string-match "12345" (buffer-string))
(setq STRING (match-string 0))
(read-string STRING)
(goto-char (point-max))
(insert ...
1
vote
1
answer
322
views
Poor's man way to debug font-lock matcher functions?
I was told on Reddit that font-lock-studio will help me debug a matcher I was working on, however, I find myself with one more problem than before as I need to learn edebug and also grasp how to debug ...
0
votes
1
answer
119
views
How do I debug when match-data is not getting set?
Lately, I have seen some cases where I use re-search-forward to find a pattern, and then try to do something with the match, only to find that the match-data is apparently not correct.
For example, ...