From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: patch for thingatpt.el Date: Mon, 16 Jul 2007 13:33:08 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184607200 24159 80.91.229.12 (16 Jul 2007 17:33:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 17:33:20 +0000 (UTC) Cc: Emacs-Devel To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 19:33:18 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IAURh-00011S-0W for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2007 19:33:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAURg-0000XJ-8i for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2007 13:33:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IAURd-0000VJ-FF for emacs-devel@gnu.org; Mon, 16 Jul 2007 13:33:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IAURc-0000UD-T9 for emacs-devel@gnu.org; Mon, 16 Jul 2007 13:33:13 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAURc-0000Tw-Mq for emacs-devel@gnu.org; Mon, 16 Jul 2007 13:33:12 -0400 Original-Received: from tomts43.bellnexxia.net ([209.226.175.110] helo=tomts43-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IAURb-0007W6-TK for emacs-devel@gnu.org; Mon, 16 Jul 2007 13:33:12 -0400 Original-Received: from pastel.home ([70.53.192.24]) by tomts43-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070716173308.YZMP5730.tomts43-srv.bellnexxia.net@pastel.home> for ; Mon, 16 Jul 2007 13:33:08 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id C013A800D; Mon, 16 Jul 2007 13:33:08 -0400 (EDT) In-Reply-To: (Drew Adams's message of "Mon\, 16 Jul 2007 09\:55\:12 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74905 Archived-At: >>>>> "Drew" == Drew Adams writes: >> > Below is a patch for thingatpt.el that provides additional >> > functionality and new thing and form functions. In particular: >> > (1) it lets you supply a syntax-table argument to most functions, >> > to affect the definition of what a word etc. is, and (2) it >> > provides functions to return things near point, not >> > just precisely at point. >> >> I believe that point 1 is misguided. We have `with-syntax-table' >> for those cases and it is quite sufficient AFAIK. > Right, and it's a much better approach too. Sorry about that. My enhancement > predated `with-syntax-table', and I wasn't aware of it. > Here is an updated change log and patch, which also incorporates the `defun' > bug fix I sent after the previous patch. > ! (defun symbol-at-point-with-bounds (&optional non-nil) > ! "Return (SYMBOL START . END) with START and END of SYMBOL. > ! Return nil if no such Emacs Lisp symbol is found. > ! SYMBOL is the `symbol-at-point' (which see). > ! If optional arg NON-NIL is non-nil, then the nearest symbol other > ! than `nil' is sought." > ! (with-syntax-table emacs-lisp-mode-syntax-table > ! (form-at-point-with-bounds > ! 'symbol (if non-nil (lambda (sym) (and sym (symbolp sym))) > 'symbolp)))) This is wrong. The name is clearly generic, whereas the docstring then goes on to say it's only specific to Emacs Lisp symbols. I think the name is right and the docstring (and code) are wrong. Check "recent" changes to symbol-at-point where I've fixed a similar problem (basically you shouldn't call `read'). Stefan