diff options
| author | Dmitry Gutov | 2022-02-21 02:59:50 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2022-02-21 02:59:50 +0200 |
| commit | 3d2c213ce99fec54bfd5230405e6fde753794b09 (patch) | |
| tree | e478edcd1a652e3df612371b5582ac3c37a9fdc3 | |
| parent | 0b755ee6951147f40fdf0b6ff4b78835f4e54bf9 (diff) | |
| download | emacs-3d2c213ce99fec54bfd5230405e6fde753794b09.tar.gz emacs-3d2c213ce99fec54bfd5230405e6fde753794b09.zip | |
Public-ize xref-current-item
* lisp/progmodes/xref.el (xref--current-item):
Rename to 'xref-current-item' (bug#53956). Update all references.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 17 |
2 files changed, 13 insertions, 6 deletions
| @@ -745,6 +745,8 @@ replacing entire matches. | |||
| 745 | 745 | ||
| 746 | *** New command 'xref-find-references-and-replace' to rename one identifier. | 746 | *** New command 'xref-find-references-and-replace' to rename one identifier. |
| 747 | 747 | ||
| 748 | *** New variable 'xref-current-item' (renamed from a private version). | ||
| 749 | |||
| 748 | ** File notifications | 750 | ** File notifications |
| 749 | 751 | ||
| 750 | +++ | 752 | +++ |
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 6677b4f0040..747151cd94e 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -485,13 +485,18 @@ To undo, use \\[xref-go-forward]." | |||
| 485 | (set-marker marker nil nil) | 485 | (set-marker marker nil nil) |
| 486 | (run-hooks 'xref-after-return-hook)))) | 486 | (run-hooks 'xref-after-return-hook)))) |
| 487 | 487 | ||
| 488 | (defvar xref--current-item nil) | 488 | (define-obsolete-variable-alias |
| 489 | 'xref--current-item | ||
| 490 | 'xref-current-item | ||
| 491 | "29.1") | ||
| 492 | |||
| 493 | (defvar xref-current-item nil) | ||
| 489 | 494 | ||
| 490 | (defun xref-pulse-momentarily () | 495 | (defun xref-pulse-momentarily () |
| 491 | (pcase-let ((`(,beg . ,end) | 496 | (pcase-let ((`(,beg . ,end) |
| 492 | (save-excursion | 497 | (save-excursion |
| 493 | (or | 498 | (or |
| 494 | (let ((length (xref-match-length xref--current-item))) | 499 | (let ((length (xref-match-length xref-current-item))) |
| 495 | (and length (cons (point) (+ (point) length)))) | 500 | (and length (cons (point) (+ (point) length)))) |
| 496 | (back-to-indentation) | 501 | (back-to-indentation) |
| 497 | (if (eolp) | 502 | (if (eolp) |
| @@ -548,7 +553,7 @@ If SELECT is non-nil, select the target window." | |||
| 548 | (window (pop-to-buffer buf t)) | 553 | (window (pop-to-buffer buf t)) |
| 549 | (frame (let ((pop-up-frames t)) (pop-to-buffer buf t)))) | 554 | (frame (let ((pop-up-frames t)) (pop-to-buffer buf t)))) |
| 550 | (xref--goto-char marker)) | 555 | (xref--goto-char marker)) |
| 551 | (let ((xref--current-item item)) | 556 | (let ((xref-current-item item)) |
| 552 | (run-hooks 'xref-after-jump-hook))) | 557 | (run-hooks 'xref-after-jump-hook))) |
| 553 | 558 | ||
| 554 | 559 | ||
| @@ -656,7 +661,7 @@ SELECT is `quit', also quit the *xref* window." | |||
| 656 | "Display the source of xref at point in the appropriate window, if any." | 661 | "Display the source of xref at point in the appropriate window, if any." |
| 657 | (interactive) | 662 | (interactive) |
| 658 | (let* ((xref (xref--item-at-point)) | 663 | (let* ((xref (xref--item-at-point)) |
| 659 | (xref--current-item xref)) | 664 | (xref-current-item xref)) |
| 660 | (when xref | 665 | (when xref |
| 661 | (xref--set-arrow) | 666 | (xref--set-arrow) |
| 662 | (xref--show-location (xref-item-location xref))))) | 667 | (xref--show-location (xref-item-location xref))))) |
| @@ -715,7 +720,7 @@ quit the *xref* buffer." | |||
| 715 | (let* ((buffer (current-buffer)) | 720 | (let* ((buffer (current-buffer)) |
| 716 | (xref (or (xref--item-at-point) | 721 | (xref (or (xref--item-at-point) |
| 717 | (user-error "Choose a reference to visit"))) | 722 | (user-error "Choose a reference to visit"))) |
| 718 | (xref--current-item xref)) | 723 | (xref-current-item xref)) |
| 719 | (xref--set-arrow) | 724 | (xref--set-arrow) |
| 720 | (xref--show-location (xref-item-location xref) (if quit 'quit t)) | 725 | (xref--show-location (xref-item-location xref) (if quit 'quit t)) |
| 721 | (if (fboundp 'next-error-found) | 726 | (if (fboundp 'next-error-found) |
| @@ -945,7 +950,7 @@ beginning of the line." | |||
| 945 | (let ((win (get-buffer-window (current-buffer)))) | 950 | (let ((win (get-buffer-window (current-buffer)))) |
| 946 | (and win (set-window-point win (point)))) | 951 | (and win (set-window-point win (point)))) |
| 947 | (xref--set-arrow) | 952 | (xref--set-arrow) |
| 948 | (let ((xref--current-item xref)) | 953 | (let ((xref-current-item xref)) |
| 949 | (xref--show-location (xref-item-location xref) t))) | 954 | (xref--show-location (xref-item-location xref) t))) |
| 950 | (t | 955 | (t |
| 951 | (error "No %s xref" (if backward "previous" "next")))))) | 956 | (error "No %s xref" (if backward "previous" "next")))))) |