From: Andreas Gerler Date: Mon, 5 Dec 2016 15:42:31 +0000 (+0100) Subject: bba-org-export-jira-clipboard bba-export-jira-org X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=d11a0a76229130b76e77618dca76daf3b755a517;p=emacsconfig.git bba-org-export-jira-clipboard bba-export-jira-org - rewritten my keyboard macro in elisp. - added bba-export-jira-org. saves the currently visible content in a org file in /tmp/. Called via bba-org-export-jira-clipboard. So with C-c J you get now: a /tmp/ticket.org file to attach to jira and jira markup language of the content in your clipboard. Add comment to ticket, insert clipboard, save, attach org file. On Mac a Finder window is open. So just drag and drop. Signed-off-by: Andreas Gerler --- diff --git a/bba.org b/bba.org index 458c9362..73db2262 100644 --- a/bba.org +++ b/bba.org @@ -845,46 +845,78 @@ Org-mode export backend for JIRA markup (require 'ox-jira)) #+END_SRC -A little macro to speed things up: +We are lazy and want to speed up things: #+BEGIN_SRC emacs-lisp - (fset 'bba-org-export-jira-clipboard - (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([24 110 115 escape 58 40 115 101 116 113 32 111 114 103 45 101 120 112 111 114 116 45 98 97 98 101 108 45 101 118 97 108 117 97 116 101 32 110 105 108 41 return 3 5 106 106 67108896 14 14 14 23 24 104 escape 119] 0 "%d")) arg))) + (defun bba-org-export-jira-clipboard() + "narrow to org subtree and store content in jira format in clipboard." + (interactive) + (org-narrow-to-subtree) + (bba-export-jira-org) + (let ((org-export-babel-evaluate nil)) + (ox-jira-export-as-jira)) + (delete-region (point) (progn (forward-line 1)(point))) + (mark-whole-buffer) + (kill-ring-save 1 1 1) + ) + (define-key org-mode-map "\C-c\S-j" 'bba-org-export-jira-clipboard) #+END_SRC +Besides the clipboard we want also an org file in =/tmp/= to attach to +the jira ticket: + + +#+BEGIN_SRC emacs-lisp + (defun bba-export-jira-org() + "export current narrowed view to file in tmp and open a finder window on OS-X." + (interactive) + (beginning-of-buffer) + (if (re-search-forward "jira:" nil t 1) + (if (org-in-regexp org-bracket-link-regexp 1) + (let ((remove (list (match-beginning 0) (match-end 0))) + (description (last (split-string (if (match-end 3) + (match-string-no-properties 3) + (match-string-no-properties 1)) ":")))) + (write-region nil nil (concat "/tmp/" (car description) ".org") nil nil ) + (if (string-equal system-type "darwin")(shell-command "open /tmp/")) + ))) + ) +#+END_SRC + ** Some initial languages we want org-babel to support #+BEGIN_SRC emacs-lisp - (org-babel-do-load-languages - 'org-babel-load-languages - '( - (sh . t) - (python . t) - (R . t) - (ruby . t) - (ditaa . t) - (dot . t) - (octave . t) - (sqlite . t) - (perl . t) - )) - - ;;(setq org-html-preamble nil - ;; org-html-postamble nil - ;; org-html-head "") - - ;; (setq org-html-preamble nil - ;; org-html-postamble nil - ;; org-html-include-default-style nil - ;; org-html-head "" - ;; org-export-html-with-timestamp nil - ;; org-export-html-style "body-only" - ;; ) - ;; body-only option ? - - ;; (setq html (org-export-as-html 3 nil nil 1)) + (org-babel-do-load-languages + 'org-babel-load-languages + '( + (sh . t) + (shell . t) + (python . t) + (R . t) + (ruby . t) + (ditaa . t) + (dot . t) + (octave . t) + (sqlite . t) + (perl . t) + )) + + ;;(setq org-html-preamble nil + ;; org-html-postamble nil + ;; org-html-head "") + + ;; (setq org-html-preamble nil + ;; org-html-postamble nil + ;; org-html-include-default-style nil + ;; org-html-head "" + ;; org-export-html-with-timestamp nil + ;; org-export-html-style "body-only" + ;; ) + ;; body-only option ? + + ;; (setq html (org-export-as-html 3 nil nil 1)) #+END_SRC