]> code.delx.au - gnu-emacs-elpa/blob - packages/debbugs/debbugs-gnu.el
packages/yasnippet: pull from external (0.10.0)
[gnu-emacs-elpa] / packages / debbugs / debbugs-gnu.el
1 ;;; debbugs-gnu.el --- interface for the GNU bug tracker -*- lexical-binding:t -*-
2
3 ;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Michael Albinus <michael.albinus@gmx.org>
7 ;; Keywords: comm, hypermedia, maint
8 ;; Package: debbugs
9
10 ;; This file is not part of GNU Emacs.
11
12 ;; This program is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
16
17 ;; This program is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Commentary:
26
27 ;; This package provides an interface to bug reports which are located
28 ;; on the GNU bug tracker debbugs.gnu.org. Its main purpose is to
29 ;; show and manipulate bug reports from Emacs, but it could be used
30 ;; also for other GNU projects which use the same bug tracker.
31
32 ;; If you have `debbugs-gnu.el' in your load-path, you could enable
33 ;; the bug tracker commands by the following lines in your ~/.emacs
34 ;;
35 ;; (autoload 'debbugs-gnu "debbugs-gnu" "" 'interactive)
36 ;; (autoload 'debbugs-gnu-search "debbugs-gnu" "" 'interactive)
37 ;; (autoload 'debbugs-gnu-usertags "debbugs-gnu" "" 'interactive)
38 ;; (autoload 'debbugs-gnu-bugs "debbugs-gnu" "" 'interactive)
39
40 ;; The bug tracker is called interactively by
41 ;;
42 ;; M-x debbugs-gnu
43
44 ;; It asks for the severities, for which bugs shall be shown. This can
45 ;; be either just one severity, or a list of severities, separated by
46 ;; comma. Valid severities are "serious", "important", "normal",
47 ;; "minor" or "wishlist". Severities "critical" and "grave" are not
48 ;; used, although configured on the GNU bug tracker. If no severity
49 ;; is given, all bugs are selected.
50
51 ;; There is also the pseudo severity "tagged". When it is used, the
52 ;; function will ask for user tags (a comma separated list), and shows
53 ;; just the bugs which are tagged with them. In general, user tags
54 ;; shall be strings denoting to subprojects of the package, like
55 ;; "cedet" or "tramp" of the package "emacs". If no user tag is
56 ;; given, locally tagged bugs are shown.
57
58 ;; If a prefix is given to the command, more search parameters are
59 ;; asked for, like packages (also a comma separated list, "emacs" is
60 ;; the default), whether archived bugs shall be shown, and whether
61 ;; closed bugs shall be suppressed from being retrieved.
62
63 ;; Another command is
64 ;;
65 ;; M-x debbugs-gnu-search
66
67 ;; It behaves like `debbugs-gnu', but asks at the beginning for a
68 ;; search phrase to be used for full text search. Additionally, it
69 ;; asks for key-value pairs to filter bugs. Keys are as described in
70 ;; `debbugs-get-status', the corresponding value must be a regular
71 ;; expression to match for. The other parameters are as described in
72 ;; `debbugs-gnu'. Usually, there is just one value except for the
73 ;; attribute "date", which needs two arguments specifying a period in
74 ;; which the bug has been submitted or modified.
75
76 ;; The bug reports are downloaded from the bug tracker. In order to
77 ;; not generate too much load of the server, up to 500 bugs will be
78 ;; downloaded at once. If there are more hits, several downloads will
79 ;; be performed, until all bugs are retrieved.
80
81 ;; These default values could be changed also by customer options
82 ;; `debbugs-gnu-default-severities', `debbugs-gnu-default-packages'
83 ;; and `debbugs-gnu-default-suppress-bugs'.
84
85 ;; The commands create a page of bug lists. Every bug is shown in one
86 ;; line, including the bug number, the status (combining merged bug
87 ;; numbers, keywords and severities), the name of the submitter, and
88 ;; the title of the bug. On every bug line you could apply the
89 ;; following actions by the following keystrokes:
90
91 ;; RET: Show corresponding messages in Gnus/Rmail
92 ;; "C": Send a control message
93 ;; "t": Mark the bug locally as tagged
94 ;; "b": Show bugs this bug is blocked by
95 ;; "B": Show bugs this bug is blocking
96 ;; "d": Show bug attributes
97
98 ;; Furthermore, you could apply the global actions
99
100 ;; "g": Rescan bugs
101 ;; "q": Quit the buffer
102 ;; "s": Toggle bug sorting for age or for state
103 ;; "x": Toggle suppressing of bugs
104 ;; "/": Display only bugs matching a string
105 ;; "R": Display only bugs blocking the current release
106 ;; "w": Display all the currently selected bug reports
107
108 ;; When you visit the related bug messages in Gnus or Rmail, you could
109 ;; also send control messages by keystroke "C".
110
111 ;; In the header line of every bug list page, you can toggle sorting
112 ;; per column by selecting a column with the mouse. The sorting
113 ;; happens as expected for the respective column; sorting in the Title
114 ;; column is depending on whether you are the owner of a bug.
115
116 ;; Another approach for listing bugs is calling the command
117 ;;
118 ;; M-x debbugs-gnu-usertags
119
120 ;; This command shows you all existing user tags for the packages
121 ;; defined in `debbugs-gnu-default-packages'. A prefix for the
122 ;; command allows you to use other package names, or an arbitrary
123 ;; string for a user who has tagged bugs. The command returns the
124 ;; list of existing user tags for the given user(s) or package
125 ;; name(s), respectively. Applying RET on a user tag, all bugs tagged
126 ;; with this user tag are shown.
127
128 ;; Unfortunately, it is not possible with the SOAP interface to show
129 ;; all users who have tagged bugs. This list can be retrieved via
130 ;; <http://debbugs.gnu.org/cgi/pkgindex.cgi?indexon=users>.
131
132 ;; Finally, if you simply want to list some bugs with known bug
133 ;; numbers, call the command
134 ;;
135 ;; M-x debbugs-gnu-bugs
136
137 ;; The bug numbers to be shown shall be entered as comma separated list.
138
139 ;;; Code:
140
141 (require 'debbugs)
142 (require 'tabulated-list)
143 (require 'add-log)
144 (eval-when-compile (require 'subr-x))
145 (eval-when-compile (require 'cl-lib))
146
147 (autoload 'article-decode-charset "gnus-art")
148 (autoload 'diff-goto-source "diff-mode")
149 (autoload 'diff-hunk-file-names "diff-mode")
150 (autoload 'gnus-article-mime-handles "gnus-art")
151 (autoload 'gnus-fetch-field "gnus-util")
152 (autoload 'gnus-read-ephemeral-emacs-bug-group "gnus-group")
153 (autoload 'gnus-summary-article-header "gnus-sum")
154 (autoload 'gnus-summary-select-article "gnus-sum")
155 (autoload 'gnus-summary-show-article "gnus-sum")
156 (autoload 'gnus-with-article-buffer "gnus-art")
157 (autoload 'log-edit-insert-changelog "log-edit")
158 (autoload 'mail-header-subject "nnheader")
159 (autoload 'message-goto-body "message")
160 (autoload 'message-make-from "message")
161 (autoload 'rmail-get-new-mail "rmail")
162 (autoload 'rmail-show-message "rmail")
163 (autoload 'rmail-summary "rmailsum")
164 (autoload 'vc-dir-hide-up-to-date "vc-dir")
165 (autoload 'vc-dir-mark "vc-dir")
166
167 (defvar compilation-in-progress)
168 (defvar diff-file-header-re)
169 (defvar gnus-article-buffer)
170 (defvar gnus-posting-styles)
171 (defvar gnus-save-duplicate-list)
172 (defvar gnus-suppress-duplicates)
173 (defvar rmail-current-message)
174 (defvar rmail-mode-map)
175 (defvar rmail-summary-mode-map)
176 (defvar rmail-total-messages)
177
178 ;; Buffer-local variables.
179 (defvar debbugs-gnu-local-query)
180 (defvar debbugs-gnu-local-filter)
181 (defvar debbugs-gnu-local-suppress)
182 (defvar debbugs-gnu-sort-state)
183 (defvar debbugs-gnu-limit)
184
185 (defgroup debbugs-gnu ()
186 "UI for the debbugs.gnu.org bug tracker."
187 :group 'debbugs
188 :version "24.1")
189
190 (defvar debbugs-gnu-blocking-report 19759
191 "The ID of the current release report used to track blocking bug reports.")
192
193 (defcustom debbugs-gnu-default-severities '("serious" "important" "normal")
194 "*The list severities bugs are searched for.
195 \"tagged\" is not a severity but marks locally tagged bugs."
196 ;; <http://debbugs.gnu.org/Developer.html#severities>
197 ;; /ssh:debbugs:/etc/debbugs/config @gSeverityList
198 ;; We don't use "critical" and "grave".
199 :group 'debbugs-gnu
200 :type '(set (const "serious")
201 (const "important")
202 (const "normal")
203 (const "minor")
204 (const "wishlist")
205 (const "tagged"))
206 :version "24.1")
207
208 (defcustom debbugs-gnu-suppress-closed t
209 "If non-nil, don't show closed bugs."
210 :group 'debbugs-gnu
211 :type 'boolean
212 :version "25.2")
213
214 (defconst debbugs-gnu-all-severities
215 (mapcar 'cadr (cdr (get 'debbugs-gnu-default-severities 'custom-type)))
216 "*List of all possible severities.")
217
218 (defcustom debbugs-gnu-default-packages '("emacs")
219 "*The list of packages to be searched for."
220 ;; <http://debbugs.gnu.org/Packages.html>
221 ;; <http://debbugs.gnu.org/cgi/pkgindex.cgi>
222 :group 'debbugs-gnu
223 :type '(set (const "adns")
224 (const "auctex")
225 (const "automake")
226 (const "cc-mode")
227 (const "coreutils")
228 (const "cppi")
229 (const "debbugs.gnu.org")
230 (const "diffutils")
231 (const "emacs")
232 (const "emacs-xwidgets")
233 (const "fm")
234 (const "gnus")
235 (const "grep")
236 (const "guile")
237 (const "guix")
238 (const "gzip")
239 (const "idutils")
240 (const "libtool")
241 (const "mh-e")
242 (const "org-mode")
243 (const "parted")
244 (const "sed")
245 (const "vc-dwim")
246 (const "woodchuck"))
247 :version "25.1")
248
249 (defconst debbugs-gnu-all-packages
250 (mapcar 'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type)))
251 "*List of all possible package names.")
252
253 (defcustom debbugs-gnu-default-suppress-bugs
254 '((pending . "done"))
255 "*A list of specs for bugs to be suppressed.
256 An element of this list is a cons cell \(KEY . REGEXP\), with key
257 being returned by `debbugs-get-status', and REGEXP a regular
258 expression matching the corresponding value, a string. Showing
259 suppressed bugs is toggled by `debbugs-gnu-toggle-suppress'."
260 :group 'debbugs-gnu
261 :type '(alist :key-type symbol :value-type regexp)
262 :version "24.1")
263
264 (defcustom debbugs-gnu-mail-backend 'gnus
265 "*The email backend to use for reading bug report email exchange.
266 If this is 'gnus, the default, use Gnus.
267 If this is 'rmail, use Rmail instead."
268 :group 'debbugs-gnu
269 :type '(choice (const :tag "Use Gnus" 'gnus)
270 (const :tag "Use Rmail" 'rmail))
271 :version "25.1")
272
273 (defface debbugs-gnu-archived '((t (:inverse-video t)))
274 "Face for archived bug reports.")
275
276 (defface debbugs-gnu-new '((t (:foreground "red")))
277 "Face for new reports that nobody has answered.")
278
279 (defface debbugs-gnu-handled '((t (:foreground "ForestGreen")))
280 "Face for reports that have been modified recently.")
281
282 (defface debbugs-gnu-pending '((t (:foreground "MidnightBlue")))
283 "Face for reports that are pending.")
284
285 (defface debbugs-gnu-stale '((t (:foreground "orange")))
286 "Face for reports that have not been touched for two weeks.")
287
288 (defface debbugs-gnu-done '((t (:foreground "DarkGrey")))
289 "Face for closed bug reports.")
290
291 (defface debbugs-gnu-tagged '((t (:foreground "red")))
292 "Face for reports that have been tagged locally.")
293
294 (defvar debbugs-gnu-local-tags nil
295 "List of bug numbers tagged locally, and kept persistent.")
296
297 (defvar debbugs-gnu-persistency-file
298 (expand-file-name (locate-user-emacs-file "debbugs"))
299 "File name of a persistency store for debbugs variables")
300
301 (defun debbugs-gnu-dump-persistency-file ()
302 "Function to store debbugs variables persistently."
303 (with-temp-file debbugs-gnu-persistency-file
304 (insert
305 ";; -*- emacs-lisp -*-\n"
306 ";; Debbugs tags connection history. Don't change this file.\n\n"
307 (format "(setq debbugs-gnu-local-tags '%S)"
308 (sort (copy-sequence debbugs-gnu-local-tags) '>)))))
309
310 (defvar debbugs-gnu-current-query nil
311 "The query object of the current search.
312 It will be applied server-side, when calling `debbugs-get-bugs'.
313 It has the same format as `debbugs-gnu-default-suppress-bugs'.")
314
315 (defvar debbugs-gnu-current-filter nil
316 "The filter object for the current search.
317 It will be applied client-side, when parsing the results of
318 `debbugs-get-status'. It has a similar format as
319 `debbugs-gnu-default-suppress-bugs'. In case of keys representing
320 a date, value is the cons cell \(BEFORE . AFTER\).")
321
322 (defvar debbugs-gnu-current-suppress nil
323 "Whether bugs shall be suppressed.
324 The specification which bugs shall be suppressed is taken from
325 `debbugs-gnu-default-suppress-bugs'.")
326
327 (defun debbugs-gnu-calendar-read (prompt acceptable &optional initial-contents)
328 "Return a string read from the minibuffer.
329 Derived from `calendar-read'."
330 (let ((value (read-string prompt initial-contents)))
331 (while (not (funcall acceptable value))
332 (setq value (read-string prompt initial-contents)))
333 value))
334
335 (defconst debbugs-gnu-phrase-prompt
336 (propertize
337 "Enter search phrase: "
338 'help-echo "\
339 The search phrase contains words to be searched for, combined by
340 operators like AND, ANDNOT and OR. If there is no operator
341 between the words, AND is used by default. The phrase can also
342 be empty, in this case only the following attributes are used for
343 search."))
344
345 ;;;###autoload
346 (defun debbugs-gnu-patches ()
347 "List the bug reports that have been marked as containing a patch."
348 (interactive)
349 (debbugs-gnu nil '("emacs") nil nil "patch"))
350
351 ;;;###autoload
352 (defun debbugs-gnu-search ()
353 "Search for Emacs bugs interactively.
354 Search arguments are requested interactively. The \"search
355 phrase\" is used for full text search in the bugs database.
356 Further key-value pairs are requested until an empty key is
357 returned. If a key cannot be queried by a SOAP request, it is
358 marked as \"client-side filter\"."
359 (interactive)
360
361 (unwind-protect
362 (let ((date-format "\\([[:digit:]]\\{4\\}\\)-\\([[:digit:]]\\{1,2\\}\\)-\\([[:digit:]]\\{1,2\\}\\)")
363 key val1 val2 phrase severities packages archivedp)
364
365 ;; Check for the phrase.
366 (setq phrase (read-string debbugs-gnu-phrase-prompt))
367 (if (zerop (length phrase))
368 (setq phrase nil)
369 (add-to-list 'debbugs-gnu-current-query (cons 'phrase phrase)))
370 ;; We suppress closed bugs if there is no phrase.
371 (setq debbugs-gnu-current-suppress
372 (if (not debbugs-gnu-suppress-closed)
373 nil
374 (null phrase)))
375
376 ;; The other queries.
377 (catch :finished
378 (while t
379 (setq key (completing-read
380 "Enter attribute: "
381 (if phrase
382 '("severity" "package" "tags"
383 "author" "date" "subject")
384 '("severity" "package" "archive" "src" "status" "tag"
385 "owner" "submitter" "maint" "correspondent"
386 ;; Client-side queries.
387 "date" "log_modified" "last_modified"
388 "found_date" "fixed_date" "unarchived"
389 "subject" "done" "forwarded" "msgid" "summary"))
390 nil t))
391 (cond
392 ;; Server-side queries.
393 ((equal key "severity")
394 (setq
395 severities
396 (completing-read-multiple
397 "Enter severities: " debbugs-gnu-all-severities nil t
398 (mapconcat 'identity debbugs-gnu-default-severities ","))))
399
400 ((equal key "package")
401 (setq
402 packages
403 (completing-read-multiple
404 "Enter packages: " debbugs-gnu-all-packages nil t
405 (mapconcat 'identity debbugs-gnu-default-packages ","))))
406
407 ((equal key "archive")
408 ;; We simplify, by assuming just archived bugs are requested.
409 (setq archivedp t))
410
411 ((member key '("src" "tag" "tags"))
412 (setq val1 (read-string (format "Enter %s: " key)))
413 (when (not (zerop (length val1)))
414 (add-to-list
415 'debbugs-gnu-current-query (cons (intern key) val1))))
416
417 ((member
418 key '("author" "owner" "submitter" "maint" "correspondent"))
419 (setq val1 (read-string "Enter email address: "))
420 (when (not (zerop (length val1)))
421 (add-to-list
422 'debbugs-gnu-current-query
423 (cons (intern (if (equal key "author") "@author" key)) val1))))
424
425 ((equal key "status")
426 (setq
427 val1
428 (completing-read
429 "Enter status: " '("pending" "forwarded" "fixed" "done")))
430 (when (not (zerop (length val1)))
431 (add-to-list
432 'debbugs-gnu-current-query (cons (intern key) val1))))
433
434 ;; Client-side filters.
435 ((member key '("date" "log_modified" "last_modified"
436 "found_date" "fixed_date" "unarchived"))
437 (setq val1
438 (debbugs-gnu-calendar-read
439 (format "Enter %s before YYYY-MM-DD%s: "
440 key (if phrase "" " (client-side filter)"))
441 (lambda (x)
442 (string-match (concat "^\\(" date-format "\\|\\)$") x))))
443 (if (string-match date-format val1)
444 (setq val1 (floor
445 (float-time
446 (encode-time
447 0 0 0
448 (string-to-number (match-string 3 val1))
449 (string-to-number (match-string 2 val1))
450 (string-to-number (match-string 1 val1))))))
451 (setq val1 nil))
452 (setq val2
453 (debbugs-gnu-calendar-read
454 (format "Enter %s after YYYY-MM-DD%s: "
455 key (if phrase "" " (client-side filter)"))
456 (lambda (x)
457 (string-match (concat "^\\(" date-format "\\|\\)$") x))))
458 (if (string-match date-format val2)
459 (setq val2 (floor
460 (float-time
461 (encode-time
462 0 0 0
463 (string-to-number (match-string 3 val2))
464 (string-to-number (match-string 2 val2))
465 (string-to-number (match-string 1 val2))))))
466 (setq val2 nil))
467 (when (or val1 val2)
468 (add-to-list
469 (if phrase
470 'debbugs-gnu-current-query 'debbugs-gnu-current-filter)
471 (cons (intern key) (cons val1 val2)))))
472
473 ((not (zerop (length key)))
474 (setq val1
475 (funcall
476 (if phrase 'read-string 'read-regexp)
477 (format "Enter %s%s"
478 key (if phrase ": " " (client-side filter)"))))
479 (when (not (zerop (length val1)))
480 (add-to-list
481 (if phrase
482 'debbugs-gnu-current-query 'debbugs-gnu-current-filter)
483 (cons (intern key) val1))))
484
485 ;; The End.
486 (t (throw :finished nil)))))
487
488 ;; Do the search.
489 (debbugs-gnu severities packages archivedp))))
490
491 ;;;###autoload
492 (defun debbugs-gnu (severities &optional packages archivedp suppress tags)
493 "List all outstanding bugs."
494 (interactive
495 (let (severities archivedp)
496 (list
497 (setq severities
498 (completing-read-multiple
499 "Severities: " debbugs-gnu-all-severities nil t
500 (mapconcat 'identity debbugs-gnu-default-severities ",")))
501 ;; The next parameters are asked only when there is a prefix.
502 (if current-prefix-arg
503 (completing-read-multiple
504 "Packages: " debbugs-gnu-all-packages nil t
505 (mapconcat 'identity debbugs-gnu-default-packages ","))
506 debbugs-gnu-default-packages)
507 (when current-prefix-arg
508 (setq archivedp (y-or-n-p "Show archived bugs?")))
509 (when (and current-prefix-arg (not archivedp))
510 (y-or-n-p "Suppress unwanted bugs?"))
511 ;; This one must be asked for severity "tagged".
512 (when (member "tagged" severities)
513 (split-string (read-string "User tag(s): ") "," t)))))
514
515 ;; Initialize variables.
516 (when (and (file-exists-p debbugs-gnu-persistency-file)
517 (not debbugs-gnu-local-tags))
518 (with-temp-buffer
519 (insert-file-contents debbugs-gnu-persistency-file)
520 (eval (read (current-buffer)))))
521 ;; Per default, we suppress retrieved unwanted bugs.
522 (when (and (called-interactively-p 'any)
523 debbugs-gnu-suppress-closed)
524 (setq debbugs-gnu-current-suppress t))
525
526 ;; Add queries.
527 (dolist (severity (if (consp severities) severities (list severities)))
528 (when (not (zerop (length severity)))
529 (when (string-equal severity "tagged")
530 (setq debbugs-gnu-current-suppress nil))
531 (add-to-list 'debbugs-gnu-current-query (cons 'severity severity))))
532 (dolist (package (if (consp packages) packages (list packages)))
533 (when (not (zerop (length package)))
534 (add-to-list 'debbugs-gnu-current-query (cons 'package package))))
535 (when archivedp
536 (setq debbugs-gnu-current-suppress nil)
537 (add-to-list 'debbugs-gnu-current-query '(archive . "1")))
538 (when suppress
539 (setq debbugs-gnu-current-suppress t)
540 (add-to-list 'debbugs-gnu-current-query '(status . "open"))
541 (add-to-list 'debbugs-gnu-current-query '(status . "forwarded")))
542 (dolist (tag (if (consp tags) tags (list tags)))
543 (when (not (zerop (length tag)))
544 (add-to-list 'debbugs-gnu-current-query (cons 'tag tag))))
545
546 ;; Show result.
547 (debbugs-gnu-show-reports)
548
549 ;; Reset query, filter and suppress.
550 (setq debbugs-gnu-current-query nil
551 debbugs-gnu-current-filter nil
552 debbugs-gnu-current-suppress nil))
553
554 (defun debbugs-gnu-get-bugs (query)
555 "Retrieve bug numbers from debbugs.gnu.org according search criteria."
556 (let* ((debbugs-port "gnu.org")
557 (bugs (assoc 'bugs query))
558 (tags (assoc 'tag query))
559 (local-tags (and (member '(severity . "tagged") query) (not tags)))
560 (phrase (assoc 'phrase query))
561 args)
562 ;; Compile query arguments.
563 (unless (or query tags)
564 (dolist (elt debbugs-gnu-default-packages)
565 (setq args (append args (list :package elt)))))
566 (dolist (elt query)
567 (unless (equal elt '(severity . "tagged"))
568 (setq args
569 (append
570 args
571 (if phrase
572 (cond
573 ((eq (car elt) 'phrase)
574 (list (list :phrase (cdr elt))))
575 ((eq (car elt) 'date)
576 (list (list :date (cddr elt) (cadr elt)
577 :operator "NUMBT")))
578 (t
579 (list (list (intern (concat ":" (symbol-name (car elt))))
580 (cdr elt) :operator "ISTRINC"))))
581 (list (intern (concat ":" (symbol-name (car elt))))
582 (cdr elt)))))))
583
584 (cond
585 ;; If the query is just a list of bug numbers, we return them.
586 (bugs (cdr bugs))
587 ;; If the query contains the pseudo-severity "tagged", we return
588 ;; just the local tagged bugs.
589 (local-tags (copy-sequence debbugs-gnu-local-tags))
590 ;; A full text query.
591 (phrase
592 (mapcar
593 (lambda (x) (cdr (assoc "id" x)))
594 (apply 'debbugs-search-est args)))
595 ;; Otherwise, we retrieve the bugs from the server.
596 (t (apply 'debbugs-get-bugs args)))))
597
598 (defun debbugs-gnu-show-reports (&optional offline)
599 "Show bug reports.
600 If OFFLINE is non-nil, the query is not sent to the server. Bugs
601 are taken from the cache instead."
602 (let ((inhibit-read-only t)
603 (buffer-name "*Emacs Bugs*"))
604 ;; The tabulated mode sets several local variables. We must get
605 ;; rid of them.
606 (when (get-buffer buffer-name)
607 (kill-buffer buffer-name))
608 (switch-to-buffer (get-buffer-create buffer-name))
609 (debbugs-gnu-mode)
610
611 ;; Print bug reports.
612 (dolist (status
613 (let ((debbugs-cache-expiry (if offline nil debbugs-cache-expiry))
614 ids)
615 (apply 'debbugs-get-status
616 (if offline
617 (progn
618 (maphash (lambda (key _elem)
619 (push key ids))
620 debbugs-cache-data)
621 (sort ids '<))
622 (debbugs-gnu-get-bugs debbugs-gnu-local-query)))))
623 (let* ((id (cdr (assq 'id status)))
624 (words
625 (mapconcat
626 'identity
627 (cons (cdr (assq 'severity status))
628 (cdr (assq 'keywords status)))
629 ","))
630 (address (if (cdr (assq 'originator status))
631 (mail-header-parse-address
632 (decode-coding-string (cdr (assq 'originator status))
633 'utf-8))))
634 (owner (if (cdr (assq 'owner status))
635 (car (mail-header-parse-address
636 (decode-coding-string (cdr (assq 'owner status))
637 'utf-8)))))
638 (subject (if (cdr (assq 'subject status))
639 (decode-coding-string (cdr (assq 'subject status))
640 'utf-8)))
641 merged)
642 (unless (equal (cdr (assq 'pending status)) "pending")
643 (setq words (concat words "," (cdr (assq 'pending status)))))
644 (let ((packages (delete "emacs" (cdr (assq 'package status)))))
645 (when packages
646 (setq words (concat words "," (mapconcat 'identity packages ",")))))
647 (when (setq merged (cdr (assq 'mergedwith status)))
648 (setq words (format "%s,%s"
649 (if (numberp merged)
650 merged
651 (mapconcat 'number-to-string merged ","))
652 words)))
653 (when (or (not merged)
654 (not (let ((found nil))
655 (dolist (id (if (listp merged)
656 merged
657 (list merged)))
658 (dolist (entry tabulated-list-entries)
659 (when (equal id (cdr (assq 'id (car entry))))
660 (setq found t))))
661 found)))
662 (add-to-list
663 'tabulated-list-entries
664 (list
665 status
666 (vector
667 (propertize
668 (format "%5d" id)
669 'face
670 ;; Mark tagged bugs.
671 (if (memq id debbugs-gnu-local-tags)
672 'debbugs-gnu-tagged
673 'default))
674 (propertize
675 ;; Mark status and age.
676 (or words "")
677 'face
678 (cond
679 ((cdr (assq 'archived status))
680 'debbugs-gnu-archived)
681 ((equal (cdr (assq 'pending status)) "done")
682 'debbugs-gnu-done)
683 ((member "pending" (cdr (assq 'keywords status)))
684 'debbugs-gnu-pending)
685 ;; For some new bugs `date' and `log_modified' may
686 ;; differ in 1 second.
687 ((< (abs (- (cdr (assq 'date status))
688 (cdr (assq 'log_modified status))))
689 3)
690 'debbugs-gnu-new)
691 ((< (- (float-time)
692 (cdr (assq 'log_modified status)))
693 (* 60 60 24 7 2))
694 'debbugs-gnu-handled)
695 (t
696 'debbugs-gnu-stale)))
697 (propertize
698 ;; Prefer the name over the address.
699 (or (cdr address)
700 (car address)
701 "")
702 'face
703 ;; Mark own submitted bugs.
704 (if (and (stringp (car address))
705 (string-equal (car address) user-mail-address))
706 'debbugs-gnu-tagged
707 'default))
708 (propertize
709 (or subject "")
710 'face
711 ;; Mark owned bugs.
712 (if (and (stringp owner)
713 (string-equal owner user-mail-address))
714 'debbugs-gnu-tagged
715 'default))))
716 'append))))
717
718 (tabulated-list-init-header)
719 (tabulated-list-print)
720
721 (set-buffer-modified-p nil)
722 (goto-char (point-min))))
723
724 (defun debbugs-gnu-print-entry (list-id cols)
725 "Insert a debbugs entry at point.
726 Used instead of `tabulated-list-print-entry'."
727 (let ((beg (point))
728 (pos 0)
729 (case-fold-search t)
730 (id (aref cols 0))
731 (id-length (nth 1 (aref tabulated-list-format 0)))
732 (state (aref cols 1))
733 (state-length (nth 1 (aref tabulated-list-format 1)))
734 (submitter (aref cols 2))
735 (submitter-length (nth 1 (aref tabulated-list-format 2)))
736 (title (aref cols 3))
737 ;; (title-length (nth 1 (aref tabulated-list-format 3)))
738 )
739 (when (and
740 ;; We may have a narrowing in effect.
741 (or (not debbugs-gnu-limit)
742 (memq (cdr (assq 'id list-id)) debbugs-gnu-limit))
743 ;; Filter suppressed bugs.
744 (or (not debbugs-gnu-local-suppress)
745 (not (catch :suppress
746 (dolist (check debbugs-gnu-default-suppress-bugs)
747 (when
748 (string-match
749 (cdr check)
750 (or (cdr (assq (car check) list-id)) ""))
751 (throw :suppress t))))))
752 ;; Filter search list.
753 (not (catch :suppress
754 (dolist (check debbugs-gnu-local-filter)
755 (let ((val (cdr (assq (car check) list-id))))
756 (if (stringp (cdr check))
757 ;; Regular expression.
758 (when (not (string-match (cdr check) (or val "")))
759 (throw :suppress t))
760 ;; Time value.
761 (when (or (and (numberp (cadr check))
762 (< (cadr check) val))
763 (and (numberp (cddr check))
764 (> (cddr check) val)))
765 (throw :suppress t))))))))
766
767 ;; Insert id.
768 (indent-to (- id-length (length id)))
769 (insert id)
770 ;; Insert state.
771 (indent-to (setq pos (+ pos id-length 1)) 1)
772 (insert (if (> (length state) state-length)
773 (propertize (substring state 0 state-length)
774 'help-echo state)
775 state))
776 ;; Insert submitter.
777 (indent-to (setq pos (+ pos state-length 1)) 1)
778 (insert "[" (if (> (length submitter) (- submitter-length 2))
779 (propertize (substring submitter 0 (- submitter-length 2))
780 'help-echo submitter)
781 submitter))
782 (indent-to (+ pos (1- submitter-length)))
783 (insert "]")
784 ;; Insert title.
785 (indent-to (setq pos (+ pos submitter-length 1)) 1)
786 (insert (propertize title 'help-echo title))
787 ;; Add properties.
788 (add-text-properties
789 beg (point)
790 `(tabulated-list-id ,list-id mouse-face highlight))
791 (insert ?\n))))
792
793 (defun debbugs-gnu-menu-map-emacs-enabled ()
794 "Whether \"Show Release Blocking Bugs\" is enabled in the menu."
795 (or ;; No package discriminator has been used.
796 (not (assq 'package debbugs-gnu-local-query))
797 ;; Package "emacs" has been selected.
798 (member '(package . "emacs") debbugs-gnu-local-query)))
799
800 (defconst debbugs-gnu-bug-triage-file
801 (expand-file-name "../admin/notes/bug-triage" data-directory)
802 "The \"bug-triage\" file.")
803
804 (defun debbugs-gnu-menu-map-bug-triage-enabled ()
805 "Whether \"Describe Bug Triage Procedure\" is enabled in the menu."
806 (and (debbugs-gnu-menu-map-emacs-enabled)
807 (stringp debbugs-gnu-bug-triage-file)
808 (file-readable-p debbugs-gnu-bug-triage-file)))
809
810 (defun debbugs-gnu-view-bug-triage ()
811 "Show \"bug-triage\" file."
812 (interactive)
813 (view-file debbugs-gnu-bug-triage-file))
814
815 (defvar debbugs-gnu-mode-map
816 (let ((map (make-sparse-keymap))
817 (menu-map (make-sparse-keymap)))
818 (set-keymap-parent map tabulated-list-mode-map)
819 (define-key map "\r" 'debbugs-gnu-select-report)
820 (define-key map [mouse-1] 'debbugs-gnu-select-report)
821 (define-key map [mouse-2] 'debbugs-gnu-select-report)
822 (define-key map "g" 'debbugs-gnu-rescan)
823 (define-key map "R" 'debbugs-gnu-show-all-blocking-reports)
824 (define-key map "C" 'debbugs-gnu-send-control-message)
825
826 (define-key map "s" 'debbugs-gnu-toggle-sort)
827 (define-key map "t" 'debbugs-gnu-toggle-tag)
828 (define-key map "x" 'debbugs-gnu-toggle-suppress)
829 (define-key map "/" 'debbugs-gnu-narrow-to-status)
830 (define-key map "w" 'debbugs-gnu-widen)
831
832 (define-key map "b" 'debbugs-gnu-show-blocked-by-reports)
833 (define-key map "B" 'debbugs-gnu-show-blocking-reports)
834 (define-key map "d" 'debbugs-gnu-display-status)
835
836 (define-key map [menu-bar debbugs] (cons "Debbugs" menu-map))
837 (define-key menu-map [debbugs-gnu-select-report]
838 '(menu-item "Show Reports" debbugs-gnu-select-report
839 :help "Show all reports belonging to this bug"))
840 (define-key-after menu-map [debbugs-gnu-rescan]
841 '(menu-item "Refresh Bugs" debbugs-gnu-rescan
842 :help "Refresh bug list")
843 'debbugs-gnu-select-report)
844 (define-key-after menu-map [debbugs-gnu-show-all-blocking-reports]
845 '(menu-item "Show Release Blocking Bugs"
846 debbugs-gnu-show-all-blocking-reports
847 :enable (debbugs-gnu-menu-map-emacs-enabled)
848 :help "Show all bugs blocking next Emacs release")
849 'debbugs-gnu-rescan)
850 (define-key-after menu-map [debbugs-gnu-send-control-message]
851 '(menu-item "Send Control Message"
852 debbugs-gnu-send-control-message
853 :help "Send control message to debbugs.gnu.org")
854 'debbugs-gnu-show-all-blocking-reports)
855
856 (define-key-after menu-map [debbugs-gnu-separator1]
857 '(menu-item "--") 'debbugs-gnu-send-control-message)
858 (define-key-after menu-map [debbugs-gnu-search]
859 '(menu-item "Search Bugs" debbugs-gnu-search
860 :help "Search bugs on debbugs.gnu.org")
861 'debbugs-gnu-separator1)
862 (define-key-after menu-map [debbugs-gnu]
863 '(menu-item "Retrieve Bugs" debbugs-gnu
864 :help "Retrieve bugs from debbugs.gnu.org")
865 'debbugs-gnu-search)
866 (define-key-after menu-map [debbugs-gnu-bugs]
867 '(menu-item "Retrieve Bugs by Number" debbugs-gnu-bugs
868 :help "Retrieve selected bugs from debbugs.gnu.org")
869 'debbugs-gnu)
870
871 (define-key-after menu-map [debbugs-gnu-separator2]
872 '(menu-item "--") 'debbugs-gnu-bugs)
873 (define-key-after menu-map [debbugs-gnu-view-bug-triage]
874 '(menu-item "Describe Bug Triage Procedure"
875 debbugs-gnu-view-bug-triage
876 :enable (debbugs-gnu-menu-map-bug-triage-enabled)
877 :help "Show procedure of triaging bugs")
878 'debbugs-gnu-separator2)
879 map))
880
881 (defun debbugs-gnu-rescan ()
882 "Rescan the current set of bug reports."
883 (interactive)
884 (let ((id (debbugs-gnu-current-id))
885 (debbugs-gnu-current-query debbugs-gnu-local-query)
886 (debbugs-gnu-current-filter debbugs-gnu-local-filter)
887 (debbugs-gnu-current-suppress debbugs-gnu-local-suppress)
888 (debbugs-cache-expiry (if current-prefix-arg t debbugs-cache-expiry)))
889 (debbugs-gnu-show-reports)
890 (when id
891 (debbugs-gnu-goto id))))
892
893 (define-derived-mode debbugs-gnu-mode tabulated-list-mode "Debbugs"
894 "Major mode for listing bug reports.
895
896 All normal editing commands are switched off.
897 \\<debbugs-gnu-mode-map>
898
899 The following commands are available:
900
901 \\{debbugs-gnu-mode-map}"
902 (set (make-local-variable 'debbugs-gnu-sort-state) 'number)
903 (set (make-local-variable 'debbugs-gnu-limit) nil)
904 (set (make-local-variable 'debbugs-gnu-local-query)
905 debbugs-gnu-current-query)
906 (set (make-local-variable 'debbugs-gnu-local-filter)
907 debbugs-gnu-current-filter)
908 (set (make-local-variable 'debbugs-gnu-local-suppress)
909 debbugs-gnu-current-suppress)
910 (setq tabulated-list-format [("Id" 5 debbugs-gnu-sort-id)
911 ("State" 20 debbugs-gnu-sort-state)
912 ("Submitter" 25 t)
913 ("Title" 10 debbugs-gnu-sort-title)])
914 (setq tabulated-list-sort-key (cons "Id" nil))
915 (setq tabulated-list-printer 'debbugs-gnu-print-entry)
916 (buffer-disable-undo)
917 (setq truncate-lines t)
918 (setq buffer-read-only t))
919
920 (defun debbugs-gnu-sort-id (s1 s2)
921 (> (cdr (assq 'id (car s1)))
922 (cdr (assq 'id (car s2)))))
923
924 (defconst debbugs-gnu-state-preference
925 '((debbugs-gnu-new . 1)
926 (debbugs-gnu-stale . 2)
927 (debbugs-gnu-handled . 3)
928 (debbugs-gnu-done . 4)
929 (debbugs-gnu-pending . 5)))
930
931 (defun debbugs-gnu-get-state-preference (face-string)
932 (or (cdr (assq (get-text-property 0 'face face-string)
933 debbugs-gnu-state-preference))
934 10))
935
936 (defconst debbugs-gnu-severity-preference
937 '(("serious" . 1)
938 ("important" . 2)
939 ("normal" . 3)
940 ("minor" . 4)
941 ("wishlist" . 5)))
942
943 (defun debbugs-gnu-get-severity-preference (state)
944 (or (cdr (assoc (cdr (assq 'severity state))
945 debbugs-gnu-severity-preference))
946 10))
947
948 (defun debbugs-gnu-sort-state (s1 s2)
949 (let ((id1 (cdr (assq 'id (car s1))))
950 (age1 (debbugs-gnu-get-state-preference (aref (nth 1 s1) 1)))
951 (id2 (cdr (assq 'id (car s2))))
952 (age2 (debbugs-gnu-get-state-preference (aref (nth 1 s2) 1))))
953 (cond
954 ;; Tagged bugs go to the end.
955 ((and (not (memq id1 debbugs-gnu-local-tags))
956 (memq id2 debbugs-gnu-local-tags))
957 t)
958 ((and (memq id1 debbugs-gnu-local-tags)
959 (not (memq id2 debbugs-gnu-local-tags)))
960 nil)
961 ;; Then, we check the age of the bugs.
962 ((< age1 age2)
963 t)
964 ((> age1 age2)
965 nil)
966 ;; If they have the same age, we check for severity.
967 ((< (debbugs-gnu-get-severity-preference (car s1))
968 (debbugs-gnu-get-severity-preference (car s2)))
969 t)
970 (t nil))))
971
972 (defun debbugs-gnu-sort-title (s1 _s2)
973 (let ((owner (if (cdr (assq 'owner (car s1)))
974 (car (mail-header-parse-address
975 (decode-coding-string (cdr (assq 'owner (car s1)))
976 'utf-8))))))
977 (and (stringp owner)
978 (string-equal owner user-mail-address))))
979
980 (defun debbugs-gnu-toggle-sort ()
981 "Toggle sorting by age and by state."
982 (interactive)
983 (if (eq debbugs-gnu-sort-state 'number)
984 (progn
985 (setq debbugs-gnu-sort-state 'state)
986 (setq tabulated-list-sort-key (cons "Id" nil)))
987 (setq debbugs-gnu-sort-state 'number)
988 (setq tabulated-list-sort-key (cons "State" nil)))
989 (tabulated-list-init-header)
990 (tabulated-list-print))
991
992 (defun debbugs-gnu-widen ()
993 "Display all the currently selected bug reports."
994 (interactive)
995 (let ((id (debbugs-gnu-current-id t))
996 (inhibit-read-only t))
997 (setq debbugs-gnu-limit nil)
998 (tabulated-list-init-header)
999 (tabulated-list-print)
1000 (when id
1001 (debbugs-gnu-goto id))))
1002
1003 (defun debbugs-gnu-show-blocked-by-reports ()
1004 "Display all bug reports this report is blocked by."
1005 (interactive)
1006 (let ((id (debbugs-gnu-current-id))
1007 (status (debbugs-gnu-current-status)))
1008 (if (null (cdr (assq 'blockedby status)))
1009 (message "Bug %d is not blocked by any other bug" id)
1010 (apply 'debbugs-gnu-bugs (cdr (assq 'blockedby status))))))
1011
1012 (defun debbugs-gnu-show-blocking-reports ()
1013 "Display all bug reports this report is blocking."
1014 (interactive)
1015 (let ((id (debbugs-gnu-current-id))
1016 (status (debbugs-gnu-current-status)))
1017 (if (null (cdr (assq 'blocks status)))
1018 (message "Bug %d is not blocking any other bug" id)
1019 (apply 'debbugs-gnu-bugs (cdr (assq 'blocks status))))))
1020
1021 (defun debbugs-gnu-show-all-blocking-reports ()
1022 "Narrow the display to just the reports that are blocking a release."
1023 (interactive)
1024 (let ((blockers (cdr (assq 'blockedby
1025 (car (debbugs-get-status
1026 debbugs-gnu-blocking-report)))))
1027 (id (debbugs-gnu-current-id t))
1028 (inhibit-read-only t)
1029 status)
1030 (setq debbugs-gnu-limit nil)
1031 (goto-char (point-min))
1032 (while (not (eobp))
1033 (setq status (debbugs-gnu-current-status))
1034 (if (not (memq (cdr (assq 'id status)) blockers))
1035 (delete-region (point) (progn (forward-line 1) (point)))
1036 (push (cdr (assq 'id status)) debbugs-gnu-limit)
1037 (forward-line 1)))
1038 (when id
1039 (debbugs-gnu-goto id))))
1040
1041 (defun debbugs-gnu-narrow-to-status (string &optional status-only)
1042 "Only display the bugs matching STRING.
1043 If STATUS-ONLY (the prefix), ignore matches in the From and
1044 Subject fields."
1045 (interactive "sNarrow to: \nP")
1046 (let ((id (debbugs-gnu-current-id t))
1047 (inhibit-read-only t)
1048 status)
1049 (setq debbugs-gnu-limit nil)
1050 (if (equal string "")
1051 (debbugs-gnu-toggle-suppress)
1052 (goto-char (point-min))
1053 (while (not (eobp))
1054 (setq status (debbugs-gnu-current-status))
1055 (if (and (not (member string (assq 'keywords status)))
1056 (not (equal string (cdr (assq 'severity status))))
1057 (or status-only
1058 (not (string-match
1059 string (cdr (assq 'originator status)))))
1060 (or status-only
1061 (not (string-match string (cdr (assq 'subject status))))))
1062 (delete-region (point) (progn (forward-line 1) (point)))
1063 (push (cdr (assq 'id status)) debbugs-gnu-limit)
1064 (forward-line 1)))
1065 (when id
1066 (debbugs-gnu-goto id)))))
1067
1068 (defun debbugs-gnu-goto (id)
1069 "Go to the line displaying bug ID."
1070 (goto-char (point-min))
1071 (while (and (not (eobp))
1072 (not (equal (debbugs-gnu-current-id t) id)))
1073 (forward-line 1)))
1074
1075 (defun debbugs-gnu-toggle-tag ()
1076 "Toggle the local tag of the report in the current line.
1077 If a report is tagged locally, it is presumed to be of little
1078 interest to you."
1079 (interactive)
1080 (save-excursion
1081 (beginning-of-line)
1082 (let ((inhibit-read-only t)
1083 (id (debbugs-gnu-current-id)))
1084 (if (memq id debbugs-gnu-local-tags)
1085 (progn
1086 (setq debbugs-gnu-local-tags (delq id debbugs-gnu-local-tags))
1087 (put-text-property (point) (+ (point) 5) 'face 'default))
1088 (add-to-list 'debbugs-gnu-local-tags id)
1089 (put-text-property
1090 (+ (point) (- 5 (length (number-to-string id)))) (+ (point) 5)
1091 'face 'debbugs-gnu-tagged))
1092 (debbugs-gnu--update-tag-face id)))
1093 (debbugs-gnu-dump-persistency-file))
1094
1095 (defun debbugs-gnu--update-tag-face (id)
1096 (dolist (entry tabulated-list-entries)
1097 (when (equal (cdr (assq 'id (car entry))) id)
1098 (aset (cadr entry) 0
1099 (propertize
1100 (format "%5d" id)
1101 'face
1102 ;; Mark tagged bugs.
1103 (if (memq id debbugs-gnu-local-tags)
1104 'debbugs-gnu-tagged
1105 'default))))))
1106
1107 (defun debbugs-gnu-toggle-suppress ()
1108 "Suppress bugs marked in `debbugs-gnu-suppress-bugs'."
1109 (interactive)
1110 (setq debbugs-gnu-local-suppress (not debbugs-gnu-local-suppress))
1111 (tabulated-list-init-header)
1112 (tabulated-list-print))
1113
1114 (defvar debbugs-gnu-bug-number nil)
1115 (defvar debbugs-gnu-subject nil)
1116
1117 (defun debbugs-gnu-current-id (&optional noerror)
1118 (or (cdr (assq 'id (debbugs-gnu-current-status)))
1119 (and (not noerror)
1120 (error "No bug on the current line"))))
1121
1122 (defun debbugs-gnu-current-status ()
1123 (get-text-property (line-beginning-position) 'tabulated-list-id))
1124
1125 (defun debbugs-gnu-display-status (query filter status)
1126 "Display the query, filter and status of the report on the current line."
1127 (interactive (list debbugs-gnu-local-query
1128 debbugs-gnu-local-filter
1129 (debbugs-gnu-current-status)))
1130 (switch-to-buffer "*Bug Status*")
1131 (let ((inhibit-read-only t))
1132 (erase-buffer)
1133 (when query
1134 (insert ";; Query\n")
1135 (pp query (current-buffer))
1136 (insert "\n"))
1137 (when filter
1138 (insert ";; Filter\n")
1139 (pp filter (current-buffer))
1140 (insert "\n"))
1141 (when status
1142 (insert ";; Status\n")
1143 (pp status (current-buffer)))
1144 (goto-char (point-min)))
1145 (set-buffer-modified-p nil)
1146 (special-mode))
1147
1148 (defun debbugs-read-emacs-bug-with-rmail (id status merged)
1149 "Read email exchange for debbugs bug ID.
1150 STATUS is the bug's status list.
1151 MERGED is the list of bugs merged with this one."
1152 (let* ((mbox-dir (make-temp-file "debbugs" t))
1153 (mbox-fname (format "%s/bug_%d.mbox" mbox-dir id)))
1154 (debbugs-get-mbox id 'mboxmaint mbox-fname)
1155 (rmail mbox-fname)
1156 ;; Download messages of all the merged bug reports and append them
1157 ;; to the mailbox of the requested bug.
1158 (when merged
1159 (dolist (bugno merged)
1160 (let ((fn (make-temp-file "url")))
1161 (debbugs-get-mbox bugno 'mboxmaint fn)
1162 (rmail-get-new-mail fn)
1163 (delete-file fn)
1164 ;; Remove the 'unseen' attribute from all the messages we've
1165 ;; just read, so that all of them appear in the summary with
1166 ;; the same face.
1167 (while (< rmail-current-message rmail-total-messages)
1168 (rmail-show-message (1+ rmail-current-message))))))
1169 (set (make-local-variable 'debbugs-gnu-bug-number) id)
1170 (set (make-local-variable 'debbugs-gnu-subject)
1171 (format "Re: bug#%d: %s" id (cdr (assq 'subject status))))
1172 (rmail-summary)
1173 (define-key rmail-summary-mode-map "C" 'debbugs-gnu-send-control-message)
1174 (set-window-text-height nil 10)
1175 (other-window 1)
1176 (define-key rmail-mode-map "C" 'debbugs-gnu-send-control-message)
1177 (rmail-show-message 1)))
1178
1179 (defun debbugs-read-emacs-bug-with-gnus (id status merged)
1180 "Read email exchange for debbugs bug ID.
1181 STATUS is the bug's status list.
1182 MERGED is the list of bugs merged with this one."
1183 (require 'gnus-dup)
1184 (setq gnus-suppress-duplicates t
1185 gnus-save-duplicate-list t)
1186 ;; Use Gnus.
1187 (gnus-read-ephemeral-emacs-bug-group
1188 (cons id (if (listp merged) merged (list merged)))
1189 (cons (current-buffer)
1190 (current-window-configuration)))
1191 (with-current-buffer (window-buffer (selected-window))
1192 (set (make-local-variable 'debbugs-gnu-bug-number) id)
1193 (set (make-local-variable 'debbugs-gnu-subject)
1194 (format "Re: bug#%d: %s" id (cdr (assq 'subject status))))
1195 (debbugs-gnu-summary-mode 1)))
1196
1197 (defun debbugs-gnu-select-report ()
1198 "Select the report on the current line."
1199 (interactive)
1200 ;; We open the report messages.
1201 (let* ((status (debbugs-gnu-current-status))
1202 (id (cdr (assq 'id status)))
1203 (merged (cdr (assq 'mergedwith status))))
1204 (setq merged (if (listp merged) merged (list merged)))
1205 (cond
1206 ((not id)
1207 (message "No bug report on the current line"))
1208 ((eq debbugs-gnu-mail-backend 'rmail)
1209 (debbugs-read-emacs-bug-with-rmail id status merged))
1210 ((eq debbugs-gnu-mail-backend 'gnus)
1211 (debbugs-read-emacs-bug-with-gnus id status merged))
1212 (t (error "No valid mail backend specified")))))
1213
1214 (defvar debbugs-gnu-summary-mode-map
1215 (let ((map (make-sparse-keymap)))
1216 (define-key map "C" 'debbugs-gnu-send-control-message)
1217 (define-key map [(meta m)] 'debbugs-gnu-apply-patch)
1218 map))
1219
1220 (define-minor-mode debbugs-gnu-summary-mode
1221 "Minor mode for providing a debbugs interface in Gnus summary buffers.
1222
1223 \\{debbugs-gnu-summary-mode-map}"
1224 :lighter " Debbugs" :keymap debbugs-gnu-summary-mode-map
1225 (set (make-local-variable 'gnus-posting-styles)
1226 `((".*"
1227 (eval
1228 (when (buffer-live-p gnus-article-copy)
1229 (with-current-buffer gnus-article-copy
1230 (set (make-local-variable 'message-prune-recipient-rules)
1231 '((".*@debbugs.*" "emacs-pretest-bug")
1232 (".*@debbugs.*" "bug-gnu-emacs")
1233 ("[0-9]+@debbugs.*" "submit@debbugs.gnu.org")
1234 ("[0-9]+@debbugs.*" "quiet@debbugs.gnu.org")))
1235 (set (make-local-variable 'message-alter-recipients-function)
1236 (lambda (address)
1237 (if (string-match "\\([0-9]+\\)@donarmstrong"
1238 (car address))
1239 (let ((new (format "%s@debbugs.gnu.org"
1240 (match-string 1 (car address)))))
1241 (cons new new))
1242 address)))
1243 ;; `gnus-posting-styles' is eval'ed after
1244 ;; `message-simplify-subject'. So we cannot use m-s-s.
1245 (setq subject ,debbugs-gnu-subject))))))))
1246
1247 (defun debbugs-gnu-guess-current-id ()
1248 "Guess the ID based on \"#23\"."
1249 (save-excursion
1250 (beginning-of-line)
1251 (and
1252 (or (re-search-forward "#\\([0-9]+\\)" (line-end-position) t)
1253 (progn
1254 (goto-char (point-min))
1255 (re-search-forward "#\\([0-9]+\\)" nil t)))
1256 (string-to-number (match-string 1)))))
1257
1258 (defvar debbugs-gnu-send-mail-function nil
1259 "A function to send control messages from debbugs.")
1260
1261 (defun debbugs-gnu-send-control-message (message &optional reverse)
1262 "Send a control message for the current bug report.
1263 You can set the severity or add a tag, or close the report. If
1264 you use the special \"done\" MESSAGE, the report will be marked as
1265 fixed, and then closed.
1266
1267 If given a prefix, and given a tag to set, the tag will be
1268 removed instead."
1269 (interactive
1270 (list (completing-read
1271 "Control message: "
1272 '("serious" "important" "normal" "minor" "wishlist"
1273 "done" "donenotabug" "donewontfix" "doneunreproducible"
1274 "unarchive" "unmerge" "reopen" "close"
1275 "merge" "forcemerge"
1276 "block" "unblock"
1277 "owner" "noowner"
1278 "invalid"
1279 "reassign"
1280 "retitle"
1281 "patch" "wontfix" "moreinfo" "unreproducible" "fixed" "notabug"
1282 "pending" "help" "security" "confirmed"
1283 "usertag")
1284 nil t)
1285 current-prefix-arg))
1286 (let* ((id (or (debbugs-gnu-current-id t)
1287 debbugs-gnu-bug-number ; Set on group entry.
1288 (debbugs-gnu-guess-current-id)))
1289 (version
1290 (when (member message '("close" "done"))
1291 (read-string
1292 "Version: "
1293 (cond
1294 ;; Emacs development versions.
1295 ((string-match
1296 "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)\\." emacs-version)
1297 (format "%s.%d"
1298 (match-string 1 emacs-version)
1299 (1+ (string-to-number (match-string 2 emacs-version)))))
1300 ;; Emacs release versions.
1301 ((string-match
1302 "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" emacs-version)
1303 (format "%s.%s"
1304 (match-string 1 emacs-version)
1305 (match-string 2 emacs-version)))
1306 (t emacs-version)))))
1307 (status (debbugs-gnu-current-status)))
1308 (with-temp-buffer
1309 (insert "To: control@debbugs.gnu.org\n"
1310 "From: " (message-make-from) "\n"
1311 (format "Subject: control message for bug #%d\n" id)
1312 mail-header-separator
1313 "\n"
1314 (cond
1315 ((member message '("unarchive" "unmerge" "reopen" "noowner"))
1316 (format "%s %d\n" message id))
1317 ((member message '("merge" "forcemerge"))
1318 (format "%s %d %s\n" message id
1319 (read-string "Merge with bug #: ")))
1320 ((member message '("block" "unblock"))
1321 (format
1322 "%s %d by %s\n" message id
1323 (mapconcat
1324 'identity
1325 (completing-read-multiple
1326 (format "%s with bug(s) #: " (capitalize message))
1327 (if (equal message "unblock")
1328 (mapcar 'number-to-string
1329 (cdr (assq 'blockedby status))))
1330 nil (and (equal message "unblock") status))
1331 " ")))
1332 ((equal message "owner")
1333 (format "owner %d !\n" id))
1334 ((equal message "retitle")
1335 (format "retitle %d %s\n" id (read-string "New title: ")))
1336 ((equal message "reassign")
1337 (format "reassign %d %s\n" id (read-string "Package(s): ")))
1338 ((equal message "close")
1339 (format "close %d %s\n" id version))
1340 ((equal message "done")
1341 (format "tags %d fixed\nclose %d %s\n" id id version))
1342 ((member message '("donenotabug" "donewontfix"
1343 "doneunreproducible"))
1344 (format "tags %d %s\nclose %d\n" id (substring message 4) id))
1345 ((member message '("serious" "important" "normal"
1346 "minor" "wishlist"))
1347 (format "severity %d %s\n" id message))
1348 ((equal message "invalid")
1349 (format "tags %d notabug\ntags %d wontfix\nclose %d\n"
1350 id id id))
1351 ((equal message "usertag")
1352 (format "user %s\nusertag %d %s\n"
1353 (completing-read
1354 "Package name or email address: "
1355 (append
1356 debbugs-gnu-all-packages (list user-mail-address))
1357 nil nil (car debbugs-gnu-default-packages))
1358 id (read-string "User tag: ")))
1359 (t
1360 (format "tags %d%s %s\n"
1361 id (if reverse " -" "")
1362 message))))
1363 (funcall (or debbugs-gnu-send-mail-function send-mail-function))
1364 (remhash id debbugs-cache-data)
1365 (message-goto-body)
1366 (message "Control message sent:\n%s"
1367 (buffer-substring-no-properties (point) (1- (point-max)))))))
1368
1369 (defvar debbugs-gnu-usertags-mode-map
1370 (let ((map (make-sparse-keymap)))
1371 (set-keymap-parent map tabulated-list-mode-map)
1372 (define-key map "\r" 'debbugs-gnu-select-usertag)
1373 (define-key map [mouse-1] 'debbugs-gnu-select-usertag)
1374 (define-key map [mouse-2] 'debbugs-gnu-select-usertag)
1375 map))
1376
1377 (define-derived-mode debbugs-gnu-usertags-mode tabulated-list-mode "Usertags"
1378 "Major mode for listing user tags.
1379
1380 All normal editing commands are switched off.
1381 \\<debbugs-gnu-usertags-mode-map>
1382
1383 The following commands are available:
1384
1385 \\{debbugs-gnu-usertags-mode-map}"
1386 (buffer-disable-undo)
1387 (setq truncate-lines t)
1388 (setq buffer-read-only t))
1389
1390 ;;;###autoload
1391 (defun debbugs-gnu-usertags (&rest users)
1392 "List all user tags for USERS, which is \(\"emacs\"\) by default."
1393 (interactive
1394 (if current-prefix-arg
1395 (completing-read-multiple
1396 "Package name(s) or email address: "
1397 (append debbugs-gnu-all-packages (list user-mail-address)) nil nil
1398 (mapconcat 'identity debbugs-gnu-default-packages ","))
1399 debbugs-gnu-default-packages))
1400
1401 (unwind-protect
1402 (let ((inhibit-read-only t)
1403 (debbugs-port "gnu.org")
1404 (buffer-name "*Emacs User Tags*")
1405 (user-tab-length
1406 (1+ (apply 'max (length "User") (mapcar 'length users)))))
1407
1408 ;; Initialize variables.
1409 (when (and (file-exists-p debbugs-gnu-persistency-file)
1410 (not debbugs-gnu-local-tags))
1411 (with-temp-buffer
1412 (insert-file-contents debbugs-gnu-persistency-file)
1413 (eval (read (current-buffer)))))
1414
1415 ;; Create buffer.
1416 (when (get-buffer buffer-name)
1417 (kill-buffer buffer-name))
1418 (switch-to-buffer (get-buffer-create buffer-name))
1419 (debbugs-gnu-usertags-mode)
1420 (setq tabulated-list-format `[("User" ,user-tab-length t)
1421 ("Tag" 10 t)])
1422 (setq tabulated-list-sort-key (cons "User" nil))
1423 ;(setq tabulated-list-printer 'debbugs-gnu-print-entry)
1424
1425 ;; Retrieve user tags.
1426 (dolist (user users)
1427 (dolist (tag (sort (debbugs-get-usertag :user user) 'string<))
1428 (add-to-list
1429 'tabulated-list-entries
1430 ;; `tabulated-list-id' is the parameter list for `debbugs-gnu'.
1431 `((("tagged") (,user) nil nil (,tag))
1432 ,(vector (propertize user 'mouse-face 'highlight)
1433 (propertize tag 'mouse-face 'highlight)))
1434 'append)))
1435
1436 ;; Add local tags.
1437 (when debbugs-gnu-local-tags
1438 (add-to-list
1439 'tabulated-list-entries
1440 `((("tagged"))
1441 ,(vector
1442 "" (propertize "(local tags)" 'mouse-face 'highlight)))))
1443
1444 ;; Show them.
1445 (tabulated-list-init-header)
1446 (tabulated-list-print)
1447
1448 (set-buffer-modified-p nil)
1449 (goto-char (point-min)))))
1450
1451 (defun debbugs-gnu-select-usertag ()
1452 "Select the user tag on the current line."
1453 (interactive)
1454 ;; We open the bug reports.
1455 (let ((args (get-text-property (line-beginning-position) 'tabulated-list-id)))
1456 (when args (apply 'debbugs-gnu args))))
1457
1458 ;;;###autoload
1459 (defun debbugs-gnu-bugs (&rest bugs)
1460 "List all BUGS, a list of bug numbers."
1461 (interactive
1462 (mapcar 'string-to-number
1463 (completing-read-multiple "Bug numbers: " nil 'natnump)))
1464 (dolist (elt bugs)
1465 (unless (natnump elt) (signal 'wrong-type-argument (list 'natnump elt))))
1466 (add-to-list 'debbugs-gnu-current-query (cons 'bugs bugs))
1467 ;; We do not suppress bugs requested explicitely.
1468 (setq debbugs-gnu-current-suppress nil)
1469 (debbugs-gnu nil))
1470
1471 (defvar debbugs-gnu-trunk-directory "~/src/emacs/trunk/"
1472 "The directory where the main source tree lives.")
1473
1474 (defvar debbugs-gnu-branch-directory "~/src/emacs/emacs-25/"
1475 "The directory where the previous source tree lives.")
1476
1477 (defun debbugs-gnu-apply-patch (&optional branch)
1478 "Apply the patch from the current message.
1479 If given a prefix, patch in the branch directory instead."
1480 (interactive "P")
1481 (add-hook 'emacs-lisp-mode-hook 'debbugs-gnu-lisp-mode)
1482 (add-hook 'diff-mode-hook 'debbugs-gnu-diff-mode)
1483 (add-hook 'change-log-mode-hook 'debbugs-gnu-change-mode)
1484 (let ((rej "/tmp/debbugs-gnu.rej")
1485 (output-buffer (get-buffer-create "*debbugs patch*"))
1486 (dir (if branch
1487 debbugs-gnu-branch-directory
1488 debbugs-gnu-trunk-directory))
1489 (patch-buffers nil))
1490 (when (file-exists-p rej)
1491 (delete-file rej))
1492 (with-current-buffer output-buffer
1493 (erase-buffer))
1494 (gnus-summary-select-article nil t)
1495 ;; The patches are either in MIME attachements or the main article
1496 ;; buffer. Determine which.
1497 (gnus-with-article-buffer
1498 (dolist (handle (mapcar 'cdr (gnus-article-mime-handles)))
1499 (when (string-match "diff\\|patch\\|plain" (mm-handle-media-type handle))
1500 (push (cons (mm-handle-encoding handle)
1501 (mm-handle-buffer handle))
1502 patch-buffers))))
1503 (unless patch-buffers
1504 (gnus-summary-show-article 'raw)
1505 (article-decode-charset)
1506 (push (cons nil gnus-article-buffer) patch-buffers))
1507 (dolist (elem patch-buffers)
1508 (with-current-buffer (generate-new-buffer "*debbugs input patch*")
1509 (insert-buffer-substring (cdr elem))
1510 (cond ((eq (car elem) 'base64)
1511 (base64-decode-region (point-min) (point-max)))
1512 ((eq (car elem) 'quoted-printable)
1513 (quoted-printable-decode-region (point-min) (point-max))))
1514 (debbugs-gnu-fix-patch dir)
1515 (call-process-region (point-min) (point-max)
1516 "patch" nil output-buffer nil
1517 "-r" rej "--no-backup-if-mismatch"
1518 "-l" "-f"
1519 "-d" (expand-file-name dir)
1520 "-p1")))
1521 (set-buffer output-buffer)
1522 (when (file-exists-p rej)
1523 (goto-char (point-max))
1524 (insert-file-contents-literally rej))
1525 (goto-char (point-max))
1526 (save-some-buffers t)
1527 (require 'compile)
1528 (mapc 'kill-process compilation-in-progress)
1529 (compile (format "cd %s; make -k" (expand-file-name "lisp" dir)))
1530 (vc-dir dir)
1531 (vc-dir-hide-up-to-date)
1532 (goto-char (point-min))
1533 (sit-for 1)
1534 (vc-diff)
1535 ;; All these commands are asynchronous, so just wait a bit. This
1536 ;; should be done properly a different way.
1537 (sit-for 2)
1538 ;; We've now done everything, so arrange the windows we need to see.
1539 (delete-other-windows)
1540 (switch-to-buffer output-buffer)
1541 (split-window)
1542 (split-window)
1543 (other-window 1)
1544 (switch-to-buffer "*compilation*")
1545 (goto-char (point-max))
1546 (other-window 1)
1547 (switch-to-buffer "*vc-diff*")
1548 (goto-char (point-min))))
1549
1550 (defun debbugs-gnu-fix-patch (dir)
1551 (setq dir (directory-file-name (expand-file-name dir)))
1552 (goto-char (point-min))
1553 (while (re-search-forward diff-file-header-re nil t)
1554 (goto-char (match-beginning 0))
1555 (let ((target-name (car (diff-hunk-file-names))))
1556 (when (and target-name
1557 (or (not (string-match "/" target-name))
1558 (and (string-match "^[ab]/" target-name)
1559 (not (file-exists-p
1560 (expand-file-name (substring target-name 2)
1561 dir))))
1562 (file-exists-p (expand-file-name target-name dir))))
1563 ;; We have a simple patch that refers to a file somewhere in the
1564 ;; tree. Find it.
1565 (when-let ((files (directory-files-recursively
1566 dir
1567 (concat "^" (regexp-quote
1568 (file-name-nondirectory target-name))
1569 "$"))))
1570 (when (re-search-forward (concat "^[+]+ "
1571 (regexp-quote target-name)
1572 "\\([ \t\n]\\)")
1573 nil t)
1574 (replace-match (concat "+++ a"
1575 (substring (car files) (length dir))
1576 (match-string 1))
1577 nil t)))))
1578 (forward-line 2)))
1579
1580 (defun debbugs-gnu-find-contributor (string)
1581 "Search through ChangeLogs to find contributors."
1582 (interactive "sContributor match: ")
1583 (let ((found 0)
1584 (match (concat "^[0-9].*" string)))
1585 (dolist (file (directory-files-recursively
1586 debbugs-gnu-trunk-directory "ChangeLog\\(.[0-9]+\\)?$"))
1587 (with-temp-buffer
1588 (when (file-exists-p file)
1589 (insert-file-contents file))
1590 (goto-char (point-min))
1591 (while (and (re-search-forward match nil t)
1592 (not (looking-at ".*tiny change")))
1593 (cl-incf found))))
1594 (message "%s is a contributor %d times" string found)
1595 found))
1596
1597 (defvar debbugs-gnu-patch-subject nil)
1598
1599 (defun debbugs-gnu-insert-changelog ()
1600 "Add a ChangeLog from a recently applied patch from a third party."
1601 (interactive)
1602 (let (from subject patch-subject changelog)
1603 (gnus-with-article-buffer
1604 (widen)
1605 (goto-char (point-min))
1606 (setq from (mail-extract-address-components (gnus-fetch-field "from"))
1607 subject (gnus-fetch-field "subject"))
1608 ;; If it's a patch formatted the right way, extract that data.
1609 (dolist (handle (mapcar 'cdr (gnus-article-mime-handles)))
1610 (when (string-match "diff\\|patch\\|plain"
1611 (mm-handle-media-type handle))
1612 (with-temp-buffer
1613 (insert-buffer-substring (mm-handle-buffer handle))
1614 (cond ((eq (mm-handle-encoding handle) 'base64)
1615 (base64-decode-region (point-min) (point-max)))
1616 ((eq (mm-handle-encoding handle) 'quoted-printable)
1617 (quoted-printable-decode-region (point-min) (point-max))))
1618 (setq patch-subject
1619 (or (gnus-fetch-field "subject") patch-subject))
1620 (goto-char (point-min))
1621 (when (re-search-forward "^[*] " nil t)
1622 (let ((start (match-beginning 0)))
1623 (while (and (not (eobp))
1624 (not (looking-at "---")))
1625 (forward-line 1))
1626 (setq changelog (buffer-substring
1627 start (line-end-position 0)))))))))
1628 (let ((add-log-full-name (car from))
1629 (add-log-mailing-address (cadr from)))
1630 (add-change-log-entry-other-window)
1631 (when patch-subject
1632 (setq-local debbugs-gnu-patch-subject patch-subject))
1633 (when changelog
1634 (delete-region (line-beginning-position) (point-max))
1635 (save-restriction
1636 (narrow-to-region (point) (point))
1637 (insert changelog)
1638 (indent-region (point-min) (point-max))))
1639 (let ((point (point)))
1640 (when (string-match "\\(bug#[0-9]+\\)" subject)
1641 (insert " (" (match-string 1 subject) ")."))
1642 (when (zerop (debbugs-gnu-find-contributor
1643 (let ((bits (split-string (car from))))
1644 (cond
1645 ((>= (length bits) 2)
1646 (format "%s.*%s" (car bits) (car (last bits))))
1647 ((= (length bits) 1)
1648 (car bits))
1649 ;; Fall back on the email address.
1650 (t
1651 (cadr from))))))
1652 (goto-char (point-max))
1653 (end-of-line)
1654 (when changelog
1655 (insert "\n\n"))
1656 (insert " Copyright-paperwork-exempt: yes"))
1657 (goto-char point)))))
1658
1659 (defvar debbugs-gnu-lisp-mode-map
1660 (let ((map (make-sparse-keymap)))
1661 (define-key map [(meta m)] 'debbugs-gnu-insert-changelog)
1662 map))
1663
1664 (define-minor-mode debbugs-gnu-lisp-mode
1665 "Minor mode for providing a debbugs interface in Lisp buffers.
1666 \\{debbugs-gnu-lisp-mode-map}"
1667 :lighter " Debbugs" :keymap debbugs-gnu-lisp-mode-map)
1668
1669 (defvar debbugs-gnu-diff-mode-map
1670 (let ((map (make-sparse-keymap)))
1671 (define-key map [(meta m)] 'debbugs-gnu-diff-select)
1672 map))
1673
1674 (define-minor-mode debbugs-gnu-diff-mode
1675 "Minor mode for providing a debbugs interface in diff buffers.
1676 \\{debbugs-gnu-diff-mode-map}"
1677 :lighter " Debbugs" :keymap debbugs-gnu-diff-mode-map)
1678
1679 (defun debbugs-gnu-diff-select ()
1680 "Select the diff under point."
1681 (interactive)
1682 (delete-other-windows)
1683 (diff-goto-source))
1684
1685 (defvar debbugs-gnu-change-mode-map
1686 (let ((map (make-sparse-keymap)))
1687 (define-key map [(meta m)] 'debbugs-gnu-change-checkin)
1688 map))
1689
1690 (define-minor-mode debbugs-gnu-change-mode
1691 "Minor mode for providing a debbugs interface in ChangeLog buffers.
1692 \\{debbugs-gnu-change-mode-map}"
1693 :lighter " Debbugs" :keymap debbugs-gnu-change-mode-map)
1694
1695 (defun debbugs-gnu-change-checkin ()
1696 "Prepare checking in the current changes."
1697 (interactive)
1698 (save-some-buffers t)
1699 (when (get-buffer "*vc-dir*")
1700 (kill-buffer (get-buffer "*vc-dir*")))
1701 (let ((patch-subject debbugs-gnu-patch-subject))
1702 (let ((trunk (expand-file-name debbugs-gnu-trunk-directory)))
1703 (if (equal (cl-subseq default-directory 0 (length trunk))
1704 trunk)
1705 (vc-dir debbugs-gnu-trunk-directory)
1706 (vc-dir debbugs-gnu-branch-directory)))
1707 (goto-char (point-min))
1708 (while (not (search-forward "edited" nil t))
1709 (sit-for 0.01))
1710 (beginning-of-line)
1711 (while (search-forward "edited" nil t)
1712 (vc-dir-mark)
1713 (beginning-of-line))
1714 (vc-diff nil)
1715 (vc-next-action nil)
1716 (delete-region (point-min) (point-max))
1717 (log-edit-insert-changelog t)
1718 (delete-other-windows)
1719 (split-window)
1720 (other-window 1)
1721 (switch-to-buffer "*vc-diff*")
1722 (other-window 1)
1723 (when patch-subject
1724 (insert "Summary: "
1725 (replace-regexp-in-string "^ *\\[PATCH\\] *" "" patch-subject)
1726 "\n"))))
1727
1728 (defun debbugs-gnu-save-cache ()
1729 "Save the bugs cache to a file."
1730 (interactive)
1731 (unless debbugs-cache-data
1732 (error "No data to cache"))
1733 (unless (file-exists-p "~/.emacs.d/debbugs-cache")
1734 (make-directory "~/.emacs.d/debbugs-cache" t))
1735 (let ((coding-system-for-write 'utf-8))
1736 (with-temp-file "~/.emacs.d/debbugs-cache/list"
1737 (prin1 debbugs-cache-data (current-buffer)))))
1738
1739 (provide 'debbugs-gnu)
1740
1741 ;;; TODO:
1742
1743 ;; * Another random thought - is it possible to implement some local
1744 ;; cache, so only changed bugs are fetched? Glenn Morris.
1745
1746 ;;; debbugs-gnu.el ends here