[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thing-at-point: inconsistent behaviour?
From: |
Andreas Röhler |
Subject: |
Re: thing-at-point: inconsistent behaviour? |
Date: |
Thu, 16 Aug 2012 13:52:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
Am 15.08.2012 21:00, schrieb Raffaele Ricciardi:
On 08/15/2012 07:34 PM, Barry Margolin wrote:
> In article <a926tjFeslU1@mid.individual.net>,
> Raffaele Ricciardi <rfflrccrd@gmail.com> wrote:
>
>> Hello there,
>>
>> the documentation of `thing-at-point' states that such function returns "the
>> thing around or next to point". This is not the case with either
>> (thing-at-point
>> 'symbol) or (thing-at-point 'sexp), for they both may return the thing
>> before
>> point. Try it with the following snippet (! symbolizes the point):
>
> Doesn't "next to" include both immediately before and immediately after?
I stand corrected after having consulted a dictionary. Then it is
(thing-at-point 'list) that is misbehaving.
hmm, IMHO you was right. Here is the code
(defun symbol-at-point ()
"Return the symbol at point, or nil if none is found."
(let ((thing (thing-at-point 'symbol)))
(if thing (intern thing))))
last line don't return the thing as delivered by thing-at-point but the result
of (intern thing)
that way breaking consistency.
BTW built a library at top of thing-at-point rationale, which aims to avoid that
https://launchpad.net/s-x-emacs-werkstatt/trunk/1.3/+download/S-X-Emacs-Werkstatt-1.3.tar.gz
>
>>
>> A!
>> (A)!
>>
>> On the contrary, (bounds-of-thing-at-point 'list) returns nil as
>> expected in this
>> snippet:
>>
>> (A)!
>>
>> Is this inconsistent behaviour or am I missing something?
>>
>> Tested on GNU Emacs 24.1 started with "emacs -Q".
>>
>> Thank you.
>
> I think this is a problem with the thing-at-point handler for 'list.
> It's doing some weird stuff, that I think is intended to distinguide
> lists from sexps.
Aren't lists sexps as well?
- thing-at-point: inconsistent behaviour?, Raffaele Ricciardi, 2012/08/15
- Re: thing-at-point: inconsistent behaviour?, Barry Margolin, 2012/08/15
- RE: thing-at-point: inconsistent behaviour?, Drew Adams, 2012/08/15
- Re: thing-at-point: inconsistent behaviour?, Raffaele Ricciardi, 2012/08/15
- Re: thing-at-point: inconsistent behaviour?,
Andreas Röhler <=
- Message not available
- Re: thing-at-point: inconsistent behaviour?, Barry Margolin, 2012/08/16
- Re: thing-at-point: inconsistent behaviour?, Andreas Röhler, 2012/08/16
- Message not available
- Re: thing-at-point: inconsistent behaviour?, Raffaele Ricciardi, 2012/08/16
- Re: thing-at-point: inconsistent behaviour?, Barry Margolin, 2012/08/16
- RE: thing-at-point: inconsistent behaviour?, Drew Adams, 2012/08/16
- Message not available
- Re: thing-at-point: inconsistent behaviour?, Barry Margolin, 2012/08/16
- RE: thing-at-point: inconsistent behaviour?, Drew Adams, 2012/08/17
- Message not available
- Re: thing-at-point: inconsistent behaviour?, Raffaele Ricciardi, 2012/08/17
- RE: thing-at-point: inconsistent behaviour?, Drew Adams, 2012/08/19