Move to the next reference and display it in the other window
(@code{xref-next-line}).
+@item N
+@findex xref-next-group
+Move to the first reference of the next reference group and display it
+in the other window (@code{xref-next-group}).
+
@item p
@itemx ,
@findex xref-prev-line
Move to the previous reference and display it in the other window
(@code{xref-prev-line}).
+@item P
+@findex xref-prev-group
+Move to the first reference of the previous reference group and
+display it in the other window (@code{xref-prev-group}).
+
@item C-o
@findex xref-show-location-at-point
Display the reference on the current line in the other window
performance in certain cases, in particular for case-insensitive
searches.
++++
+*** New commands 'xref-prev-group' and 'xref-next-group'.
+These commands are bound respectively to 'P' and 'N', and navigate to
+the first item of the previous or next group in the "*xref*" buffer.
+
** json.el
---
(xref--search-property 'xref-item t)
(xref-show-location-at-point))
+(defun xref-next-group ()
+ "Move to the first item of the next xref group and display its source."
+ (interactive)
+ (xref--search-property 'xref-group)
+ (xref--search-property 'xref-item)
+ (xref-show-location-at-point))
+
+(defun xref-prev-group ()
+ "Move to the first item of the previous xref group and display its source."
+ (interactive)
+ ;; Search for the xref group of the current item, provided that the
+ ;; point is not already in an xref group.
+ (unless (plist-member (text-properties-at (point)) 'xref-group)
+ (xref--search-property 'xref-group t))
+ ;; Search for the previous xref group.
+ (xref--search-property 'xref-group t)
+ (xref--search-property 'xref-item)
+ (xref-show-location-at-point))
+
(defun xref--item-at-point ()
(save-excursion
(back-to-indentation)
(let ((map (make-sparse-keymap)))
(define-key map (kbd "n") #'xref-next-line)
(define-key map (kbd "p") #'xref-prev-line)
+ (define-key map (kbd "N") #'xref-next-group)
+ (define-key map (kbd "P") #'xref-prev-group)
(define-key map (kbd "r") #'xref-query-replace-in-results)
(define-key map (kbd "RET") #'xref-goto-xref)
(define-key map (kbd "TAB") #'xref-quit-and-goto-xref)