Subject: Re: bug#21391: 24.5; `thing-at-point' returns error when called with arguments 'number t)

From: Tino Calancha <[email-masked]>
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 <[email-masked]>
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