'How can I treat certain patterns as web-site links, that can be followed with org-open-at-point?
At work I frequently deal with support issues that my company keeps track of in a web-based bug tracker.
Each issue has an URL that looks like https://mycompany.com/support/SUPPORT-12345
, but of course I don't want to spell this out every time I mention a support issue in my Org-mode file. I would like set up Org-mode in such a way that the pattern SUPPORT-(\d+)
is treated as a hyperlink to https://mycompany.com/support/SUPPORT-\1
.
I would like to be able to place my cursor over the SUPPORT-2345
, type C-c C-o
, and have Emacs point my browser to https://mycompany.com/support/SUPPORT-2345
. Ideally, SUPPORT-2345
would behave no different than a hyperlink.
Can Org-mode be configured in this way? If not, what is the best alternative?
Solution 1:[1]
You should be able to do this with org-link-abbrev-alist
. For example, see the below for some I use. You can then put [[Support:1234]]
in your Org-mode file and have it treated as the expanded link.
(setq org-link-abbrev-alist
'(
("DOI" . "http://dx.doi.org/")
("FreshDesk" . "https://xyz.freshdesk.com/support/tickets/")
("JIRA" . "https://jira.apps.monash.edu/browse/")
("Support" . "https://support.xyz.com/helpdesk/tickets/")
("ISBN" . "http://isbn.nu/")))
Solution 2:[2]
I don't know whether Org-mode have this feature, but there is a bug-reference-mode
for it.
Here is sample org file:
;; Local Variables:
;; eval: (bug-reference-mode)
;; bug-reference-bug-regexp: "\\(\\(?:\\(?:SUPPORT\\|support\\)-\\)\\([0-9]+\\)\\)"
;; bug-reference-url-format: "https://mycompany.com/support/SUPPORT-%s"
;; End:
* SUPPORT-123
* support-1234
And you can move point on support-* and press C-c RET
(bug-reference-push-button) to open it.
For more detail about Bug Reference, please refer to C-h r g Bug Reference
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Peter Mortensen |
Solution 2 | Peter Mortensen |