all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dgutov@yandex.ru, Tino Calancha <tino.calancha@gmail.com>,
	21391@debbugs.gnu.org
Subject: bug#21391: 24.5; `thing-at-point' should return a string
Date: Fri, 11 Nov 2016 23:13:55 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1611112313020.23900@calancha-pc> (raw)
In-Reply-To: <83bmxme12w.fsf@gnu.org>



On Fri, 11 Nov 2016, Eli Zaretskii wrote:

>> From: Tino Calancha <tino.calancha@gmail.com>
>> Date: Fri, 11 Nov 2016 19:07:15 +0900 (JST)
>> cc: Eli Zaretskii <eliz@gnu.org>, tino.calancha@gmail.com,
>>     21391@debbugs.gnu.org
>>
>>> On 10.11.2016 21:59, Eli Zaretskii wrote:
>>>
>>>> Because currently they can call thing-at-point without defining
>>>> foo-at-point.  AFAIU, you suggest to deny them this possibility, and
>>>> force them to define foo-at-point for every foo.
>>>
>>> They'll really have to do that only for string-unrepresentable foos.
>>>
>>> Like currently (thing-at-point 'symbol) returns a string, whereas
>>> (symbol-at-point) returns an interned symbol. That's nothing new.
>> Indeed, this sounds the right usage for me, and for an user who has
>> read the part of the manual refering to `thing-at-point'.
>
> I disagree, sorry.
The current implementation makes the things harder to understand.
Currently one user need to read the source code to know the actual
type this function returns.

Depending of what is foo in:

(thing-at-point 'foo nil)

you could get:

1) a non-string
2) a string with properties
3) a string without properties.

That's true even after you pass nil to the second argument
(see examples below).  Then it's not clear to me the motivation
of the second argument: if non-nil means strip the properties, i guess
a nil value should means do not strip them.

Let's say i want to get some things as strings keeping their
properties (in this example warning face).

;; list: OK
(with-temp-buffer
   (insert (propertize "(foo)" 'face 'warning))
   (goto-char 2)
   (thing-at-point 'list))
=> #("(foo)" 0 5 (face warning))

;; sexp: OK
(with-temp-buffer
   (insert (propertize "(foo)" 'face 'warning))
   (goto-char 2)
   (thing-at-point 'sexp))
=> #("foo" 0 3 (face warning))

;; symbol: OK
(with-temp-buffer
   (insert (propertize "(foo)" 'face 'warning))
   (goto-char 2)
   (thing-at-point 'symbol))
=> #("foo" 0 3 (face warning))

;; filename: OK
(with-temp-buffer
   (insert (propertize "thingatpt.el" 'face 'warning))
   (goto-char 2)
   (thing-at-point 'filename))
=> #("thingatpt.el" 0 12 (face warning))

;; url: Opps! And the properties?
(with-temp-buffer
   (insert (propertize "https://www.example.com" 'face 'warning))
   (goto-char 2)
   (thing-at-point 'url))
=> "https://www.example.com"

;; email: Again No properties
(with-temp-buffer
   (insert (propertize "foo@bar.edu" 'face 'warning))
   (goto-char 2)
   (thing-at-point 'email))
=> "foo@bar.edu"

;; number: Cannot get even a string.
(with-temp-buffer
   (insert (propertize "4" 'face 'warning))
   (goto-char 1)
   (thing-at-point 'number))
=> 4





  reply	other threads:[~2016-11-11 14:13 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  1:59 bug#21391: 24.5; `thing-at-point' returns error when called with arguments 'number t Tino Calancha
2015-09-05  8:23 ` Eli Zaretskii
2016-10-13  7:00 ` bug#21391: 24.5; `thing-at-point' returns error when called with arguments 'number t) Tino Calancha
2016-11-04 16:31   ` Drew Adams
2016-11-04 18:31     ` Andreas Röhler
2016-11-04 19:27       ` Drew Adams
2016-11-04 20:21         ` Drew Adams
2016-11-07  9:30           ` Andreas Röhler
2016-11-07 15:00             ` Drew Adams
2016-11-07 15:01             ` Drew Adams
2016-11-04 20:03     ` Drew Adams
2016-11-07  3:17       ` bug#21391: 24.5; `thing-at-point' should return a string Tino Calancha
2016-11-07 15:14         ` Eli Zaretskii
2016-11-07 19:12           ` Dmitry Gutov
2016-11-07 19:47             ` Eli Zaretskii
2016-11-07 19:51               ` Dmitry Gutov
2016-11-07 20:02                 ` Eli Zaretskii
2016-11-07 20:03                   ` Dmitry Gutov
2016-11-08 13:15                     ` Tino Calancha
2016-11-08 15:05                     ` Eli Zaretskii
2016-11-09  0:04                       ` Dmitry Gutov
2016-11-09  6:43                         ` Andreas Röhler
2016-11-09 15:45                         ` Eli Zaretskii
2016-11-09 23:30                           ` Dmitry Gutov
2016-11-10 16:08                             ` Eli Zaretskii
2016-11-10 16:19                               ` Dmitry Gutov
2016-11-10 17:13                                 ` Eli Zaretskii
2016-11-10 17:28                                   ` Dmitry Gutov
2016-11-10 18:49                                     ` Eli Zaretskii
2016-11-10 18:55                                       ` Dmitry Gutov
2016-11-10 19:59                                         ` Eli Zaretskii
2016-11-10 21:12                                           ` Dmitry Gutov
2016-11-11 10:07                                             ` Tino Calancha
2016-11-11 10:57                                               ` Eli Zaretskii
2016-11-11 14:13                                                 ` Tino Calancha [this message]
2016-11-11 14:35                                                   ` Eli Zaretskii
2016-11-11 14:46                                                     ` Dmitry Gutov
2016-11-11 14:51                                                       ` Eli Zaretskii
2016-11-11 14:57                                                         ` Dmitry Gutov
2016-11-11 15:31                                                           ` Eli Zaretskii
2016-11-11 15:05                                                         ` Tino Calancha
2016-11-11 15:37                                                           ` Eli Zaretskii
2016-11-14  1:52                                                             ` Dmitry Gutov
2016-11-14  2:43                                                               ` Drew Adams
2016-11-14 10:26                                                                 ` Andreas Röhler
2016-11-14 15:19                                                                   ` Drew Adams
2016-11-16 13:49                                                                     ` Andreas Röhler
2016-11-16 14:45                                                                       ` Drew Adams
2016-11-14 15:36                                                                   ` Eli Zaretskii
2016-11-15  7:18                                                                     ` Andreas Röhler
2016-11-14 15:34                                                                 ` Eli Zaretskii
2016-11-10 18:27                                 ` Drew Adams
2016-11-09 17:58                         ` Drew Adams
2016-11-09 23:35                           ` Dmitry Gutov
2016-11-10  0:40                             ` Drew Adams
2016-11-10  8:55                               ` Dmitry Gutov
2020-08-24 18:32                       ` Lars Ingebrigtsen
     [not found]                     ` <<83inrygggr.fsf@gnu.org>
2016-11-08 16:31                       ` Drew Adams
     [not found]                       ` <<cc2e7eab-e58d-db76-b5ed-0ec9871fad9d@yandex.ru>
     [not found]                         ` <<83y40sfyij.fsf@gnu.org>
     [not found]                           ` <<76505436-e66c-0ed3-6d7a-ce654f38ef30@yandex.ru>
     [not found]                             ` <<83bmxnfhbi.fsf@gnu.org>
     [not found]                               ` <<73600483-1df5-597c-6066-232189bbdd4a@yandex.ru>
     [not found]                                 ` <<834m3ffeb9.fsf@gnu.org>
     [not found]                                   ` <<fcb1bcf1-20f0-3eda-1c33-df7ba085d487@yandex.ru>
     [not found]                                     ` <<83twbfdvav.fsf@gnu.org>
     [not found]                                       ` <<73be4b9d-2df8-cc83-b873-398cb7dd043b@yandex.ru>
     [not found]                                         ` <<83pom3ds3e.fsf@gnu.org>
     [not found]                                           ` <<ef67e387-0302-1aaa-4764-cab2d3337a2c@yandex.ru>
     [not found]                                             ` <<alpine.DEB.2.20.1611111851250.21428@calancha-pc>
     [not found]                                               ` <<83bmxme12w.fsf@gnu.org>
     [not found]                                                 ` <<alpine.DEB.2.20.1611112313020.23900@calancha-pc>
     [not found]                                                   ` <<834m3edqyr.fsf@gnu.org>
     [not found]                                                     ` <<6dbea00c-3bde-6ec3-b109-7aa205bedb5f@yandex.ru>
     [not found]                                                       ` <<8337iydq8z.fsf@gnu.org>
     [not found]                                                         ` <<alpine.DEB.2.20.1611112355090.24203@calancha-pc>
     [not found]                                                           ` <<83y40qc9jv.fsf@gnu.org>
     [not found]                                                             ` <<df484e47-dbd7-06d5-5987-a067185d3e00@yandex.ru>
     [not found]                                                               ` <<bd8f220e-6ac2-4996-91ed-7bcf4cc5413f@default>
     [not found]                                                                 ` <<83a8d2hy8f.fsf@gnu.org>
2016-11-14 16:24                                                                   ` Drew Adams
2016-11-14 16:44                                                                     ` Eli Zaretskii
2016-11-08  8:22                   ` Andreas Röhler
     [not found]       ` <<874m3krnb6.fsf_-_@gmail.com>
     [not found]         ` <<83a8dbiaps.fsf@gnu.org>
2016-11-07 16:10           ` Drew Adams
2016-11-07 18:04             ` Eli Zaretskii
2016-11-07 17:22       ` bug#21391: 24.5; `thing-at-point' returns error when called with arguments 'number t) Andreas Röhler
2016-11-07 17:37         ` Drew Adams
2016-11-08  8:43           ` Andreas Röhler
2016-11-08 16:31             ` Drew Adams
     [not found]       ` <<<874m3krnb6.fsf_-_@gmail.com>
     [not found]         ` <<<83a8dbiaps.fsf@gnu.org>
     [not found]           ` <<123efdfd-3a87-4b39-9567-a56ecc3ea82e@default>
     [not found]             ` <<831syni2u1.fsf@gnu.org>
2016-11-07 18:37               ` bug#21391: 24.5; `thing-at-point' should return a string Drew Adams
     [not found] <<<<alpine.LRH.2.20.1509011056480.5317@calancha-ilc.kek.jp>
     [not found] ` <<<<83pom7gjhl.fsf@gnu.org>
     [not found]   ` <<<<0a8d76e4-4d1b-a26d-2b76-a2d9384d9f72@yandex.ru>
     [not found]     ` <<<<83mvhbgitf.fsf@gnu.org>
     [not found]       ` <<<<25bb22e8-1388-275a-d0da-7e698acdf6da@yandex.ru>
     [not found]         ` <<<<83inrygggr.fsf@gnu.org>
     [not found]           ` <<<<cc2e7eab-e58d-db76-b5ed-0ec9871fad9d@yandex.ru>
     [not found]             ` <<<<83y40sfyij.fsf@gnu.org>
     [not found]               ` <<<<76505436-e66c-0ed3-6d7a-ce654f38ef30@yandex.ru>
     [not found]                 ` <<<<83bmxnfhbi.fsf@gnu.org>
     [not found]                   ` <<<<73600483-1df5-597c-6066-232189bbdd4a@yandex.ru>
     [not found]                     ` <<<<834m3ffeb9.fsf@gnu.org>
     [not found]                       ` <<<<fcb1bcf1-20f0-3eda-1c33-df7ba085d487@yandex.ru>
     [not found]                         ` <<<<83twbfdvav.fsf@gnu.org>
     [not found]                           ` <<<<73be4b9d-2df8-cc83-b873-398cb7dd043b@yandex.ru>
     [not found]                             ` <<<<83pom3ds3e.fsf@gnu.org>
     [not found]                               ` <<<<ef67e387-0302-1aaa-4764-cab2d3337a2c@yandex.ru>
     [not found]                                 ` <<<<alpine.DEB.2.20.1611111851250.21428@calancha-pc>
     [not found]                                   ` <<<<83bmxme12w.fsf@gnu.org>
     [not found]                                     ` <<<<alpine.DEB.2.20.1611112313020.23900@calancha-pc>
     [not found]                                       ` <<<<834m3edqyr.fsf@gnu.org>
     [not found]                                         ` <<<<6dbea00c-3bde-6ec3-b109-7aa205bedb5f@yandex.ru>
     [not found]                                           ` <<<<8337iydq8z.fsf@gnu.org>
     [not found]                                             ` <<<<alpine.DEB.2.20.1611112355090.24203@calancha-pc>
     [not found]                                               ` <<<<83y40qc9jv.fsf@gnu.org>
     [not found]                                                 ` <<<<df484e47-dbd7-06d5-5987-a067185d3e00@yandex.ru>
     [not found]                                                   ` <<<<bd8f220e-6ac2-4996-91ed-7bcf4cc5413f@default>
     [not found]                                                     ` <<<<83a8d2hy8f.fsf@gnu.org>
     [not found]                                                       ` <<<5a6ddd21-ebf9-42bf-9fb6-7fc9e037b3ed@default>
     [not found]                                                         ` <<<83zil2ggf7.fsf@gnu.org>
     [not found]                                                           ` <<fe942899-b2b4-4add-9f80-87ddf53bc680@default>
     [not found]                                                             ` <<83wpg6gc8h.fsf@gnu.org>
2016-11-14 18:54                                                               ` Drew Adams
     [not found] <<<alpine.LRH.2.20.1509011056480.5317@calancha-ilc.kek.jp>
     [not found] ` <<<83pom7gjhl.fsf@gnu.org>
     [not found]   ` <<<0a8d76e4-4d1b-a26d-2b76-a2d9384d9f72@yandex.ru>
     [not found]     ` <<<83mvhbgitf.fsf@gnu.org>
     [not found]       ` <<<25bb22e8-1388-275a-d0da-7e698acdf6da@yandex.ru>
     [not found]         ` <<<83inrygggr.fsf@gnu.org>
     [not found]           ` <<<cc2e7eab-e58d-db76-b5ed-0ec9871fad9d@yandex.ru>
     [not found]             ` <<<83y40sfyij.fsf@gnu.org>
     [not found]               ` <<<76505436-e66c-0ed3-6d7a-ce654f38ef30@yandex.ru>
     [not found]                 ` <<<83bmxnfhbi.fsf@gnu.org>
     [not found]                   ` <<<73600483-1df5-597c-6066-232189bbdd4a@yandex.ru>
     [not found]                     ` <<<834m3ffeb9.fsf@gnu.org>
     [not found]                       ` <<<fcb1bcf1-20f0-3eda-1c33-df7ba085d487@yandex.ru>
     [not found]                         ` <<<83twbfdvav.fsf@gnu.org>
     [not found]                           ` <<<73be4b9d-2df8-cc83-b873-398cb7dd043b@yandex.ru>
     [not found]                             ` <<<83pom3ds3e.fsf@gnu.org>
     [not found]                               ` <<<ef67e387-0302-1aaa-4764-cab2d3337a2c@yandex.ru>
     [not found]                                 ` <<<alpine.DEB.2.20.1611111851250.21428@calancha-pc>
     [not found]                                   ` <<<83bmxme12w.fsf@gnu.org>
     [not found]                                     ` <<<alpine.DEB.2.20.1611112313020.23900@calancha-pc>
     [not found]                                       ` <<<834m3edqyr.fsf@gnu.org>
     [not found]                                         ` <<<6dbea00c-3bde-6ec3-b109-7aa205bedb5f@yandex.ru>
     [not found]                                           ` <<<8337iydq8z.fsf@gnu.org>
     [not found]                                             ` <<<alpine.DEB.2.20.1611112355090.24203@calancha-pc>
     [not found]                                               ` <<<83y40qc9jv.fsf@gnu.org>
     [not found]                                                 ` <<<df484e47-dbd7-06d5-5987-a067185d3e00@yandex.ru>
     [not found]                                                   ` <<<bd8f220e-6ac2-4996-91ed-7bcf4cc5413f@default>
     [not found]                                                     ` <<<83a8d2hy8f.fsf@gnu.org>
     [not found]                                                       ` <<5a6ddd21-ebf9-42bf-9fb6-7fc9e037b3ed@default>
     [not found]                                                         ` <<83zil2ggf7.fsf@gnu.org>
2016-11-14 17:33                                                           ` Drew Adams
2016-11-14 18:14                                                             ` Eli Zaretskii
     [not found] <<alpine.LRH.2.20.1509011056480.5317@calancha-ilc.kek.jp>
     [not found] ` <<83pom7gjhl.fsf@gnu.org>
     [not found]   ` <<0a8d76e4-4d1b-a26d-2b76-a2d9384d9f72@yandex.ru>
     [not found]     ` <<83mvhbgitf.fsf@gnu.org>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1611112313020.23900@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=21391@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.