diff options
author | Yuchen Pei <me@ypei.me> | 2021-08-12 11:02:26 +1000 |
---|---|---|
committer | Yuchen Pei <me@ypei.me> | 2021-08-12 11:02:26 +1000 |
commit | ee361633cbdbf97a6331aa7d9721a734b7bbe207 (patch) | |
tree | ea8e78d4f234fe5e1ad226c5a6f385ee39eb612e | |
parent | 5293fda690c04309bb4e48b6e8a5d8307ffeeff2 (diff) |
Factoring out the function that moves the point to a ticket section.
-rw-r--r-- | rt-liberation-org.el | 11 | ||||
-rw-r--r-- | rt-liberation.el | 14 |
2 files changed, 16 insertions, 9 deletions
diff --git a/rt-liberation-org.el b/rt-liberation-org.el index 0f58a64..a682ed4 100644 --- a/rt-liberation-org.el +++ b/rt-liberation-org.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; Author: Yuchen Pei <hi@ypei.me> +;; Authors: Yoni Rabkin <yrk@gnu.org> ;; Maintainer: Yoni Rabkin <yrk@gnu.org> ;; This file is a part of rt-liberation. @@ -36,14 +37,8 @@ (rt-liber-browse-query (format "id = \"%s\"" id)) (rt-liber-browser-move-point-to-ticket id) (rt-liber-ticket-at-point) - (if history-id - (let ((current-history-id (alist-get 'id (rt-liber-viewer2-get-section-data))) - (previous-history-id nil)) - (while (not (or (string-equal history-id current-history-id) - (eq current-history-id previous-history-id))) - (setq previous-history-id current-history-id) - (rt-liber-viewer2-next-section-in) - (setq current-history-id (alist-get 'id (rt-liber-viewer2-get-section-data)))))))) + (when history-id + (rt-liber-viewer-move-point-to-section history-id)))) ((string-match "^query:\\(.+\\)" link) (rt-liber-browse-query (match-string 1 link))) (t (error "Unrecognized link type '%s'" link)))) diff --git a/rt-liberation.el b/rt-liberation.el index 1140eed..51efc69 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; Author: Yoni Rabkin <yrk@gnu.org> -;; Authors: Aaron S. Hawley <aaron.s.hawley@gmail.com>, John Sullivan <johnsu01@wjsullivan.net> +;; Authors: Aaron S. Hawley <aaron.s.hawley@gmail.com>, John Sullivan <johnsu01@wjsullivan.net>, Yuchen Pei <hi@ypei.me> ;; Maintainer: Yoni Rabkin <yrk@gnu.org> ;; Version: 2.4rc ;; Keywords: rt, tickets @@ -785,6 +785,18 @@ returned as no associated text properties." (message "no previous section")) (goto-char (point-at-bol))) +(defun rt-liber-viewer-move-point-to-section (history-id) + "Move point to the beginning of section with HISTORY-ID." + (let ((current-history-id (alist-get 'id (rt-liber-viewer2-get-section-data))) + (previous-history-id nil)) + (while (not (or (string-equal history-id current-history-id) + (eq current-history-id previous-history-id))) + (setq previous-history-id current-history-id) + (rt-liber-viewer2-next-section-in) + (setq current-history-id (alist-get 'id (rt-liber-viewer2-get-section-data)))) + (when (not (string-equal history-id current-history-id)) + (error "Cannot find section.")))) + ;; wrapper functions around specific functions provided by a backend (declare-function rt-liber-gnus-compose |