From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: thing-at-point: inconsistent behaviour?
Date: Thu, 16 Aug 2012 13:52:38 +0200 [thread overview]
Message-ID: <502CDF06.3020405@easy-emacs.de> (raw)
In-Reply-To: <a929u0F61sU1@mid.individual.net>
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?
>
next prev parent reply other threads:[~2012-08-16 11:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-15 18:08 thing-at-point: inconsistent behaviour? Raffaele Ricciardi
2012-08-15 18:34 ` Barry Margolin
2012-08-15 18:44 ` Drew Adams
2012-08-15 19:00 ` Raffaele Ricciardi
2012-08-16 11:52 ` Andreas Röhler [this message]
[not found] ` <mailman.7107.1345117968.855.help-gnu-emacs@gnu.org>
2012-08-16 15:48 ` Barry Margolin
2012-08-16 16:24 ` Andreas Röhler
[not found] ` <mailman.7114.1345134264.855.help-gnu-emacs@gnu.org>
2012-08-16 17:12 ` Raffaele Ricciardi
2012-08-16 23:19 ` Barry Margolin
2012-08-17 0:46 ` Drew Adams
[not found] ` <mailman.7128.1345164390.855.help-gnu-emacs@gnu.org>
2012-08-17 1:46 ` Barry Margolin
2012-08-17 4:38 ` Drew Adams
[not found] ` <mailman.7135.1345178331.855.help-gnu-emacs@gnu.org>
2012-08-17 9:23 ` Raffaele Ricciardi
2012-08-20 0:15 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=502CDF06.3020405@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).