Skip to content

Instantly share code, notes, and snippets.

@EnigmaCurry
Last active August 29, 2015 14:26
Show Gist options
  • Save EnigmaCurry/487e2ec34258c68dd48a to your computer and use it in GitHub Desktop.
Save EnigmaCurry/487e2ec34258c68dd48a to your computer and use it in GitHub Desktop.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Hyperlink JIRA ticket numbers for DataStax projects
;;
;; For example, all of these tickets should be clickable when
;; bug-reference-prog-mode or bug-reference-mode are enabled :
;;
;; CASSANDRA-8099
;; PYTHON-363
;; TESTINF-386
;; DSP-6091
;;
;; This is setup to only apply to a single directory of source code
;; (and it's subdirectories.) Set datastax-source-directory to
;; reflect your local directory.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq datastax-source-directory "/home/ryan/git/datastax")
(setq datastax-bugref-jira-apache "CASSANDRA\\|INFRA\\|THRIFT\\|HBASE\\|HADOOP")
(setq datastax-bugref-jira-datastax "DSP\\|TESTINF\\|DOC\\|COMMUNITY")
(setq datastax-bugref-jira-datastax-oss "PYTHON\\|CSHARP\\|RUBY\\|JAVA\\|NODEJS\\|CPP\\|PHP\\|SPARKC")
(setq datastax-bugref-regexp-datastax (concat "\\("
datastax-bugref-jira-apache "\\|"
datastax-bugref-jira-datastax "\\|"
datastax-bugref-jira-datastax-oss
"\\)-\\([0-9]+\\)"
))
(defun datastax-bugref-url-format ()
(let ((ticket-type (match-string 1)) (ticket-number (match-string 2)))
(if (member ticket-type (split-string datastax-bugref-jira-apache "|" nil "\\\\"))
(setq url (concat "https://issues.apache.org/jira/browse/" ticket-type "-" ticket-number))
)
(if (member ticket-type (split-string datastax-bugref-jira-datastax "|" nil "\\\\"))
(setq url (concat "https://datastax.jira.com/browse/" ticket-type "-" ticket-number))
)
(if (member ticket-type (split-string datastax-bugref-jira-datastax-oss "|" nil "\\\\"))
(setq url (concat "https://datastax-oss.atlassian.net/browse/" ticket-type "-" ticket-number))
)
)
url
)
;; Setup directory local variables for DataStax code:
(dir-locals-set-class-variables
'datastax
`((nil . ((bug-reference-url-format . datastax-bugref-url-format)
(bug-reference-bug-regexp . ,datastax-bugref-regexp-datastax)
))))
(dir-locals-set-directory-class
datastax-source-directory 'datastax)
(provide 'datastax-bugrefs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment