From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#64664: [PATCH] Ensure 'existing-filename' has 'bounds-of-thing-at-point' Date: Sun, 16 Jul 2023 12:03:28 +0000 Message-ID: <875y6k12sv.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6795"; mail-complaints-to="usenet@ciao.gmane.io" To: 64664@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 16 14:04:23 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qL0UA-0001VA-Vy for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Jul 2023 14:04:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qL0Ts-0001fW-Jc; Sun, 16 Jul 2023 08:04:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qL0Tq-0001f3-J8 for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 08:04:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qL0Tq-00036A-B0 for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 08:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qL0Tq-0000QQ-61 for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 08:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Jul 2023 12:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64664 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16895090231601 (code B ref -1); Sun, 16 Jul 2023 12:04:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Jul 2023 12:03:43 +0000 Original-Received: from localhost ([127.0.0.1]:46989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL0TX-0000Pk-3Y for submit@debbugs.gnu.org; Sun, 16 Jul 2023 08:03:43 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:51906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL0TT-0000PV-HN for submit@debbugs.gnu.org; Sun, 16 Jul 2023 08:03:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qL0TO-0001bt-88 for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 08:03:34 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qL0TM-0002wn-1r for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 08:03:34 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id A9503240104 for ; Sun, 16 Jul 2023 14:03:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1689509009; bh=pPV02xhTmrseLcT4jpLFpkQ2sAOsk7VHOM/2a2J7S/Q=; h=From:To:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=qnlnMieX6uR/E984xJ/02FtJxeJC2pXbKhC9057Zg8C6kEjcgUWc/TB0svuhsEYO7 f/oAC9kN5fBouk3j1SMFo3Zb1TptKI+w5p5j4vqvc7Rm7quNR4ZOfn/rrcqCb9Llq9 OmTgfj1Th+zYP7DIT+dX/G1MraMxYO/Ogn7jMB9giXt7UQer48Z2rmj9k27ofFdP5F T1RD/1BqvrkV0p1sqbq64x4rvXdMODILDOfTOHUzHbY26mDxtrQwwBxiGcWElY8wtq tlnS3uPdMkT7cTLJsPJc/NISCuzESiDSRIjUHouBOPZRAo7J6d0YmfsSs34frQSZQa yxaYxvcLr6kvw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4R3kPs2pwvz6trs for ; Sun, 16 Jul 2023 14:03:29 +0200 (CEST) Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265322 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Currently, it seems that (bounds-of-thing-at-point 'existing-filename) ;=> nil even if at the same time. (thing-at-point 'existing-filename) ;=> non-nil To reproduce in emacs -Q, write some existing filename into *scratch* and then using M-: evaluate the above expressions. I propose a simple fix in the patch below. In GNU Emacs 29.0.92 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0) of 2023-07-16 built on quetzal Repository revision: 17073af84d7eaedc81d84fc16f8aa0db215c6a31 Repository branch: emacs-29 System Description: Debian GNU/Linux 12 (bookworm) Configured using: 'configure --with-pgtk --with-native-compilation --with-imagemagick --with-tree-sitter' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Ensure-existing-filename-has-bounds-of-thing-at-poin.patch >From fcde115d5748880ad7ebbf43a10753fb7014a6e1 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 16 Jul 2023 13:56:23 +0200 Subject: [PATCH] Ensure 'existing-filename' has 'bounds-of-thing-at-point' * lisp/thingatpt.el (existing-filename): Define 'bounds-of-thing-at-point' for 'existing-filename'. --- lisp/thingatpt.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 9363a474cb5..5b6f706bd15 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -359,6 +359,10 @@ thing-at-point-file-at-point (and (file-exists-p filename) filename))) +(put 'existing-filename 'bounds-of-thing-at-point + (lambda () + (and (thing-at-point 'existing-filename) + (bounds-of-thing-at-point 'filename)))) (put 'existing-filename 'thing-at-point 'thing-at-point-file-at-point) ;; Faces -- 2.39.2 --=-=-=--