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 #17 received at 21391 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 21391 <at> debbugs.gnu.org
Cc: Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#21391: 24.5; `thing-at-point' returns error when called with
 arguments 'number t)
Date: Thu, 13 Oct 2016 16:00:01 +0900 (JST)
Using `sequencep' looks too general here: `set-text-properties'
justs accepts as arg OBJECT an string or a buffer.  The case
of interest for this function seems when text satisfy `stringp'.
We might want to do in the future (or some 3rd party code)
something like:
(put 'list 'thing-at-point 'list-at-point)

In that case, 'text' would satisfy `listp', so it would
satisfy `sequencep' as well:  we would then call
`set-text-properties' with arg OBJECT being a list, which signals
an error.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 346ce0fcf3665ebfb24303763e2372551b33a1ae Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Thu, 13 Oct 2016 15:45:02 +0900
Subject: [PATCH] thing-at-point: Delete text properties only if text is a
 string

* lisp/thingatpt.el (thing-at-point): Delete text properties
only when text is an string (Bug#21391).
---
 lisp/thingatpt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 6d1014b..2fd51e6 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -145,7 +145,7 @@ thing-at-point
            (let ((bounds (bounds-of-thing-at-point thing)))
              (when bounds
                (buffer-substring (car bounds) (cdr bounds)))))))
-    (when (and text no-properties (sequencep text))
+    (when (and text no-properties (stringp text))
       (set-text-properties 0 (length text) nil text))
     text))

-- 
2.9.3

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 26.0.50.16 (x86_64-pc-linux-gnu, GTK+ Version 3.22.1)
 of 2016-10-13 built on calancha-pc
Repository revision: 1dd54e3eef7543720eff161457677a35fae2435c





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.