[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8972437: Extend arguments of `debbugs-gnu-bugs', plus mino
From: |
Michael Albinus |
Subject: |
[elpa] master 8972437: Extend arguments of `debbugs-gnu-bugs', plus minor fixes |
Date: |
Tue, 13 Sep 2016 11:58:33 +0000 (UTC) |
branch: master
commit 8972437397d5642048e72827ac1c0beb53ecabca
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Extend arguments of `debbugs-gnu-bugs', plus minor fixes
* packages/debbugs/debbugs-gnu.el (debbugs-gnu-default-severities)
(debbugs-gnu-all-severities, debbugs-gnu-default-packages)
(debbugs-gnu-all-packages, debbugs-gnu-default-suppress-bugs)
(debbugs-gnu-mail-backend): Remove leading "*" from docstring.
(debbugs-gnu-completion-table): Rework implementation according to
extended arguments of `debbugs-gnu-bugs'.
(debbugs-gnu-proper-bug-number, debbugs-gnu-expand-bug-number-list):
New defuns.
(debbugs-gnu-default-bug-number-list): New defcustom.
(debbugs-gnu-send-control-message, debbugs-gnu-bugs): Use them.
(debbugs-gnu-trunk-directory, debbugs-gnu-branch-directory):
New defcustoms.
(debbugs-gnu-init-current-directory): New defun.
(debbugs-gnu-apply-patch, debbugs-gnu-find-contributor)
(debbugs-gnu-change-checkin): Use it.
* packages/debbugs/debbugs-ug.texi: Use "user option" consequently.
(Retrieving Bugs): Explain extended arguments for interactive use.
---
packages/debbugs/debbugs-gnu.el | 148 ++++++++++++++++++++++++++------------
packages/debbugs/debbugs-ug.info | 53 ++++++++------
packages/debbugs/debbugs-ug.texi | 19 +++--
3 files changed, 149 insertions(+), 71 deletions(-)
diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el
index 8550291..4a69f2b 100644
--- a/packages/debbugs/debbugs-gnu.el
+++ b/packages/debbugs/debbugs-gnu.el
@@ -187,7 +187,7 @@
:version "24.1")
(defcustom debbugs-gnu-default-severities '("serious" "important" "normal")
- "*The list severities bugs are searched for.
+ "The list severities bugs are searched for.
\"tagged\" is not a severity but marks locally tagged bugs."
;; <http://debbugs.gnu.org/Developer.html#severities>
;; /ssh:debbugs:/etc/debbugs/config @gSeverityList
@@ -223,10 +223,10 @@ If nil, the value of `send-mail-function' is used
instead."
(defconst debbugs-gnu-all-severities
(mapcar 'cadr (cdr (get 'debbugs-gnu-default-severities 'custom-type)))
- "*List of all possible severities.")
+ "List of all possible severities.")
(defcustom debbugs-gnu-default-packages '("emacs")
- "*The list of packages to be searched for."
+ "The list of packages to be searched for."
;; <http://debbugs.gnu.org/Packages.html>
;; <http://debbugs.gnu.org/cgi/pkgindex.cgi>
:group 'debbugs-gnu
@@ -264,11 +264,11 @@ If nil, the value of `send-mail-function' is used
instead."
(defconst debbugs-gnu-all-packages
(mapcar 'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type)))
- "*List of all possible package names.")
+ "List of all possible package names.")
(defcustom debbugs-gnu-default-suppress-bugs
'((pending . "done"))
- "*A list of specs for bugs to be suppressed.
+ "A list of specs for bugs to be suppressed.
An element of this list is a cons cell \(KEY . REGEXP\), with key
being returned by `debbugs-get-status', and REGEXP a regular
expression matching the corresponding value, a string. Showing
@@ -278,7 +278,7 @@ suppressed bugs is toggled by
`debbugs-gnu-toggle-suppress'."
:version "24.1")
(defcustom debbugs-gnu-mail-backend 'gnus
- "*The email backend to use for reading bug report email exchange.
+ "The email backend to use for reading bug report email exchange.
If this is `gnus', the default, use Gnus.
If this is `rmail', use Rmail instead."
:group 'debbugs-gnu
@@ -1393,27 +1393,62 @@ MERGED is the list of bugs merged with this one."
(re-search-forward "#\\([0-9]+\\)" nil t)))
(string-to-number (match-string 1)))))
+(defun debbugs-gnu-proper-bug-number (id)
+ "Check that ID is a number string and in the range of existing bugs."
+ (and (string-match "^[1-9][0-9]*$" id)
+ (<= (string-to-number id) (car (debbugs-newest-bugs 1)))))
+
(defvar debbugs-gnu-completion-table
(completion-table-dynamic
(lambda (string)
- (if (string-equal string "")
+ (let* ((split (split-string string "-"))
+ (from (and (cdr split) (car split)))
+ (to (or (car (cdr split)) (car split))))
+ (cond
+ ((> (length split) 2) nil)
+ ((and (or (zerop (length from)) (debbugs-gnu-proper-bug-number from))
+ (string-equal to ""))
+ (mapcar
+ (lambda (x) (concat string x))
+ (cons (unless from "-") '("1" "2" "3" "4" "5" "6" "7" "8" "9"))))
+ ((and (or (zerop (length from)) (debbugs-gnu-proper-bug-number from))
+ (debbugs-gnu-proper-bug-number to))
(mapcar
(lambda (x)
- (list (format "%d" x) x))
- '(1 2 3 4 5 6 7 8 9))
- (let ((newest-bug (car (debbugs-newest-bugs 1))))
- (and (string-match "^[1-9][0-9]*$" string)
- (<= (string-to-number string) newest-bug)
- (append
- `(,string)
- (mapcar
- (lambda (x)
- (let ((y (format "%s%d" string x)))
- (and (<= (string-to-number y) newest-bug)
- (list y x))))
- '(0 1 2 3 4 5 6 7 8 9))))))))
+ (and (debbugs-gnu-proper-bug-number (concat to x))
+ (concat string x)))
+ '("" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")))))))
"Dynamic completion table for reading bug numbers.")
+(defun debbugs-gnu-expand-bug-number-list (bug-number-list)
+ "Expand BUG-NUMBER-LIST to a list of singe bug numbers.
+BUG-NUMBER-LIST is a list of bug numbers or bug number ranges, as
+returned by `debbugs-gnu-bugs'."
+ (let (result)
+ (dolist (elt bug-number-list result)
+ (let* ((split (split-string elt "-"))
+ (from (and (cdr split) (car split)))
+ (to (or (car (cdr split)) (car split))))
+ (setq
+ result
+ (cond
+ ((or (> (length split) 2)
+ (zerop (length to)))
+ (user-error "Wrong bug number or range %s" elt))
+ ((null from)
+ (cons to result))
+ ((string-equal from "")
+ (append
+ (mapcar
+ 'number-to-string
+ (debbugs-newest-bugs (string-to-number to)))
+ result))
+ (t (append
+ (mapcar
+ 'number-to-string
+ (number-sequence (string-to-number from) (string-to-number to)))
+ result))))))))
+
(defun debbugs-gnu-send-control-message (message &optional reverse)
"Send a control message for the current bug report.
You can set the severity or add a tag, or close the report. If
@@ -1477,22 +1512,24 @@ removed instead."
"%s %d %s\n" message id
(mapconcat
'identity
- (completing-read-multiple
- (format "%s with bug(s) #: " (capitalize message))
- debbugs-gnu-completion-table)
+ (debbugs-gnu-expand-bug-number-list
+ (completing-read-multiple
+ (format "%s with bug(s) #: " (capitalize message))
+ debbugs-gnu-completion-table))
" ")))
((member message '("block" "unblock"))
(format
"%s %d by %s\n" message id
(mapconcat
'identity
- (completing-read-multiple
- (format "%s with bug(s) #: " (capitalize message))
- (if (equal message "unblock")
- (mapcar 'number-to-string
- (cdr (assq 'blockedby status)))
- debbugs-gnu-completion-table)
- nil (and (equal message "unblock") status))
+ (debbugs-gnu-expand-bug-number-list
+ (completing-read-multiple
+ (format "%s with bug(s) #: " (capitalize message))
+ (if (equal message "unblock")
+ (mapcar 'number-to-string
+ (cdr (assq 'blockedby status)))
+ debbugs-gnu-completion-table)
+ nil (and (equal message "unblock") status)))
" ")))
((equal message "owner")
(format "owner %d !\n" id))
@@ -1620,13 +1657,23 @@ The following commands are available:
(let ((args (get-text-property (line-beginning-position)
'tabulated-list-id)))
(when args (apply 'debbugs-gnu args))))
+(defcustom debbugs-gnu-default-bug-number-list "-10"
+ "The default value used in interactive call of `debbugs-gnu-bugs'.
+It must be a string, containing a comma separated list of bugs or bug ranges."
+ :group 'debbugs-gnu
+ :type 'string
+ :version "25.2")
+
;;;###autoload
(defun debbugs-gnu-bugs (&rest bugs)
"List all BUGS, a list of bug numbers."
(interactive
(mapcar
'string-to-number
- (completing-read-multiple "Bug numbers: " debbugs-gnu-completion-table)))
+ (debbugs-gnu-expand-bug-number-list
+ (or
+ (completing-read-multiple "Bug numbers: " debbugs-gnu-completion-table)
+ (split-string debbugs-gnu-default-bug-number-list "," t)))))
(dolist (elt bugs)
(unless (natnump elt) (signal 'wrong-type-argument (list 'natnump elt))))
(add-to-list 'debbugs-gnu-current-query (cons 'bugs bugs))
@@ -1634,15 +1681,34 @@ The following commands are available:
(setq debbugs-gnu-current-suppress nil)
(debbugs-gnu nil))
-(defvar debbugs-gnu-trunk-directory "~/src/emacs/trunk/"
- "The directory where the main source tree lives.")
+(defcustom debbugs-gnu-trunk-directory "~/src/emacs/trunk/"
+ "The directory where the main source tree lives."
+ :group 'debbugs-gnu
+ :type 'directory
+ :version "25.2")
-(defvar debbugs-gnu-branch-directory "~/src/emacs/emacs-25/"
- "The directory where the previous source tree lives.")
+(defcustom debbugs-gnu-branch-directory "~/src/emacs/emacs-25/"
+ "The directory where the previous source tree lives."
+ :group 'debbugs-gnu
+ :type 'directory
+ :version "25.2")
(defvar debbugs-gnu-current-directory nil
"The current source tree directory.")
+(defun debbugs-gnu-init-current-directory (&optional branch)
+"Initialize `debbugs-gnu-current-directory'."
+ (setq debbugs-gnu-current-directory
+ (or debbugs-gnu-current-directory
+ (if branch
+ debbugs-gnu-branch-directory
+ debbugs-gnu-trunk-directory)))
+ (unless (file-directory-p debbugs-gnu-current-directory)
+ (setq debbugs-gnu-current-directory
+ (read-file-name
+ "Emacs repository location: "
+ debbugs-gnu-current-directory nil t nil 'file-directory-p))))
+
(defun debbugs-gnu-apply-patch (&optional branch)
"Apply the patch from the current message.
If given a prefix, patch in the branch directory instead."
@@ -1650,6 +1716,7 @@ If given a prefix, patch in the branch directory instead."
(add-hook 'emacs-lisp-mode-hook 'debbugs-gnu-lisp-mode)
(add-hook 'diff-mode-hook 'debbugs-gnu-diff-mode)
(add-hook 'change-log-mode-hook 'debbugs-gnu-change-mode)
+ (debbugs-gnu-init-current-directory branch)
(let ((rej (expand-file-name "debbugs-gnu.rej" temporary-file-directory))
(output-buffer (get-buffer-create "*debbugs patch*"))
(patch-buffers nil))
@@ -1657,15 +1724,6 @@ If given a prefix, patch in the branch directory
instead."
(delete-file rej))
(with-current-buffer output-buffer
(erase-buffer))
- (setq debbugs-gnu-current-directory
- (if branch
- debbugs-gnu-branch-directory
- debbugs-gnu-trunk-directory))
- (unless (file-directory-p debbugs-gnu-current-directory)
- (setq debbugs-gnu-current-directory
- (read-file-name
- "Emacs repository location: "
- debbugs-gnu-current-directory nil t nil 'file-directory-p)))
(gnus-summary-select-article nil t)
;; The patches are either in MIME attachements or the main article
;; buffer. Determine which.
@@ -1760,6 +1818,7 @@ If given a prefix, patch in the branch directory instead."
(defun debbugs-gnu-find-contributor (string)
"Search through ChangeLogs to find contributors."
(interactive "sContributor match: ")
+ (debbugs-gnu-init-current-directory)
(let ((found 0)
(match (concat "^[0-9].*" string)))
(dolist (file (directory-files-recursively
@@ -1879,6 +1938,7 @@ If given a prefix, patch in the branch directory instead."
(defun debbugs-gnu-change-checkin ()
"Prepare checking in the current changes."
(interactive)
+ (debbugs-gnu-init-current-directory)
(save-some-buffers t)
(when (get-buffer "*vc-dir*")
(kill-buffer (get-buffer "*vc-dir*")))
diff --git a/packages/debbugs/debbugs-ug.info b/packages/debbugs/debbugs-ug.info
index af64d4f..0d4ad7d 100644
--- a/packages/debbugs/debbugs-ug.info
+++ b/packages/debbugs/debbugs-ug.info
@@ -105,8 +105,8 @@ prefix.
SUPPRESS shall also distinct between 'nil' and non-'nil'. When
non-'nil', closed bugs are suppressed from being retrieved from
the Debbugs server. Which bugs are regarded as suppressed is
- configured in the customer option 'debbugs-gnu-suppress-bugs'.
- Per default, bugs marked as '"done"' are suppressed from being
+ configured in the user option 'debbugs-gnu-suppress-bugs'. Per
+ default, bugs marked as '"done"' are suppressed from being
retrieved.
When SEVERITIES contains the severity '"tagged"', TAGS is
@@ -122,7 +122,7 @@ prefix.
minibuffer, lists must be entered comma-separated.
Default values for interactive use could be configured in the
- customer options 'debbugs-gnu-default-severities' and
+ user options 'debbugs-gnu-default-severities' and
'debbugs-gnu-default-packages'.
*note Presenting Bugs:: for the presentation of the results.
@@ -132,7 +132,15 @@ prefix.
The commands 'debbugs-gnu-bugs' and 'debbugs-org-bugs' show bugs
specified by their bug number. Interactively, the bug numbers
- must be entered as comma-separated list.
+ must be entered as comma-separated list of bugs or bug ranges.
+
+ A bug range has either the form '12345-21345' or '-123'. In the
+ former case, all bugs from 12345 until 21345 are presented, and
+ in the latter case the last 123 bugs are shown, counting from the
+ highest bug number in the repository.
+
+ A default value for interactive use could be configured in the
+ user option 'debbugs-gnu-default-bug-number-list'.
*note Presenting Bugs:: for the presentation of the results.
@@ -549,7 +557,7 @@ included in the message, applies them, runs 'make -k' in
the 'lisp'
subdirectory, and shows a '*vc-dir*' buffer of the Emacs repository
with the changed file(s).
- The Emacs repository is determined via the variables
+ The Emacs repository is determined via the user options
'debbugs-gnu-trunk-directory' or 'debbugs-gnu-branch-directory'. The
latter one is used, when the patch is applied with the prefixed
command 'C-u M-m'. If the predefined directory does not point to an
@@ -574,9 +582,9 @@ hyperlinks are implemented as minor modes
'bug-reference-mode' and
This package adds a new minor mode 'debbugs-browse-mode' on top of
them. Instead of using the default built-in Emacs browser for a given
-bug reference, it opens a corresponding bug report buffer. The
-customer option 'debbugs-browse-function' controls, whether
-'debbugs-gnu-bugs' or 'debbugs-org-bugs' is called.
+bug reference, it opens a corresponding bug report buffer. The user
+option 'debbugs-browse-function' controls, whether 'debbugs-gnu-bugs'
+or 'debbugs-org-bugs' is called.
This minor mode is applicable for all URLs, not only bug
references. Any URL with the format <http://debbugs.gnu.org/12345>
@@ -595,11 +603,11 @@ Command Index
* debbugs-browse-mode: Minor Mode. (line 12)
* debbugs-gnu: Retrieving Bugs. (line 15)
* debbugs-gnu-bugs: Retrieving Bugs. (line 69)
-* debbugs-gnu-patches: Retrieving Bugs. (line 78)
+* debbugs-gnu-patches: Retrieving Bugs. (line 86)
* debbugs-gnu-search: Searching Bugs. (line 15)
* debbugs-org: Retrieving Bugs. (line 17)
* debbugs-org-bugs: Retrieving Bugs. (line 70)
-* debbugs-org-patches: Retrieving Bugs. (line 79)
+* debbugs-org-patches: Retrieving Bugs. (line 87)
* debbugs-org-search: Searching Bugs. (line 16)
@@ -615,6 +623,7 @@ Variable Index
* debbugs-gnu-all-packages: Retrieving Bugs. (line 36)
* debbugs-gnu-all-severities: Retrieving Bugs. (line 27)
* debbugs-gnu-branch-directory: Applying Patches. (line 18)
+* debbugs-gnu-default-bug-number-list: Retrieving Bugs. (line 81)
* debbugs-gnu-default-packages: Retrieving Bugs. (line 63)
* debbugs-gnu-default-severities: Retrieving Bugs. (line 63)
* debbugs-gnu-default-suppress-bugs: Retrieving Bugs. (line 44)
@@ -659,17 +668,17 @@ Key Index
Tag Table:
Node: Top1097
Node: Retrieving Bugs2635
-Node: Searching Bugs6474
-Ref: Searching Bugs-Footnote-110787
-Ref: Searching Bugs-Footnote-210875
-Node: Presenting Bugs10966
-Node: Tabulated Lists11542
-Node: TODO Items15217
-Node: Control Messages16273
-Node: Applying Patches19315
-Node: Minor Mode20678
-Node: Command Index21626
-Node: Variable Index22415
-Node: Key Index23418
+Node: Searching Bugs6868
+Ref: Searching Bugs-Footnote-111181
+Ref: Searching Bugs-Footnote-211269
+Node: Presenting Bugs11360
+Node: Tabulated Lists11936
+Node: TODO Items15611
+Node: Control Messages16667
+Node: Applying Patches19709
+Node: Minor Mode21075
+Node: Command Index22019
+Node: Variable Index22808
+Node: Key Index23882
End Tag Table
diff --git a/packages/debbugs/debbugs-ug.texi b/packages/debbugs/debbugs-ug.texi
index 03d7c70..e63923a 100644
--- a/packages/debbugs/debbugs-ug.texi
+++ b/packages/debbugs/debbugs-ug.texi
@@ -117,7 +117,7 @@ archived bugs on the GNU Debbugs server.
@var{suppress} shall also distinct between @code{nil} and
address@hidden When address@hidden, closed bugs are suppressed from
being retrieved from the Debbugs server. Which bugs are regarded as
-suppressed is configured in the customer option
+suppressed is configured in the user option
@code{debbugs-gnu-suppress-bugs}. Per default, bugs marked as
@code{"done"} are suppressed from being retrieved.
@@ -135,7 +135,7 @@ minibuffer, lists must be entered comma-separated.
@vindex debbugs-gnu-default-severities
@vindex debbugs-gnu-default-packages
-Default values for interactive use could be configured in the customer
+Default values for interactive use could be configured in the user
options @code{debbugs-gnu-default-severities} and
@code{debbugs-gnu-default-packages}.
@@ -149,7 +149,16 @@ options @code{debbugs-gnu-default-severities} and
The commands @code{debbugs-gnu-bugs} and @code{debbugs-org-bugs} show
bugs specified by their bug number. Interactively, the bug numbers
-must be entered as comma-separated list.
+must be entered as comma-separated list of bugs or bug ranges.
+
+A bug range has either the form @samp{12345-21345} or @samp{-123}. In
+the former case, all bugs from 12345 until 21345 are presented, and in
+the latter case the last 123 bugs are shown, counting from the highest
+bug number in the repository.
+
address@hidden debbugs-gnu-default-bug-number-list
+A default value for interactive use could be configured in the user
+option @code{debbugs-gnu-default-bug-number-list}.
@ref{Presenting Bugs} for the presentation of the results.
@@ -616,7 +625,7 @@ Emacs repository with the changed file(s).
@vindex debbugs-gnu-trunk-directory
@vindex debbugs-gnu-branch-directory
-The Emacs repository is determined via the variables
+The Emacs repository is determined via the user options
@code{debbugs-gnu-trunk-directory} or
@code{debbugs-gnu-branch-directory}. The latter one is used, when the
patch is applied with the prefixed command @kbd{C-u M-m}. If the
@@ -644,7 +653,7 @@ The reference to such bugs have a specialized format,
This package adds a new minor mode @code{debbugs-browse-mode} on top
of them. Instead of using the default built-in Emacs browser for a
given bug reference, it opens a corresponding bug report buffer. The
-customer option @code{debbugs-browse-function} controls, whether
+user option @code{debbugs-browse-function} controls, whether
@code{debbugs-gnu-bugs} or @code{debbugs-org-bugs} is called.
This minor mode is applicable for all URLs, not only bug references.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master 8972437: Extend arguments of `debbugs-gnu-bugs', plus minor fixes,
Michael Albinus <=