GNU bug report logs - #21391
24.5; `thing-at-point' returns error when called with arguments 'number t

Previous Next

Package: emacs;

Reported by: Tino Calancha <f92capac <at> gmail.com>

Date: Tue, 1 Sep 2015 01:57:01 UTC

Severity: minor

Found in version 24.5

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 21391 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tino Calancha <tino.calancha <at> gmail.com>, 21391 <at> debbugs.gnu.org
Subject: RE: bug#21391: 24.5; `thing-at-point' returns error when called with
 arguments 'number t)
Date: Fri, 4 Nov 2016 09:31:38 -0700 (PDT)
Tino is right.  The mistake behind the handling of optional arg
NO-PROPERTIES (which was added in Emacs 24.4) is to assume that
`thing-at-point' returns a string.  This is a common misconception.
It can return anything that Emacs Lisp can return.

emacs -Q
M-x load-library thingatpt
M-: (put 'list 'thing-at-point (lambda () '(1 2 3 4)))

In *scratch*:

C-x h
C-w
M-: (insert "(foo)")
M-x goto-char 2
M-: (thing-at-point 'list) ; => (1 2 3 4)
M-: (thing-at-point 'list t) ; => error raised

The proper test is not `sequencep', but either `stringp' or
(or (stringp text) (buffer-live-p text)).  This is obvious
from just the signature of `set-text-properties'.

And "text" should be renamed accordingly - it is a THING,
not necessarily text.

[And I disagree that the doc string should say that THING
specifies a type of "syntactic" entity.  It should say that
THING specifies a type of thing that can be manipulated by
Emacs Lisp.  You could say a type of Lisp object, but it
could be, say, a file (not just a file name).]




This bug report was last modified 4 years and 328 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.