I use org-mode to manage my notes and TODOs. At work, we use Jira to track bugs and development stories and I'd like to make this a bit easier.

I'd like to make all DEV-[0-9]+, BUG-[0-9]+ and some other terms behave like a normal URL, so that they are clickable (no need to make a explicit org-mode link) and that they open a URL with the matched term appended to them.

So DEV-1234 should be recognized as a link, and when I click on it Emacs should open the URL http://jira/browse/DEV-1234.

If possible, I'd like to have other terms with other endpoints as well.

  • 2
    You may want to look at bug-reference-mode
    – YoungFrog
    Aug 25, 2016 at 7:42

3 Answers 3


One straightforward way is to

  1. write a function inserting the desired buttons and then
  2. hook it up with font-lock.
(defvar jira-link-url "http://jira/browse/%s")

(defun jira-link-insert-buttons (beg end)
  (remove-overlays beg end 'type 'jira-link)
    (goto-char beg)
    (while (re-search-forward "\\_<\\(DEV\\|BUG\\)-[0-9]+\\_>" end t)
      (make-button (match-beginning 0)
                   (match-end 0)
                   'type 'jira-link
                   'action (lambda (button)
                             (browse-url (format jira-link-url (button-get button 'text))))
                   'follow-link t
                   'text (match-string 0)))))

(define-minor-mode jira-link-mode nil nil nil nil
    (jit-lock-register #'jira-link-insert-buttons)
    (jira-link-insert-buttons (point-min) (point-max)))
    (jit-lock-unregister #'jira-link-insert-buttons)
    (remove-overlays (point-min) (point-max) 'type 'jira-link))))

Another approach is the button-lock package.

(require 'button-lock)

 (lambda ()
   (browse-url (concat "http://jira/browse/"
            (previous-single-property-change (point) 'mouse-face)
            (next-single-property-change (point) 'mouse-face)))))
 :face (list 'org-link))

An Org-native approach: use a link abbreviation.


To enable:

(add-to-list 'org-link-abbrev-alist 
    '("jira-dev" . "http://jira/browse/DEV-%s"))

just correcting to -alist but adding this comment because edits must be at least 6 characters for some reason

And similarly for BUG-* etc.

With a suitably constructed org-capture template you could enter just "1234" in response to a prompt and then have the rest automagically filled in for you.

  • I think this is great for a beginner like me. May you suggest me where to put this function? ~/.emacs?
    – vault
    Mar 23, 2018 at 12:01
  • But of course! :-) Mar 24, 2018 at 13:57
  • i'm currently using (setq org-link-abbrev-alist ..., are you sure of your command add-to-list?
    – vault
    Mar 25, 2018 at 19:34
  • Not mine, it's built-in. C-h f add-to-list RET will tell you how it works. Probably less laborious, more concise, clearer and less error-prone than the setq approach. Mar 26, 2018 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.