bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21391: 24.5; `thing-at-point' returns error when called with argumen


From: Drew Adams
Subject: bug#21391: 24.5; `thing-at-point' returns error when called with arguments 'number t)
Date: Mon, 7 Nov 2016 09:37:30 -0800 (PST)

> > `thing-at-point' should always return a string.
> 
> Indeed. Which would require some normalization WRT number-at-point
> etc.

`number-at-point' uses `form-at-point'.  It returns a number (or nil),
not a numeral (string).  It satisfies `numberp', not `stringp'.

What normalization do you have in mind?

(I have also `decimal-number-at-point' and `hex-number-at-point', FWIW.)

> > `list-at-point', `form-at-point', etc. are a different
> > story - they can return anything.
> 
> Interesting question. Maybe returns the symbol if found - nil
> otherwise?

That's what `symbol-at-point' does.  However, since `nil' is a
symbol, `symbol-at-point' does not distinguish between finding
that symbol and not finding any symbol at point.

The others return a thing of the given type (or nil, if none).

`list-at-point', like `symbol-at-point', does not distinguish
between an empty list at point (buffer text "nil" or "()" or "(  )"
etc.) and no list at point.  The doc for `list-at-point' should in
fact say that it returns the _non-nil_ list at point, or nil if none.

It should also return the list (quote (1 2)) when on '(1 2) (it's
broken, IMO).  (I also have a function `unquoted-list-at-point'.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]