Permalink
Browse files

Added support for linking to Emacs bugs in Org

  • Loading branch information...
1 parent de914bd commit 1c701e7989e0299b3dbbe008b93b5aee5532441f @jwiegley committed Jul 4, 2012
Showing with 55 additions and 5 deletions.
  1. +4 −0 debbugs
  2. +1 −0 dot-org.el
  3. +42 −0 lisp/org-debbugs.el
  4. +8 −5 lisp/org-smart-capture.el
View
@@ -0,0 +1,4 @@
+;; -*- emacs-lisp -*-
+;; Debbugs tags connection history. Don't change this file.
+
+(setq debbugs-gnu-local-tags 'nil)
View
@@ -8,6 +8,7 @@
;;(require 'org-crypt)
(require 'org-devonthink)
+(require 'org-debbugs)
(require 'org-magit)
(require 'org-x)
(require 'ox-org)
View
@@ -0,0 +1,42 @@
+;;; org-debbugs.el - Support for links to debbugs messages by their UUID
+
+;; version 1.1, by John Wiegley <johnw@gnu.org>
+
+(require 'org)
+
+(org-add-link-type "x-debbugs-gnu" 'org-debbugs-open)
+
+(defun org-debbugs-open (record-location)
+ "Visit the debbugs-gnu bug with the given id."
+ (message "(gnus-read-ephemeral-emacs-bug-group %d)" (string-to-number record-location))
+ (gnus-read-ephemeral-emacs-bug-group (string-to-number record-location)))
+
+(defun org-get-debbugs-link (&optional given-name)
+ (interactive)
+ (let* ((status (debbugs-gnu-current-status))
+ (id (cdr (assq 'id status)))
+ (subject (cdr (assq 'subject status))))
+ (cons (format "x-debbugs-gnu:%d" id)
+ (or given-name subject))))
+
+(defun org-insert-debbugs-link ()
+ (interactive)
+ (let (name)
+ (when (region-active-p)
+ (setq name (buffer-substring-no-properties (region-beginning)
+ (region-end)))
+ (delete-region (region-beginning) (region-end)))
+ (let ((link-data (org-get-debbugs-link name)))
+ (insert (org-make-link-string (car link-data) (cdr link-data))))))
+
+(defun org-debbugs-store-link ()
+ "Store a link to an debbugs-gnu bug by its id."
+ (let ((link-data (org-get-debbugs-link)))
+ (org-store-link-props
+ :type "x-debbugs-gnu"
+ :link (cons (car link-data) (car link-data))
+ :description (cdr link-data))))
+
+(provide 'org-debbugs)
+
+;;; org-debbugs.el ends here
View
@@ -28,6 +28,7 @@
;; I use: (define-key global-map [(meta ?m)] 'org-smart-capture)
(require 'gnus-sum)
+(require 'org-capture)
(defgroup org-smart-capture nil
"Capture Gnus messages as tasks, with context"
@@ -39,11 +40,13 @@
:group 'org-smart-capture)
(defvar org-subject-transforms
- '(("\\`\\(Re\\|Fwd\\): " . "")
- ("\\`{ledger} " . "")
- ("(#[0-9]+)\\'" . "")
- ("\\`\\[Bug \\([0-9]+\\)\\] New:" . "[[bug:\\1][#\\1]]")
- ("\\`\\[.*? - [A-Za-z]+ #\\([0-9]+\\)\\] (New)" . "[[redmine:\\1][#\\1]]")))
+ '(("\\`\\(Re\\|Fwd\\): " . "")
+ ("\\`{ledger} " . "")
+ ("(#[0-9]+)\\'" . "")
+ ("\\`bug#\\([0-9]+\\):" . "[[x-debbugs-gnu:\\1][#\\1]]")
+ ("\\`\\[Bug \\([0-9]+\\)\\] New:" . "[[bug:\\1][#\\1]]")
+ ("\\`\\[.*? - [A-Za-z]+ #\\([0-9]+\\)\\] (New)"
+ . "[[redmine:\\1][#\\1]]")))
(defun convert-dates ()
(interactive)

0 comments on commit 1c701e7

Please sign in to comment.