45 (when (file-regular-p file) |
45 (when (file-regular-p file) |
46 ;; (with-temp-buffer |
46 ;; (with-temp-buffer |
47 ;; (insert-file-contents file)) |
47 ;; (insert-file-contents file)) |
48 (insert "\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n\n") |
48 (insert "\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n\n") |
49 (insert-file-contents file) |
49 (insert-file-contents file) |
50 (end-of-buffer))) |
50 (goto-char (point-max)))) |
51 (directory-files debian-doc-dir t))) |
51 (directory-files debian-doc-dir t))) |
52 (read-only-mode 1) |
52 (read-only-mode 1) |
53 (debian-doc-mode) |
53 (debian-doc-mode) |
54 (beginning-of-buffer))) |
54 (goto-char (point-min)))) |
55 |
55 |
56 ;;;###autoload |
56 ;;;###autoload |
57 (defun debian-doc-visit () |
57 (defun debian-doc-visit () |
58 "Prompt for Debian package which represent docs and visit its entry in Debian-oc buffer." |
58 "Prompt for Debian package which represent docs and visit its entry in Debian-oc buffer." |
59 (interactive) |
59 (interactive) |
60 (let (word start) |
60 (let (word start) |
61 (debian-doc) |
61 (debian-doc) |
62 (unless debian-doc-completion-list |
62 (unless debian-doc-completion-list |
63 (save-excursion |
63 (save-excursion |
64 (beginning-of-buffer) |
64 (goto-char (point-min)) |
65 (while (setq start (search-forward "Document: " nil t)) |
65 (while (setq start (search-forward "Document: " nil t)) |
66 (end-of-line) |
66 (end-of-line) |
67 (push (buffer-substring-no-properties start (point)) debian-doc-completion-list)))) |
67 (push (buffer-substring-no-properties start (point)) debian-doc-completion-list)))) |
68 (when (setq word (completing-read "Package: " debian-doc-completion-list nil t)) |
68 (when (setq word (completing-read "Package: " debian-doc-completion-list nil t)) |
69 (beginning-of-buffer) |
69 (goto-char (point-min)) |
70 (search-forward (concat "Document: " word) nil t) |
70 (search-forward (concat "Document: " word) nil t) |
71 (recenter-top-bottom)))) |
71 (recenter-top-bottom)))) |
72 (define-key debian-doc-mode-map (kbd "RET") 'debian-doc-visit-at-point) |
72 (define-key debian-doc-mode-map (kbd "RET") 'debian-doc-visit-at-point) |
73 |
73 |
74 |
74 |