annotate lisp/lisp-mnt.el @ 502:7039e6323819

[xemacs-hg @ 2001-05-04 22:41:46 by ben] ----------------------- byte-comp warning fixes ----------------- New functions for cleanly eliminating byte-compiler warnings. Their definitions require no changes at all in bytecomp.el, meaning that any package that wants to use them and be compatible with older versions of XEmacs need only copy the code and rename the functions (i.e. prefix them with the package name). Eliminate byte-compiler warnings using the new functions in bytecomp-runtime.el. Move coding-system-put,get,category, since they're not Mule-specific and are used in prefer-coding-system. font.el was incredibly ugly. Clean it up. Avoid using defsubst for any exported functions, to avoid possible compatibility problems if we later change the internal interface. (It happened before, with face accessors, between 19.8 and 19.9). Fix tons of warnings. Clean up (new function gpm-is-supported-p eliminates duplicate code in gpm-create/delete-device-hook) and eliminate warnings. ---------- make byte-recompile-directory work in the --------- core `lisp' dir, even in the absence of a Mule XEmacs (i.e. make it skip the Mule files rather than trying to compile them). now you should be able to do `touch *.el' in the `lisp' dir, then M-x byte-recompile-directory, and get no warnings. Avoid trying to compile Mule files in byte-recompile-directory when we're not in a Mule XEmacs, since we're highly likely to get syntax errors. Add a coding-system cookie to all Mule files so that byte-recompile-directory ignores them. Magic cookie function moved to files.el from code-files.el (for use by bytecomp even in a non-coding-system XEmacs), and changed names and semantics for use by bytecomp. NOTE: IMO this is an internal function that we can change as we like (and there is absolutely no code anywhere else using the function). ---------------- GUI improvements: menus, help ------------------- Rearrange order of keymap declarations to be alphabetical. Improve help on help to include all bindings, and group by category. Add bindings for new Info commands. Remove warnings. Use command-hyper-apropos in place of command-apropos. Add a function to do the equivalent of command-apropos. Evals its help-text argument so you can put expressions there. Used now by help-for-help. Add binding to continue text searches. Expand index searches to work over multiple info documents. Add commands to search text/index in User and Lispref. Add new entry, "Uncomment Region" (parallels "Comment Out Region"). Redo Help menu; add bindings for new Info commands to search the index or text of the User and Lispref manuals. Add command for mark-paragraph, activate-region. Make Edit->R accelerator be rectangle, not register (more commonly used), and put rectangle first. Fix the Edit Init File entry to never load the .elc file. Simplify the default-popup-menu. Add Cmds->Tabs menu. Use kp-left not kp_left, etc. ---------------- Miscellaneous bug fixes/cleanup ------------------- byte-compiler-options: Correct doc string. easy-menu-do-define: fix extra quote. fill-paragraph-or-region:Rewrite to be more correct -- use call-interactively so that we always get exactly the same behavior as if the functions were called directly. No need to fiddle with zmacs-region-stays, now that bogus clearing of it (2001-04-28 src/ChangeLog) is removed. Put dialog titles back in -- this time correctly. Fix various other problems with leaks and such. key-sequence-list-description: Clean up fun to always correctly canonicalize. Clean up Kinsoku comments, synch comment-region with FSF 20.7. * simple.el (region-exists-p): * simple.el (region-active-p): Add comment about which one is correct to use in menu specs. * sound.el (load-sound-file): Minor code clean up. * startup.el: * startup.el (command-line-early): * startup.el (initial-scratch-message): Comment changes. Add info about sample.init.el to splash screen. Improve initial-scratch-message and clarify purpose of Scratch buffer. Fix byte-compile warning. ------------------------ Added features ------------------------- Add new variable to control whether etags checks all parent directories for tag files. (On by default.) * hash-table.el: New file, useful utility functions. * dumped-lisp.el (preloaded-file-list): Dump hash-table.el. ------------ notable bug fix: Windows event code -------------- Get critical quit working. ------------ notable bug fix and new feature: regex code -------------- Shy groups were implemented in a horrible, half-assed way that would cause them to screw up regex searching in most cases. Fixed to work correctly. Also extended back-reference syntax past 9. Only is recognized as such if there are at least that many non-shy groups; and optionally will warn about such uses, to catch old code that might be using them differently. (Added variable to control this in search.c -- `warn-about-possibly-incompatible-back- references', on by default for the moment. Declared in lisp.h. ---------------- process/SIGIO improvements ------------------- define USE_GETADDRINFO to replace more complex conditional, and use it. the code conditionalized on this in unix_open_network_stream had *serious* problems handling errors. it's now fixed, and major amounts of duplicate code between the two versions were combined. don't disable SIGIO and other interrupts unless CONNECT_NEEDS_SLOWED_INTERRUPTS is defined -- don't penalize OS's without bugs. similarly for a freebsd bug that was affecting all OS's. * s\ultrix.h: define CONNECT_NEEDS_SLOWED_INTERRUPTS, since that's the OS mentioned as having a kernel bug. * sysdep.c (request_sigio_on_device): * sysdep.c (unrequest_sigio_on_device): fix SIGIO problems on Linux. add check for O_ASYNC in case it's defined and FASYNC isn't. add comment about other ways to do SIGIO on Linux. * callproc.c (Fold_call_process_internal): * process.c (Fstart_process_internal): Deal with the possibility that `default-directory' doesn't have terminating slash. Correct comments about vfork. ---------------- Miscellaneous bug fixes/cleanup ------------------- * callint.c (Finteractive): Add lots of documentation -- exactly what the Lisp equivalents of all the interactive specs are. * console.h (struct console): change type of quit_char to Emchar. * event-msw.c (lstream_type_create_mswindows_selectable): spacing change. Eliminate events-mod.h and combine into events.h. * emacs.c: * emacs.c (make_arg_list_1): * emacs.c (main_1): A couple of char->Extbyte changes, add a comment. * glyphs-msw.c: Correct indentation of function defns to not exceed 80 cols. Try (sort of) to fix some code that sets the colors of the progress gauge. (Commented out) * keymap.c (syms_of_keymap): use DEFSYMBOL. * process.c (read_process_output): No need to fiddle with zmacs_region_stays, now that bogus clearing of it (see below) is removed. * search.c (Freplace_match): warning fix.
author ben
date Fri, 04 May 2001 22:42:35 +0000
parents 3078fd1074e8
children 51494923758b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; lisp-mnt.el --- minor mode for Emacs Lisp maintainers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Maintainer: Eric S. Raymond <esr@snark.thyrsus.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Created: 14 Jul 1992
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Keywords: docs, maint
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; X-Modified-by: Bob Weiner <weiner@beopen.com>, 4/14/95, to support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; InfoDock headers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; X-Bogus-Bureaucratic-Cruft: Gruad will get you if you don't watch out!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; along with XEmacs; see the file COPYING. If not, write to the Free
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;; 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;;; Synched up with: FSF 20.2.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 ;; This minor mode adds some services to Emacs-Lisp editing mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 ;; First, it knows about the header conventions for library packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 ;; One entry point supports generating synopses from a library directory.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 ;; Another can be used to check for missing headers in library files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; Another entry point automatically addresses bug mail to a package's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; maintainer or author.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 ;; This file can be loaded by your lisp-mode-hook. Have it (require 'lisp-mnt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;; This file is an example of the header conventions. Note the following
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ;; features:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ;; * Header line --- makes it possible to extract a one-line summary of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ;; the package's uses automatically for use in library synopses, KWIC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ;; indexes and the like.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 ;; Format is three semicolons, followed by the filename, followed by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 ;; three dashes, followed by the summary. All fields space-separated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 ;; * Author line --- contains the name and net address of at least
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 ;; the principal author.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 ;; If there are multiple authors, they should be listed on continuation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 ;; lines led by ;;<TAB><TAB> (or multiple blanks), like this:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 ;; ;; Author: Ashwin Ram <Ram-Ashwin@cs.yale.edu>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 ;; ;; Dave Sill <de5@ornl.gov>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;; ;; David Lawrence <tale@pawl.rpi.edu>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ;; ;; Noah Friedman <friedman@ai.mit.edu>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 ;; ;; Joe Wells <jbw@maverick.uswest.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 ;; ;; Dave Brennan <brennan@hal.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 ;; ;; Eric Raymond <esr@snark.thyrsus.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 ;; This field may have some special values; notably "FSF", meaning
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 ;; "Free Software Foundation".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 ;; * Maintainer line --- should be a single name/address as in the Author
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ;; line, or an address only, or the string "FSF". If there is no maintainer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 ;; line, the person(s) in the Author field are presumed to be it. The example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 ;; in this file is mildly bogus because the maintainer line is redundant.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 ;; The idea behind these two fields is to be able to write a Lisp function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ;; that does "send mail to the author" without having to mine the name out by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 ;; hand. Please be careful about surrounding the network address with <> if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 ;; there's also a name in the field.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 ;; * Created line --- optional, gives the original creation date of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 ;; file. For historical interest, basically.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 ;; * Version line --- intended to give the reader a clue if they're looking
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 ;; at a different version of the file than the one they're accustomed to. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ;; may be an RCS or SCCS header.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ;; * Adapted-By line --- this is for FSF's internal use. The person named
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;; in this field was the one responsible for installing and adapting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ;; package for the distribution. (This file doesn't have one because the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 ;; author *is* one of the maintainers.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 ;; * Keywords line --- used by the finder code (now under construction)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 ;; for finding Emacs Lisp code related to a topic.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 ;; * X-Bogus-Bureaucratic-Cruft line --- this is a joke and an example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 ;; of a comment header. Headers starting with `X-' should never be used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 ;; for any real purpose; this is the way to safely add random headers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 ;; without invoking the wrath of any program.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 ;; * Commentary line --- enables Lisp code to find the developer's and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 ;; maintainers' explanations of the package internals.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 ;; * Change log line --- optional, exists to terminate the commentary
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 ;; section and start a change-log part, if one exists.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 ;; * Code line --- exists so Lisp can know where commentary and/or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 ;; change-log sections end.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 ;; * Footer line --- marks end-of-file so it can be distinguished from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 ;; an expanded formfeed or the results of truncation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 ;;; Change Log:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 ;; Tue Jul 14 23:44:17 1992 ESR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 ;; * Created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 (require 'picture) ; provides move-to-column-force
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 ;(require 'emacsbug) ; XEmacs, not needed for bytecompilation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 ;;; Variables:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (defvar lm-header-prefix "^;;*[ \t]+\\(@\(#\)\\)?[ \t]*\\([\$]\\)?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 "Prefix that is ignored before the tag.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 For example, you can write the 1st line synopsis string and headers like this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 in your Lisp package:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 ;; @(#) package.el -- package description
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 ;; @(#) $Maintainer: Person Foo Bar $
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 The @(#) construct is used by unix what(1) and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 then $identifier: doc string $ is used by GNU ident(1)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 (defvar lm-comment-column 16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 "Column used for placing formatted output.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 (defvar lm-commentary-header "Commentary\\|Documentation"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 "Regexp which matches start of documentation section.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 (defvar lm-history-header "Change Log\\|History"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 "Regexp which matches the start of code log section.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 ;;; Functions:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 ;; These functions all parse the headers of the current buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 (defsubst lm-get-header-re (header &optional mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 "Returns regexp for matching HEADER.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 If called with optional MODE and with value `section',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 return section regexp instead."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 (cond ((eq mode 'section)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 (concat "^;;;;* " header ":[ \t]*$"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 (concat lm-header-prefix header ":[ \t]*"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 (defsubst lm-get-package-name ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 "Returns package name by looking at the first line."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (if (and (looking-at (concat lm-header-prefix))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 (progn (goto-char (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 (looking-at "\\([^\t ]+\\)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 (buffer-substring (match-beginning 1) (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 (defun lm-section-mark (header &optional after)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 "Return the buffer location of a given section start marker.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 The HEADER is the section mark string to search for.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 If AFTER is non-nil, return the location of the next line."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 (let ((case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 (if (re-search-forward (lm-get-header-re header 'section) nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 (if after (forward-line 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 (defsubst lm-code-mark ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 "Return the buffer location of the `Code' start marker."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 (lm-section-mark "Code"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 (defsubst lm-commentary-mark ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 "Return the buffer location of the `Commentary' start marker."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 (lm-section-mark lm-commentary-header))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 (defsubst lm-history-mark ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 "Return the buffer location of the `History' start marker."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 (lm-section-mark lm-history-header))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 (defun lm-header (header)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 "Return the contents of the header named HEADER."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 (let ((case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 (if (and (re-search-forward (lm-get-header-re header) (lm-code-mark) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 ;; RCS ident likes format "$identifier: data$"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 (looking-at "\\([^$\n]+\\)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 (buffer-substring (match-beginning 1) (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 (defun lm-header-multiline (header)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 "Return the contents of the header named HEADER, with continuation lines.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 The returned value is a list of strings, one per line."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 (let ((res (lm-header header)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 (res
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 (setq res (list res))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 (while (and (looking-at (concat lm-header-prefix "[\t ]+"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 (goto-char (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 (looking-at "\\(.*\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 (setq res (cons (buffer-substring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 res))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 (forward-line 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 res
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 ;; These give us smart access to the header fields and commentary
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 (defun lm-summary (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 "Return the one-line summary of file FILE, or current buffer if FILE is nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 (if (and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 (looking-at lm-header-prefix)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 (progn (goto-char (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 (looking-at "[^ ]+[ \t]+--+[ \t]+\\(.*\\)")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 (buffer-substring (match-beginning 1) (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 (defun lm-crack-address (x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 "Split up an email address into full name and real email address.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 The value is a cons of the form (FULLNAME . ADDRESS)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 (cond ((string-match "\\(.+\\) [(<]\\(\\S-+@\\S-+\\)[>)]" x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 (cons (substring x (match-beginning 1) (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 (substring x (match-beginning 2) (match-end 2))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 ((string-match "\\(\\S-+@\\S-+\\) [(<]\\(.*\\)[>)]" x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 (cons (substring x (match-beginning 2) (match-end 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 (substring x (match-beginning 1) (match-end 1))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 ((string-match "\\S-+@\\S-+" x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 (cons nil x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 (cons x nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 (defun lm-authors (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 "Return the author list of file FILE, or current buffer if FILE is nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 Each element of the list is a cons; the car is the full name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 the cdr is an email address."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 ;; XEmacs change (Is E-MAIL an infodock header? -sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 (let* ((authorlist (lm-header-multiline "author"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 (email-list (lm-header-multiline "E-MAIL"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 (authors authorlist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 (if (null email-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 (mapcar 'lm-crack-address authorlist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 (while (and email-list authors)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 (setcar authors (cons (car authors) (car email-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 (setq email-list (cdr email-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 authors (cdr authors)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 authorlist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 (kill-buffer (current-buffer))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 (defun lm-maintainer (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 "Return the maintainer of file FILE, or current buffer if FILE is nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 The return value has the form (NAME . ADDRESS)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 (let ((maint (lm-header "maintainer")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 (if maint
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 (lm-crack-address maint)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 (car (lm-authors))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 (kill-buffer (current-buffer))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 (defun lm-creation-date (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 "Return the created date given in file FILE, or current buffer if FILE is nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 ;; XEmacs change (Is ORIG-DATE an Infodock header? -sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 (or (lm-header "created")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 (let ((date-and-time (lm-header "ORIG-DATE")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 (if date-and-time
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 (substring date-and-time 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 (string-match " " date-and-time)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 (defun lm-last-modified-date (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 "Return the modify-date given in file FILE, or current buffer if FILE is nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 (if (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 (re-search-forward
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 "\\$[I]d: [^ ]+ [^ ]+ \\([^/]+\\)/\\([^/]+\\)/\\([^ ]+\\) "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 (lm-code-mark) t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 (format "%s %s %s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 (buffer-substring (match-beginning 3) (match-end 3))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 (nth (string-to-int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 (buffer-substring (match-beginning 2) (match-end 2)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 '("" "Jan" "Feb" "Mar" "Apr" "May" "Jun"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 (buffer-substring (match-beginning 1) (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 ;; XEmacs change (Infodock change? -sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 (let ((date-and-time (lm-header "LAST-MOD")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 (if date-and-time
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (substring date-and-time 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 (string-match " " date-and-time)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 (defun lm-version (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 "Return the version listed in file FILE, or current buffer if FILE is nil.
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 428
diff changeset
346 This can be found in an RCS or SCCS header to crack it out of."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 (or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 (lm-header "version")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 (let ((header-max (lm-code-mark)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 ;; Look for an RCS header
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 ((re-search-forward "\\$[I]d: [^ ]+ \\([^ ]+\\) " header-max t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 (buffer-substring (match-beginning 1) (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 ;; Look for an SCCS header
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 ((re-search-forward
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 (concat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 (regexp-quote "@(#)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 (regexp-quote (file-name-nondirectory (buffer-file-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 "\t\\([012345679.]*\\)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 header-max t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 (buffer-substring (match-beginning 1) (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 (t nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 (defun lm-keywords (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 "Return the keywords given in file FILE, or current buffer if FILE is nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 (let ((keywords (lm-header "keywords")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 (and keywords (downcase keywords)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 (defun lm-adapted-by (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 "Return the adapted-by names in file FILE, or current buffer if FILE is nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 This is the name of the person who cleaned up this package for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 distribution."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 (lm-header "adapted-by")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 (defun lm-commentary (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 "Return the commentary in file FILE, or current buffer if FILE is nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 The value is returned as a string. In the text, the commentary starts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 with tag `Commentary' and ends with tag `Change Log' or `History'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (let ((commentary (lm-commentary-mark))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 (change-log (lm-history-mark))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 (code (lm-code-mark))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 ((and commentary change-log)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 (buffer-substring commentary change-log))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 ((and commentary code)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 (buffer-substring commentary code))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 ;; XEmacs change (Infodock headers? -sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 (setq commentary (lm-section-mark "DESCRIPTION" t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 (setq end (lm-section-mark "DESCRIP-END"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (and commentary end (buffer-substring commentary end)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 ;;; Verification and synopses
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 (defun lm-insert-at-column (col &rest strings)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 "Insert list of STRINGS, at column COL."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 (if (> (current-column) col) (insert "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (move-to-column-force col)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 (apply 'insert strings))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (defun lm-verify (&optional file showok &optional verb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 "Check that the current buffer (or FILE if given) is in proper format.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 If FILE is a directory, recurse on its files and generate a report in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 a temporary buffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 (let* ((verb (or verb (interactive-p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 ret
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 (if verb
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 (setq ret "Ok.")) ;init value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 (if (and file (file-directory-p file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (setq
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 ret
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 (switch-to-buffer (get-buffer-create "*lm-verify*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 (mapcar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 #'(lambda (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 (if (string-match ".*\\.el$" f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (let ((status (lm-verify f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 (if status
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 (insert f ":")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (lm-insert-at-column lm-comment-column status "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 (and showok
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 (insert f ":")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 (lm-insert-at-column lm-comment-column "OK\n")))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 (directory-files file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 (setq name (lm-get-package-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 (setq
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 ret
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 ((null name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 "Can't find a package NAME")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 ((not (lm-authors))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 "Author: tag missing.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 ((not (lm-maintainer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 "Maintainer: tag missing.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 ((not (lm-summary))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 "Can't find a one-line 'Summary' description")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 ((not (lm-keywords))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 "Keywords: tag missing.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 ((not (lm-commentary-mark))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 "Can't find a 'Commentary' section marker.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 ((not (lm-history-mark))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 "Can't find a 'History' section marker.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 ((not (lm-code-mark))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 "Can't find a 'Code' section marker")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 ((progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 (not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 (re-search-backward
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 (concat "^;;;[ \t]+" name "[ \t]+ends here[ \t]*$"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 "\\|^;;;[ \t]+ End of file[ \t]+" name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 nil t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 (format "Can't find a footer line for [%s]" name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 ret))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 ))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 (if verb
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 (message ret))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 ret
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 (defun lm-synopsis (&optional file showall)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 "Generate a synopsis listing for the buffer or the given FILE if given.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 If FILE is a directory, recurse on its files and generate a report in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 a temporary buffer. If SHOWALL is non-nil, also generate a line for files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 which do not include a recognizable synopsis."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 (list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 (read-file-name "Synopsis for (file or dir): ")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (if (and file (file-directory-p file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 (switch-to-buffer (get-buffer-create "*lm-verify*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 (mapcar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 (lambda (f) ; XEmacs - dequote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 (if (string-match ".*\\.el$" f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 (let ((syn (lm-synopsis f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 (if syn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 (insert f ":")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 (lm-insert-at-column lm-comment-column syn "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 (and showall
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 (insert f ":")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 (lm-insert-at-column lm-comment-column "NA\n")))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 (directory-files file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 (find-file file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 (lm-summary)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 (kill-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 ))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 (defun lm-report-bug (topic)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 "Report a bug in the package currently being visited to its maintainer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 Prompts for bug subject. Leaves you in a mail buffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 (interactive "sBug Subject: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 (let ((package (lm-get-package-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 (addr (lm-maintainer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 (version (lm-version)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 (mail nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 (if addr
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 (concat (car addr) " <" (cdr addr) ">")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 (or (and (boundp 'report-emacs-bug-beta-address)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 448
diff changeset
564 (declare-boundp report-emacs-bug-beta-address))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 "<xemacs-beta@xemacs.org>"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 topic)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 (insert "\nIn "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 (if version (concat " version " version) "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 "\n\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 (message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 (substitute-command-keys "Type \\[mail-send] to send bug report."))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 (provide 'lisp-mnt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 ;;; lisp-mnt.el ends here