[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: `looking-back' strange warning
From: |
Drew Adams |
Subject: |
RE: `looking-back' strange warning |
Date: |
Fri, 2 Oct 2015 14:35:03 -0700 (PDT) |
> This version is about 6 times faster in the t case and a still a bit
> faster in the nil case where the char before point is already different
> (which is the best case for your function).
>
> (defun chars-before (chars)
> "Return non-nil if the literal string CHARS is right before point.
> This is more efficient that `looking-back' for this use case."
> (let ((beg (- (point) (length chars))))
> (unless (< beg 0)
> (save-excursion
> (goto-char beg)
> (looking-at (regexp-quote chars))))))
OK. Good to know.
See also bug #17284,
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17284,
where this has been discussed and I and others proposed
code for this.
You are welcome to contribute to that (short) bug thread,
or to otherwise try to get such a function added to Emacs.
- Re: `looking-back' strange warning, (continued)
- Re: `looking-back' strange warning, Dmitry Gutov, 2015/10/08
- Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
- Re: `looking-back' strange warning, Dmitry Gutov, 2015/10/08
- Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
- Re: `looking-back' strange warning, Stefan Monnier, 2015/10/08
- Re: `looking-back' strange warning, Michael Heerdegen, 2015/10/08
- Re: `looking-back' strange warning, Michael Heerdegen, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Tassilo Horn, 2015/10/08
- RE: `looking-back' strange warning,
Drew Adams <=
- Re: `looking-back' strange warning, Tassilo Horn, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
- Re: `looking-back' strange warning, Michael Heerdegen, 2015/10/08
- Re: `looking-back' strange warning, Stefan Monnier, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Tom Tromey, 2015/10/08