From 7f68ee0dc0079958534d5ce3d3313f9fa9a45cf8 Mon Sep 17 00:00:00 2001 From: psg <> Date: Sat, 6 Sep 2003 02:58:04 +0000 Subject: debian-bug: make it a front-end to `debian-bug-package' (the old `debian-bug') and `debian-bug-filename' and make those non-interactive, reducing the number of interactive commands. --- debian-bug.el | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'debian-bug.el') diff --git a/debian-bug.el b/debian-bug.el index 353e6be..aef0cae 100644 --- a/debian-bug.el +++ b/debian-bug.el @@ -209,6 +209,9 @@ ;; - debian-bug-filename: Added File: in informational block. ;; - debian-bug-search-file: Added message about system call to dpkg. ;; - debian-bug-font-lock-keywords: added File: +;; - debian-bug: make it a front-end to `debian-bug-package' (the old +;; `debian-bug') and `debian-bug-filename' and make those non-interactive, +;; reducing the number of interactive commands. ;; ---------------------------------------------------------------------------- ;;; Todo (Peter's list): @@ -711,16 +714,16 @@ Reportbug may have sent an empty report!"))) (call-process "uname" nil '(t t) nil "-a") (forward-line -5)))) -(defun debian-bug (&optional package) - "Submit a Debian bug report. -Optional argument PACKAGE can be provided in programs." - (interactive (list (save-window-excursion - (if debian-bug-display-help - (debian-bug-help-pseudo-packages)) - (completing-read - "Package name: " - (debian-bug-fill-packages-obarray) - nil nil nil nil (current-word))))) +(defun debian-bug-package (&optional package) + "Submit a Debian bug report about PACKAGE." + (if (or (not package) (string= "" package)) + (save-window-excursion + (if debian-bug-display-help + (debian-bug-help-pseudo-packages)) + (setq package (completing-read + "Package name: " + (debian-bug-fill-packages-obarray) + nil nil nil nil (current-word))))) (if (string= package "wnpp") (debian-bug-wnpp) (debian-bug-fill-packages-obarray) @@ -1751,7 +1754,6 @@ Call this function from the mode setup with MINOR-MODE-MAP." (defun debian-bug-filename () "Submit a Debian bug report for a given filename's package." - (interactive) (let ((filename (read-file-name "Filename: " "/" nil t nil))) (cond ((string-equal "" filename) @@ -1762,11 +1764,25 @@ Call this function from the mode setup with MINOR-MODE-MAP." (let ((answer (y-or-n-p (format "File is in package %s; continue? " package)))) (when answer - (debian-bug package) + (debian-bug-package package) (save-excursion (forward-char -1) (insert "File: " filename "\n")))))))))) +(defun debian-bug () + "Submit a Debian bug report." + (interactive) + (let ((type (read-string + "Report a bug for a [P]ackage or [F]ile: (default P) "))) + (cond + ((or (string-equal "" type) + (string-match "^[pP]" type)) + (debian-bug-package)) + ((string-match "^[fF]" type) + (debian-bug-filename)) + (t + (message "Sorry, try that again"))))) + (provide 'debian-bug) ;;; debian-bug.el ends here -- cgit v1.2.3