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