[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: thing-at-point: inconsistent behaviour?
From: |
Drew Adams |
Subject: |
RE: thing-at-point: inconsistent behaviour? |
Date: |
Thu, 16 Aug 2012 17:46:18 -0700 |
> 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.
In `thingatpt+.el' there are separate functions that return a Lisp symbol (i.e.,
interned in the standard `obarray'), and there are other functions that return a
symbol name. The symbol-name functions are used more often, IMO.
Symbols:
`symbol-at-point'
`symbol-nearest-point'
`non-nil-symbol-nearest-point'
Symbol names:
`non-nil-symbol-name-at-point'
`symbol-name-nearest-point'
`non-nil-symbol-name-nearest-point'
`region-or-non-nil-symbol-name-nearest-point'
(There are also functions that return the symbol or symbol name plus its bounds
in the buffer, and so on.)
- 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 <=
- 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