From 74e35ba4d4cda486a664c44195b72425a2233c81 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Wed, 11 Aug 2021 13:00:28 -0400 Subject: * rt-liberation-org.el: code and stylistic changes --- rt-liberation-org.el | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/rt-liberation-org.el b/rt-liberation-org.el index 605c911..38a0be5 100644 --- a/rt-liberation-org.el +++ b/rt-liberation-org.el @@ -22,63 +22,44 @@ ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. -;;; Installation and Use: -;; -;; Detailed instructions for installation and use can be found in the -;; rt-liberation manual, in the doc/ directory of the distribution. - -;;; History: -;; -;; Started near the end of 2008. (require 'org) +(require 'rt-liberation) (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:')." - (require 'rt-liberation) (cond ((string-match "^id:\\([^/]+\\)\\(/\\(.+\\)\\)?" link) - (let ( - (id (match-string 1 link)) - (history-id (match-string 3 link)) - ) + (let ((id (match-string 1 link)) + (history-id (match-string 3 link))) (rt-liber-browse-query (format "id = \"%s\"" id)) (rt-liber-next-ticket-in-browser) (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) - ) + (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))) - ) - )))) + (setq current-history-id (alist-get 'id (rt-liber-viewer2-get-section-data)))))))) ((string-match "^query:\\(.+\\)" link) (rt-liber-browse-query (match-string 1 link))) - (t (error "Unrecognized link type '%s'" link)) - )) + (t (error "Unrecognized link type '%s'" link)))) (defun rt-org-store-link () "Stores an rt link in ticket-browser or ticker-viewer mode." - (require 'rt-liberation) (let ((ticket (or (get-text-property (point) 'rt-ticket) rt-liber-ticket-local))) (when ticket - (let* ( - (ticket-id-link (concat "rt:id:" (rt-liber-ticket-id-only ticket))) + (let* ((ticket-id-link (concat "rt:id:" (rt-liber-ticket-id-only ticket))) (subject (cdr (assoc "Subject" ticket))) (history-id (alist-get 'id (rt-liber-viewer2-get-section-data))) - (link (concat ticket-id-link (if history-id (concat "/" history-id) ""))) - ) + (link (concat ticket-id-link (if history-id (concat "/" history-id) "")))) (org-link-add-props :link link - :description subject - ) + :description subject) link)))) ;; org-add-link-type is obsolete as of org-mode 9. Instead we will use the @@ -86,11 +67,10 @@ (if (fboundp 'org-link-set-parameters) (org-link-set-parameters "rt" :follow #'rt-org-open - :store #'rt-org-store-link - ) - (org-add-link-type "rt" rt-org-open) - (add-hook 'org-store-link-functions 'rt-org-store-link) - ) + :store #'rt-org-store-link) + (org-add-link-type "rt" #'rt-org-open) + (add-hook 'org-store-link-functions 'rt-org-store-link)) + ;;; _ (provide 'rt-liberation-org) -- cgit v1.2.3