Skip to content

Commit

Permalink
Added extra function and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andykuszyk committed Sep 13, 2024
1 parent 1eff535 commit 55b69e2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ This package is not yet on MELPA, but can be installed locally with:
:ensure t
:load-path "/path/to/ob-jira-markdown.el/"
:custom
(ob-jira-markdown-host "https://your-org.atlassian.net"))
(ob-jira-markdown-host "https://your-org.atlassian.net")
:bind (("C-x j o" . ob-jira-markdown-open-in-browser)
("C-x j w" . ob-jira-markdown-kill-issue)))
#+end_src
The variable ~ob-jira-markdown-host~ can be customised to make enable opening the issue for source blocks in a browser, but isn't required for the main functionality of ~ob-jira-markdown~.
** Requirements
Expand Down Expand Up @@ -50,5 +52,12 @@ The following header arguments are supported:
- :type :: They type of issue to create, e.g. ~Story~.
*** Opening issues in a browser
If point is on a source block that has the ~:issue~ header argument set, the command ~ob-jira-markdown-open-in-browser~ can be used interactively to open the issue in a web browser. The custom variable ~ob-jira-markdown-host~ must be set to the address of your Jira installation for this to work correctly.
*** Killing the issue reference of the current source block
A useful command is included in this package to add the issue reference of the source block at point to the kill ring: ~ob-jira-markdown-kill-issue~.
** Related projects
- [[https://github.com/andykuszyk/jira-cli.el][jira-cli.el]]
- [[https://www.emacswiki.org/emacs/jira.el][jira.el]]
- [[https://github.com/ahungry/org-jira][org-jira]]
- [[https://github.com/nyyManni/ejira][ejira]]
** Contributions
Contributions are very welcome! Please feel free to fork this repo, and raise a PR 🙏
20 changes: 20 additions & 0 deletions ob-jira-markdown.el
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,25 @@ The URL of the Jira issue is constructed using the `ob-jira-markdown-host`
(message (format "opening issue in browser: %s" url))
(browse-url url)))))

(defun ob-jira-markdown-kill-issue ()
"Kill the issue key of the current source block to the kill ring.
When invoked on a source block with the :issue header argument, this function
will add the issue key to the kill ring.
For example, if called on the source block below, \"EMX-123\" would be added to
the kill ring:
#+begin_src markdown :issue EMX-123
Plain text for the win!
#+end_src"
(interactive)
(let* ((src-block-info (org-babel-get-src-block-info))
(jira-cli-issue (cdr (assoc :issue (nth 2 src-block-info)))))
(if (not jira-cli-issue)
(error "Jira issue could not be found!")
(message (format "killed reference: %s" jira-cli-issue))
(kill-new jira-cli-issue))))

(provide 'ob-jira-markdown)
;;; ob-jira-markdown.el ends here

0 comments on commit 55b69e2

Please sign in to comment.