#+TITLE: Fetch jira summary from JIRA-ID under cursor with emacs #+DATE: 2016-11-10 10:45:13 UTC #+DESCRIPTION: Example to insert jira comment and link at cursor position in emacs #+FILETAGS: emacs:lisp #+CATEGORY: lisp #+SLUG: fetch-jira-summary-from-jira-id-under-cursor-with-emacs #+BEGIN_COMMENT .. title: Fetch jira summary from JIRA-ID under cursor with emacs .. slug: fetch-jira-summary-from-jira-id-under-cursor-with-emacs .. date: 2016-11-10 10:45:13 UTC .. tags: lisp, emacs .. category: lisp .. link: .. description: Example to insert jira comment and link at cursor position in emacs .. type: text #+END_COMMENT The below snippet will grab the JIRA-ID under your cursor and use it to look up the summary and past it next to the JIRA-ID. You need to have org-jira installed because this makes use of org-jira-get-issue-by-id to look up the ticket details. #+BEGIN_SRC emacs-lisp (defun org-jira-get-summary () "insert summary next to ticket id from jira" (interactive) (let ((jira_id (thing-at-point 'symbol))) (forward-symbol 1) (insert (format " - %s" (cdr (assoc 'summary (car (org-jira-get-issue-by-id jira_id)))))))) #+END_SRC This next snippet does the same as the first except it also replaces the ID with a link back to jira #+BEGIN_SRC emacs-lisp (defun org-jira-get-summary-url () "insert summary next to ticket id from jira with url link" (interactive) (let ((jira_id (thing-at-point 'symbol))) (sp-kill-symbol 1) (insert (format "[[%s][%s]] - %s" (concatenate 'string jiralib-url "browse/" jira_id) jira_id (cdr (assoc 'summary (car (org-jira-get-issue-by-id jira_id)))))))) #+END_SRC You will need to also place the code below some where to make the jira methods available, hopefully these will be merged directly into org jira soon. #+BEGIN_SRC emacs-lisp (require 'org-jira) #+END_SRC