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#24605: Subject: 25.1.50; form-at-point might fail for some THINGS Date: Wed, 5 Oct 2016 12:35:45 +0900 (JST) Message-ID: References: <877f9ny4sc.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1475638592 11643 195.159.176.226 (5 Oct 2016 03:36:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Oct 2016 03:36:32 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 24605@debbugs.gnu.org, Tino Calancha To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 05 05:36:28 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 1brd08-0000OT-K4 for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Oct 2016 05:36:12 +0200 Original-Received: from localhost ([::1]:46312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brd07-00039T-7w for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Oct 2016 23:36:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brd00-00039D-Tq for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 23:36:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brczy-0001fo-6e for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 23:36:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brczy-0001fc-34 for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 23:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1brczx-0007bR-Qt for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 23:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Oct 2016 03:36: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: patch Original-Received: via spool by 24605-submit@debbugs.gnu.org id=B24605.147563855629215 (code B ref 24605); Wed, 05 Oct 2016 03:36:01 +0000 Original-Received: (at 24605) by debbugs.gnu.org; 5 Oct 2016 03:35:56 +0000 Original-Received: from localhost ([127.0.0.1]:45089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brczs-0007b9-D6 for submit@debbugs.gnu.org; Tue, 04 Oct 2016 23:35:56 -0400 Original-Received: from mail-pa0-f42.google.com ([209.85.220.42]:35921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brczq-0007at-Ur for 24605@debbugs.gnu.org; Tue, 04 Oct 2016 23:35:55 -0400 Original-Received: by mail-pa0-f42.google.com with SMTP id ry6so3925669pac.3 for <24605@debbugs.gnu.org>; Tue, 04 Oct 2016 20:35:54 -0700 (PDT) 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=lNbB6iejS6GjJO5R3BG8wE/s/xA+KV0tqOaFkirUnrQ=; b=UbyGDL4hkYu2JfzOe6ZNbkEamcPgDDEEsmHQXi4HnKcPCkh4585Uv8SSftSJCs6Hgb y5d5d2IwoTyPDFQ6LxpN4PfIF3ZTIfgUyGsyHJ+OAtvCVL5Eq9hz5bdFxZt9HGcmpMp/ HGQbfBk7JFS4oB0bcrSAENLWrZNAD85Olcgmyv598BkQBwj11KdPq1yXxsgsQUDhVLcx y1xVuJe9wyPYHFGuJAEjbTjwo+LgmHEY2iWJLqGebGLc8mSzWd4W1YDBNActStnkpodQ JMsV8VPq28lhku4rNDQvT+/pfYzbmQxLyF/Z7Sr2vbTos6JZYpccvY35FLcSvFlt/FRF puew== 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=lNbB6iejS6GjJO5R3BG8wE/s/xA+KV0tqOaFkirUnrQ=; b=TBo0yidQ2ZJROX/3LNVjD/TLMjoBPA5UrVvf6A07jSBww1NomifMAXBN/lKdyGkNmc LBcLOLYSP9FrzaVj8uT9gL6oZ7Xa6Dq3LQV4o/6HI99JmI9Ch6s3mMWsvkgefSuM0k3j G6XUJ8EtRolsbISY1M3rDL4jFFtyz8RSQeUIsuvYPqV3d9RFbj5OjMSiIcjlF3b5UPmM RMaqL5e1GJeI6loJN9oNL3u/E3KLBwnv8W6lVvhbNsPbQNjBis/josss4B/NtlMtMY0Z yXAeR+aiyUr5+K6YGkU9bmkk/IN51kKw68yiGFnpZsniWq4BhyfwBOrahL4F2hITI6BG f+mA== X-Gm-Message-State: AA6/9RlozePmRZuhGaAFyk5Rg422sgkYt/YOKKRGV2mgt07ygJcA/x+db1kVP5G5MZoMbw== X-Received: by 10.66.87.131 with SMTP id ay3mr10013760pab.193.1475638548707; Tue, 04 Oct 2016 20:35:48 -0700 (PDT) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id ak3sm9244951pad.19.2016.10.04.20.35.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Oct 2016 20:35:48 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <877f9ny4sc.fsf@users.sourceforge.net> 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:124083 Archived-At: Thank you for the e-mail. On Tue, 4 Oct 2016, npostavs@users.sourceforge.net wrote: > 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. In my case i use lib thingatpt+, so i have: (get 'list 'thing-at-point) => tap-list-at-point That causes `list-at-point' always fails regardless on where it is the point, for the same reason: `tap-list-at-point' returns a cons not an string. > I suggest keeping the `ignore-errors' strictly around the > `thing-at-point--read-from-whole-string' call. Ok, corrected the patch: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From ea4c09df929451f4268ea4d608ee11bb4249854f Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Wed, 5 Oct 2016 12:25:07 +0900 Subject: [PATCH] form-at-point work for all kind of THINGS * lisp/thingatpt.el (form-at-point): Use thing-at-point--read-from-whole-string only if thing-at-point returns a string (Bug#24605). --- lisp/thingatpt.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index df5c52d..6d1014b 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -586,9 +586,11 @@ 'read-from-whole-string "This is an internal thingatpt function and should not be used.") (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 (if (stringp obj) + (ignore-errors + (thing-at-point--read-from-whole-string obj)) + obj))) (if (or (not pred) (funcall pred sexp)) sexp))) ;;;###autoload -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.0) of 2016-10-04 built on calancha-pc Repository revision: e2913dc880b9843bf69cf885270551bafeb46120