From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.bugs Subject: bug#8634: 24.0.50; `number-at-point' returns char value for `?' constructs - 1) doc, 2) new fns Date: Mon, 10 Feb 2014 15:27:27 +0100 Message-ID: <87d2ivavqo.fsf@yahoo.fr> References: <458B95C58F7348C2AA62A340071C6E1C@us.oracle.com> <87lhxk7pjl.fsf@building.gnus.org> <83r47cuupv.fsf@gnu.org> <87fvnrzsjq.fsf@building.gnus.org> <83eh3bvdlh.fsf@gnu.org> <87iosnehy4.fsf@building.gnus.org> <444a1561-7d78-4d58-a2c3-8b4c7858071d@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392042494 8211 80.91.229.3 (10 Feb 2014 14:28:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Feb 2014 14:28:14 +0000 (UTC) Cc: 8634@debbugs.gnu.org, Lars Ingebrigtsen To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 10 15:28:18 2014 Return-path: Envelope-to: geb-bug-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 1WCrqM-0007PX-C3 for geb-bug-gnu-emacs@m.gmane.org; Mon, 10 Feb 2014 15:28:18 +0100 Original-Received: from localhost ([::1]:55884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCrqL-0002cn-U0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 10 Feb 2014 09:28:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCrqC-0002VM-Sp for bug-gnu-emacs@gnu.org; Mon, 10 Feb 2014 09:28:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCrq7-0007Tn-HU for bug-gnu-emacs@gnu.org; Mon, 10 Feb 2014 09:28:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCrq7-0007Th-EJ for bug-gnu-emacs@gnu.org; Mon, 10 Feb 2014 09:28:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WCrq6-0006RK-AN for bug-gnu-emacs@gnu.org; Mon, 10 Feb 2014 09:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Richard Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Feb 2014 14:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8634 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8634-submit@debbugs.gnu.org id=B8634.139204245324717 (code B ref 8634); Mon, 10 Feb 2014 14:28:02 +0000 Original-Received: (at 8634) by debbugs.gnu.org; 10 Feb 2014 14:27:33 +0000 Original-Received: from localhost ([127.0.0.1]:39368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCrpc-0006Qa-EJ for submit@debbugs.gnu.org; Mon, 10 Feb 2014 09:27:32 -0500 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]:16226) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCrpZ-0006QL-MP for 8634@debbugs.gnu.org; Mon, 10 Feb 2014 09:27:30 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EANPg+FKkD4Xx/2dsb2JhbABZw1iBJnSCJQEBBAF5EAgDISUPAQRJE4dwAQwIqUaWZwGJHReHcocLB4Q4BJgrhjGLcIFvgT87 Original-Received: from mathsrv4.ulb.ac.be (HELO geodiff-mac3) ([164.15.133.241]) by smtp.ulb.ac.be with ESMTP; 10 Feb 2014 15:27:27 +0100 In-Reply-To: <444a1561-7d78-4d58-a2c3-8b4c7858071d@default> (Drew Adams's message of "Sun, 9 Feb 2014 20:06:42 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:85263 Archived-At: Drew Adams writes: >> I just tried saying the same in the *scratch* buffer, and there it >> returns 65! >> >> Here in the Message buffer it returns nil. It does in a >> fundamental-mode buffer, too... > > Sounds like we might be getting somewhere now. Something in > certain buffers causes `number-at-point' to do the wrong thing. That is because number-at-point uses the 'sexp at point, which depends on the syntax table. The following definition seems to fix that dependance (500 is arbitrary choice -- the same arbitrary choice as for emails) : diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 9a40049..7b4cf56 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -581,7 +581,10 @@ Signal an error if the entire string was not used." ;;;###autoload (defun number-at-point () "Return the number at point, or nil if none is found." - (form-at-point 'sexp 'numberp)) + (when (thing-at-point-looking-at "-?[0-9]+\\.?[0-9]*" 500) + (string-to-number + (buffer-substring (match-beginning 0) (match-end 0))))) + (put 'number 'thing-at-point 'number-at-point) ;;;###autoload (defun list-at-point () -- Nico.