From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#21391: 24.5; `thing-at-point' should return a string Date: Fri, 11 Nov 2016 23:13:55 +0900 (JST) Message-ID: References: <0a68c2ae-0940-4e2c-8b3c-1faceb45c43c@default> <1773ab35-70b1-42f9-8a8b-fe07881487d1@default> <874m3krnb6.fsf_-_@gmail.com> <83a8dbiaps.fsf@gnu.org> <83pom7gjhl.fsf@gnu.org> <0a8d76e4-4d1b-a26d-2b76-a2d9384d9f72@yandex.ru> <83mvhbgitf.fsf@gnu.org> <25bb22e8-1388-275a-d0da-7e698acdf6da@yandex.ru> <83inrygggr.fsf@gnu.org> <83y40sfyij.fsf@gnu.org> <76505436-e66c-0ed3-6d7a-ce654f38ef30@yandex.ru> <83bmxnfhbi.fsf@gnu.org> <73600483-1df5-597c-6066-232189bbdd4a@yandex.ru> <834m3ffeb9.fsf@gnu.org> <83twbfdvav.fsf@gnu.org> <73be4b9d-2df8-cc83-b873-398cb7dd043b@yandex.ru> <83pom3ds3e.fsf@gnu.org> <83bmxme12w.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1478873735 28833 195.159.176.226 (11 Nov 2016 14:15:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Nov 2016 14:15:35 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: dgutov@yandex.ru, Tino Calancha , 21391@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 11 15:15:29 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5Cbp-0004q3-TA for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 15:15:14 +0100 Original-Received: from localhost ([::1]:53195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5Cbt-000652-1T for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 09:15:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5Cbl-00062q-8N for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 09:15:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5Cbe-0005bh-Q0 for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 09:15:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37722) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c5Cbe-0005bd-N2 for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 09:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c5Cbe-0005SO-Fk for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 09:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Nov 2016 14:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21391 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21391-submit@debbugs.gnu.org id=B21391.147887364620893 (code B ref 21391); Fri, 11 Nov 2016 14:15:02 +0000 Original-Received: (at 21391) by debbugs.gnu.org; 11 Nov 2016 14:14:06 +0000 Original-Received: from localhost ([127.0.0.1]:53121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5Cak-0005Qv-Ic for submit@debbugs.gnu.org; Fri, 11 Nov 2016 09:14:06 -0500 Original-Received: from mail-pg0-f66.google.com ([74.125.83.66]:33779) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5Caj-0005QI-Qz for 21391@debbugs.gnu.org; Fri, 11 Nov 2016 09:14:06 -0500 Original-Received: by mail-pg0-f66.google.com with SMTP id 3so2015382pgd.0 for <21391@debbugs.gnu.org>; Fri, 11 Nov 2016 06:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=BCW8NT6PR7SidTqeX2xvRy0fPZKCqgxr0cQezQzLjnU=; b=bUoc2ydj6wy1YgDQjNsVyuXFaQ3V+PLxy3bVT1w9EqvduO+ESL0fmXZv8hHxKd9prG KdAmUCV4t2LibHdC5bVmL+4PnwUhm+Wk9N0hdP7rlFruwX1QWxRLTMnvj6y3YiRPvlhu UhE1u72RwfcwozHrfKXSchjY/izPsTdMQeZl97/R71DHJpiu5Qxr9qRbHpnOgJxSXlYt h40rcd+8UolqdjUTUJr2ZrfEHP78qQHaESYR6GDPB9w7iGQv7Q+HprRXyaPRu+967gtA KkCQdsKa+87PxEIPiEXTQIIoM9AC+IZlWraYMqybgWN/0E3Ar173frN/KbzH1fuxvT5J P9sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=BCW8NT6PR7SidTqeX2xvRy0fPZKCqgxr0cQezQzLjnU=; b=eMKyCCp03feo5BUO82yg0C9Jwo/GzcpWBNZyXq9UnvW4maKs+HXd9Uz/4IYtmfUxS7 Rx75i6xIn3nkAGbNlAiqYb3dvficqRhFL5W1XV4utUR+XkkpEonE2csyaxXQPG2reLRe VyXMpnpQkmczueRybTNr2w5UfGeKnTn8rvtc+9FyHxyj0Lup3deNVuPFdQcKEgTtzWu4 bWRSWoG1eoZsdjKpeqmalqwngR8Sc58BPqeQyT4lZrteKz/hy9EtStRX66f4dacplrgl Uj+Amnaq6Yng7ButV+4P+xEDWt+rbQidIpJgxa0yfRElGjbKPsR/rXZbQ4g43y5Jc1eg D9Rg== X-Gm-Message-State: ABUngvdq1kiA8uuUz8QtdZxQ552BVkcB2YpDcg5bwq25xSpXGnyfxC+GARp9OKL2NjyGSQ== X-Received: by 10.99.149.22 with SMTP id p22mr37388964pgd.21.1478873640069; Fri, 11 Nov 2016 06:14:00 -0800 (PST) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id 3sm15652579pam.21.2016.11.11.06.13.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 06:13:59 -0800 (PST) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <83bmxme12w.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125616 Archived-At: On Fri, 11 Nov 2016, Eli Zaretskii wrote: >> From: Tino Calancha >> Date: Fri, 11 Nov 2016 19:07:15 +0900 (JST) >> cc: Eli Zaretskii , 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