branch: externals/hyperbole commit 36601ca973b7bfe8d0f8f20ae4e5749d51f4727a Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
Bug#59903: Fix Action Key error due to issue in xref--item-at-point --- ChangeLog | 7 +++++++ hmouse-tag.el | 36 +++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 362b829ab7..03f689ebbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-01-08 Bob Weiner <r...@gnu.org> + +* hmouse-tag.el (xref--item-at-point): Fix this function (still broken + in Emacs29) to not error when called on a blank line at the beginning + of the buffer. Was triggering an Action Key error. Fix for 'unrelated + issue' reported in Emacs bug#59903. + 2023-01-08 Mats Lidell <ma...@gnu.org> * test/hui-tests.el (hui--kill-ring-save-in-kotl-mode-copies-region) diff --git a/hmouse-tag.el b/hmouse-tag.el index 45bbd95e27..3df2de10d4 100644 --- a/hmouse-tag.el +++ b/hmouse-tag.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 24-Aug-91 -;; Last-Mod: 28-Nov-22 at 02:48:17 by Bob Weiner +;; Last-Mod: 8-Jan-23 at 13:02:53 by Bob Weiner ;; ;; Copyright (C) 1991-2022 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -29,20 +29,26 @@ (load "tags-fix" t))))) ;; If etags utilizes the new xref.el library, define some helper -;; functions to simplify programming. -(when (and (featurep 'xref) (not (fboundp 'xref-definition))) - (defun xref-definition (identifier) - "Return the first definition of string IDENTIFIER." - (car (xref-backend-definitions (xref-find-backend) identifier))) - (defun xref-definitions (identifier) - "Return a list of all definitions of string IDENTIFIER." - (xref-backend-definitions (xref-find-backend) identifier)) - (defun xref-item-buffer (item) - "Return the buffer in which xref ITEM is defined." - (marker-buffer (save-excursion (xref-location-marker (xref-item-location item))))) - (defun xref-item-position (item) - "Return the buffer position where xref ITEM is defined." - (marker-position (save-excursion (xref-location-marker (xref-item-location item)))))) +;; functions to simplify programming and fix one existing function. +(when (require 'xref nil t) + ;; Fix next xref function to handle when called at beginning of buffer + (defun xref--item-at-point () + (get-text-property + (max (point-min) (if (eolp) (1- (point)) (point))) + 'xref-item)) + (when (not (fboundp 'xref-definition)) + (defun xref-definition (identifier) + "Return the first definition of string IDENTIFIER." + (car (xref-backend-definitions (xref-find-backend) identifier))) + (defun xref-definitions (identifier) + "Return a list of all definitions of string IDENTIFIER." + (xref-backend-definitions (xref-find-backend) identifier)) + (defun xref-item-buffer (item) + "Return the buffer in which xref ITEM is defined." + (marker-buffer (save-excursion (xref-location-marker (xref-item-location item))))) + (defun xref-item-position (item) + "Return the buffer position where xref ITEM is defined." + (marker-position (save-excursion (xref-location-marker (xref-item-location item))))))) ;;; ************************************************************************ ;;; Public variables