0

I'd like to have clickable links to JIRA tickets in my Python code from within Emacs.

For example, I use doxygen docstrings in my integration test code, which links a ticket number:

def test_user_type_isolation(self):
    """
    Ensure UDT cannot be used from another keyspace
    @jira_ticket CASSANDRA-9409
    @since 2.2
    """
    ....

I'd like to be able to click the CASSANDRA-9409 and have it go directly to the JIRA ticket it's referencing. I found button-lock-mode and it works great! However, this elisp works in every mode except for python-mode:

(require 'button-lock)
(global-button-lock-mode 1)

(setq cassandra-jira-button
      (button-lock-set-button "CASSANDRA-[0-9]+"
        #'(lambda ()
            (interactive)
            (browse-url (concat "https://issues.apache.org/jira/browse/"
                         (thing-at-point 'symbol)))
        )
    :face 'link :face-policy 'prepend))

It's not just my code though, none of the examples included in button-lock.el work in python-mode either. So, does anyone know what might be causing the conflict?

EnigmaCurry
  • 5,597
  • 2
  • 23
  • 15

1 Answers1

1

I don't know anything about button-lock-mode, but Emacs comes with bug-reference-mode, and the very useful sub-mode bug-reference-prog-mode. I would suggest using those instead. For your use you would want to configure this via bug-reference-bug-regexp and bug-reference-url-format.

bug-reference-prog-mode is handy because it limits its buttonizing behavior to comments and strings -- perfect for programming modes.

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63
  • That's perfect. Thank-you! I'll probably use that, but I'll leave this question open in case I can figure out the button-lock-mode because I can envision a few other uses for it still. – EnigmaCurry Jul 30 '15 at 04:30
  • Awesome, I was able to achieve multiple bug tracker hyperlinks using this: https://gist.github.com/EnigmaCurry/487e2ec34258c68dd48a – EnigmaCurry Jul 31 '15 at 00:51