1 ;;; debbugs-gnu.el --- interface for the GNU bug tracker
3 ;; Copyright (C) 2011-2014 Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Michael Albinus <michael.albinus@gmx.org>
7 ;; Keywords: comm, hypermedia, maint
11 ;; This file is not part of GNU Emacs.
13 ;; This program is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 3 of the License, or
16 ;; (at your option) any later version.
18 ;; This program is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; This package provides an interface to bug reports which are located
29 ;; on the GNU bug tracker debbugs.gnu.org. Its main purpose is to
30 ;; show and manipulate bug reports from Emacs, but it could be used
31 ;; also for other GNU projects which use the same bug tracker.
33 ;; If you have `debbugs-gnu.el' in your load-path, you could enable
34 ;; the bug tracker commands by the following lines in your ~/.emacs
36 ;; (autoload 'debbugs-gnu "debbugs-gnu" "" 'interactive)
37 ;; (autoload 'debbugs-gnu-search "debbugs-gnu" "" 'interactive)
38 ;; (autoload 'debbugs-gnu-usertags "debbugs-gnu" "" 'interactive)
39 ;; (autoload 'debbugs-gnu-bugs "debbugs-gnu" "" 'interactive)
41 ;; The bug tracker is called interactively by
45 ;; It asks for the severities, for which bugs shall be shown. This can
46 ;; be either just one severity, or a list of severities, separated by
47 ;; comma. Valid severities are "serious", "important", "normal",
48 ;; "minor" or "wishlist". Severities "critical" and "grave" are not
49 ;; used, although configured on the GNU bug tracker. If no severity
50 ;; is given, all bugs are selected.
52 ;; There is also the pseudo severity "tagged". When it is used, the
53 ;; function will ask for user tags (a comma separated list), and shows
54 ;; just the bugs which are tagged with them. In general, user tags
55 ;; shall be strings denoting to subprojects of the package, like
56 ;; "cedet" or "tramp" of the package "emacs". If no user tag is
57 ;; given, locally tagged bugs are shown.
59 ;; If a prefix is given to the command, more search parameters are
60 ;; asked for, like packages (also a comma separated list, "emacs" is
61 ;; the default), whether archived bugs shall be shown, and whether
62 ;; closed bugs shall be shown.
66 ;; M-x debbugs-gnu-search
68 ;; It behaves like `debbugs-gnu', but asks at the beginning for a
69 ;; search phrase to be used for full text search. Additionally, it
70 ;; asks for key-value pairs to filter bugs. Keys are as described in
71 ;; `debbugs-get-status', the corresponding value must be a regular
72 ;; expression to match for. The other parameters are as described in
73 ;; `debbugs-gnu'. Usually, there is just one value except for the
74 ;; attribute "date", which needs two arguments specifying a period in
75 ;; which the bug has been submitted or modified.
77 ;; The bug reports are downloaded from the bug tracker. In order to
78 ;; not generate too much load of the server, up to 500 bugs will be
79 ;; downloaded at once. If there are more hits, you will be asked to
80 ;; change this limit, but please don't increase this number too much.
82 ;; These default values could be changed also by customer options
83 ;; `debbugs-gnu-default-severities', `debbugs-gnu-default-packages',
84 ;; `debbugs-gnu-default-hits-per-page' and `debbugs-gnu-default-suppress-bugs'.
86 ;; The commands create one or more pages of bug lists. Every bug is
87 ;; shown in one line, including the bug number, the status (combining
88 ;; merged bug numbers, keywords and severities), the name of the
89 ;; submitter, and the title of the bug. On every bug line you could
90 ;; apply the following actions by the following keystrokes:
92 ;; RET: Show corresponding messages in Gnus
93 ;; "C": Send a control message
94 ;; "t": Mark the bug locally as tagged
95 ;; "d": Show bug attributes
97 ;; Furthermore, you could apply the global actions
100 ;; "q": Quit the buffer
101 ;; "s": Toggle bug sorting for age or for state
102 ;; "x": Toggle suppressing of bugs
103 ;; "/": Display only bugs matching a string
104 ;; "w": Display all the currently selected bug reports
106 ;; When you visit the related bug messages in Gnus, you could also
107 ;; send control messages by keystroke "C".
109 ;; In the header line of every bug list page, you can toggle sorting
110 ;; per column by selecting a column with the mouse. The sorting
111 ;; happens as expected for the respective column; sorting in the Title
112 ;; column is depending on whether you are the owner of a bug.
114 ;; Another approach for listing bugs is calling the command
116 ;; M-x debbugs-gnu-usertags
118 ;; This command shows you all existing user tags for the packages
119 ;; defined in `debbugs-gnu-default-packages'. A prefix for the
120 ;; command allows you to use other packe names, or an arbitrary string
121 ;; for a user who has tagged bugs. The command returns the list of
122 ;; existing user tags for the given user(s) or package name(s),
123 ;; respectively. Applying RET on a user tag, all bugs tagged with
124 ;; this user tag are shown.
126 ;; Unfortunately, it is not possible with the SOAP interface to show
127 ;; all users who have tagged bugs. This list can be retrieved via
128 ;; <http://debbugs.gnu.org/cgi/pkgindex.cgi?indexon=users>.
130 ;; Finally, if you simply want to list some bugs with known bug
131 ;; numbers, call the command
133 ;; M-x debbugs-gnu-bugs
135 ;; The bug numbers to be shown shall be entered as comma separated list.
142 (require 'tabulated-list)
144 (eval-when-compile (require 'cl))
146 (autoload 'gnus-read-ephemeral-emacs-bug-group "gnus-group")
147 (autoload 'mail-header-subject "nnheader")
148 (autoload 'gnus-summary-article-header "gnus-sum")
149 (autoload 'message-make-from "message")
151 (defgroup debbugs-gnu ()
152 "UI for the debbugs.gnu.org bug tracker."
156 (defcustom debbugs-gnu-default-severities '("serious" "important" "normal")
157 "*The list severities bugs are searched for.
158 \"tagged\" is not a severity but marks locally tagged bugs."
159 ;; <http://debbugs.gnu.org/Developer.html#severities>
161 :type '(set (const "serious")
169 (defconst debbugs-gnu-all-severities
170 (mapcar 'cadr (cdr (get 'debbugs-gnu-default-severities 'custom-type)))
171 "*List of all possible severities.")
173 (defcustom debbugs-gnu-default-packages '("emacs")
174 "*The list of packages to be searched for."
175 ;; <http://debbugs.gnu.org/Packages.html>
176 ;; <http://debbugs.gnu.org/cgi/pkgindex.cgi>
178 :type '(set (const "auctex")
183 (const "debbugs.gnu.org")
186 (const "emacs-xwidgets")
202 (defconst debbugs-gnu-all-packages
203 (mapcar 'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type)))
204 "*List of all possible package names.")
206 (defcustom debbugs-gnu-default-hits-per-page 500
207 "*The number of bugs shown per page."
212 (defcustom debbugs-gnu-default-suppress-bugs
213 '((pending . "done"))
214 "*A list of specs for bugs to be suppressed.
215 An element of this list is a cons cell \(KEY . REGEXP\), with key
216 being returned by `debbugs-get-status', and VAL a regular
217 expression matching the corresponding value, a string. Showing
218 suppressed bugs is toggled by `debbugs-gnu-toggle-suppress'."
220 :type '(alist :key-type symbol :value-type regexp)
223 (defface debbugs-gnu-new '((t (:foreground "red")))
224 "Face for new reports that nobody has answered.")
226 (defface debbugs-gnu-handled '((t (:foreground "ForestGreen")))
227 "Face for reports that have been modified recently.")
229 (defface debbugs-gnu-pending '((t (:foreground "MidnightBlue")))
230 "Face for reports that are pending.")
232 (defface debbugs-gnu-stale '((t (:foreground "orange")))
233 "Face for reports that have not been touched for a week.")
235 (defface debbugs-gnu-done '((t (:foreground "DarkGrey")))
236 "Face for closed bug reports.")
238 (defface debbugs-gnu-tagged '((t (:foreground "red")))
239 "Face for reports that have been tagged locally.")
241 (defvar debbugs-gnu-widgets nil)
243 (defvar debbugs-gnu-widget-map
244 (let ((map (make-sparse-keymap)))
245 (define-key map "\r" 'widget-button-press)
246 (define-key map [mouse-2] 'widget-button-press)
249 (defvar debbugs-gnu-local-tags nil
250 "List of bug numbers tagged locally, and kept persistent.")
252 (defvar debbugs-gnu-persistency-file
253 (expand-file-name (locate-user-emacs-file "debbugs"))
254 "File name of a persistency store for debbugs variables")
256 (defun debbugs-gnu-dump-persistency-file ()
257 "Function to store debbugs variables persistently."
258 (with-temp-file debbugs-gnu-persistency-file
260 ";; -*- emacs-lisp -*-\n"
261 ";; Debbugs tags connection history. Don't change this file.\n\n"
262 (format "(setq debbugs-gnu-local-tags '%S)"
263 (sort (copy-sequence debbugs-gnu-local-tags) '<)))))
265 (defvar debbugs-gnu-current-query nil
266 "The query object of the current search.
267 It will be applied server-side, when calling `debbugs-get-bugs'.
268 It has the same format as `debbugs-gnu-default-suppress-bugs'.")
270 (defvar debbugs-gnu-current-filter nil
271 "The filter object for the current search.
272 It will be applied client-side, when parsing the results of
273 `debbugs-get-status'. It has a similar format as
274 `debbugs-gnu-default-suppress-bugs'. In case of keys representing
275 a date, value is the cons cell \(BEFORE . AFTER\).")
277 (defun debbugs-gnu-calendar-read (prompt acceptable &optional initial-contents)
278 "Return a string read from the minibuffer.
279 Derived from `calendar-read'."
280 (let ((value (read-string prompt initial-contents)))
281 (while (not (funcall acceptable value))
282 (setq value (read-string prompt initial-contents)))
285 (defconst debbugs-gnu-phrase-prompt
287 "Enter search phrase: "
289 The search phrase contains words to be searched for, combined by
290 operators like AND, ANDNOT and OR. If there is no operator
291 between the words, AND is used by default. The phrase can also
292 be empty, in this case only the following attributes are used for
296 (defun debbugs-gnu-search ()
297 "Search for Emacs bugs interactively.
298 Search arguments are requested interactively. The \"search
299 phrase\" is used for full text search in the bugs database.
300 Further key-value pairs are requested until an empty key is
301 returned. If a key cannot be queried by a SOAP request, it is
302 marked as \"client-side filter\"."
306 (let ((date-format "\\([[:digit:]]\\{4\\}\\)-\\([[:digit:]]\\{1,2\\}\\)-\\([[:digit:]]\\{1,2\\}\\)")
307 key val1 val2 phrase severities packages archivedp)
309 ;; Check for the phrase.
310 (setq phrase (read-string debbugs-gnu-phrase-prompt))
311 (if (zerop (length phrase))
313 (add-to-list 'debbugs-gnu-current-query (cons 'phrase phrase)))
315 ;; The other queries.
318 (setq key (completing-read
321 '("severity" "package" "tags" "submitter" "date"
323 '("severity" "package" "archive" "src" "tag"
324 "owner" "submitter" "maint" "correspondent"
325 "date" "log_modified" "last_modified"
326 "found_date" "fixed_date" "unarchived"
327 "subject" "done" "forwarded" "msgid" "summary"))
330 ;; Server-side queries.
331 ((equal key "severity")
334 (completing-read-multiple
335 "Enter severities: " debbugs-gnu-all-severities nil t
336 (mapconcat 'identity debbugs-gnu-default-severities ","))))
338 ((equal key "package")
341 (completing-read-multiple
342 "Enter packages: " debbugs-gnu-all-packages nil t
343 (mapconcat 'identity debbugs-gnu-default-packages ","))))
345 ((equal key "archive")
346 ;; We simplify, by assuming just archived bugs are requested.
349 ((member key '("src" "tag" "tags"))
350 (setq val1 (read-string (format "Enter %s: " key)))
351 (when (not (zerop (length val1)))
353 'debbugs-gnu-current-query (cons (intern key) val1))))
355 ((member key '("owner" "submitter" "maint" "correspondent"))
356 (setq val1 (read-string "Enter email address: "))
357 (when (not (zerop (length val1)))
359 'debbugs-gnu-current-query (cons (intern key) val1))))
361 ((equal key "status")
364 (completing-read "Enter status: " '("done" "forwarded" "open")))
365 (when (not (zerop (length val1)))
367 'debbugs-gnu-current-query (cons (intern key) val1))))
369 ;; Client-side filters.
370 ((member key '("date" "log_modified" "last_modified"
371 "found_date" "fixed_date" "unarchived"))
373 (debbugs-gnu-calendar-read
374 (format "Enter %s before YYYY-MM-DD%s: "
375 key (if phrase "" " (client-side filter)"))
377 (string-match (concat "^\\(" date-format "\\|\\)$") x))))
378 (if (string-match date-format val1)
383 (string-to-number (match-string 3 val1))
384 (string-to-number (match-string 2 val1))
385 (string-to-number (match-string 1 val1))))))
388 (debbugs-gnu-calendar-read
389 (format "Enter %s after YYYY-MM-DD%s: "
390 key (if phrase "" " (client-side filter)"))
392 (string-match (concat "^\\(" date-format "\\|\\)$") x))))
393 (if (string-match date-format val2)
398 (string-to-number (match-string 3 val2))
399 (string-to-number (match-string 2 val2))
400 (string-to-number (match-string 1 val2))))))
405 'debbugs-gnu-current-query 'debbugs-gnu-current-filter)
406 (cons (intern key) (cons val1 val2)))))
408 ((not (zerop (length key)))
411 (if phrase 'read-string 'read-regexp)
413 key (if phrase ": " " (client-side filter)"))))
414 (when (not (zerop (length val1)))
417 'debbugs-gnu-current-query 'debbugs-gnu-current-filter)
418 (cons (intern key) val1))))
421 (t (throw :finished nil)))))
424 (debbugs-gnu severities packages archivedp))
426 ;; Reset query and filter.
427 (setq debbugs-gnu-current-query nil
428 debbugs-gnu-current-filter nil)))
431 (defun debbugs-gnu (severities &optional packages archivedp suppress tags)
432 "List all outstanding bugs."
434 (let (severities archivedp)
437 (completing-read-multiple
438 "Severities: " debbugs-gnu-all-severities nil t
439 (mapconcat 'identity debbugs-gnu-default-severities ",")))
440 ;; The next parameters are asked only when there is a prefix.
441 (if current-prefix-arg
442 (completing-read-multiple
443 "Packages: " debbugs-gnu-all-packages nil t
444 (mapconcat 'identity debbugs-gnu-default-packages ","))
445 debbugs-gnu-default-packages)
446 (when current-prefix-arg
447 (setq archivedp (y-or-n-p "Show archived bugs?")))
448 (when (and current-prefix-arg (not archivedp))
449 (y-or-n-p "Suppress unwanted bugs?"))
450 ;; This one must be asked for severity "tagged".
451 (when (member "tagged" severities)
452 (split-string (read-string "User tag(s): ") "," t)))))
454 ;; Initialize variables.
455 (when (and (file-exists-p debbugs-gnu-persistency-file)
456 (not debbugs-gnu-local-tags))
458 (insert-file-contents debbugs-gnu-persistency-file)
459 (eval (read (current-buffer)))))
460 (setq debbugs-gnu-widgets nil)
463 (dolist (severity (if (consp severities) severities (list severities)))
464 (when (not (zerop (length severity)))
465 (add-to-list 'debbugs-gnu-current-query (cons 'severity severity))))
466 (dolist (package (if (consp packages) packages (list packages)))
467 (when (not (zerop (length package)))
468 (add-to-list 'debbugs-gnu-current-query (cons 'package package))))
470 (add-to-list 'debbugs-gnu-current-query '(archive . "1")))
472 (add-to-list 'debbugs-gnu-current-query '(status . "open"))
473 (add-to-list 'debbugs-gnu-current-query '(status . "forwarded")))
474 (dolist (tag (if (consp tags) tags (list tags)))
475 (when (not (zerop (length tag)))
476 (add-to-list 'debbugs-gnu-current-query (cons 'tag tag))))
479 (let ((hits debbugs-gnu-default-hits-per-page)
480 (ids (debbugs-gnu-get-bugs debbugs-gnu-current-query)))
482 (if (> (length ids) hits)
483 (let ((cursor-in-echo-area nil))
488 "How many reports (available %d, default %d): "
492 (number-to-string hits))))))
494 (if (> (length ids) hits)
499 curr-ids (butlast ids (- (length ids) hits)))
504 :follow-link 'mouse-face
505 :notify (lambda (widget &rest ignore)
506 (debbugs-gnu-show-reports widget))
507 :keymap debbugs-gnu-widget-map
509 :buffer-name (format "*Emacs Bugs*<%d>" i)
511 :query debbugs-gnu-current-query
512 :filter debbugs-gnu-current-filter
513 :help-echo (format "%d-%d" (car ids) (car (last curr-ids)))
515 (number-to-string i))
517 (setq ids (last ids (- (length ids) hits))))
518 (debbugs-gnu-show-reports (car debbugs-gnu-widgets)))
520 (debbugs-gnu-show-reports
524 :buffer-name "*Emacs Bugs*"
526 :query debbugs-gnu-current-query
527 :filter debbugs-gnu-current-filter))))
529 ;; Reset query and filter.
530 (setq debbugs-gnu-current-query nil
531 debbugs-gnu-current-filter nil)))
533 (defun debbugs-gnu-get-bugs (query)
534 "Retrieve bugs numbers from debbugs.gnu.org according search criteria."
535 (let* ((debbugs-port "gnu.org")
536 (bugs (assoc 'bugs query))
537 (tags (assoc 'tag query))
538 (local-tags (and (member '(severity . "tagged") query) (not tags)))
539 (phrase (assoc 'phrase query))
541 ;; Compile query arguments.
542 (unless (or query tags)
543 (dolist (elt debbugs-gnu-default-packages)
544 (setq args (append args (list :package elt)))))
546 (unless (equal elt '(severity . "tagged"))
552 ((eq (car elt) 'phrase)
553 (list (list :phrase (cdr elt) :max 500)))
554 ((eq (car elt) 'date)
555 (list (list :date (cddr elt) (cadr elt)
558 (list (list (intern (concat ":" (symbol-name (car elt))))
559 (cdr elt) :operator "ISTRINC"))))
560 (list (intern (concat ":" (symbol-name (car elt))))
565 ;; If the query is just a list of bug numbers, we return them.
567 ;; If the query contains the pseudo-severity "tagged", we return
568 ;; just the local tagged bugs.
569 (local-tags (copy-sequence debbugs-gnu-local-tags))
570 ;; A full text query.
573 (lambda (x) (cdr (assoc "id" x)))
574 (apply 'debbugs-search-est args)))
577 (setq args (mapcar (lambda (x) (if (eq x :package) :user x)) args))
578 (apply 'debbugs-get-usertag args))
579 ;; Otherwise, we retrieve the bugs from the server.
580 (t (apply 'debbugs-get-bugs args)))
584 (defvar debbugs-gnu-current-widget nil)
585 (defvar debbugs-gnu-current-limit nil)
587 (defun debbugs-gnu-show-reports (widget)
588 "Show bug reports as given in WIDGET property :bug-ids."
589 ;; The tabulated mode sets several local variables. We must get rid
591 (when (get-buffer (widget-get widget :buffer-name))
592 (kill-buffer (widget-get widget :buffer-name)))
593 (pop-to-buffer (get-buffer-create (widget-get widget :buffer-name)))
595 (let ((inhibit-read-only t)
596 (debbugs-port "gnu.org"))
598 (set (make-local-variable 'debbugs-gnu-current-widget) widget)
600 (dolist (status (apply 'debbugs-get-status (widget-get widget :bug-ids)))
601 (let* ((id (cdr (assq 'id status)))
605 (cons (cdr (assq 'severity status))
606 (cdr (assq 'keywords status)))
608 (address (mail-header-parse-address
609 (decode-coding-string (cdr (assq 'originator status))
611 (owner (if (cdr (assq 'owner status))
612 (car (mail-header-parse-address
613 (decode-coding-string (cdr (assq 'owner status))
615 (subject (decode-coding-string (cdr (assq 'subject status))
618 (unless (equal (cdr (assq 'pending status)) "pending")
620 (concat words "," (cdr (assq 'pending status)))))
621 (let ((packages (delete "emacs" (cdr (assq 'package status)))))
623 (setq words (concat words "," (mapconcat 'identity packages ",")))))
624 (when (setq merged (cdr (assq 'mergedwith status)))
625 (setq words (format "%s,%s"
628 (mapconcat 'number-to-string merged ","))
630 (when (or (not merged)
631 (not (let ((found nil))
632 (dolist (id (if (listp merged)
635 (dolist (entry tabulated-list-entries)
636 (when (equal id (cdr (assq 'id (car entry))))
640 'tabulated-list-entries
648 (if (memq id debbugs-gnu-local-tags)
652 ;; Mark status and age.
656 ((equal (cdr (assq 'pending status)) "done")
658 ((member "pending" (cdr (assq 'keywords status)))
659 'debbugs-gnu-pending)
660 ((= (cdr (assq 'date status))
661 (cdr (assq 'log_modified status)))
664 (cdr (assq 'log_modified status)))
666 'debbugs-gnu-handled)
668 'debbugs-gnu-stale)))
670 ;; Prefer the name over the address.
674 ;; Mark own submitted bugs.
675 (if (and (stringp (car address))
676 (string-equal (car address) user-mail-address))
683 (if (and (stringp owner)
684 (string-equal owner user-mail-address))
688 (tabulated-list-init-header)
689 (tabulated-list-print)
691 (set-buffer-modified-p nil)
692 (goto-char (point-min))))
694 (defun debbugs-gnu-print-entry (list-id cols)
695 "Insert a debbugs entry at point.
696 Used instead of `tabulated-list-print-entry'."
697 ;; This shall be in `debbugs-gnu-show-reports'. But
698 ;; `tabulated-list-print' erases the buffer, therefore we do it
700 (when (and debbugs-gnu-widgets (= (point) (point-min)))
701 (widget-insert "Page:")
704 (if (eq obj debbugs-gnu-current-widget)
705 (widget-put obj :button-face 'widget-button-pressed)
706 (widget-put obj :button-face 'widget-button-face))
707 (widget-apply obj :create))
709 (widget-insert "\n\n")
711 (widget-insert "\nPage:")
712 (mapc (lambda (obj) (widget-apply obj :create)) debbugs-gnu-widgets)
719 (id-length (nth 1 (aref tabulated-list-format 0)))
720 (state (aref cols 1))
721 (state-length (nth 1 (aref tabulated-list-format 1)))
722 (submitter (aref cols 2))
723 (submitter-length (nth 1 (aref tabulated-list-format 2)))
724 (title (aref cols 3))
725 (title-length (nth 1 (aref tabulated-list-format 3))))
727 ;; We may have a narrowing in effect.
728 (or (not debbugs-gnu-current-limit)
729 (memq (cdr (assq 'id list-id)) debbugs-gnu-current-limit))
730 ;; Filter suppressed bugs.
731 (or (not (widget-get debbugs-gnu-current-widget :suppress))
732 (and (not (memq (cdr (assq 'id list-id)) debbugs-gnu-local-tags))
733 (not (catch :suppress
734 (dolist (check debbugs-gnu-default-suppress-bugs)
738 (or (cdr (assq (car check) list-id)) ""))
739 (throw :suppress t)))))))
740 ;; Filter search list.
741 (not (catch :suppress
743 (widget-get debbugs-gnu-current-widget :filter))
744 (let ((val (cdr (assq (car check) list-id))))
745 (if (stringp (cdr check))
746 ;; Regular expression.
747 (when (not (string-match (cdr check) (or val "")))
750 (when (or (and (numberp (cadr check))
751 (< (cadr check) val))
752 (and (numberp (cddr check))
753 (> (cddr check) val)))
754 (throw :suppress t))))))))
757 (indent-to (- id-length (length id)))
760 (indent-to (setq pos (+ pos id-length 1)) 1)
761 (insert (if (> (length state) state-length)
762 (propertize (substring state 0 state-length)
766 (indent-to (setq pos (+ pos state-length 1)) 1)
767 (insert "[" (if (> (length submitter) (- submitter-length 2))
768 (propertize (substring submitter 0 (- submitter-length 2))
769 'help-echo submitter)
771 (indent-to (+ pos (1- submitter-length)))
774 (indent-to (setq pos (+ pos submitter-length 1)) 1)
775 (insert (propertize title 'help-echo title))
778 beg (point) `(tabulated-list-id ,list-id mouse-face ,widget-mouse-face))
781 (defvar debbugs-gnu-mode-map
782 (let ((map (make-sparse-keymap)))
783 (set-keymap-parent map tabulated-list-mode-map)
784 (define-key map "\r" 'debbugs-gnu-select-report)
785 (define-key map [mouse-1] 'debbugs-gnu-select-report)
786 (define-key map [mouse-2] 'debbugs-gnu-select-report)
787 (define-key map "s" 'debbugs-gnu-toggle-sort)
788 (define-key map "t" 'debbugs-gnu-toggle-tag)
789 (define-key map "d" 'debbugs-gnu-display-status)
790 (define-key map "g" 'debbugs-gnu-rescan)
791 (define-key map "x" 'debbugs-gnu-toggle-suppress)
792 (define-key map "/" 'debbugs-gnu-narrow-to-status)
793 (define-key map "w" 'debbugs-gnu-widen)
794 (define-key map "C" 'debbugs-gnu-send-control-message)
797 (defun debbugs-gnu-rescan ()
798 "Rescan the current set of bug reports."
801 ;; The last page will be provided with new bug ids.
802 ;; TODO: Do it also for the other pages.
803 (when (and debbugs-gnu-widgets
804 (eq debbugs-gnu-current-widget (car (last debbugs-gnu-widgets))))
805 (let ((first-id (car (widget-get debbugs-gnu-current-widget :bug-ids)))
807 (last (widget-get debbugs-gnu-current-widget :bug-ids))))
808 (ids (debbugs-gnu-get-bugs
809 (widget-get debbugs-gnu-current-widget :query))))
811 (while (and (<= first-id last-id) (not (memq first-id ids)))
812 (setq first-id (1+ first-id)))
814 (when (<= first-id last-id)
815 (widget-put debbugs-gnu-current-widget :bug-ids (memq first-id ids)))))
817 ;; Refresh the buffer. `save-excursion' does not work, so we
818 ;; remember the position.
820 (debbugs-gnu-show-reports debbugs-gnu-current-widget)
823 (defvar debbugs-gnu-sort-state 'number)
825 (define-derived-mode debbugs-gnu-mode tabulated-list-mode "Debbugs"
826 "Major mode for listing bug reports.
828 All normal editing commands are switched off.
829 \\<debbugs-gnu-mode-map>
831 The following commands are available:
833 \\{debbugs-gnu-mode-map}"
834 (set (make-local-variable 'debbugs-gnu-sort-state) 'number)
835 (set (make-local-variable 'debbugs-gnu-current-limit) nil)
836 (setq tabulated-list-format [("Id" 5 debbugs-gnu-sort-id)
837 ("State" 20 debbugs-gnu-sort-state)
839 ("Title" 10 debbugs-gnu-sort-title)])
840 (setq tabulated-list-sort-key (cons "Id" nil))
841 (setq tabulated-list-printer 'debbugs-gnu-print-entry)
842 (buffer-disable-undo)
843 (setq truncate-lines t)
844 (setq buffer-read-only t))
846 (defun debbugs-gnu-sort-id (s1 s2)
847 (< (cdr (assq 'id (car s1)))
848 (cdr (assq 'id (car s2)))))
850 (defconst debbugs-gnu-state-preference
851 '((debbugs-gnu-new . 1)
852 (debbugs-gnu-stale . 2)
853 (debbugs-gnu-handled . 3)
854 (debbugs-gnu-done . 4)
855 (debbugs-gnu-pending . 5)))
857 (defun debbugs-gnu-get-state-preference (face-string)
858 (or (cdr (assq (get-text-property 0 'face face-string)
859 debbugs-gnu-state-preference))
862 (defconst debbugs-gnu-severity-preference
869 (defun debbugs-gnu-get-severity-preference (state)
870 (or (cdr (assoc (cdr (assq 'severity state))
871 debbugs-gnu-severity-preference))
874 (defun debbugs-gnu-sort-state (s1 s2)
875 (let ((id1 (cdr (assq 'id (car s1))))
876 (age1 (debbugs-gnu-get-state-preference (aref (nth 1 s1) 1)))
877 (id2 (cdr (assq 'id (car s2))))
878 (age2 (debbugs-gnu-get-state-preference (aref (nth 1 s2) 1))))
880 ;; Tagged bugs go to the end.
881 ((and (not (memq id1 debbugs-gnu-local-tags))
882 (memq id2 debbugs-gnu-local-tags))
884 ((and (memq id1 debbugs-gnu-local-tags)
885 (not (memq id2 debbugs-gnu-local-tags)))
887 ;; Then, we check the age of the bugs.
892 ;; If they have the same age, we check for severity.
893 ((< (debbugs-gnu-get-severity-preference (car s1))
894 (debbugs-gnu-get-severity-preference (car s2)))
898 (defun debbugs-gnu-sort-title (s1 s2)
899 (let ((owner (if (cdr (assq 'owner (car s1)))
900 (car (mail-header-parse-address
901 (decode-coding-string (cdr (assq 'owner (car s1)))
904 (string-equal owner user-mail-address))))
906 (defun debbugs-gnu-toggle-sort ()
907 "Toggle sorting by age and by state."
909 (if (eq debbugs-gnu-sort-state 'number)
911 (setq debbugs-gnu-sort-state 'state)
912 (setq tabulated-list-sort-key (cons "Id" nil)))
913 (setq debbugs-gnu-sort-state 'number)
914 (setq tabulated-list-sort-key (cons "State" nil)))
915 (tabulated-list-init-header)
916 (tabulated-list-print))
918 (defun debbugs-gnu-widen ()
919 "Display all the currently selected bug reports."
921 (let ((id (debbugs-gnu-current-id t))
922 (inhibit-read-only t))
923 (setq debbugs-gnu-current-limit nil)
924 (tabulated-list-init-header)
925 (tabulated-list-print)
927 (debbugs-gnu-goto id))))
929 (defun debbugs-gnu-narrow-to-status (string &optional status-only)
930 "Only display the bugs matching STRING.
931 If STATUS-ONLY (the prefix), ignore matches in the From and
933 (interactive "sNarrow to: \nP")
934 (let ((id (debbugs-gnu-current-id t))
935 (inhibit-read-only t)
937 (setq debbugs-gnu-current-limit nil)
938 (if (equal string "")
939 (debbugs-gnu-toggle-suppress)
940 (goto-char (point-min))
942 (setq status (debbugs-gnu-current-status))
943 (if (and (not (member string (assq 'keywords status)))
944 (not (member string (assq 'severity status)))
946 (not (string-match string (cdr (assq 'originator status)))))
948 (not (string-match string (cdr (assq 'subject status))))))
949 (delete-region (point) (progn (forward-line 1) (point)))
950 (push (cdr (assq 'id status)) debbugs-gnu-current-limit)
953 (debbugs-gnu-goto id)))))
955 (defun debbugs-gnu-goto (id)
956 "Go to the line displaying bug ID."
957 (goto-char (point-min))
958 (while (and (not (eobp))
959 (not (equal (debbugs-gnu-current-id t) id)))
962 (defun debbugs-gnu-toggle-tag ()
963 "Toggle the local tag of the report in the current line.
964 If a report is tagged locally, it is presumed to be of little
969 (let ((inhibit-read-only t)
970 (id (debbugs-gnu-current-id)))
971 (if (memq id debbugs-gnu-local-tags)
973 (setq debbugs-gnu-local-tags (delq id debbugs-gnu-local-tags))
974 (put-text-property (point) (+ (point) 5) 'face 'default))
975 (add-to-list 'debbugs-gnu-local-tags id)
977 (+ (point) (- 5 (length (number-to-string id)))) (+ (point) 5)
978 'face 'debbugs-gnu-tagged))
979 (debbugs-gnu--update-tag-face id)))
980 (debbugs-gnu-dump-persistency-file))
982 (defun debbugs-gnu--update-tag-face (id)
983 (dolist (entry tabulated-list-entries)
984 (when (equal (cdr (assq 'id (car entry))) id)
990 (if (memq id debbugs-gnu-local-tags)
994 (defun debbugs-gnu-toggle-suppress ()
995 "Suppress bugs marked in `debbugs-gnu-suppress-bugs'."
997 (widget-put debbugs-gnu-current-widget :suppress
998 (not (widget-get debbugs-gnu-current-widget :suppress)))
999 (tabulated-list-init-header)
1000 (tabulated-list-print))
1002 (defvar debbugs-gnu-bug-number nil)
1003 (defvar debbugs-gnu-subject nil)
1005 (defun debbugs-gnu-current-id (&optional noerror)
1006 (or (cdr (assq 'id (debbugs-gnu-current-status)))
1008 (error "No bug on the current line"))))
1010 (defun debbugs-gnu-current-status ()
1011 (get-text-property (line-beginning-position) 'tabulated-list-id))
1013 (defun debbugs-gnu-current-query ()
1014 (widget-get debbugs-gnu-current-widget :query))
1016 (defun debbugs-gnu-display-status (query status)
1017 "Display the query and status of the report on the current line."
1018 (interactive (list (debbugs-gnu-current-query)
1019 (debbugs-gnu-current-status)))
1020 (pop-to-buffer "*Bug Status*")
1021 (let ((inhibit-read-only t))
1023 (when query (pp query (current-buffer)))
1024 (when status (pp status (current-buffer)))
1025 (goto-char (point-min)))
1026 (set-buffer-modified-p nil)
1029 (defun debbugs-gnu-select-report ()
1030 "Select the report on the current line."
1032 ;; We open the report messages.
1033 (let* ((status (debbugs-gnu-current-status))
1034 (id (cdr (assq 'id status)))
1035 (merged (cdr (assq 'mergedwith status))))
1036 (gnus-read-ephemeral-emacs-bug-group
1037 (cons id (if (listp merged)
1040 (cons (current-buffer)
1041 (current-window-configuration)))
1042 (with-current-buffer (window-buffer (selected-window))
1043 (set (make-local-variable 'debbugs-gnu-bug-number) id)
1044 (set (make-local-variable 'debbugs-gnu-subject)
1045 (format "Re: bug#%d: %s" id (cdr (assq 'subject status))))
1046 (debbugs-gnu-summary-mode 1))))
1048 (defvar debbugs-gnu-summary-mode-map
1049 (let ((map (make-sparse-keymap)))
1050 (define-key map "C" 'debbugs-gnu-send-control-message)
1051 (define-key map [(meta m)] 'debbugs-gnu-apply-patch)
1054 (defvar gnus-posting-styles)
1056 (define-minor-mode debbugs-gnu-summary-mode
1057 "Minor mode for providing a debbugs interface in Gnus summary buffers.
1059 \\{debbugs-gnu-summary-mode-map}"
1060 :lighter " Debbugs" :keymap debbugs-gnu-summary-mode-map
1061 (set (make-local-variable 'gnus-posting-styles)
1064 (when (buffer-live-p gnus-article-copy)
1065 (with-current-buffer gnus-article-copy
1066 (set (make-local-variable 'message-prune-recipient-rules)
1067 '((".*@debbugs.*" "emacs-pretest-bug")
1068 (".*@debbugs.*" "bug-gnu-emacs")
1069 ("[0-9]+@debbugs.*" "submit@debbugs.gnu.org")
1070 ("[0-9]+@debbugs.*" "quiet@debbugs.gnu.org")))
1071 (set (make-local-variable 'message-alter-recipients-function)
1073 (if (string-match "\\([0-9]+\\)@donarmstrong"
1075 (let ((new (format "%s@debbugs.gnu.org"
1076 (match-string 1 (car address)))))
1079 ;; `gnus-posting-styles' is eval'ed after
1080 ;; `message-simplify-subject'. So we cannot use m-s-s.
1081 (setq subject ,debbugs-gnu-subject))))))))
1083 (defun debbugs-gnu-guess-current-id ()
1084 "Guess the ID based on \"#23\"."
1088 (or (re-search-forward "#\\([0-9]+\\)" (line-end-position) t)
1090 (goto-char (point-min))
1091 (re-search-forward "#\\([0-9]+\\)" nil t)))
1092 (string-to-number (match-string 1)))))
1094 (defun debbugs-gnu-send-control-message (message &optional reverse)
1095 "Send a control message for the current bug report.
1096 You can set the severity or add a tag, or close the report. If
1097 you use the special \"done\" MESSAGE, the report will be marked as
1098 fixed, and then closed.
1100 If given a prefix, and given a tag to set, the tag will be
1103 (list (completing-read
1105 '("serious" "important" "normal" "minor" "wishlist"
1106 "done" "donenotabug" "donewontfix" "doneunreproducible"
1107 "unarchive" "reopen" "close"
1108 "merge" "forcemerge"
1112 "patch" "wontfix" "moreinfo" "unreproducible" "fixed" "notabug"
1113 "pending" "help" "security" "confirmed"
1116 current-prefix-arg))
1117 (let* ((id (or debbugs-gnu-bug-number ; Set on group entry.
1118 (debbugs-gnu-guess-current-id)
1119 (debbugs-gnu-current-id)))
1121 (when (member message '("close" "done"))
1125 ;; Emacs development versions.
1127 "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)\\." emacs-version)
1129 (match-string 1 emacs-version)
1130 (1+ (string-to-number (match-string 2 emacs-version)))))
1131 ;; Emacs release versions.
1133 "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" emacs-version)
1135 (match-string 1 emacs-version)
1136 (match-string 2 emacs-version)))
1137 (t emacs-version))))))
1139 (insert "To: control@debbugs.gnu.org\n"
1140 "From: " (message-make-from) "\n"
1141 (format "Subject: control message for bug #%d\n" id)
1144 ((member message '("unarchive" "reopen" "noowner"))
1145 (format "%s %d\n" message id))
1146 ((member message '("merge" "forcemerge"))
1147 (format "%s %d %s\n" message id
1148 (read-string "Merge with bug #: ")))
1149 ((equal message "owner")
1150 (format "owner %d !\n" id))
1151 ((equal message "reassign")
1152 (format "reassign %d %s\n" id (read-string "Package(s): ")))
1153 ((equal message "close")
1154 (format "close %d %s\n" id version))
1155 ((equal message "done")
1156 (format "tags %d fixed\nclose %d %s\n" id id version))
1157 ((member message '("donenotabug" "donewontfix"
1158 "doneunreproducible"))
1159 (format "tags %d %s\nclose %d\n" id (substring message 4) id))
1160 ((member message '("serious" "important" "normal"
1161 "minor" "wishlist"))
1162 (format "severity %d %s\n" id message))
1163 ((equal message "invalid")
1164 (format "tags %d notabug\ntags %d wontfix\nclose %d\n"
1166 ((equal message "usertag")
1167 (format "user %s\nusertag %d %s\n"
1169 "Package name or email address: "
1171 debbugs-gnu-all-packages (list user-mail-address))
1172 nil nil (car debbugs-gnu-default-packages))
1173 id (read-string "User tag: ")))
1175 (format "tags %d%s %s\n"
1176 id (if reverse " -" "")
1178 (funcall send-mail-function))))
1180 (defvar debbugs-gnu-usertags-mode-map
1181 (let ((map (make-sparse-keymap)))
1182 (set-keymap-parent map tabulated-list-mode-map)
1183 (define-key map "\r" 'debbugs-gnu-select-usertag)
1184 (define-key map [mouse-1] 'debbugs-gnu-select-usertag)
1185 (define-key map [mouse-2] 'debbugs-gnu-select-usertag)
1188 (define-derived-mode debbugs-gnu-usertags-mode tabulated-list-mode "Usertags"
1189 "Major mode for listing user tags.
1191 All normal editing commands are switched off.
1192 \\<debbugs-gnu-usertags-mode-map>
1194 The following commands are available:
1196 \\{debbugs-gnu-usertags-mode-map}"
1197 (buffer-disable-undo)
1198 (setq truncate-lines t)
1199 (setq buffer-read-only t))
1202 (defun debbugs-gnu-usertags (&rest users)
1203 "List all user tags for USERS, which is \(\"emacs\"\) by default."
1205 (if current-prefix-arg
1206 (completing-read-multiple
1207 "Package name(s) or email address: "
1208 (append debbugs-gnu-all-packages (list user-mail-address)) nil nil
1209 (mapconcat 'identity debbugs-gnu-default-packages ","))
1210 debbugs-gnu-default-packages))
1213 (let ((inhibit-read-only t)
1214 (debbugs-port "gnu.org")
1215 (buffer-name "*Emacs User Tags*")
1217 (1+ (apply 'max (length "User") (mapcar 'length users)))))
1219 ;; Initialize variables.
1220 (when (and (file-exists-p debbugs-gnu-persistency-file)
1221 (not debbugs-gnu-local-tags))
1223 (insert-file-contents debbugs-gnu-persistency-file)
1224 (eval (read (current-buffer)))))
1227 (when (get-buffer buffer-name)
1228 (kill-buffer buffer-name))
1229 (pop-to-buffer (get-buffer-create buffer-name))
1230 (debbugs-gnu-usertags-mode)
1231 (setq tabulated-list-format `[("User" ,user-tab-length t)
1233 (setq tabulated-list-sort-key (cons "User" nil))
1234 ;(setq tabulated-list-printer 'debbugs-gnu-print-entry)
1237 ;; Retrieve user tags.
1238 (dolist (user users)
1239 (dolist (tag (sort (debbugs-get-usertag :user user) 'string<))
1241 'tabulated-list-entries
1242 ;; `tabulated-list-id' is the parameter list for `debbugs-gnu'.
1243 `((("tagged") (,user) nil nil (,tag))
1244 ,(vector (propertize user 'mouse-face widget-mouse-face)
1245 (propertize tag 'mouse-face widget-mouse-face)))
1249 (when debbugs-gnu-local-tags
1251 'tabulated-list-entries
1253 ,(vector "" (propertize "(local tags)"
1254 'mouse-face widget-mouse-face)))))
1257 (tabulated-list-init-header)
1258 (tabulated-list-print)
1260 (set-buffer-modified-p nil)
1261 (goto-char (point-min)))))
1263 (defun debbugs-gnu-select-usertag ()
1264 "Select the user tag on the current line."
1266 ;; We open the bug reports.
1267 (let ((args (get-text-property (line-beginning-position) 'tabulated-list-id)))
1268 (when args (apply 'debbugs-gnu args))))
1271 (defun debbugs-gnu-bugs (&rest bugs)
1272 "List all BUGS, a list of bug numbers."
1274 (mapcar 'string-to-number
1275 (completing-read-multiple "Bug numbers: " nil 'natnump)))
1277 (unless (natnump elt) (signal 'wrong-type-argument (list 'natnump elt))))
1278 (add-to-list 'debbugs-gnu-current-query (cons 'bugs bugs))
1281 (defvar debbugs-gnu-trunk-directory "~/src/emacs/trunk/"
1282 "The directory where the main source tree lives.")
1284 (defvar debbugs-gnu-branch-directory "~/src/emacs/emacs-24/"
1285 "The directory where the previous source tree lives.")
1287 (defun debbugs-gnu-apply-patch (&optional branch)
1288 "Apply the patch from the current message.
1289 If given a prefix, patch in the branch directory instead."
1291 (add-hook 'emacs-lisp-mode-hook 'debbugs-gnu-lisp-mode)
1292 (add-hook 'diff-mode-hook 'debbugs-gnu-diff-mode)
1293 (add-hook 'change-log-mode-hook 'debbugs-gnu-change-mode)
1294 (let ((rej "/tmp/debbugs-gnu.rej")
1295 (output-buffer (get-buffer-create "*debbugs patch*"))
1297 debbugs-gnu-branch-directory
1298 debbugs-gnu-trunk-directory))
1299 (patch-buffers nil))
1300 (when (file-exists-p rej)
1302 (with-current-buffer output-buffer
1304 (gnus-summary-select-article nil t)
1305 ;; The patches are either in MIME attachements or the main article
1306 ;; buffer. Determine which.
1307 (gnus-with-article-buffer
1308 (dolist (handle (mapcar 'cdr (gnus-article-mime-handles)))
1309 (when (string-match "diff\\|patch" (mm-handle-media-type handle))
1310 (push (mm-handle-buffer handle) patch-buffers))))
1311 (unless patch-buffers
1312 (gnus-summary-show-article 'raw)
1313 (article-decode-charset)
1314 (push (current-buffer) patch-buffers))
1315 (dolist (buffer patch-buffers)
1316 (with-current-buffer buffer
1317 (call-process-region (point-min) (point-max)
1318 "patch" nil output-buffer nil
1319 "-r" rej "--no-backup-if-mismatch"
1321 "-d" (expand-file-name dir)
1323 (set-buffer output-buffer)
1324 (when (file-exists-p rej)
1325 (goto-char (point-max))
1326 (insert-file-contents-literally rej))
1327 (goto-char (point-max))
1328 (save-some-buffers t)
1329 (mapcar 'kill-process compilation-in-progress)
1330 (compile (format "cd %s; make -k" (expand-file-name "lisp" dir)))
1332 (vc-dir-hide-up-to-date)
1333 (goto-char (point-min))
1336 ;; All these commands are asynchronous, so just wait a bit. This
1337 ;; should be done properly a different way.
1339 ;; We've now done everything, so arrange the windows we need to see.
1340 (delete-other-windows)
1341 (switch-to-buffer output-buffer)
1345 (switch-to-buffer "*compilation*")
1346 (goto-char (point-max))
1348 (switch-to-buffer "*vc-diff*")
1349 (goto-char (point-min))))
1351 (defun debbugs-gnu-find-contributor (string)
1352 "Search through ChangeLogs to find contributors."
1353 (interactive "sContributor match: ")
1355 (match (concat "^[0-9].*" string)))
1356 (dolist (file (directory-files-recursively
1357 debbugs-gnu-trunk-directory "ChangeLog\\(.[0-9]+\\)?$"))
1359 (when (file-exists-p file)
1360 (insert-file-contents file))
1361 (goto-char (point-min))
1362 (while (and (re-search-forward match nil t)
1363 (not (looking-at ".*tiny change")))
1365 (message "%s is a contributor %d times" string found)
1368 (defun debbugs-gnu-insert-changelog ()
1369 "Add a ChangeLog from a recently applied patch from a third party."
1372 (gnus-with-article-buffer
1374 (goto-char (point-min))
1375 (setq from (mail-extract-address-components (gnus-fetch-field "from"))
1376 subject (gnus-fetch-field "subject")))
1377 (let ((add-log-full-name (car from))
1378 (add-log-mailing-address (cadr from)))
1379 (add-change-log-entry-other-window)
1380 (let ((point (point)))
1381 (when (string-match "\\(bug#[0-9]+\\)" subject)
1382 (insert " (" (match-string 1 subject) ")."))
1383 (when (zerop (debbugs-gnu-find-contributor
1384 (let ((bits (split-string (car from))))
1386 ((>= (length bits) 2)
1387 (format "%s.*%s" (car bits) (car (last bits))))
1388 ((= (length bits) 1)
1390 ;; Fall back on the email address.
1393 (goto-char (point-min))
1395 (insert " (tiny change"))
1396 (goto-char point)))))
1398 (defvar debbugs-gnu-lisp-mode-map
1399 (let ((map (make-sparse-keymap)))
1400 (define-key map [(meta m)] 'debbugs-gnu-insert-changelog)
1403 (define-minor-mode debbugs-gnu-lisp-mode
1404 "Minor mode for providing a debbugs interface in Lisp buffers.
1405 \\{debbugs-gnu-lisp-mode-map}"
1406 :lighter " Debbugs" :keymap debbugs-gnu-lisp-mode-map)
1408 (defvar debbugs-gnu-diff-mode-map
1409 (let ((map (make-sparse-keymap)))
1410 (define-key map [(meta m)] 'debbugs-gnu-diff-select)
1413 (define-minor-mode debbugs-gnu-diff-mode
1414 "Minor mode for providing a debbugs interface in diff buffers.
1415 \\{debbugs-gnu-diff-mode-map}"
1416 :lighter " Debbugs" :keymap debbugs-gnu-diff-mode-map)
1418 (defun debbugs-gnu-diff-select ()
1419 "Select the diff under point."
1421 (delete-other-windows)
1424 (defvar debbugs-gnu-change-mode-map
1425 (let ((map (make-sparse-keymap)))
1426 (define-key map [(meta m)] 'debbugs-gnu-change-checkin)
1429 (define-minor-mode debbugs-gnu-change-mode
1430 "Minor mode for providing a debbugs interface in ChangeLog buffers.
1431 \\{debbugs-gnu-change-mode-map}"
1432 :lighter " Debbugs" :keymap debbugs-gnu-change-mode-map)
1434 (defun debbugs-gnu-change-checkin ()
1435 "Prepare checking in the current changes."
1437 (save-some-buffers t)
1438 (when (get-buffer "*vc-dir*")
1439 (kill-buffer (get-buffer "*vc-dir*")))
1440 (vc-dir debbugs-gnu-trunk-directory)
1441 (goto-char (point-min))
1442 (while (not (search-forward "edited" nil t))
1445 (while (search-forward "edited" nil t)
1447 (beginning-of-line))
1449 (vc-next-action nil)
1450 (log-edit-insert-changelog t)
1451 (delete-other-windows)
1454 (switch-to-buffer "*vc-diff*")
1457 (provide 'debbugs-gnu)
1461 ;; * Reorganize pages after client-side filtering.
1463 ;;; debbugs-gnu.el ends here