Mercurial > hg > xemacs-beta
annotate lisp/lisp-mnt.el @ 5127:a9c41067dd88 ben-lisp-object
more cleanups, terminology clarification, lots of doc work
-------------------- ChangeLog entries follow: --------------------
man/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* internals/internals.texi (Introduction to Allocation):
* internals/internals.texi (Integers and Characters):
* internals/internals.texi (Allocation from Frob Blocks):
* internals/internals.texi (lrecords):
* internals/internals.texi (Low-level allocation):
Rewrite section on allocation of Lisp objects to reflect the new
reality. Remove references to nonexistent XSETINT and XSETCHAR.
modules/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c (allocate_pgconn):
* postgresql/postgresql.c (allocate_pgresult):
* postgresql/postgresql.h (struct Lisp_PGconn):
* postgresql/postgresql.h (struct Lisp_PGresult):
* ldap/eldap.c (allocate_ldap):
* ldap/eldap.h (struct Lisp_LDAP):
Same changes as in src/ dir. See large log there in ChangeLog,
but basically:
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
../hlo/src/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (old_alloc_sized_lcrecord):
* alloc.c (very_old_free_lcrecord):
* alloc.c (copy_lisp_object):
* alloc.c (zero_sized_lisp_object):
* alloc.c (zero_nonsized_lisp_object):
* alloc.c (lisp_object_storage_size):
* alloc.c (free_normal_lisp_object):
* alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC):
* alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT):
* alloc.c (Fcons):
* alloc.c (noseeum_cons):
* alloc.c (make_float):
* alloc.c (make_bignum):
* alloc.c (make_bignum_bg):
* alloc.c (make_ratio):
* alloc.c (make_ratio_bg):
* alloc.c (make_ratio_rt):
* alloc.c (make_bigfloat):
* alloc.c (make_bigfloat_bf):
* alloc.c (size_vector):
* alloc.c (make_compiled_function):
* alloc.c (Fmake_symbol):
* alloc.c (allocate_extent):
* alloc.c (allocate_event):
* alloc.c (make_key_data):
* alloc.c (make_button_data):
* alloc.c (make_motion_data):
* alloc.c (make_process_data):
* alloc.c (make_timeout_data):
* alloc.c (make_magic_data):
* alloc.c (make_magic_eval_data):
* alloc.c (make_eval_data):
* alloc.c (make_misc_user_data):
* alloc.c (Fmake_marker):
* alloc.c (noseeum_make_marker):
* alloc.c (size_string_direct_data):
* alloc.c (make_uninit_string):
* alloc.c (make_string_nocopy):
* alloc.c (mark_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (sweep_lcrecords_1):
* alloc.c (malloced_storage_size):
* buffer.c (allocate_buffer):
* buffer.c (compute_buffer_usage):
* buffer.c (DEFVAR_BUFFER_LOCAL_1):
* buffer.c (nuke_all_buffer_slots):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.h (struct buffer_text):
* buffer.h (struct buffer):
* bytecode.c:
* bytecode.c (make_compiled_function_args):
* bytecode.c (size_compiled_function_args):
* bytecode.h (struct compiled_function_args):
* casetab.c (allocate_case_table):
* casetab.h (struct Lisp_Case_Table):
* charset.h (struct Lisp_Charset):
* chartab.c (fill_char_table):
* chartab.c (Fmake_char_table):
* chartab.c (make_char_table_entry):
* chartab.c (copy_char_table_entry):
* chartab.c (Fcopy_char_table):
* chartab.c (put_char_table):
* chartab.h (struct Lisp_Char_Table_Entry):
* chartab.h (struct Lisp_Char_Table):
* console-gtk-impl.h (struct gtk_device):
* console-gtk-impl.h (struct gtk_frame):
* console-impl.h (struct console):
* console-msw-impl.h (struct Lisp_Devmode):
* console-msw-impl.h (struct mswindows_device):
* console-msw-impl.h (struct msprinter_device):
* console-msw-impl.h (struct mswindows_frame):
* console-msw-impl.h (struct mswindows_dialog_id):
* console-stream-impl.h (struct stream_console):
* console-stream.c (stream_init_console):
* console-tty-impl.h (struct tty_console):
* console-tty-impl.h (struct tty_device):
* console-tty.c (allocate_tty_console_struct):
* console-x-impl.h (struct x_device):
* console-x-impl.h (struct x_frame):
* console.c (allocate_console):
* console.c (nuke_all_console_slots):
* console.c (DEFVAR_CONSOLE_LOCAL_1):
* console.c (common_init_complex_vars_of_console):
* data.c (make_weak_list):
* data.c (make_weak_box):
* data.c (make_ephemeron):
* database.c:
* database.c (struct Lisp_Database):
* database.c (allocate_database):
* database.c (finalize_database):
* device-gtk.c (allocate_gtk_device_struct):
* device-impl.h (struct device):
* device-msw.c:
* device-msw.c (mswindows_init_device):
* device-msw.c (msprinter_init_device):
* device-msw.c (finalize_devmode):
* device-msw.c (allocate_devmode):
* device-tty.c (allocate_tty_device_struct):
* device-x.c (allocate_x_device_struct):
* device.c:
* device.c (nuke_all_device_slots):
* device.c (allocate_device):
* dialog-msw.c (handle_question_dialog_box):
* elhash.c:
* elhash.c (struct Lisp_Hash_Table):
* elhash.c (finalize_hash_table):
* elhash.c (make_general_lisp_hash_table):
* elhash.c (Fcopy_hash_table):
* elhash.h (htentry):
* emacs.c (main_1):
* eval.c:
* eval.c (size_multiple_value):
* event-stream.c (finalize_command_builder):
* event-stream.c (allocate_command_builder):
* event-stream.c (free_command_builder):
* event-stream.c (event_stream_generate_wakeup):
* event-stream.c (event_stream_resignal_wakeup):
* event-stream.c (event_stream_disable_wakeup):
* event-stream.c (event_stream_wakeup_pending_p):
* events.h (struct Lisp_Timeout):
* events.h (struct command_builder):
* extents-impl.h:
* extents-impl.h (struct extent_auxiliary):
* extents-impl.h (struct extent_info):
* extents-impl.h (set_extent_no_chase_aux_field):
* extents-impl.h (set_extent_no_chase_normal_field):
* extents.c:
* extents.c (gap_array_marker):
* extents.c (gap_array):
* extents.c (extent_list_marker):
* extents.c (extent_list):
* extents.c (stack_of_extents):
* extents.c (gap_array_make_marker):
* extents.c (extent_list_make_marker):
* extents.c (allocate_extent_list):
* extents.c (SLOT):
* extents.c (mark_extent_auxiliary):
* extents.c (allocate_extent_auxiliary):
* extents.c (attach_extent_auxiliary):
* extents.c (size_gap_array):
* extents.c (finalize_extent_info):
* extents.c (allocate_extent_info):
* extents.c (uninit_buffer_extents):
* extents.c (allocate_soe):
* extents.c (copy_extent):
* extents.c (vars_of_extents):
* extents.h:
* faces.c (allocate_face):
* faces.h (struct Lisp_Face):
* faces.h (struct face_cachel):
* file-coding.c:
* file-coding.c (finalize_coding_system):
* file-coding.c (sizeof_coding_system):
* file-coding.c (Fcopy_coding_system):
* file-coding.h (struct Lisp_Coding_System):
* file-coding.h (MARKED_SLOT):
* fns.c (size_bit_vector):
* font-mgr.c:
* font-mgr.c (finalize_fc_pattern):
* font-mgr.c (print_fc_pattern):
* font-mgr.c (Ffc_pattern_p):
* font-mgr.c (Ffc_pattern_create):
* font-mgr.c (Ffc_name_parse):
* font-mgr.c (Ffc_name_unparse):
* font-mgr.c (Ffc_pattern_duplicate):
* font-mgr.c (Ffc_pattern_add):
* font-mgr.c (Ffc_pattern_del):
* font-mgr.c (Ffc_pattern_get):
* font-mgr.c (fc_config_create_using):
* font-mgr.c (fc_strlist_to_lisp_using):
* font-mgr.c (fontset_to_list):
* font-mgr.c (Ffc_config_p):
* font-mgr.c (Ffc_config_up_to_date):
* font-mgr.c (Ffc_config_build_fonts):
* font-mgr.c (Ffc_config_get_cache):
* font-mgr.c (Ffc_config_get_fonts):
* font-mgr.c (Ffc_config_set_current):
* font-mgr.c (Ffc_config_get_blanks):
* font-mgr.c (Ffc_config_get_rescan_interval):
* font-mgr.c (Ffc_config_set_rescan_interval):
* font-mgr.c (Ffc_config_app_font_add_file):
* font-mgr.c (Ffc_config_app_font_add_dir):
* font-mgr.c (Ffc_config_app_font_clear):
* font-mgr.c (size):
* font-mgr.c (Ffc_config_substitute):
* font-mgr.c (Ffc_font_render_prepare):
* font-mgr.c (Ffc_font_match):
* font-mgr.c (Ffc_font_sort):
* font-mgr.c (finalize_fc_config):
* font-mgr.c (print_fc_config):
* font-mgr.h:
* font-mgr.h (struct fc_pattern):
* font-mgr.h (XFC_PATTERN):
* font-mgr.h (struct fc_config):
* font-mgr.h (XFC_CONFIG):
* frame-gtk.c (allocate_gtk_frame_struct):
* frame-impl.h (struct frame):
* frame-msw.c (mswindows_init_frame_1):
* frame-x.c (allocate_x_frame_struct):
* frame.c (nuke_all_frame_slots):
* frame.c (allocate_frame_core):
* gc.c:
* gc.c (GC_CHECK_NOT_FREE):
* glyphs.c (finalize_image_instance):
* glyphs.c (allocate_image_instance):
* glyphs.c (Fcolorize_image_instance):
* glyphs.c (allocate_glyph):
* glyphs.c (unmap_subwindow_instance_cache_mapper):
* glyphs.c (register_ignored_expose):
* glyphs.h (struct Lisp_Image_Instance):
* glyphs.h (struct Lisp_Glyph):
* glyphs.h (struct glyph_cachel):
* glyphs.h (struct expose_ignore):
* gui.c (allocate_gui_item):
* gui.h (struct Lisp_Gui_Item):
* keymap.c (struct Lisp_Keymap):
* keymap.c (make_keymap):
* lisp.h:
* lisp.h (struct Lisp_String_Direct_Data):
* lisp.h (struct Lisp_String_Indirect_Data):
* lisp.h (struct Lisp_Vector):
* lisp.h (struct Lisp_Bit_Vector):
* lisp.h (DECLARE_INLINE_LISP_BIT_VECTOR):
* lisp.h (struct weak_box):
* lisp.h (struct ephemeron):
* lisp.h (struct weak_list):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER):
* lrecord.h (struct lcrecord_list):
* lstream.c (finalize_lstream):
* lstream.c (sizeof_lstream):
* lstream.c (Lstream_new):
* lstream.c (Lstream_delete):
* lstream.h (struct lstream):
* marker.c:
* marker.c (finalize_marker):
* marker.c (compute_buffer_marker_usage):
* mule-charset.c:
* mule-charset.c (make_charset):
* mule-charset.c (compute_charset_usage):
* objects-impl.h (struct Lisp_Color_Instance):
* objects-impl.h (struct Lisp_Font_Instance):
* objects-tty-impl.h (struct tty_color_instance_data):
* objects-tty-impl.h (struct tty_font_instance_data):
* objects-tty.c (tty_initialize_color_instance):
* objects-tty.c (tty_initialize_font_instance):
* objects.c (finalize_color_instance):
* objects.c (Fmake_color_instance):
* objects.c (finalize_font_instance):
* objects.c (Fmake_font_instance):
* objects.c (reinit_vars_of_objects):
* opaque.c:
* opaque.c (sizeof_opaque):
* opaque.c (make_opaque_ptr):
* opaque.c (free_opaque_ptr):
* opaque.h:
* opaque.h (Lisp_Opaque):
* opaque.h (Lisp_Opaque_Ptr):
* print.c (printing_unreadable_lcrecord):
* print.c (external_object_printer):
* print.c (debug_p4):
* process.c (finalize_process):
* process.c (make_process_internal):
* procimpl.h (struct Lisp_Process):
* rangetab.c (Fmake_range_table):
* rangetab.c (Fcopy_range_table):
* rangetab.h (struct Lisp_Range_Table):
* scrollbar.c:
* scrollbar.c (create_scrollbar_instance):
* scrollbar.c (compute_scrollbar_instance_usage):
* scrollbar.h (struct scrollbar_instance):
* specifier.c (finalize_specifier):
* specifier.c (sizeof_specifier):
* specifier.c (set_specifier_caching):
* specifier.h (struct Lisp_Specifier):
* specifier.h (struct specifier_caching):
* symeval.h:
* symeval.h (SYMBOL_VALUE_MAGIC_P):
* symeval.h (DEFVAR_SYMVAL_FWD):
* symsinit.h:
* syntax.c (init_buffer_syntax_cache):
* syntax.h (struct syntax_cache):
* toolbar.c:
* toolbar.c (allocate_toolbar_button):
* toolbar.c (update_toolbar_button):
* toolbar.h (struct toolbar_button):
* tooltalk.c (struct Lisp_Tooltalk_Message):
* tooltalk.c (make_tooltalk_message):
* tooltalk.c (struct Lisp_Tooltalk_Pattern):
* tooltalk.c (make_tooltalk_pattern):
* ui-gtk.c:
* ui-gtk.c (allocate_ffi_data):
* ui-gtk.c (emacs_gtk_object_finalizer):
* ui-gtk.c (allocate_emacs_gtk_object_data):
* ui-gtk.c (allocate_emacs_gtk_boxed_data):
* ui-gtk.h:
* window-impl.h (struct window):
* window-impl.h (struct window_mirror):
* window.c (finalize_window):
* window.c (allocate_window):
* window.c (new_window_mirror):
* window.c (mark_window_as_deleted):
* window.c (make_dummy_parent):
* window.c (compute_window_mirror_usage):
* window.c (compute_window_usage):
Overall point of this change and previous ones in this repository:
(1) Introduce new, clearer terminology: everything other than int
or char is a "record" object, which comes in two types: "normal
objects" and "frob-block objects". Fix up all places that
referred to frob-block objects as "simple", "basic", etc.
(2) Provide an advertised interface for doing operations on Lisp
objects, including creating new types, that is clean and
consistent in its naming, uses the above-referenced terms and
avoids referencing "lrecords", "old lcrecords", etc., which should
hide under the surface.
(3) Make the size_in_bytes and finalizer methods take a
Lisp_Object rather than a void * for consistency with other methods.
(4) Separate finalizer method into finalizer and disksaver, so
that normal finalize methods don't have to worry about disksaving.
Other specifics:
(1) Renaming:
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
implementation->basic_p -> implementation->frob_block_p
ALLOCATE_FIXED_TYPE_AND_SET_IMPL -> ALLOC_FROB_BLOCK_LISP_OBJECT
*FCCONFIG*, wrap_fcconfig -> *FC_CONFIG*, wrap_fc_config
*FCPATTERN*, wrap_fcpattern -> *FC_PATTERN*, wrap_fc_pattern
(the last two changes make the naming of these macros consistent
with the naming of all other macros, since the objects are named
fc-config and fc-pattern with a hyphen)
(2) Lots of documentation fixes in lrecord.h.
(3) Eliminate macros for copying, freeing, zeroing objects, getting
their storage size. Instead, new functions:
zero_sized_lisp_object()
zero_nonsized_lisp_object()
lisp_object_storage_size()
free_normal_lisp_object()
(copy_lisp_object() already exists)
LISP_OBJECT_FROB_BLOCK_P() (actually a macro)
Eliminated:
free_lrecord()
zero_lrecord()
copy_lrecord()
copy_sized_lrecord()
old_copy_lcrecord()
old_copy_sized_lcrecord()
old_zero_lcrecord()
old_zero_sized_lcrecord()
LISP_OBJECT_STORAGE_SIZE()
COPY_SIZED_LISP_OBJECT()
COPY_SIZED_LCRECORD()
COPY_LISP_OBJECT()
ZERO_LISP_OBJECT()
FREE_LISP_OBJECT()
(4) Catch the remaining places where lrecord stuff was used directly
and use the advertised interface, e.g. alloc_sized_lrecord() ->
ALLOC_SIZED_LISP_OBJECT().
(5) Make certain statically-declared pseudo-objects
(buffer_local_flags, console_local_flags) have their lheader
initialized correctly, so things like copy_lisp_object() can work
on them. Make extent_auxiliary_defaults a proper heap object
Vextent_auxiliary_defaults, and make extent auxiliaries dumpable
so that this object can be dumped. allocate_extent_auxiliary()
now just creates the object, and attach_extent_auxiliary()
creates an extent auxiliary and attaches to an extent, like the
old allocate_extent_auxiliary().
(6) Create EXTENT_AUXILIARY_SLOTS macro, similar to the foo-slots.h
files but in a macro instead of a file. The purpose is to avoid
duplication when iterating over all the slots in an extent auxiliary.
Use it.
(7) In lstream.c, don't zero out object after allocation because
allocation routines take care of this.
(8) In marker.c, fix a mistake in computing marker overhead.
(9) In print.c, clean up printing_unreadable_lcrecord(),
external_object_printer() to avoid lots of ifdef NEW_GC's.
(10) Separate toolbar-button allocation into a separate
allocate_toolbar_button() function for use in the example code
in lrecord.h.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Fri, 05 Mar 2010 04:08:17 -0600 |
parents | 199ecf2503c8 |
children | 308d34e9f07d |
rev | line source |
---|---|
428 | 1 ;;; lisp-mnt.el --- minor mode for Emacs Lisp maintainers |
2 | |
3 ;; Copyright (C) 1992, 1994 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | |
6 ;; Maintainer: Eric S. Raymond <esr@snark.thyrsus.com> | |
7 ;; Created: 14 Jul 1992 | |
8 ;; Keywords: docs, maint | |
9 ;; X-Modified-by: Bob Weiner <weiner@beopen.com>, 4/14/95, to support | |
10 ;; InfoDock headers. | |
11 ;; X-Bogus-Bureaucratic-Cruft: Gruad will get you if you don't watch out! | |
12 | |
13 ;; This file is part of XEmacs. | |
14 | |
15 ;; XEmacs is free software; you can redistribute it and/or modify it | |
16 ;; under the terms of the GNU General Public License as published by | |
17 ;; the Free Software Foundation; either version 2, or (at your option) | |
18 ;; any later version. | |
19 | |
20 ;; XEmacs is distributed in the hope that it will be useful, but | |
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
23 ;; General Public License for more details. | |
24 | |
25 ;; You should have received a copy of the GNU General Public License | |
26 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
4630
64e5e393f15d
Update FSF address in permissions notice.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
776
diff
changeset
|
27 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
64e5e393f15d
Update FSF address in permissions notice.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
776
diff
changeset
|
28 ;; Boston, MA 02110-1301, USA. |
428 | 29 |
30 ;;; Synched up with: FSF 20.2. | |
31 | |
32 ;;; Commentary: | |
33 | |
34 ;; This minor mode adds some services to Emacs-Lisp editing mode. | |
35 ;; | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
36 ;; It provides knowledge about the header conventions for library packages. |
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
37 ;; `lm-synopsis' supports generating synopses from a library directory. |
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
38 ;; `lm-verify' can be used to check for missing headers in library files. |
428 | 39 ;; |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
40 ;; `lm-report-bug' automatically addresses bug mail to a package's |
428 | 41 ;; maintainer or author. |
42 | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
43 ;; This file can be loaded by your lisp-mode-hook with `(require 'lisp-mnt)'. |
428 | 44 |
45 ;; This file is an example of the header conventions. Note the following | |
46 ;; features: | |
47 ;; | |
48 ;; * Header line --- makes it possible to extract a one-line summary of | |
49 ;; the package's uses automatically for use in library synopses, KWIC | |
50 ;; indexes and the like. | |
51 ;; | |
52 ;; Format is three semicolons, followed by the filename, followed by | |
53 ;; three dashes, followed by the summary. All fields space-separated. | |
54 ;; | |
55 ;; * Author line --- contains the name and net address of at least | |
56 ;; the principal author. | |
57 ;; | |
58 ;; If there are multiple authors, they should be listed on continuation | |
59 ;; lines led by ;;<TAB><TAB> (or multiple blanks), like this: | |
60 ;; | |
61 ;; ;; Author: Ashwin Ram <Ram-Ashwin@cs.yale.edu> | |
62 ;; ;; Dave Sill <de5@ornl.gov> | |
63 ;; ;; David Lawrence <tale@pawl.rpi.edu> | |
64 ;; ;; Noah Friedman <friedman@ai.mit.edu> | |
65 ;; ;; Joe Wells <jbw@maverick.uswest.com> | |
66 ;; ;; Dave Brennan <brennan@hal.com> | |
67 ;; ;; Eric Raymond <esr@snark.thyrsus.com> | |
68 ;; | |
69 ;; This field may have some special values; notably "FSF", meaning | |
70 ;; "Free Software Foundation". | |
71 ;; | |
72 ;; * Maintainer line --- should be a single name/address as in the Author | |
73 ;; line, or an address only, or the string "FSF". If there is no maintainer | |
74 ;; line, the person(s) in the Author field are presumed to be it. The example | |
75 ;; in this file is mildly bogus because the maintainer line is redundant. | |
76 ;; The idea behind these two fields is to be able to write a Lisp function | |
77 ;; that does "send mail to the author" without having to mine the name out by | |
78 ;; hand. Please be careful about surrounding the network address with <> if | |
79 ;; there's also a name in the field. | |
80 ;; | |
81 ;; * Created line --- optional, gives the original creation date of the | |
82 ;; file. For historical interest, basically. | |
83 ;; | |
84 ;; * Version line --- intended to give the reader a clue if they're looking | |
85 ;; at a different version of the file than the one they're accustomed to. This | |
86 ;; may be an RCS or SCCS header. | |
87 ;; | |
88 ;; * Adapted-By line --- this is for FSF's internal use. The person named | |
89 ;; in this field was the one responsible for installing and adapting the | |
90 ;; package for the distribution. (This file doesn't have one because the | |
91 ;; author *is* one of the maintainers.) | |
92 ;; | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
93 ;; * Keywords line --- used by the finder code (now direly bit-rotted) |
428 | 94 ;; for finding Emacs Lisp code related to a topic. |
95 ;; | |
96 ;; * X-Bogus-Bureaucratic-Cruft line --- this is a joke and an example | |
97 ;; of a comment header. Headers starting with `X-' should never be used | |
98 ;; for any real purpose; this is the way to safely add random headers | |
99 ;; without invoking the wrath of any program. | |
100 ;; | |
101 ;; * Commentary line --- enables Lisp code to find the developer's and | |
102 ;; maintainers' explanations of the package internals. | |
103 ;; | |
104 ;; * Change log line --- optional, exists to terminate the commentary | |
105 ;; section and start a change-log part, if one exists. | |
106 ;; | |
107 ;; * Code line --- exists so Lisp can know where commentary and/or | |
108 ;; change-log sections end. | |
109 ;; | |
110 ;; * Footer line --- marks end-of-file so it can be distinguished from | |
111 ;; an expanded formfeed or the results of truncation. | |
112 | |
113 ;;; Change Log: | |
114 | |
115 ;; Tue Jul 14 23:44:17 1992 ESR | |
116 ;; * Created. | |
117 | |
118 ;;; Code: | |
119 | |
120 (require 'picture) ; provides move-to-column-force | |
121 | |
122 ;;; Variables: | |
123 | |
124 (defvar lm-header-prefix "^;;*[ \t]+\\(@\(#\)\\)?[ \t]*\\([\$]\\)?" | |
125 "Prefix that is ignored before the tag. | |
126 For example, you can write the 1st line synopsis string and headers like this | |
127 in your Lisp package: | |
128 | |
129 ;; @(#) package.el -- package description | |
130 ;; | |
131 ;; @(#) $Maintainer: Person Foo Bar $ | |
132 | |
133 The @(#) construct is used by unix what(1) and | |
134 then $identifier: doc string $ is used by GNU ident(1)") | |
135 | |
136 (defvar lm-comment-column 16 | |
137 "Column used for placing formatted output.") | |
138 | |
139 (defvar lm-commentary-header "Commentary\\|Documentation" | |
140 "Regexp which matches start of documentation section.") | |
141 | |
142 (defvar lm-history-header "Change Log\\|History" | |
143 "Regexp which matches the start of code log section.") | |
144 | |
145 ;;; Functions: | |
146 | |
147 ;; These functions all parse the headers of the current buffer | |
148 | |
149 (defsubst lm-get-header-re (header &optional mode) | |
150 "Returns regexp for matching HEADER. | |
151 If called with optional MODE and with value `section', | |
152 return section regexp instead." | |
153 (cond ((eq mode 'section) | |
154 (concat "^;;;;* " header ":[ \t]*$")) | |
155 (t | |
156 (concat lm-header-prefix header ":[ \t]*")))) | |
157 | |
158 (defsubst lm-get-package-name () | |
159 "Returns package name by looking at the first line." | |
160 (save-excursion | |
161 (goto-char (point-min)) | |
162 (if (and (looking-at (concat lm-header-prefix)) | |
163 (progn (goto-char (match-end 0)) | |
164 (looking-at "\\([^\t ]+\\)") | |
165 (match-end 1))) | |
166 (buffer-substring (match-beginning 1) (match-end 1)) | |
167 ))) | |
168 | |
169 (defun lm-section-mark (header &optional after) | |
170 "Return the buffer location of a given section start marker. | |
171 The HEADER is the section mark string to search for. | |
172 If AFTER is non-nil, return the location of the next line." | |
173 (save-excursion | |
174 (let ((case-fold-search t)) | |
175 (goto-char (point-min)) | |
176 (if (re-search-forward (lm-get-header-re header 'section) nil t) | |
177 (progn | |
178 (beginning-of-line) | |
179 (if after (forward-line 1)) | |
180 (point)) | |
181 nil)))) | |
182 | |
183 (defsubst lm-code-mark () | |
184 "Return the buffer location of the `Code' start marker." | |
185 (lm-section-mark "Code")) | |
186 | |
187 (defsubst lm-commentary-mark () | |
188 "Return the buffer location of the `Commentary' start marker." | |
189 (lm-section-mark lm-commentary-header)) | |
190 | |
191 (defsubst lm-history-mark () | |
192 "Return the buffer location of the `History' start marker." | |
193 (lm-section-mark lm-history-header)) | |
194 | |
195 (defun lm-header (header) | |
196 "Return the contents of the header named HEADER." | |
197 (goto-char (point-min)) | |
198 (let ((case-fold-search t)) | |
199 (if (and (re-search-forward (lm-get-header-re header) (lm-code-mark) t) | |
200 ;; RCS ident likes format "$identifier: data$" | |
201 (looking-at "\\([^$\n]+\\)") | |
202 (match-end 1)) | |
203 (buffer-substring (match-beginning 1) (match-end 1)) | |
204 nil))) | |
205 | |
206 (defun lm-header-multiline (header) | |
207 "Return the contents of the header named HEADER, with continuation lines. | |
208 The returned value is a list of strings, one per line." | |
209 (save-excursion | |
210 (goto-char (point-min)) | |
211 (let ((res (lm-header header))) | |
212 (cond | |
213 (res | |
214 (setq res (list res)) | |
215 (forward-line 1) | |
216 | |
217 (while (and (looking-at (concat lm-header-prefix "[\t ]+")) | |
218 (progn | |
219 (goto-char (match-end 0)) | |
220 (looking-at "\\(.*\\)")) | |
221 (match-end 1)) | |
222 (setq res (cons (buffer-substring | |
223 (match-beginning 1) | |
224 (match-end 1)) | |
225 res)) | |
226 (forward-line 1)) | |
227 )) | |
228 res | |
229 ))) | |
230 | |
231 ;; These give us smart access to the header fields and commentary | |
232 | |
233 (defun lm-summary (&optional file) | |
234 "Return the one-line summary of file FILE, or current buffer if FILE is nil." | |
235 (save-excursion | |
236 (if file | |
237 (find-file file)) | |
238 (goto-char (point-min)) | |
239 (prog1 | |
240 (if (and | |
241 (looking-at lm-header-prefix) | |
242 (progn (goto-char (match-end 0)) | |
243 (looking-at "[^ ]+[ \t]+--+[ \t]+\\(.*\\)"))) | |
244 (buffer-substring (match-beginning 1) (match-end 1))) | |
245 (if file | |
246 (kill-buffer (current-buffer))) | |
247 ))) | |
248 | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
249 ;; #### This should be replaced by a call into mail-lib. |
428 | 250 (defun lm-crack-address (x) |
251 "Split up an email address into full name and real email address. | |
252 The value is a cons of the form (FULLNAME . ADDRESS)." | |
253 (cond ((string-match "\\(.+\\) [(<]\\(\\S-+@\\S-+\\)[>)]" x) | |
254 (cons (substring x (match-beginning 1) (match-end 1)) | |
255 (substring x (match-beginning 2) (match-end 2)))) | |
256 ((string-match "\\(\\S-+@\\S-+\\) [(<]\\(.*\\)[>)]" x) | |
257 (cons (substring x (match-beginning 2) (match-end 2)) | |
258 (substring x (match-beginning 1) (match-end 1)))) | |
259 ((string-match "\\S-+@\\S-+" x) | |
260 (cons nil x)) | |
261 (t | |
262 (cons x nil)))) | |
263 | |
264 (defun lm-authors (&optional file) | |
265 "Return the author list of file FILE, or current buffer if FILE is nil. | |
266 Each element of the list is a cons; the car is the full name, | |
267 the cdr is an email address." | |
268 (save-excursion | |
269 (if file | |
270 (find-file file)) | |
271 ;; XEmacs change (Is E-MAIL an infodock header? -sb) | |
272 (let* ((authorlist (lm-header-multiline "author")) | |
273 (email-list (lm-header-multiline "E-MAIL")) | |
274 (authors authorlist)) | |
275 (prog1 | |
276 (if (null email-list) | |
277 (mapcar 'lm-crack-address authorlist) | |
278 (while (and email-list authors) | |
279 (setcar authors (cons (car authors) (car email-list))) | |
280 (setq email-list (cdr email-list) | |
281 authors (cdr authors))) | |
282 authorlist) | |
283 (if file | |
284 (kill-buffer (current-buffer)))) | |
285 ))) | |
286 | |
287 (defun lm-maintainer (&optional file) | |
288 "Return the maintainer of file FILE, or current buffer if FILE is nil. | |
289 The return value has the form (NAME . ADDRESS)." | |
290 (save-excursion | |
291 (if file | |
292 (find-file file)) | |
293 (prog1 | |
294 (let ((maint (lm-header "maintainer"))) | |
295 (if maint | |
296 (lm-crack-address maint) | |
297 (car (lm-authors)))) | |
298 (if file | |
299 (kill-buffer (current-buffer)))))) | |
300 | |
301 (defun lm-creation-date (&optional file) | |
302 "Return the created date given in file FILE, or current buffer if FILE is nil." | |
303 (save-excursion | |
304 (if file | |
305 (find-file file)) | |
306 (prog1 | |
307 ;; XEmacs change (Is ORIG-DATE an Infodock header? -sb) | |
308 (or (lm-header "created") | |
309 (let ((date-and-time (lm-header "ORIG-DATE"))) | |
310 (if date-and-time | |
311 (substring date-and-time 0 | |
312 (string-match " " date-and-time))))) | |
313 (if file | |
314 (kill-buffer (current-buffer))) | |
315 ))) | |
316 | |
317 (defun lm-last-modified-date (&optional file) | |
318 "Return the modify-date given in file FILE, or current buffer if FILE is nil." | |
319 (save-excursion | |
320 (if file | |
321 (find-file file)) | |
322 (prog1 | |
323 (if (progn | |
324 (goto-char (point-min)) | |
325 (re-search-forward | |
326 "\\$[I]d: [^ ]+ [^ ]+ \\([^/]+\\)/\\([^/]+\\)/\\([^ ]+\\) " | |
327 (lm-code-mark) t)) | |
328 (format "%s %s %s" | |
329 (buffer-substring (match-beginning 3) (match-end 3)) | |
330 (nth (string-to-int | |
331 (buffer-substring (match-beginning 2) (match-end 2))) | |
332 '("" "Jan" "Feb" "Mar" "Apr" "May" "Jun" | |
333 "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")) | |
334 (buffer-substring (match-beginning 1) (match-end 1))) | |
335 ;; XEmacs change (Infodock change? -sb) | |
336 (let ((date-and-time (lm-header "LAST-MOD"))) | |
337 (if date-and-time | |
338 (substring date-and-time 0 | |
339 (string-match " " date-and-time))))) | |
340 (if file | |
341 (kill-buffer (current-buffer))) | |
342 ))) | |
343 | |
344 (defun lm-version (&optional file) | |
345 "Return the version listed in file FILE, or current buffer if FILE is nil. | |
448 | 346 This can be found in an RCS or SCCS header to crack it out of." |
428 | 347 (save-excursion |
348 (if file | |
349 (find-file file)) | |
350 (prog1 | |
351 (or | |
352 (lm-header "version") | |
353 (let ((header-max (lm-code-mark))) | |
354 (goto-char (point-min)) | |
355 (cond | |
356 ;; Look for an RCS header | |
357 ((re-search-forward "\\$[I]d: [^ ]+ \\([^ ]+\\) " header-max t) | |
358 (buffer-substring (match-beginning 1) (match-end 1))) | |
359 | |
360 ;; Look for an SCCS header | |
361 ((re-search-forward | |
362 (concat | |
363 (regexp-quote "@(#)") | |
364 (regexp-quote (file-name-nondirectory (buffer-file-name))) | |
365 "\t\\([012345679.]*\\)") | |
366 header-max t) | |
367 (buffer-substring (match-beginning 1) (match-end 1))) | |
368 | |
369 (t nil)))) | |
370 (if file | |
371 (kill-buffer (current-buffer))) | |
372 ))) | |
373 | |
374 (defun lm-keywords (&optional file) | |
375 "Return the keywords given in file FILE, or current buffer if FILE is nil." | |
376 (save-excursion | |
377 (if file | |
378 (find-file file)) | |
379 (prog1 | |
380 (let ((keywords (lm-header "keywords"))) | |
381 (and keywords (downcase keywords))) | |
382 (if file | |
383 (kill-buffer (current-buffer))) | |
384 ))) | |
385 | |
386 (defun lm-adapted-by (&optional file) | |
387 "Return the adapted-by names in file FILE, or current buffer if FILE is nil. | |
388 This is the name of the person who cleaned up this package for | |
389 distribution." | |
390 (save-excursion | |
391 (if file | |
392 (find-file file)) | |
393 (prog1 | |
394 (lm-header "adapted-by") | |
395 (if file | |
396 (kill-buffer (current-buffer))) | |
397 ))) | |
398 | |
399 (defun lm-commentary (&optional file) | |
400 "Return the commentary in file FILE, or current buffer if FILE is nil. | |
401 The value is returned as a string. In the text, the commentary starts | |
402 with tag `Commentary' and ends with tag `Change Log' or `History'." | |
403 (save-excursion | |
404 (if file | |
405 (find-file file)) | |
406 (prog1 | |
407 (let ((commentary (lm-commentary-mark)) | |
408 (change-log (lm-history-mark)) | |
409 (code (lm-code-mark)) | |
410 end) | |
411 (cond | |
412 ((and commentary change-log) | |
413 (buffer-substring commentary change-log)) | |
414 ((and commentary code) | |
415 (buffer-substring commentary code)) | |
416 (t | |
417 ;; XEmacs change (Infodock headers? -sb) | |
418 (setq commentary (lm-section-mark "DESCRIPTION" t)) | |
419 (setq end (lm-section-mark "DESCRIP-END")) | |
420 (and commentary end (buffer-substring commentary end))))) | |
421 (if file | |
422 (kill-buffer (current-buffer))) | |
423 ))) | |
424 | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
425 ;;; Utilities |
428 | 426 |
427 (defun lm-insert-at-column (col &rest strings) | |
428 "Insert list of STRINGS, at column COL." | |
429 (if (> (current-column) col) (insert "\n")) | |
430 (move-to-column-force col) | |
431 (apply 'insert strings)) | |
432 | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
433 ;;; Entry points: verification, synopses, and bug reporting |
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
434 |
428 | 435 (defun lm-verify (&optional file showok &optional verb) |
436 "Check that the current buffer (or FILE if given) is in proper format. | |
437 If FILE is a directory, recurse on its files and generate a report in | |
438 a temporary buffer." | |
439 (interactive) | |
440 (let* ((verb (or verb (interactive-p))) | |
441 ret | |
442 name | |
443 ) | |
444 (if verb | |
445 (setq ret "Ok.")) ;init value | |
446 | |
447 (if (and file (file-directory-p file)) | |
448 (setq | |
449 ret | |
450 (progn | |
451 (switch-to-buffer (get-buffer-create "*lm-verify*")) | |
452 (erase-buffer) | |
453 (mapcar | |
454 #'(lambda (f) | |
455 (if (string-match ".*\\.el$" f) | |
456 (let ((status (lm-verify f))) | |
457 (if status | |
458 (progn | |
459 (insert f ":") | |
460 (lm-insert-at-column lm-comment-column status "\n")) | |
461 (and showok | |
462 (progn | |
463 (insert f ":") | |
464 (lm-insert-at-column lm-comment-column "OK\n"))))))) | |
465 (directory-files file)) | |
466 )) | |
467 (save-excursion | |
468 (if file | |
469 (find-file file)) | |
470 (setq name (lm-get-package-name)) | |
471 | |
472 (setq | |
473 ret | |
474 (prog1 | |
475 (cond | |
476 ((null name) | |
477 "Can't find a package NAME") | |
478 | |
479 ((not (lm-authors)) | |
480 "Author: tag missing.") | |
481 | |
482 ((not (lm-maintainer)) | |
483 "Maintainer: tag missing.") | |
484 | |
485 ((not (lm-summary)) | |
486 "Can't find a one-line 'Summary' description") | |
487 | |
488 ((not (lm-keywords)) | |
489 "Keywords: tag missing.") | |
490 | |
491 ((not (lm-commentary-mark)) | |
492 "Can't find a 'Commentary' section marker.") | |
493 | |
494 ((not (lm-history-mark)) | |
495 "Can't find a 'History' section marker.") | |
496 | |
497 ((not (lm-code-mark)) | |
498 "Can't find a 'Code' section marker") | |
499 | |
500 ((progn | |
501 (goto-char (point-max)) | |
502 (not | |
503 (re-search-backward | |
504 (concat "^;;;[ \t]+" name "[ \t]+ends here[ \t]*$" | |
505 "\\|^;;;[ \t]+ End of file[ \t]+" name) | |
506 nil t | |
507 ))) | |
508 (format "Can't find a footer line for [%s]" name)) | |
509 (t | |
510 ret)) | |
511 (if file | |
512 (kill-buffer (current-buffer))) | |
513 )))) | |
514 (if verb | |
515 (message ret)) | |
516 ret | |
517 )) | |
518 | |
519 (defun lm-synopsis (&optional file showall) | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
520 "Generate a synopsis listing for FILE, defaulting to the visited file. |
428 | 521 If FILE is a directory, recurse on its files and generate a report in |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
522 a temporary buffer. If optional SHOWALL is non-nil, also generate a line |
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
523 for files which do not include a recognizable synopsis. Interactively, |
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
524 to specify the current directory, remove the trailing slash from the default |
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
525 string. Interactively, SHOWALL is taken from the prefix argument." |
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
526 (interactive "FSynopsis for (file or dir): \nP") |
428 | 527 |
528 (if (and file (file-directory-p file)) | |
529 (progn | |
530 (switch-to-buffer (get-buffer-create "*lm-verify*")) | |
531 (erase-buffer) | |
532 (mapcar | |
533 (lambda (f) ; XEmacs - dequote | |
534 (if (string-match ".*\\.el$" f) | |
535 (let ((syn (lm-synopsis f))) | |
536 (if syn | |
537 (progn | |
538 (insert f ":") | |
539 (lm-insert-at-column lm-comment-column syn "\n")) | |
540 (and showall | |
541 (progn | |
542 (insert f ":") | |
543 (lm-insert-at-column lm-comment-column "NA\n"))))))) | |
544 (directory-files file)) | |
545 ) | |
546 (save-excursion | |
547 (if file | |
548 (find-file file)) | |
549 (prog1 | |
550 (lm-summary) | |
551 (if file | |
552 (kill-buffer (current-buffer))) | |
553 )))) | |
554 | |
4631
866681a74bd9
Improve lisp-mnt documentation.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4630
diff
changeset
|
555 ;; #### This should call out to `report-xemacs-bug'. |
428 | 556 (defun lm-report-bug (topic) |
557 "Report a bug in the package currently being visited to its maintainer. | |
558 Prompts for bug subject. Leaves you in a mail buffer." | |
559 (interactive "sBug Subject: ") | |
560 (let ((package (lm-get-package-name)) | |
561 (addr (lm-maintainer)) | |
562 (version (lm-version))) | |
776 | 563 (if-fboundp 'mail |
564 (mail nil | |
565 (if addr | |
566 (concat (car addr) " <" (cdr addr) ">") | |
567 (or (and-boundp 'report-xemacs-bug-beta-address | |
568 report-xemacs-bug-beta-address) | |
569 "<xemacs-beta@xemacs.org>")) | |
570 topic) | |
571 (error 'unimplemented "No mail package available")) | |
428 | 572 (goto-char (point-max)) |
573 (insert "\nIn " | |
574 package | |
575 (if version (concat " version " version) "") | |
576 "\n\n") | |
577 (message | |
578 (substitute-command-keys "Type \\[mail-send] to send bug report.")))) | |
579 | |
4633
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
580 ;;; Entry point: insert boilerplate |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
581 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
582 (defconst lm-standard-permission |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
583 "\n;; This file is part of XEmacs. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
584 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
585 ;; XEmacs is free software; you can redistribute it and/or modify it |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
586 ;; under the terms of the GNU General Public License as published by |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
587 ;; the Free Software Foundation; either version 2, or (at your option) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
588 ;; any later version. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
589 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
590 ;; XEmacs is distributed in the hope that it will be useful, but |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
591 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
592 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
593 ;; General Public License for more details. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
594 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
595 ;; You should have received a copy of the GNU General Public License |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
596 ;; along with XEmacs; see the file COPYING. If not, write to the Free |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
597 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
598 ;; Boston, MA 02110-1301, USA.\n" |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
599 "Standard permissions notice for Lisp files that are part of XEmacs. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
600 License version and FSF address are current as of 2009-04-01.") |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
601 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
602 (defconst lm-change-log |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
603 "\n;;; Change Log: |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
604 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
605 ;; %s %s <%s> |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
606 ;; |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
607 ;; * Created.\n" |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
608 "GNU standard change-log template.") |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
609 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
610 (defconst lm-boilerplate |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
611 ";;; %s --- %s |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
612 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
613 ;; Copyright (C) %s %s |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
614 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
615 ;; Author: %s <%s> |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
616 ;; Created: %s |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
617 ;; Keywords: %s |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
618 %s |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
619 ;;; Synched up with: Not in GNU. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
620 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
621 ;;; Commentary: |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
622 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
623 ;; PLACE YOUR COMMENTARY (DESCRIPTION OF THE LIBRARY'S CONTENTS AND FUNCTION) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
624 ;; IN THIS SECTION. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
625 %s |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
626 ;;; Code:\n\n" |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
627 "lisp-mnt standard boilerplate.") |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
628 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
629 ;; #### Need to improve the interactive declaration. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
630 ;; #### Need to check for existing boilerplate. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
631 (defun lm-insert-boilerplate (file synopsis permission author email keys log) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
632 "Insert lisp-mnt standard header and footer. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
633 FILE is the file name of the library. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
634 SYNOPSIS is a one line description of the file. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
635 Total length of FILE and SYNOPSIS should be less than 70 characters. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
636 PERMISSION, if non-nil, means to use a simple \"All Rights Reserved.\" |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
637 Otherwise, the standard boilerplate for XEmacs sources is inserted. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
638 AUTHOR is the name of the author, defaulting to `user-full-name'. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
639 EMAIL is the contact email address, defaulting to `user-mail-address'. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
640 KEYS is a comma-separated list of finder keywords. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
641 LOG, if non-nil, means to insert a Change Log section. |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
642 Otherwise, it will be omitted." |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
643 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
644 (interactive "FName of file: \nsSynopsis: \nP\nsAuthor: \nsEmail: |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
645 sKeywords: \ncInsert a Change Log section? (y/n)") |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
646 |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
647 (save-restriction |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
648 (widen) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
649 (let ((file (file-name-nondirectory file)) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
650 (year (format-time-string "%Y")) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
651 (date (format-time-string "%Y-%m-%d")) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
652 (author (if (> (length author) 0) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
653 author |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
654 user-full-name)) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
655 (email (if (> (length email) 0) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
656 email |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
657 user-mail-address)) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
658 (log (eql (upcase log) ?Y))) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
659 (goto-char (point-min)) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
660 (insert (format lm-boilerplate |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
661 file synopsis |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
662 year author |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
663 author email |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
664 date |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
665 keys |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
666 (if permission |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
667 "\n;; All Rights Reserved.\n" |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
668 lm-standard-permission) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
669 (if log |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
670 (format lm-change-log date author email) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
671 ""))) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
672 (goto-char (point-max)) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
673 (insert (format "\n;;; %s ends here\n" file))))) |
199ecf2503c8
Add standard section headers in preparation for 21.5.29.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4631
diff
changeset
|
674 |
428 | 675 (provide 'lisp-mnt) |
676 | |
677 ;;; lisp-mnt.el ends here |