From 16947d6b1a2679ca94f9986b0dc77683cfad900f Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 28 Mar 2023 00:14:03 +1100 Subject: Adding function to go to next / previous header of the same thing --- buildbot-view.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'buildbot-view.el') diff --git a/buildbot-view.el b/buildbot-view.el index e1b8e55..dd0d4b0 100644 --- a/buildbot-view.el +++ b/buildbot-view.el @@ -37,6 +37,17 @@ (beginning-of-line 1))) (define-key buildbot-view-mode-map "n" 'buildbot-view-next-header) +(defun buildbot-view-next-header-same-thing (n) + (interactive "p") + (when-let + ((type (get-text-property (point) 'type))) + (dotimes (_ n) + (buildbot-view-next-header 1) + (while (not (eq (get-text-property (point) 'type) type)) + (buildbot-view-next-header 1))))) +(define-key buildbot-view-mode-map (kbd "M-n") + 'buildbot-view-next-header-same-thing) + (defun buildbot-view-previous-header (n) (interactive "p") (beginning-of-line 1) @@ -46,6 +57,17 @@ (re-search-backward buildbot-view-header-regex))) (define-key buildbot-view-mode-map "p" 'buildbot-view-previous-header) +(defun buildbot-view-previous-header-same-thing (n) + (interactive "p") + (when-let + ((type (get-text-property (point) 'type))) + (dotimes (_ n) + (buildbot-view-previous-header 1) + (while (not (eq (get-text-property (point) 'type) type)) + (buildbot-view-previous-header 1))))) +(define-key buildbot-view-mode-map (kbd "M-p") + 'buildbot-view-previous-header-same-thing) + (defun buildbot-view-format-revision-info (revision-info) (propertize (format -- cgit v1.2.3