From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#24605: Subject: 25.1.50; form-at-point might fail for some THINGS Date: Tue, 04 Oct 2016 21:15:47 -0400 Message-ID: <877f9ny4sc.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1475630185 15283 195.159.176.226 (5 Oct 2016 01:16:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Oct 2016 01:16:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 24605@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 05 03:16:21 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 1braoh-0002nw-BM for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Oct 2016 03:16:15 +0200 Original-Received: from localhost ([::1]:45996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1braog-0003fm-0m for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Oct 2016 21:16:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1braoZ-0003eT-JM for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 21:16:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1braoU-0007KQ-EO for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 21:16:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1braoU-0007KM-7k for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 21:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1braoT-0002W1-Sb for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 21:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Oct 2016 01:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24605 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24605-submit@debbugs.gnu.org id=B24605.14756301249621 (code B ref 24605); Wed, 05 Oct 2016 01:16:01 +0000 Original-Received: (at 24605) by debbugs.gnu.org; 5 Oct 2016 01:15:24 +0000 Original-Received: from localhost ([127.0.0.1]:45061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1branr-0002V2-NF for submit@debbugs.gnu.org; Tue, 04 Oct 2016 21:15:23 -0400 Original-Received: from mail-it0-f43.google.com ([209.85.214.43]:35644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1branp-0002Ug-H6; Tue, 04 Oct 2016 21:15:22 -0400 Original-Received: by mail-it0-f43.google.com with SMTP id r192so161521101ita.0; Tue, 04 Oct 2016 18:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=xgT5mhJP1IwfhWxVXJkA0LdRS8ucdjH/tyDeQOdSw0Y=; b=W77FvBbdCBOC/mcPTHZbnceuA9arYudHmaLRMuSHBix1/GvUXSecLUsYRI3nnnHKY8 TkUtIh0B9HMof6bwD4fLJMHhYrQPL6G7YZT4ZMn23zw2rQMvyDdK7zc5pSZdsBvlcZIF WKQo9utr/2xvwVUTHjwG2MwWtWA3sVyu/gV2WN8ZkgUEJ4ycGvM3Fxtzecy/S2M0zuZM coN3nkutv8FoALXqi2M6Clur/rbAM2OV+XCJiKBB2hWLpXLgrZ/SC3jst3cKfKWqK5C4 FQ15SFSKJwu3kN7u7xXburfp4erlhtN7a4ilCjD/dXAXQ3DKt6gyKgYT8lfA7/1usMGt DCbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=xgT5mhJP1IwfhWxVXJkA0LdRS8ucdjH/tyDeQOdSw0Y=; b=Gxsw2636RVd2eN1AywTA+pEtebAgw8s2VflrUxHc6LyBVHwS393pUGToi57nDqIFCK c3BTrHgTaF01xCqH3AZzLmFiuXZzQ7DvrFbfGocNS0Y6QLcZsqxQgCh6PQUkvDRsTBLT siUo7wrRNJ8z4xkW+y/Gc7BExi9G/9W6pN/wylzBcHSeMKUEmjswxkMejQthf0974Jje cX6Ct8BdATomrv+XN32xRXlBDfpnAcOTYQzSEnrCa4/SsxhYXdVQUpSVQCk+BDveyBcl LcnZETAxzUN4Cvb3MOOKIxZoBWTmQWFpVGYkXishFJtINWlnCGtyt8TtFzxJU71aqUCw PScg== X-Gm-Message-State: AA6/9RmtrX4SGmTAX4OTF4k7uVeeaip0hRc1ZS12spViwEZYn5VVibK7k9uEwPGInIYaGw== X-Received: by 10.107.17.133 with SMTP id 5mr8257182ior.207.1475630115188; Tue, 04 Oct 2016 18:15:15 -0700 (PDT) Original-Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id z125sm12961848itc.0.2016.10.04.18.15.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Oct 2016 18:15:14 -0700 (PDT) In-Reply-To: (Tino Calancha's message of "Tue, 4 Oct 2016 15:22:39 +0900 (JST)") 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:124080 Archived-At: tags 24605 patch severity 24605 minor quit Tino Calancha writes: > Because `thing-at-point' doesn't return always a string, as > `form-at-point' currently assumes. [...] > > (with-temp-buffer > (require 'thingatpt) > (insert "1") > (let ((res > (cond ((and (number-at-point) > (form-at-point 'number)) 0) > ((and (number-at-point) > (not (form-at-point 'number))) -1) > ((and (not (number-at-point)) > (form-at-point 'number)) -2) > ((and (not (number-at-point)) > (not (form-at-point 'number))) -3)))) > (pcase res > ('0 (message "OK, both 'number-at-point and 'form-at-point successf= ull")) > (-1 (message "'number-at-point' works but (form-at-point 'number) f= ails")) > (-2 (message "(form-at-point 'number) works but 'number-at-point' f= ails")) > (-3 (message "Both 'number-at-point' and (form-at-point 'number) fa= ils"))))) > =3D> "=E2=80=99number-at-point=E2=80=99 works but (form-at-point =E2=80= =99number) fails" Well, it looks like `form-at-point' was assumed to be used only for implementing the foo-at-point functions, (form-at-point 'sexp 'numberp) does work fine for this. But we may as well let (form-at-point 'number) work too, since it's the more obvious way to call it. > (defun form-at-point (&optional thing pred) > - (let ((sexp (ignore-errors > - (thing-at-point--read-from-whole-string > - (thing-at-point (or thing 'sexp)))))) > + (let* ((obj (thing-at-point (or thing 'sexp))) > + (sexp (ignore-errors > + (if (stringp obj) > + (thing-at-point--read-from-whole-string obj) > + obj)))) I suggest keeping the `ignore-errors' strictly around the `thing-at-point--read-from-whole-string' call. > (if (or (not pred) (funcall pred sexp)) sexp)))