From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: thing-at-point: inconsistent behaviour? Date: Thu, 16 Aug 2012 21:38:38 -0700 Message-ID: References: 14343615082012@@ews.eternal-sepppppppppppp NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345178336 23081 80.91.229.3 (17 Aug 2012 04:38:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2012 04:38:56 +0000 (UTC) To: "'Barry Margolin'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 17 06:38:56 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T2EKl-0003pq-SA for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 06:38:55 +0200 Original-Received: from localhost ([::1]:43129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2EKk-0000Eq-S4 for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 00:38:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2EKf-0000Eg-MZ for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 00:38:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2EKe-0003XF-Ii for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 00:38:49 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:27536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2EKe-0003X5-CU for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 00:38:48 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q7H4ciLU032464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 17 Aug 2012 04:38:45 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q7H4chP2020785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 17 Aug 2012 04:38:44 GMT Original-Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q7H4chsd019967; Thu, 16 Aug 2012 23:38:43 -0500 Original-Received: from dradamslap1 (/10.159.221.217) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 16 Aug 2012 21:38:43 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Ac18GqMKY4Q+QLyzRIe5LcaQ9fX//wAERR7g X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86388 > > In the case of a symbol, IMO most programs really want/need > > to grab a symbol _name_, often for use as the default value > > in an interactive spec. Most do not really want/need a Lisp > > symbol. And even when they do, they can call `intern' > > or `intern-soft' or `make-symbol' themselves. > > Then they should call (thing-at-point 'symbol), not > (symbol-at-point). Yes. On the other hand, for many such use cases it is not very useful to obtain a value of `nil' (a symbol, not a string) when there is no symbol name at point (not even "nil"). Function `non-nil-symbol-name-at-point' returns "" in that case. It is, in effect, (or (thing-at-point 'symbol) ""). > It seems like this tangent is because someone thought that the > latter should just be a shorthand for the former, but they do > different things and are intended for different situations. If > symbol-at-point doesn't do what you want (e.g. it interns things > when you would prefer it didn't), don't use it. No one's forcing > you to. Exactly. And not just "someone" - such confusion does not seem that rare. You might have come to understand that (thing-at-point 'symbol) returns a string, and you correctly distinguish it from what `symbol-at-point' does, but it is easy for others not to get this. Especially since `thing-at-point' does NOT always return a string - it returns a list for (thing-at-point 'list), for instance. There is nothing in the name, i.e., on the surface of it, that tells you that (thing-at-point 'symbol) returns either a symbol name or the symbol `nil'. It looks every bit like it might return the thing at point that is a symbol. This confusion wrt symbols is why it is helpful to provide a function that has `symbol-name' and not just `symbol' in its name, the former doing, in effect, what (or (thing-at-point 'symbol) "") does. BTW, I don't think most use cases really care whether or not the name has been interned. What is more important usually is what kind of value is returned: a symbol or a string (symbol name). The other thing that can be important for some use cases is to distinguish the absence of any symbol name at point from the presence of the symbol name "nil" at point. When picking up a symbol name to serve as a completion candidate for some input, it is often the case that "nil" is not appropriate. FWIW, this 2007 Emacs Devel thread discusses exactly what is being discussed in the present thread, and a bit more: http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg01520.html