[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thing-at-point: inconsistent behaviour?
From: |
Barry Margolin |
Subject: |
Re: thing-at-point: inconsistent behaviour? |
Date: |
Thu, 16 Aug 2012 21:46:26 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.7128.1345164390.855.help-gnu-emacs@gnu.org>,
"Drew Adams" <drew.adams@oracle.com> wrote:
> > When you are looking for a buffer substring, you call
> > `bounds-of-thing-at-point'; when you are looking for a string
> > result, you call `thing-at-point'; when you want the result
> > as a sexp, you call the specialized function.
>
> There is even another complication/confusion. "Symbol" in Emacs can refer to
> two different things, especially as regards text that might represent a name.
>
> * It can refer to a string of chars that have symbol syntax (or
> symbol-or-word
> syntax) in a given mode - any mode, not just Lisp.
>
> * It can refer to a Lisp symbol, i.e., a specific kind of Lisp object (with
> the
> possibility of a non-nil `symbol-value' and `symbol-function, for instance).
>
> IMO, most Elisp programs use thing-at-point functions to grab a string
> representing the name of something or representing a sexp or other object
> (URL,
> file name, etc.).
>
> In the case of a symbol, IMO most programs really want/need to grab a symbol
> _name_, often for use as the default value in an interactive spec. Most do
> not
> really want/need a Lisp symbol. And even when they do, they can call
> `intern'
> or `intern-soft' or `make-symbol' themselves.
Then they should call (thing-at-point 'symbol), not (symbol-at-point).
It seems like this tangent is because someone thought that the latter
should just be a shorthand for the former, but they do different things
and are intended for different situations. If symbol-at-point doesn't
do what you want (e.g. it interns things when you would prefer it
didn't), don't use it. No one's forcing you to.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
- 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, 2012/08/16
- 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 <=
- 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