unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: 64664@debbugs.gnu.org
Subject: bug#64664: [PATCH] Ensure 'existing-filename' has 'bounds-of-thing-at-point'
Date: Sun, 16 Jul 2023 12:03:28 +0000	[thread overview]
Message-ID: <875y6k12sv.fsf@posteo.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 716 bytes --]

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'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Ensure-existing-filename-has-bounds-of-thing-at-poin.patch --]
[-- Type: text/patch, Size: 908 bytes --]

From fcde115d5748880ad7ebbf43a10753fb7014a6e1 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
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


                 reply	other threads:[~2023-07-16 12:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875y6k12sv.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=64664@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).