------------------------------------------------------------ revno: 283 committer: Michael Albinus <michael.albi...@gmx.de branch nick: elpa timestamp: Thu 2012-10-25 11:43:50 +0200 message: * debbugs.el (debbugs-get-usertag): Fix comments. * debbugs-gnu.el: New command `debbugs-gnu-usertags' and helper functions. modified: packages/debbugs/debbugs-gnu.el packages/debbugs/debbugs.el
=== modified file 'packages/debbugs/debbugs-gnu.el' --- a/packages/debbugs/debbugs-gnu.el 2012-10-18 13:27:09 +0000 +++ b/packages/debbugs/debbugs-gnu.el 2012-10-25 09:43:50 +0000 @@ -34,6 +34,7 @@ ;; ;; (autoload 'debbugs-gnu "debbugs-gnu" "" 'interactive) ;; (autoload 'debbugs-gnu-search "debbugs-gnu" "" 'interactive) +;; (autoload 'debbugs-gnu-usertags "debbugs-gnu" "" 'interactive) ;; The bug tracker is called interactively by ;; @@ -108,6 +109,22 @@ ;; happens as expected for the respective column; sorting in the Title ;; column is depending on whether you are the owner of a bug. +;; Another approach for listing bugs is calling the command +;; +;; M-x debbugs-gnu-usertags + +;; This command shows you all existing user tags for the packages +;; defined in `debbugs-gnu-default-packages'. A prefix for the +;; command allows you to use other packe names, or an arbitrary string +;; for a user who has tagged bugs. The command returns the list of +;; existing user tags for the given user(s) or package name(s), +;; respectively. Applying RET on a user tag, all bugs tagged with +;; this user tag are shown. + +;; Unfortunately, it is not possible with the SOAP interface to show +;; all users who have tagged bugs. This list can be retrieved via +;; <http://debbugs.gnu.org/cgi/pkgindex.cgi?indexon=users>. + ;;; Code: (require 'debbugs) @@ -1113,6 +1130,82 @@ message)))) (funcall send-mail-function)))) +(defvar debbugs-gnu-usertags-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map tabulated-list-mode-map) + (define-key map "\r" 'debbugs-gnu-select-usertag) + (define-key map [mouse-1] 'debbugs-gnu-select-usertag) + (define-key map [mouse-2] 'debbugs-gnu-select-usertag) + map)) + +(define-derived-mode debbugs-gnu-usertags-mode tabulated-list-mode "Usertags" + "Major mode for listing user tags. + +All normal editing commands are switched off. +\\<debbugs-gnu-usertags-mode-map> + +The following commands are available: + +\\{debbugs-gnu-usertags-mode-map}" + (buffer-disable-undo) + (setq truncate-lines t) + (setq buffer-read-only t)) + +;;;###autoload +(defun debbugs-gnu-usertags (&optional packages) + "List all outstanding Emacs bugs." + (interactive + (list + (if current-prefix-arg + (completing-read-multiple + "Package name(s) or email address: " + (append debbugs-gnu-all-packages (list user-mail-address)) nil nil + (mapconcat 'identity debbugs-gnu-default-packages ",")) + debbugs-gnu-default-packages))) + + (unwind-protect + (let ((inhibit-read-only t) + (debbugs-port "gnu.org") + (buffer-name "*Emacs User Tags*") + (user-tab-length + (1+ (apply 'max (length "User") (mapcar 'length packages))))) + + ;; Create buffer. + (when (get-buffer buffer-name) + (kill-buffer buffer-name)) + (pop-to-buffer (get-buffer-create buffer-name)) + (debbugs-gnu-usertags-mode) + (setq tabulated-list-format `[("User" ,user-tab-length t) + ("Tag" 10 t)]) + (setq tabulated-list-sort-key (cons "User" nil)) + ;(setq tabulated-list-printer 'debbugs-gnu-print-entry) + (erase-buffer) + + ;; Retrieve user tags. + (dolist (package packages) + (dolist (tag (debbugs-get-usertag :package package)) + (add-to-list + 'tabulated-list-entries + ;; `tabulated-list-id' is the parameter list for `debbugs-gnu'. + `((("tagged") (,package) nil nil (,tag)) + ,(vector (propertize package 'mouse-face widget-mouse-face) + (propertize tag 'mouse-face widget-mouse-face))) + 'append))) + + ;; Show them. + (tabulated-list-init-header) + (tabulated-list-print) + + (set-buffer-modified-p nil) + (goto-char (point-min))))) + +(defun debbugs-gnu-select-usertag () + "Select the user tag on the current line." + (interactive) + ;; We open the bug reports. + (let ((args (get-text-property (line-beginning-position) 'tabulated-list-id))) + (when args (apply 'debbugs-gnu args)))) + (provide 'debbugs-gnu) ;;; TODO:
=== modified file 'packages/debbugs/debbugs.el' --- a/packages/debbugs/debbugs.el 2012-10-18 13:27:09 +0000 +++ b/packages/debbugs/debbugs.el 2012-10-25 09:43:50 +0000 @@ -362,7 +362,7 @@ (setq key (substring (symbol-name kw) 1)) (case kw ((:package) - ;; Value shall be one word. + ;; Value shall be one word. Extract email address, if existing. (if (string-match "\\`\\S-+\\'" val) (progn (when (string-equal "me" val) @@ -372,7 +372,7 @@ (add-to-list 'user val)) (error "Wrong %s: %s" key val))) ((:tag) - ;; Value shall be one word. Extract email address, if existing. + ;; Value shall be one word. (if (string-match "\\`\\S-+\\'" val) (add-to-list 'tags val) (error "Wrong %s: %s" key val)))