summaryrefslogtreecommitdiff
path: root/rt-liberation-viewer.el
diff options
context:
space:
mode:
authorYoni Rabkin <yoni@rabkins.net>2020-11-16 22:33:26 -0500
committerYoni Rabkin <yoni@rabkins.net>2020-11-16 22:33:26 -0500
commit237b11d4507ee8b1208cab40eddf9d2c6747a183 (patch)
tree71cab23b44f4bf75dd3b61cf69fd20dfc3f162f1 /rt-liberation-viewer.el
parent0ee9eba3a41a1dfc5c79abf5df2439ba5e497030 (diff)
* rt-liberation-viewer.el: reorganize
Diffstat (limited to 'rt-liberation-viewer.el')
-rw-r--r--rt-liberation-viewer.el69
1 files changed, 37 insertions, 32 deletions
diff --git a/rt-liberation-viewer.el b/rt-liberation-viewer.el
index e3b6309..bc0e15d 100644
--- a/rt-liberation-viewer.el
+++ b/rt-liberation-viewer.el
@@ -36,37 +36,14 @@
"Type: " "Field: " "OldValue: "
"NewValue: " "Data: "
"Description: " "Created: "
- "Creator: " "Attachments: ") t)))
+ "Creator: " "Attachments: ")
+ t)))
(list
(list (concat "^" header-regexp ".*$") 0
'font-lock-comment-face)))
"Expressions to font-lock for RT ticket viewer.")
-(defun rt-liber-jump-to-latest-correspondence ()
- "Move point to the newest correspondence section."
- (interactive)
- (let (latest-point)
- (save-excursion
- (goto-char (point-max))
- (when (re-search-backward rt-liber-correspondence-regexp
- (point-min) t)
- (setq latest-point (point))))
- (if latest-point
- (progn
- (goto-char latest-point)
- (rt-liber-next-section-in-viewer))
- (message "no correspondence found"))))
-
-(defun rt-liber-viewer-visit-in-browser ()
- "Visit this ticket in the RT Web interface."
- (interactive)
- (let ((id (rt-liber-ticket-id-only rt-liber-ticket-local)))
- (if id
- (browse-url
- (concat rt-liber-base-url "Ticket/Display.html?id=" id))
- (error "no ticket currently in view"))))
-
(defun rt-liber-display-ticket-history (ticket-alist &optional assoc-browser)
"Display history for ticket.
@@ -93,6 +70,34 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
(setq buffer-read-only t)))
(switch-to-buffer new-ticket-buffer)))
+
+;;; ------------------------------------------------------------------
+;;; viewer mode functions
+;;; ------------------------------------------------------------------
+(defun rt-liber-jump-to-latest-correspondence ()
+ "Move point to the newest correspondence section."
+ (interactive)
+ (let (latest-point)
+ (save-excursion
+ (goto-char (point-max))
+ (when (re-search-backward rt-liber-correspondence-regexp
+ (point-min) t)
+ (setq latest-point (point))))
+ (if latest-point
+ (progn
+ (goto-char latest-point)
+ (rt-liber-next-section-in-viewer))
+ (message "no correspondence found"))))
+
+(defun rt-liber-viewer-visit-in-browser ()
+ "Visit this ticket in the RT Web interface."
+ (interactive)
+ (let ((id (rt-liber-ticket-id-only rt-liber-ticket-local)))
+ (if id
+ (browse-url
+ (concat rt-liber-base-url "Ticket/Display.html?id=" id))
+ (error "no ticket currently in view"))))
+
(defun rt-liber-viewer-mode-quit ()
"Bury the ticket viewer."
(interactive)
@@ -129,6 +134,13 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
(message "no previous section"))
(goto-char (point-at-bol)))
+(defun rt-liber-refresh-ticket-history (&optional _ignore-auto _noconfirm)
+ (interactive)
+ (if rt-liber-ticket-local
+ (rt-liber-display-ticket-history rt-liber-ticket-local
+ rt-liber-assoc-browser)
+ (error "not viewing a ticket")))
+
(defconst rt-liber-viewer-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "q") 'rt-liber-viewer-mode-quit)
@@ -165,15 +177,8 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
(rt-liber-jump-to-latest-correspondence))
(run-hooks 'rt-liber-viewer-hook))
-(defun rt-liber-refresh-ticket-history (&optional _ignore-auto _noconfirm)
- (interactive)
- (if rt-liber-ticket-local
- (rt-liber-display-ticket-history rt-liber-ticket-local
- rt-liber-assoc-browser)
- (error "not viewing a ticket")))
;; wrapper functions around specific functions provided by a backend
-
(declare-function
rt-liber-gnus-compose-reply-to-requestor
"rt-liberation-gnus.el")