[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat ae4a2b5b4b 2/3: compat-28: Add bounds-of-thing-a
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat ae4a2b5b4b 2/3: compat-28: Add bounds-of-thing-at-mouse |
Date: |
Sun, 15 Jan 2023 15:57:26 -0500 (EST) |
branch: externals/compat
commit ae4a2b5b4bad773976f3f60c33b42f43456d9094
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
compat-28: Add bounds-of-thing-at-mouse
---
NEWS.org | 1 +
compat-28.el | 9 +++++++++
compat.texi | 8 ++++++++
3 files changed, 18 insertions(+)
diff --git a/NEWS.org b/NEWS.org
index 4dd85e9657..a7f5b0e648 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -7,6 +7,7 @@
- compat-27: Add generalized variables for ~decoded-time-*~.
- compat-28: Add ~macroexp-warn-and-return~.
- compat-28: Add ~subr-native-elisp-p~.
+- compat-28: Add ~bounds-of-thing-at-mouse~.
* Release of "Compat" Version 29.1.1.1
diff --git a/compat-28.el b/compat-28.el
index 6237ce04aa..e60ea41e4f 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -740,6 +740,15 @@ where the mouse button is clicked to find a thing nearby."
(mouse-set-point event)
(thing-at-point thing no-properties)))
+(compat-defun bounds-of-thing-at-mouse (event thing) ;; <UNTESTED>
+ "Determine start and end locations for THING at mouse click given by EVENT.
+Like `bounds-of-thing-at-point', but tries to use the position in EVENT
+where the mouse button is clicked to find the thing nearby."
+ :feature thingatpt
+ (save-excursion
+ (mouse-set-point event)
+ (bounds-of-thing-at-point thing)))
+
;;;; Defined in macroexp.el
(compat-defun macroexp-warn-and-return (msg form &optional _category
_compile-only _arg) ;; <OK>
diff --git a/compat.texi b/compat.texi
index dfee2b02f4..199afd2381 100644
--- a/compat.texi
+++ b/compat.texi
@@ -1784,6 +1784,14 @@ When @var{no-properties} has a non-@code{nil} value, any
text properties
that might have been present in the buffer are stripped away.
@end defun
+@c based on lisp/thingatpt.el
+@defun bounds-of-thing-at-mouse event thing
+Determine start and end locations for @var{thing} at mouse click given
+by @var{event}. Like @code{bounds-of-thing-at-point}, but tries to use
+the position in @var{event} where the mouse button is clicked to find
+the thing nearby.
+@end defun
+
@c based on lisp/emacs-lisp/macroexp.el
@defun macroexp-file-name
Return the name of the file in which the code is currently being