* Re: [nongnu] elpa/haskell-mode d16c68ccdf 2/2: Merge pull request #1829 from DataKinds/master
[not found] ` <20231025110101.AAD84C09BE6@vcs2.savannah.gnu.org>
@ 2023-10-25 11:31 ` Stefan Monnier
2023-10-25 11:58 ` Emanuel Berg
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2023-10-25 11:31 UTC (permalink / raw)
To: Steve Purcell; +Cc: emacs-devel
> +(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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [nongnu] elpa/haskell-mode d16c68ccdf 2/2: Merge pull request #1829 from DataKinds/master
2023-10-25 11:31 ` [nongnu] elpa/haskell-mode d16c68ccdf 2/2: Merge pull request #1829 from DataKinds/master Stefan Monnier
@ 2023-10-25 11:58 ` Emanuel Berg
0 siblings, 0 replies; 2+ messages in thread
From: Emanuel Berg @ 2023-10-25 11:58 UTC (permalink / raw)
To: emacs-devel
Stefan Monnier wrote:
> And personally, I'd recommend:
>
> (not (and (save-excursion
> (re-search-backward "\\\\end{code}\\|\\\\begin{code}\\(\\)"
> nil t))
> (match-end 1)))
Why don't we have a "nand"?
(defun nand (&rest conditions)
(when (member nil conditions)
t) )
;; (nand) ; nil
;; (nand 1 2 3) ; nil
;; (nand nil) ; t
;; (nand 1 2 nil 3) ; t
https://en.wikipedia.org/wiki/Logical_NAND
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-25 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <169823166043.2094.16911105176687452779@vcs2.savannah.gnu.org>
[not found] ` <20231025110101.AAD84C09BE6@vcs2.savannah.gnu.org>
2023-10-25 11:31 ` [nongnu] elpa/haskell-mode d16c68ccdf 2/2: Merge pull request #1829 from DataKinds/master Stefan Monnier
2023-10-25 11:58 ` Emanuel Berg
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).