summaryrefslogtreecommitdiff
path: root/rt-liberation-org.el
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2021-07-27 16:37:40 +1000
committerYuchen Pei <me@ypei.me>2021-07-27 16:37:40 +1000
commit8dd984effdc99dda0426ac715e7e34c90422be20 (patch)
tree8cc03f626dd27000546af8b9223b6f77fff136f6 /rt-liberation-org.el
parent19cadf0137cfaefb5012fd62611397129752761a (diff)
updating rt-org-open to allow opening a specific section of a ticket
rt:id:123#2 goes to the second section of ticket #123
Diffstat (limited to 'rt-liberation-org.el')
-rw-r--r--rt-liberation-org.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/rt-liberation-org.el b/rt-liberation-org.el
index 0943774..70dd536 100644
--- a/rt-liberation-org.el
+++ b/rt-liberation-org.el
@@ -34,14 +34,19 @@
(defun rt-org-open (link)
"Opens the rt LINK.
- Open the rt ticket (for links starting with 'id:') or run
- the query (for links starting with 'query:')."
+ Open the rt ticket (for links starting with 'id:') or run
+ the query (for links starting with 'query:')."
(require 'rt-liberation)
(cond
- ((string-match "^id:\\(.+\\)" link)
- (rt-liber-browse-query (format "id = \"%s\"" (match-string 1 link)))
- (rt-liber-ticket-at-point)
- )
+ ((string-match "^id:\\([^#]+\\)\\(#\\(.+\\)\\)?" link)
+ (let ((id (match-string 1 link))
+ (section (string-to-number (or (match-string 3 link) "0"))))
+ (rt-liber-browse-query (format "id = \"%s\"" id))
+ (rt-liber-next-ticket-in-browser)
+ (rt-liber-ticket-at-point)
+ (dotimes (unused section)
+ (rt-liber-viewer2-next-section-in))
+ ))
((string-match "^query:\\(.+\\)" link)
(rt-liber-browse-query (match-string 1 link)))
(t (error "Unrecognized link type '%s'" link))))