[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiling Elisp to a native code with a GCC plugin
From: |
David Kastrup |
Subject: |
Re: Compiling Elisp to a native code with a GCC plugin |
Date: |
Thu, 16 Sep 2010 10:31:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
"Stephen J. Turnbull" <address@hidden> writes:
> David Kastrup writes:
>
> > > (defun is-the-string-following-point-equal-to-this-string-p (s)
> > > (string= s (buffer-substring (point) (+ (point) (length s)))))
> > >
> > > or
> > >
> > > (defun is-the-string-following-point-equal-to-this-string-p (s)
> > > (search-forward s (+ (point) (length s)) t))
>
> > The former will signal an error when the string is longer than the
> > rest of the buffer. The latter won't.
> >
> > You can't figure this out by reading the doc strings of the used
> > functions. You have to read their source code.
> >
> > Since a user is not likely to pick the correct one-liner, it might
> > make sense to define a function for that.
>
> It might, but I would prefer a documentation patch. ;-)
Can't really do the trick here.
"If START or END are outside the accessible buffer region, an error
is signaled. In case you wanted to check for the presence of a string
str at buffer point, consider using `search-forward' with a LIMIT
of (+ (length str) (point)) and a NOERROR of t.
Or use
(condition-case nil
(string= s (buffer-substring (point) (+ (point) (length s))))
(args-out-of-range nil))
Or maybe
(string= s (buffer-substring (point) (min (point-max) (+ (point) (length s)))))
"
I mean, get real. One can't write suggestions for all possible intended
uses into a DOC string.
Would make more sense to give buffer-substring a NOERROR argument of its
own. Still ugh.
--
David Kastrup
- Re: Compiling Elisp to a native code with a GCC plugin, (continued)
- Re: Compiling Elisp to a native code with a GCC plugin, Andreas Schwab, 2010/09/16
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/16
- Re: Compiling Elisp to a native code with a GCC plugin, Eli Zaretskii, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Eli Zaretskii, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/16
- Re: Compiling Elisp to a native code with a GCC plugin, Stephen J. Turnbull, 2010/09/15
- Re: Compiling Elisp to a native code with a GCC plugin, David Kastrup, 2010/09/16
- Re: Compiling Elisp to a native code with a GCC plugin, Stephen J. Turnbull, 2010/09/16
- Re: Compiling Elisp to a native code with a GCC plugin,
David Kastrup <=
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/16
- Re: Compiling Elisp to a native code with a GCC plugin, Stephen J. Turnbull, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, David Kastrup, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, David Kastrup, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, David Kastrup, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17