summaryrefslogtreecommitdiff
path: root/debian-bug.el
diff options
context:
space:
mode:
authorpsg <>2003-09-21 01:21:07 +0000
committerpsg <>2003-09-21 01:21:07 +0000
commit036115badc59d9a97f3b4c01333ba02e0faf0d1a (patch)
tree9f4307c1abd45d37506a9ff602ec96e3357216f1 /debian-bug.el
parent5a183b4dc2c2cbd85499f364ba68e32dcd0050f8 (diff)
Bug fix: "debbugs-el: debian-bug-search-file: should use dlocate when
available", thanks to Jeff Sheinberg (Closes: #211598). Added dlocate to package Recommends.
Diffstat (limited to 'debian-bug.el')
-rw-r--r--debian-bug.el56
1 files changed, 38 insertions, 18 deletions
diff --git a/debian-bug.el b/debian-bug.el
index 52356a4..c80d982 100644
--- a/debian-bug.el
+++ b/debian-bug.el
@@ -225,6 +225,9 @@
;; and broke the splitting-up of large bug categories. Fixed.
;; - bugs.debian.org added HTML "name" tags which I need to exclude from
;; titles.
+;; V1.47 20Sep2003 Peter S Galbraith <psg@debian.org>
+;; - debian-bug-search-file: Use dlocate if available when filename is
+;; given. thanks to Jeff Sheinberg (Closes: #211598).
;; ----------------------------------------------------------------------------
;;; Todo (Peter's list):
@@ -1732,28 +1735,45 @@ Call this function from the mode setup with MINOR-MODE-MAP."
(defun debian-bug-search-file (filename)
"Search for FILENAME returning which package name it belongs to."
(save-excursion
- (let ((tmp-buffer (get-buffer-create " *debian-bug-tmp*")))
+ (let ((tmp-buffer (get-buffer-create " *debian-bug-tmp*"))
+ (expanded-file (expand-file-name filename))
+ (package))
(set-buffer tmp-buffer)
(unwind-protect
(progn
- (message "Calling dpkg for the search...")
- (call-process "dpkg" nil '(t nil) nil "-S"
- (expand-file-name filename))
- (message "Calling dpkg for the search...done")
+ (condition-case err
+ (call-process "dlocate" nil '(t nil) nil "-S" expanded-file)
+ (file-error
+ (message "dlocate not installed...")))
(goto-char (point-min))
- (cond
- ((re-search-forward "not found.$" nil t)
- (message "%s not found in package list" filename)
- nil)
- ((re-search-forward "^\\(.*, .*\\): " nil t)
- (with-output-to-temp-buffer "*Help*"
- (princ (format "Please refine your search,\nthere is more than one matched package:\n\n%s" (match-string 1))))
- nil)
- ((re-search-forward "^\\(.*\\): " nil t)
- (match-string 1))
- (t
- (message "%s not found in package list" filename)
- nil)))
+ (when (re-search-forward
+ (concat "^\\(.*\\): " (regexp-quote expanded-file) "$")
+ nil t)
+ ;; found one at least. Try for another.
+ (setq package (match-string 1))
+ (when (re-search-forward
+ (concat "^.*: " (regexp-quote expanded-file) "$") nil t)
+ (setq package nil)))
+ (if package
+ package
+ (message "Calling dpkg for the search...")
+ (call-process "dpkg" nil '(t nil) nil "-S"
+ (expand-file-name filename))
+ (message "Calling dpkg for the search...done")
+ (goto-char (point-min))
+ (cond
+ ((re-search-forward "not found.$" nil t)
+ (message "%s not found in package list" filename)
+ nil)
+ ((re-search-forward "^\\(.*, .*\\): " nil t)
+ (with-output-to-temp-buffer "*Help*"
+ (princ (format "Please refine your search,\nthere is more than one matched package:\n\n%s" (match-string 1))))
+ nil)
+ ((re-search-forward "^\\(.*\\): " nil t)
+ (match-string 1))
+ (t
+ (message "%s not found in package list" filename)
+ nil))))
(kill-buffer tmp-buffer)))))
(defun debian-bug-filename ()