Mercurial > emacs
annotate lisp/emacs-lisp/lisp-mnt.el @ 2448:0d7fdb12dcdb
(etags-tags-completion-table): Rewritten with a mondo regexp.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Thu, 01 Apr 1993 02:11:02 +0000 |
parents | 8c8fe9da1f5e |
children | df68ddbcc2f1 |
rev | line source |
---|---|
879 | 1 ;;; lisp-mnt.el --- minor mode for Emacs Lisp maintainers |
2 | |
3 ;; Copyright (C) 1992 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | |
6 ;; Maintainer: Eric S. Raymond <esr@snark.thyrsus.com> | |
7 ;; Created: 14 Jul 1992 | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
8 ;; Version: $Id: lisp-mnt.el,v 1.3 1993/03/24 23:46:52 esr Exp $ |
879 | 9 ;; Keywords: docs |
10 ;; Bogus-Bureaucratic-Cruft: Gruad will get you if you don't watch out! | |
11 | |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
16 ;; the Free Software Foundation; either version 1, or (at your option) | |
17 ;; any later version. | |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
25 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
26 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
27 | |
28 ;;; Commentary: | |
29 | |
30 ;; This minor mode adds some services to Emacs-Lisp editing mode. | |
31 ;; | |
32 ;; First, it knows about the header conventions for library packages. | |
33 ;; One entry point supports generating synopses from a library directory. | |
34 ;; Another can be used to check for missing headers in library files. | |
35 ;; | |
36 ;; Another entry point automatically addresses bug mail to a package's | |
37 ;; maintainer or author. | |
38 | |
39 ;; This file can be loaded by your lisp-mode-hook. Have it (require 'lisp-mnt) | |
40 | |
41 ;; This file is an example of the header conventions. Note the following | |
42 ;; features: | |
43 ;; | |
44 ;; * Header line --- makes it possible to extract a one-line summary of | |
45 ;; the package's uses automatically for use in library synopses, KWIC | |
46 ;; indexes and the like. | |
47 ;; | |
48 ;; Format is three semicolons, followed by the filename, followed by | |
49 ;; three dashes, followed by the summary. All fields space-separated. | |
50 ;; | |
51 ;; * Author line --- contains the name and net address of at least | |
52 ;; the principal author. | |
53 ;; | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
54 ;; If there are multiple authors, they should be listed on continuation |
879 | 55 ;; lines led by ;;<TAB>, like this: |
56 ;; | |
57 ;; ;; Author: Ashwin Ram <Ram-Ashwin@cs.yale.edu> | |
58 ;; ;; Dave Sill <de5@ornl.gov> | |
59 ;; ;; David Lawrence <tale@pawl.rpi.edu> | |
60 ;; ;; Noah Friedman <friedman@ai.mit.edu> | |
61 ;; ;; Joe Wells <jbw@maverick.uswest.com> | |
62 ;; ;; Dave Brennan <brennan@hal.com> | |
63 ;; ;; Eric Raymond <esr@snark.thyrsus.com> | |
64 ;; | |
65 ;; This field may have some special values; notably "FSF", meaning | |
66 ;; "Free Software Foundation". | |
67 ;; | |
68 ;; * Maintainer line --- should be a single name/address as in the Author | |
69 ;; line, or an address only, or the string "FSF". If there is no maintainer | |
70 ;; line, the person(s) in the Author field are presumed to be it. The example | |
71 ;; in this file is mildly bogus because the maintainer line is redundant. | |
72 ;; The idea behind these two fields is to be able to write a lisp function | |
73 ;; that does "send mail to the author" without having to mine the name out by | |
74 ;; hand. Please be careful about surrounding the network address with <> if | |
75 ;; there's also a name in the field. | |
76 ;; | |
77 ;; * Created line --- optional, gives the original creation date of the | |
78 ;; file. For historical interest, basically. | |
79 ;; | |
80 ;; * Version line --- intended to give the reader a clue if they're looking | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
81 ;; at a different version of the file than the one they're accustomed to. This |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
82 ;; may be an RCS or SCCS header. |
879 | 83 ;; |
84 ;; * Adapted-By line --- this is for FSF's internal use. The person named | |
85 ;; in this field was the one responsible for installing and adapting the | |
86 ;; package for the distribution. (This file doesn't have one because the | |
87 ;; author *is* one of the maintainers.) | |
88 ;; | |
89 ;; * Keywords line --- used by the finder code (now under construction) | |
90 ;; for finding elisp code related to a topic. | |
91 ;; | |
92 ;; * Bogus-Bureaucratic-Cruft line --- this is a joke. I figured I should | |
93 ;; satirize this design before someone else did. Also, it illustrates the | |
94 ;; possibility that other headers may be added in the future for new purposes. | |
95 ;; | |
96 ;; * Commentary line --- enables lisp code to find the developer's and | |
97 ;; maintainers' explanations of the package internals. | |
98 ;; | |
99 ;; * Change log line --- optional, exists to terminate the commentary | |
100 ;; section and start a change-log part, if one exists. | |
101 ;; | |
102 ;; * Code line --- exists so elisp can know where commentary and/or | |
103 ;; change-log sections end. | |
104 ;; | |
105 ;; * Footer line --- marks end-of-file so it can be distinguished from | |
106 ;; an expanded formfeed or the results of truncation. | |
107 | |
108 ;;; Change Log: | |
109 | |
110 ;; Tue Jul 14 23:44:17 1992 ESR | |
111 ;; * Created. | |
112 | |
113 ;;; Code: | |
114 | |
115 (require 'picture) ; provides move-to-column-force | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
116 (require 'emacsbug) |
879 | 117 |
118 ;; These functions all parse the headers of the current buffer | |
119 | |
120 (defun lm-section-mark (hd) | |
121 ;; Return the buffer location of a given section start marker | |
122 (save-excursion | |
123 (let ((case-fold-search t)) | |
124 (goto-char (point-min)) | |
125 (if (re-search-forward (concat "^;;; " hd ":$") nil t) | |
126 (progn | |
127 (beginning-of-line) | |
128 (point)) | |
129 nil)))) | |
130 | |
131 (defun lm-code-mark () | |
132 ;; Return the buffer location of the code start marker | |
133 (lm-section-mark "Code")) | |
134 | |
135 (defun lm-header (hd) | |
136 ;; Return the contents of a named header | |
137 (goto-char (point-min)) | |
138 (let ((case-fold-search t)) | |
139 (if (re-search-forward | |
140 (concat "^;; " hd ": \\(.*\\)") (lm-code-mark) t) | |
141 (buffer-substring (match-beginning 1) (match-end 1)) | |
142 nil))) | |
143 | |
144 (defun lm-header-multiline (hd) | |
145 ;; Return the contents of a named header, with possible continuation lines. | |
146 ;; Note -- the returned value is a list of strings, one per line. | |
147 (save-excursion | |
148 (goto-char (point-min)) | |
149 (let ((res (save-excursion (lm-header hd)))) | |
150 (if res | |
151 (progn | |
152 (forward-line 1) | |
153 (setq res (list res)) | |
154 (while (looking-at "^;;\t\\(.*\\)") | |
155 (setq res (cons (buffer-substring | |
156 (match-beginning 1) | |
157 (match-end 1)) | |
158 res)) | |
159 (forward-line 1)) | |
160 )) | |
161 res))) | |
162 | |
163 ;; These give us smart access to the header fields and commentary | |
164 | |
165 (defun lm-summary (&optional file) | |
166 ;; Return the buffer's or FILE's one-line summary. | |
167 (save-excursion | |
168 (if file | |
169 (find-file file)) | |
170 (goto-char (point-min)) | |
171 (prog1 | |
172 (if (looking-at "^;;; [^ ]+ --- \\(.*\\)") | |
173 (buffer-substring (match-beginning 1) (match-end 1))) | |
174 (if file | |
175 (kill-buffer (current-buffer))) | |
176 ))) | |
177 | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
178 |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
179 (defun lm-crack-address (x) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
180 ;; Given a string containing a human and email address, parse it |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
181 ;; into a cons pair (name . address). |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
182 (cond ((string-match "\\(.+\\) [(<]\\(\\S-+@\\S-+\\)[>)]" x) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
183 (cons (substring x (match-beginning 1) (match-end 1)) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
184 (substring x (match-beginning 2) (match-end 2)))) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
185 ((string-match "\\(\\S-+@\\S-+\\) [(<]\\(.*\\)[>)]" x) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
186 (cons (substring x (match-beginning 2) (match-end 2)) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
187 (substring x (match-beginning 1) (match-end 1)))) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
188 ((string-match "\\S-+@\\S-+" x) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
189 (cons nil x)) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
190 (t |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
191 (cons x nil)))) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
192 |
879 | 193 (defun lm-authors (&optional file) |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
194 ;; Return the buffer's or FILE's author list. Each element of the |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
195 ;; list is a cons; the car is a name-aming-humans, the cdr an email |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
196 ;; address. |
879 | 197 (save-excursion |
198 (if file | |
199 (find-file file)) | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
200 (let ((authorlist (lm-header-multiline "author"))) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
201 (prog1 |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
202 (mapcar 'lm-crack-address authorlist) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
203 (if file |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
204 (kill-buffer (current-buffer))) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
205 )))) |
879 | 206 |
207 (defun lm-maintainer (&optional file) | |
208 ;; Get a package's bug-report & maintenance address. Parse it out of FILE, | |
209 ;; or the current buffer if FILE is nil. | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
210 ;; The return value is a (name . address) cons. |
879 | 211 (save-excursion |
212 (if file | |
213 (find-file file)) | |
214 (prog1 | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
215 (let ((maint (lm-header "maintainer"))) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
216 (if maint |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
217 (lm-crack-address maint) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
218 (car (lm-authors)))) |
879 | 219 (if file |
220 (kill-buffer (current-buffer))) | |
221 ))) | |
222 | |
223 (defun lm-creation-date (&optional file) | |
224 ;; Return a package's creation date, if any. Parse it out of FILE, | |
225 ;; or the current buffer if FILE is nil. | |
226 (save-excursion | |
227 (if file | |
228 (find-file file)) | |
229 (prog1 | |
230 (lm-header "created") | |
231 (if file | |
232 (kill-buffer (current-buffer))) | |
233 ))) | |
234 | |
235 | |
236 (defun lm-last-modified-date (&optional file) | |
237 ;; Return a package's last-modified date, if you can find one. | |
238 (save-excursion | |
239 (if file | |
240 (find-file file)) | |
241 (prog1 | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
242 (if (progn |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
243 (goto-char (point-min)) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
244 (re-search-forward |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
245 "\\$Id: [^ ]+ [^ ]+ \\([^/]+\\)/\\([^/]+\\)/\\([^ ]+\\) " |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
246 (lm-code-mark) t)) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
247 (format "%s %s %s" |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
248 (buffer-substring (match-beginning 3) (match-end 3)) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
249 (nth (string-to-int |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
250 (buffer-substring (match-beginning 2) (match-end 2))) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
251 '("" "Jan" "Feb" "Mar" "Apr" "May" "Jun" |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
252 "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
253 (buffer-substring (match-beginning 1) (match-end 1)) |
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
254 )) |
879 | 255 (if file |
256 (kill-buffer (current-buffer))) | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
257 ))) |
879 | 258 |
259 (defun lm-version (&optional file) | |
260 ;; Return the package's version field. | |
261 ;; If none, look for an RCS or SCCS header to crack it out of. | |
262 (save-excursion | |
263 (if file | |
264 (find-file file)) | |
265 (prog1 | |
266 (or | |
267 (lm-header "version") | |
268 (let ((header-max (lm-code-mark))) | |
269 (goto-char (point-min)) | |
270 (cond | |
271 ;; Look for an RCS header | |
272 ((re-search-forward "\\$Id: [^ ]+ \\([^ ]+\\) " header-max t) | |
273 (buffer-substring (match-beginning 1) (match-end 1))) | |
274 | |
275 ;; Look for an SCCS header | |
276 ((re-search-forward | |
277 (concat | |
278 (regexp-quote "@(#)") | |
279 (regexp-quote (file-name-nondirectory (buffer-file-name))) | |
280 "\t\\([012345679.]*\\)") | |
281 header-max t) | |
282 (buffer-substring (match-beginning 1) (match-end 1))) | |
283 | |
284 (t nil)))) | |
285 (if file | |
286 (kill-buffer (current-buffer))) | |
287 ))) | |
288 | |
289 (defun lm-keywords (&optional file) | |
290 ;; Return the header containing the package's topic keywords. | |
291 ;; Parse them out of FILE, or the current buffer if FILE is nil. | |
292 (save-excursion | |
293 (if file | |
294 (find-file file)) | |
295 (prog1 | |
296 (let ((keywords (lm-header "keywords"))) | |
297 (and keywords (downcase keywords))) | |
298 (if file | |
299 (kill-buffer (current-buffer))) | |
300 ))) | |
301 | |
302 (defun lm-adapted-by (&optional file) | |
303 ;; Return the name or code of the person who cleaned up this package | |
304 ;; for distribution. Parse it out of FILE, or the current buffer if | |
305 ;; FILE is nil. | |
306 (save-excursion | |
307 (if file | |
308 (find-file file)) | |
309 (prog1 | |
310 (lm-header "adapted-by") | |
311 (if file | |
312 (kill-buffer (current-buffer))) | |
313 ))) | |
314 | |
315 (defun lm-commentary-region (&optional file) | |
316 ;; Return a pair of character locations enclosing the commentary region. | |
317 (save-excursion | |
318 (if file | |
319 (find-file file)) | |
320 (prog1 | |
321 (let ((commentary (lm-section-mark "Commentary")) | |
322 (change-log (lm-section-mark "Change Log")) | |
323 (code (lm-section-mark "Code"))) | |
324 (if commentary | |
325 (if change-log | |
326 (cons commentary change-log) | |
327 (cons commentary code))) | |
328 ) | |
329 (if file | |
330 (kill-buffer (current-buffer))) | |
331 ))) | |
332 | |
333 ;;; Verification and synopses | |
334 | |
335 (defun insert-at-column (col &rest pieces) | |
336 (if (> (current-column) col) (insert "\n")) | |
337 (move-to-column-force col) | |
338 (apply 'insert pieces)) | |
339 | |
340 (defconst lm-comment-column 16) | |
341 | |
342 (defun lm-verify (&optional file showok) | |
343 "Check that the current buffer (or FILE if given) is in proper format. | |
344 If FILE is a directory, recurse on its files and generate a report into | |
345 a temporary buffer." | |
346 (if (and file (file-directory-p file)) | |
347 (progn | |
348 (switch-to-buffer (get-buffer-create "*lm-verify*")) | |
349 (erase-buffer) | |
350 (mapcar | |
351 '(lambda (f) | |
352 (if (string-match ".*\\.el$" f) | |
353 (let ((status (lm-verify f))) | |
354 (if status | |
355 (progn | |
356 (insert f ":") | |
357 (insert-at-column lm-comment-column status "\n")) | |
358 (and showok | |
359 (progn | |
360 (insert f ":") | |
361 (insert-at-column lm-comment-column "OK\n"))))))) | |
362 (directory-files file)) | |
363 ) | |
364 (save-excursion | |
365 (if file | |
366 (find-file file)) | |
367 (prog1 | |
368 (cond | |
369 ((not (lm-summary)) | |
370 "Can't find a package summary") | |
371 ((not (lm-code-mark)) | |
372 "Can't find a code section marker") | |
373 ((progn | |
374 (goto-char (point-max)) | |
375 (forward-line -1) | |
376 (looking-at (concat ";;; " file "ends here"))) | |
377 "Can't find a footer line") | |
378 ) | |
379 (if file | |
380 (kill-buffer (current-buffer))) | |
381 )))) | |
382 | |
383 (defun lm-synopsis (&optional file showall) | |
384 "Generate a synopsis listing for the buffer or the given FILE if given. | |
385 If FILE is a directory, recurse on its files and generate a report into | |
386 a temporary buffer. If SHOWALL is on, also generate a line for files | |
387 which do not include a recognizable synopsis." | |
388 (if (and file (file-directory-p file)) | |
389 (progn | |
390 (switch-to-buffer (get-buffer-create "*lm-verify*")) | |
391 (erase-buffer) | |
392 (mapcar | |
393 '(lambda (f) | |
394 (if (string-match ".*\\.el$" f) | |
395 (let ((syn (lm-synopsis f))) | |
396 (if syn | |
397 (progn | |
398 (insert f ":") | |
399 (insert-at-column lm-comment-column syn "\n")) | |
400 (and showall | |
401 (progn | |
402 (insert f ":") | |
403 (insert-at-column lm-comment-column "NA\n"))))))) | |
404 (directory-files file)) | |
405 ) | |
406 (save-excursion | |
407 (if file | |
408 (find-file file)) | |
409 (prog1 | |
410 (lm-summary) | |
411 (if file | |
412 (kill-buffer (current-buffer))) | |
413 )))) | |
414 | |
415 (defun lm-report-bug (topic) | |
416 "Report a bug in the package currently being visited to its maintainer. | |
417 Prompts for bug subject. Leaves you in a mail buffer." | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
418 (interactive "sBug Subject: ") |
879 | 419 (let ((package (buffer-name)) |
420 (addr (lm-maintainer)) | |
421 (version (lm-version))) | |
2352
8c8fe9da1f5e
(lm-last-modified-date) Fixed return bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
879
diff
changeset
|
422 (mail nil (or addr bug-gnu-emacs) topic) |
879 | 423 (goto-char (point-max)) |
424 (insert "\nIn " | |
425 package | |
426 (and version (concat " version " version)) | |
427 "\n\n") | |
428 (message | |
429 (substitute-command-keys "Type \\[mail-send] to send bug report.")))) | |
430 | |
431 (provide 'lisp-mnt) | |
432 | |
433 ;;; lisp-mnt.el ends here |