[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nongnu] elpa/haskell-mode d16c68ccdf 2/2: Merge pull request #1829
From: |
Stefan Monnier |
Subject: |
Re: [nongnu] elpa/haskell-mode d16c68ccdf 2/2: Merge pull request #1829 from DataKinds/master |
Date: |
Wed, 25 Oct 2023 07:31:01 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> +(defun haskell-indentation-tex-outside-code-p ()
> + "Non-NIL if we are in tex literate mode, but outside of code."
> + (and (haskell-indentation-tex-p)
> + (if (save-excursion
> + (re-search-forward "\\(\\\\end\{code\}\\|\\\\begin\{code\}\\)"
> nil t))
> + (cond ((equal "\\end{code}" (match-string-no-properties 0)) nil)
> + ((equal "\\begin{code}" (match-string-no-properties 0)) t))
> + (save-excursion (re-search-backward "\\\\end\{code\}" nil t)))))
[ The \ in front of the braces do nothing and the \\(..\\) subgroup is unused.
]
We don't need to allocate strings here, we can just do:
(if (save-excursion
(re-search-forward "\\\\end{code}\\|\\\\begin{code}\\(\\)"
nil t))
(match-end 1)
(save-excursion (re-search-backward "\\\\end{code}" nil t)))))
And personally, I'd recommend:
(not (and (save-excursion
(re-search-backward "\\\\end{code}\\|\\\\begin{code}\\(\\)"
nil t))
(match-end 1)))
-- Stefan
- Re: [nongnu] elpa/haskell-mode d16c68ccdf 2/2: Merge pull request #1829 from DataKinds/master,
Stefan Monnier <=