Timeline for Perform-replace only on text (no comments, no math) in latex-mode?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 3, 2023 at 17:31 | comment | added | Drew |
@AlexanderPraehauser: Comments here aren't the place for this. Send me an email or pose a separate question here. Provide a step-by-step recipe to repro the problem, saying what you see at each step and what you expected to see instead. FWIW, the add-to-list sexp you show isn't valid. You need two add-to-list calls, to add two elements to the alist.
|
|
Aug 3, 2023 at 16:40 | comment | added | Alexander Praehauser |
@Drew Based on the documentation I've written a function that can act as a predicate and wanted to add it to the default filter predicates. However, it still doesn't shine up in them. Can you take a look? I do (add-to-list 'isearchp-filter-predicates-alist '("[math]" check-math-mode "[MATH]") '("~[math]" check-not-math-mode "[MATH]") ) and it shines up on the list but isn't found when I do C-s C-z & [math] .
|
|
Mar 12, 2019 at 7:08 | vote | accept | Gabriele | ||
May 22, 2017 at 22:40 | comment | added | Drew |
@link0ff: That's not complementary to the answer. Whether you use a font-lock face or syntax-ppss , the answer applies: use isearch-filter-predicate (in both cases). Of course it's possible to not use isearch-filter-predicate and instead use code that searches and actively explicitly skips over comments etc. But that is a different answer, and, like this one, it applies to use of both faces and syntax-ppss .
|
|
May 22, 2017 at 20:30 | comment | added | link0ff |
Elena is right with a comment complementary to the answer. face-at-point is useful when the buffer is already fontified, and when not then better would be to rely on syntax, e.g. (and comment-start (nth 4 (syntax-ppss))) .
|
|
May 19, 2017 at 4:02 | comment | added | Drew | @Elena: That seems like a comment for the question, not for this answer, no? | |
May 19, 2017 at 0:01 | comment | added | Eleno |
You can use face-at-point to recognize and skip comments and formulas (which will have their own faces, I suppose).
|
|
May 18, 2017 at 23:51 | history | edited | Drew | CC BY-SA 3.0 |
added 250 characters in body
|
May 17, 2017 at 17:36 | comment | added | Drew | You can probably just let-bind it. When the let-binding is done the previous value is restored. | |
May 17, 2017 at 17:05 | comment | added | Gabriele |
Thank you. I'm not asking someone to give me the code ;-). I didn't know about isearch-filter-predicate so now I have my homework to do. I have to find a way to change that variable in my functions and restore the default value at the end. (I'm not properly a hacker... so this will be a little tricky for me.) Thank you again.
|
|
May 17, 2017 at 16:45 | history | answered | Drew | CC BY-SA 3.0 |