home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / packages / fa-extras.el < prev    next >
Encoding:
Text File  |  1993-03-22  |  18.9 KB  |  498 lines

  1. ;;;; -*-Emacs-Lisp-*- Enhancements to Kyle Jones' Adaptive Fill Package
  2. ;;;; Written by Eric Eide, last modified on March 8, 1993.
  3. ;;;; (C) Copyright 1992, 1993, Eric Eide and the University of Utah
  4. ;;;;
  5. ;;;; COPYRIGHT NOTICE
  6. ;;;;
  7. ;;;; This program is free software; you can redistribute it and/or modify it
  8. ;;;; under the terms of the GNU General Public License as published by the Free
  9. ;;;; Software Foundation; either version 1, or (at your option) any later
  10. ;;;; version.
  11. ;;;;
  12. ;;;; This program is distributed in the hope that it will be useful, but
  13. ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  14. ;;;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. ;;;; for more details.
  16. ;;;;
  17. ;;;; You should have received a copy of the GNU General Public License along
  18. ;;;; with this program; if not, write to the Free Software Foundation, Inc.,
  19. ;;;; 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. ;;;; AUTHORS
  22. ;;;;
  23. ;;;; This set of functions was written by Eric Eide (eeide@cs.utah.edu) but is
  24. ;;;; very heavily based on Kyle Jones' "filladapt" package and the standard GNU
  25. ;;;; Emacs code.
  26. ;;;;
  27. ;;;; Addresses:
  28. ;;;;
  29. ;;;;   Eric Eide (eeide@cs.utah.edu)
  30. ;;;;   University of Utah
  31. ;;;;   3190 Merrill Engineering Building
  32. ;;;;   Salt Lake City, Utah  84112
  33. ;;;;
  34. ;;;;   Kyle Jones (kyle@crystal.wonderworks.com)
  35. ;;;;
  36. ;;;; Kyle Jones' "filladapt" package is Copyright (C) 1989 by Kyle E. Jones.
  37. ;;;; It is distributed under the terms of the GNU General Public License.
  38.  
  39. ;;;; LISP CODE DIRECTORY INFORMATION
  40. ;;;;
  41. ;;;; LCD Archive Entry:
  42. ;;;; fa-extras|Eric Eide|eeide@cs.utah.edu|
  43. ;;;; Enhancements to Kyle Jones' "filladapt"; hanging lists in Lisp comments|
  44. ;;;; 08-Mar-1993||~/packages/fa-extras.el.Z|
  45.  
  46. ;;;; SUMMARY
  47. ;;;;
  48. ;;;; This file enhances Kyle Jones' "filladapt" package to properly indent
  49. ;;;; hanging paragraphs in more circumstances.  The whitespace that insets a
  50. ;;;; hanging paragraph may now contain both spaces and TABs.  Hanging
  51. ;;;; paragraphs within Lisp comments are also handled correctly.  Examples:
  52. ;;;;
  53. ;;;;   ;; + This text is     ;; 1. This text is     ;; (a) This text is
  54. ;;;;   ;;   filled.          ;;    filled.          ;;     filled.
  55. ;;;;
  56. ;;;; This file redefines the function filladapt-hanging-list from Kyle Jones'
  57. ;;;; "filladapt" package.  This file also redefines the standard GNU Emacs
  58. ;;;; functions indent-new-comment-line (from "simple.el"), fill-region-as-
  59. ;;;; paragraph (from "fill.el"), and lisp-mode-variables (from "lisp-mode.el").
  60. ;;;; All required slight modifications to better handle comments.
  61. ;;;;
  62. ;;;; To use this file, simply load it after Kyle Jones' "filladapt" package has
  63. ;;;; been loaded.
  64.  
  65.  
  66. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  67. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  68. ;;;;
  69. ;;;; Here are the global variable declarations.
  70. ;;;;
  71. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  72. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  73.  
  74. ;; This new filladapt table contains three new entries: the ones that refer to
  75. ;; the function filladapt-hanging-list-in-lisp-comment.  Also, the regular
  76. ;; expressions associated with filladapt-supercite-included-text and filladapt-
  77. ;; hanging-list are slightly modified.
  78.  
  79. (setq filladapt-prefix-table
  80.   '(
  81.     ;; Included text in news or mail replies
  82.     ("[ \t]*\\(>+ *\\)+" . filladapt-normal-included-text)
  83.     ;; Included text generated by SUPERCITE.  We can't hope to match all
  84.     ;; the possible variations, your mileage may vary.
  85.     ("[ \t]*[^'`\"< \t]*> *" . filladapt-supercite-included-text)
  86.     ;; These are the new entries for handling hanging lists within Lisp
  87.     ;; comments.
  88.     ("\\([ \t]*\\(;[ \t]*\\)*;\\)[ \t]*(?\\([0-9]+[a-z]?\\|[a-z]\\))[ \t]+" .
  89.      filladapt-hanging-list-in-lisp-comment)
  90.     ("\\([ \t]*\\(;[ \t]*\\)*;\\)[ \t]*\\([0-9]+[a-z]?\\|[a-z]\\)\\.[ \t]+" .
  91.      filladapt-hanging-list-in-lisp-comment)
  92.     ("\\([ \t]*\\(;[ \t]*\\)*;\\)[?!~*+--- \t]+[ \t]" . ;; See NOTE below.
  93.      filladapt-hanging-list-in-lisp-comment)
  94.     ;; Lisp comments
  95.     ("[ \t]*\\(;+[ \t]*\\)+" . filladapt-lisp-comment)
  96.     ;; UNIX shell comments
  97.     ("[ \t]*\\(#+[ \t]*\\)+" . filladapt-sh-comment)
  98.     ;; Postscript comments
  99.     ("[ \t]*\\(%+[ \t]*\\)+" . filladapt-postscript-comment)
  100.     ;; C++ comments
  101.     ("[ \t]*//[/ \t]*" . filladapt-c++-comment)
  102.     ;; Lists with hanging indents, e.g.
  103.     ;; 1. xxxxx   or   *   xxxxx   etc.
  104.     ;;    xxxxx            xxx
  105.     ("[ \t]*(?\\([0-9]+[a-z]?\\|[a-z]\\))[ \t]+" . filladapt-hanging-list)
  106.     ("[ \t]*\\([0-9]+[a-z]?\\|[a-z]\\)\\.[ \t]+" . filladapt-hanging-list)
  107.     ("[?!~*+--- \t]*[ \t]" . filladapt-hanging-list)
  108.     ;; This keeps normal paragraphs from interacting unpleasantly with
  109.     ;; the types given above.
  110.     ("[^ \t/#%?!~*+---]" . filladapt-normal)
  111.     ))
  112.  
  113. ;; NOTE that the indicated regular expression for hanging lists in Lisp
  114. ;; comments sometimes does the "wrong thing" in unusual circumstances.  For
  115. ;; example, it will cause the following two lines to be filled "incorrectly":
  116. ;;
  117. ;;  ;; This is line one.
  118. ;;  ;; This is line two.
  119. ;;
  120. ;; The regular expression matches ";;  " and filladapt-hanging-list-in-lisp-
  121. ;; comment believes that it is the prefix.  The filler then fills the comments
  122. ;; as:
  123. ;;
  124. ;;  ;; This is line one.  ;; This is line two.
  125. ;;
  126. ;; (NOTE the embedded semicolons.)  However, the following lines will be filled
  127. ;; "correctly" because there is only one space between the semicolons:
  128. ;;
  129. ;; ;; This is line one.
  130. ;; ;; This is line two.
  131. ;;
  132. ;; These lines will be filled by filladapt-lisp-comment as:
  133. ;;
  134. ;; ;; This is line one.  This is line two.
  135. ;;
  136. ;; So be careful how you nest your semicolons.
  137.  
  138.  
  139. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  140. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  141. ;;;;
  142. ;;;; Here are the functions that allow one to fill hanging paragraphs.
  143. ;;;;
  144. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  145. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  146.  
  147. (defun filladapt-looking-at (regexp width)
  148.   ;; This function returns t if point is at the beginning of the given regular
  149.   ;; expression and the width (not length!) of the matching text is equal to
  150.   ;; the specified width.
  151.   (if (looking-at regexp)
  152.       (let ((looking-at-width (- (save-excursion
  153.                    (goto-char (match-end 0))
  154.                    (current-column))
  155.                  (if (bolp)
  156.                      0
  157.                    (current-column)))))
  158.     (= looking-at-width width))
  159.     nil))
  160.  
  161. (defun filladapt-make-whitespace (start-column width)
  162.   ;; Make a string of whitespace containing TABs and spaces.
  163.   (if indent-tabs-mode
  164.       (let* ((end-column (+ start-column width))
  165.          (tabs-before-start (/ start-column tab-width))
  166.          (tabs-before-end (/ end-column tab-width))
  167.          (tabs (- tabs-before-end tabs-before-start))
  168.          (spaces (if (> tabs 0)
  169.              (% end-column tab-width)
  170.                width))
  171.          (whitespace (make-string (+ tabs spaces) ?\ )))
  172.     ;; Special case: don't use only one TAB to go one space.
  173.     (if (and (= tabs 1) (= (+ tabs spaces) width))
  174.         (setq tabs 0
  175.           spaces (1+ spaces)))
  176.     ;; Fill in the whitespace string with the required TABs.
  177.     (let ((index 0))
  178.       (while (> tabs 0)
  179.         (aset whitespace index ?\t)
  180.         (setq index (1+ index)
  181.           tabs (1- tabs))))
  182.     whitespace)
  183.     ;; indent-tabs-mode is nil; only use spaces.
  184.     (make-string width ?\ )))
  185.  
  186. ;;; The function below is a replacement for the function filladapt-hanging-list
  187. ;;; from Kyle Jones' "filladapt" package.  This new filladapt-hanging-list
  188. ;;; understands whitespace that contains both spaces and TABs.
  189.  
  190. (defun filladapt-hanging-list (paragraph)
  191.   (let (prefix match match-width beg end)
  192.     (setq match-width (save-excursion (goto-char (match-end 0))
  193.                       (current-column)))
  194.     (setq prefix (filladapt-make-whitespace 0 match-width))
  195.     (if paragraph
  196.     (progn
  197.       (setq match (buffer-substring (match-beginning 0) (match-end 0)))
  198.       (if (string-match "^[ \t]+$" match)
  199.           (save-excursion
  200.         (while (and (not (bobp))
  201.                 (filladapt-looking-at "[ \t]*" match-width))
  202.           (forward-line -1))
  203.         (if (or (filladapt-looking-at
  204.              "[ \t]*(?\\([0-9]+[a-z]?\\|[a-z]\\))[ \t]+"
  205.              match-width)
  206.             (filladapt-looking-at
  207.              "[ \t]*\\([0-9]+[a-z]?\\|[a-z]\\)\\.[ \t]+"
  208.              match-width)
  209.             (filladapt-looking-at
  210.              "[ \t]*[?!~*+---]+[ \t]+"
  211.              match-width))
  212.             (setq beg (point))
  213.           (setq beg (progn (forward-line 1) (point)))))
  214.         (setq beg (point)))
  215.       (save-excursion
  216.         (goto-char beg)
  217.         (forward-line)
  218.         (while (filladapt-looking-at "[ \t]*" match-width)
  219.           (replace-match prefix nil t)
  220.           (forward-line))
  221.         (setq end (point)))
  222.       (narrow-to-region beg end)))
  223.     (setq fill-prefix prefix)))
  224.  
  225. ;;; filladapt-hanging-list-in-lisp-comment started as a merger of the functions
  226. ;;; filladapt-lisp-comment and filladapt-hanging-list (both from Kyle Jones'
  227. ;;; "filladapt" package).  But it became much more complicated when I taught it
  228. ;;; to understand whitespace containing both spaces and TABs.
  229.  
  230. (defun filladapt-hanging-list-in-lisp-comment (paragraph)
  231.   (let (prefix match
  232.     match-width          ;; The width of the entire match.
  233.     leading-whitespace-width  ;; ...of the whitespace before the semicolons
  234.     to-last-semicolon-width      ;; ...of the text between bol and the last ;.
  235.     comment-semicolons      ;; The text from the first ; to the last ;.
  236.     matching-prefix-regexp      ;; Regexp for finding prefixes "like" prefix.
  237.     beg end)
  238.     (save-excursion
  239.       (setq match-width (progn (goto-char (match-end 0))
  240.                    (current-column))
  241.         leading-whitespace-width (progn (goto-char (match-beginning 2))
  242.                         (current-column))
  243.         to-last-semicolon-width (progn (goto-char (match-end 1))
  244.                        (current-column))
  245.         comment-semicolons (buffer-substring (match-beginning 2)
  246.                          (match-end 1))))
  247.     (setq prefix
  248.       (concat
  249.        (filladapt-make-whitespace 0 leading-whitespace-width)
  250.        comment-semicolons
  251.        (filladapt-make-whitespace to-last-semicolon-width
  252.                       (- match-width to-last-semicolon-width))
  253.        ))
  254.     (if paragraph
  255.     (progn
  256.       (setq paragraph-separate (concat "^" prefix "[ \t]*;\\|^"
  257.                        (filladapt-negate-string prefix))
  258.         match (buffer-substring (match-beginning 0) (match-end 0))
  259.         matching-prefix-regexp (concat "[ \t]*"
  260.                            (regexp-quote
  261.                         comment-semicolons)
  262.                            "[ \t]*"))
  263.       (if (string-match "^[ \t]*\\(;[ \t]*\\)*;[ \t]+$" match)
  264.           (save-excursion
  265.         (while (and (not (bobp))
  266.                 ;; I need two regular expressions here because I
  267.                 ;; want the leading whitespace to be of a certain
  268.                 ;; width.  I can't check that without two calls to
  269.                 ;; filladapt-looking-prefix -- unless I change that
  270.                 ;; function to accept more arguments.
  271.                 (filladapt-looking-at "[ \t]*"
  272.                           leading-whitespace-width)
  273.                 (filladapt-looking-at matching-prefix-regexp
  274.                           match-width))
  275.           (forward-line -1))
  276.         (if (or
  277.              (filladapt-looking-at
  278.               "\\([ \t]*\\(;[ \t]*\\)*;\\)[ \t]*(?\\([0-9]+[a-z]?\\|[a-z]\\)[ \t]+"
  279.               match-width)
  280.              (filladapt-looking-at
  281.               "\\([ \t]*\\(;[ \t]*\\)*;\\)[ \t]*\\([0-9]+[a-z]?\\|[a-z]\\)\\.[ \t]+"
  282.               match-width)
  283.              (filladapt-looking-at
  284.               "\\([ \t]*\\(;[ \t]*\\)*;\\)[ \t]*[?!~*+---]+[ \t]+"
  285.               match-width))
  286.             (setq beg (point))
  287.           (setq beg (progn (forward-line 1) (point)))))
  288.         (setq beg (point)))
  289.       (save-excursion
  290.         (goto-char beg)
  291.         (forward-line)
  292.         (while (and (filladapt-looking-at "[ \t]*"
  293.                           leading-whitespace-width)
  294.             (filladapt-looking-at matching-prefix-regexp
  295.                           match-width))
  296.           (replace-match prefix nil t)
  297.           (forward-line))
  298.         (setq end (point)))
  299.       (narrow-to-region beg end)))
  300.     (setq fill-prefix prefix)))
  301.  
  302.  
  303. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  304. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  305. ;;;;
  306. ;;;; Here are the new versions of the standard GNU Emacs functions indent-new-
  307. ;;;; comment-line, fill-region-as-paragraph, and lisp-mode-variables.
  308. ;;;;
  309. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  310. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  311.  
  312. ;;; This version of indent-new-comment-line (originally from "simple.el" in GNU
  313. ;;; Emacs 18.58) has been modified to work better when a fill prefix has been
  314. ;;; specified for filling a comment.  The changed line is marked with my
  315. ;;; initials (ENE).
  316.  
  317. (defun indent-new-comment-line ()
  318.   "Break line at point and indent, continuing comment if presently within one.
  319. The body of the continued comment is indented under the previous comment line."
  320.   (interactive "*")
  321.   (let (comcol comstart)
  322.     (skip-chars-backward " \t")
  323.     (delete-region (point)
  324.            (progn (skip-chars-forward " \t")
  325.               (point)))
  326.     (insert ?\n)
  327.     (save-excursion
  328.       (if (and comment-start-skip
  329.            (let ((opoint (point)))
  330.          (forward-line -1)
  331.          (re-search-forward comment-start-skip opoint t)))
  332.       ;; The old line is a comment.
  333.       ;; Set WIN to the pos of the comment-start.
  334.       ;; But if the comment is empty, look at preceding lines
  335.       ;; to find one that has a nonempty comment.
  336.       (let ((win (match-beginning 0)))
  337.         (while (and (eolp) (not (bobp))
  338.             (let (opoint)
  339.               (beginning-of-line)
  340.               (setq opoint (point))
  341.               (forward-line -1)
  342.               (re-search-forward comment-start-skip opoint t)))
  343.           (setq win (match-beginning 0)))
  344.         ;; Indent this line like what we found.
  345.         (goto-char win)
  346.         (setq comcol (current-column))
  347.         (setq comstart (buffer-substring (point) (match-end 0))))))
  348.     (if (and comcol (not fill-prefix)) ;; ENE: Changed this test.
  349.     (let ((comment-column comcol)
  350.           (comment-start comstart)
  351.           (comment-end comment-end))
  352.       (and comment-end (not (equal comment-end ""))
  353.            (if (not comment-multi-line)
  354.            (progn
  355.              (forward-char -1)
  356.              (insert comment-end)
  357.              (forward-char 1))
  358.          (setq comment-column (+ comment-column (length comment-start))
  359.                comment-start "")))
  360.       (if (not (eolp))
  361.           (setq comment-end ""))
  362.       (insert ?\n)
  363.       (forward-char -1)
  364.       (indent-for-comment)
  365.       (delete-char 1))
  366.       (if fill-prefix
  367.       (insert fill-prefix)
  368.     (indent-according-to-mode)))))
  369.  
  370. ;;; This version of fill-region-as-paragraph (originally from "fill.el" in GNU
  371. ;;; Emacs 18.58) has been modified to skip past the comment start (if present)
  372. ;;; on the first line of the paragraph to be filled.  The added form is marked
  373. ;;; with my initials (ENE).
  374.  
  375. (defun fill-region-as-paragraph (from to &optional justify-flag)
  376.   "Fill region as one paragraph: break lines to fit fill-column.
  377. Prefix arg means justify too.
  378. >From program, pass args FROM, TO and JUSTIFY-FLAG."
  379.   (interactive "r\nP")
  380.   (save-restriction
  381.     (narrow-to-region from to)
  382.     (goto-char (point-min))
  383.     (skip-chars-forward "\n")
  384.     (narrow-to-region (point) (point-max))
  385.     (setq from (point))
  386.     (let ((fpre (and fill-prefix (not (equal fill-prefix ""))
  387.              (regexp-quote fill-prefix))))
  388.       ;; Delete the fill prefix from every line except the first.
  389.       ;; The first line may not even have a fill prefix.
  390.       (and fpre
  391.        (progn
  392.          (if (>= (length fill-prefix) fill-column)
  393.          (error "fill-prefix too long for specified width"))
  394.          (goto-char (point-min))
  395.          (forward-line 1)
  396.          (while (not (eobp))
  397.            (if (looking-at fpre)
  398.            (delete-region (point) (match-end 0)))
  399.            (forward-line 1))
  400.          (goto-char (point-min))
  401.          (and (looking-at fpre) (forward-char (length fill-prefix)))
  402.          (setq from (point)))))
  403.     ;; from is now before the text to fill,
  404.     ;; but after any fill prefix on the first line.
  405.  
  406.     ;; Make sure sentences ending at end of line get an extra space.
  407.     (goto-char from)
  408.     (while (re-search-forward "[.?!][])""']*$" nil t)
  409.       (insert ? ))
  410.     ;; Then change all newlines to spaces.
  411.     (subst-char-in-region from (point-max) ?\n ?\ )
  412.     ;; Flush excess spaces, except in the paragraph indentation.
  413.     (goto-char from)
  414.     (skip-chars-forward " \t")
  415.     ;; ENE: Added the following "if" form to move past the comment start.
  416.     (if (and comment-start-skip
  417.          (looking-at comment-start-skip))
  418.     (goto-char (match-end 0)))
  419.     (while (re-search-forward "   *" nil t)
  420.       (delete-region
  421.        (+ (match-beginning 0)
  422.       (if (save-excursion
  423.            (skip-chars-backward " ])\"'")
  424.            (memq (preceding-char) '(?. ?? ?!)))
  425.           2 1))
  426.        (match-end 0)))
  427.     (goto-char (point-max))
  428.     (delete-horizontal-space)
  429.     (insert "  ")
  430.     (goto-char (point-min))
  431.     (let ((prefixcol 0))
  432.       (while (not (eobp))
  433.     (move-to-column (1+ fill-column))
  434.     (if (eobp)
  435.         nil
  436.       ;; Move back to start of word.
  437.       (skip-chars-backward "^ \n")
  438.       (if (if (zerop prefixcol) (bolp) (>= prefixcol (current-column)))
  439.           ;; Move back over whitespace before the word.
  440.           (skip-chars-forward "^ \n")
  441.         ;; Normally, move back over the single space between the words.
  442.         (forward-char -1)))
  443.     ;; Replace all whitespace here with one newline.
  444.     ;; Insert before deleting, so we don't forget which side of
  445.     ;; the whitespace point or markers used to be on.
  446.     (skip-chars-backward " ")
  447.     (insert ?\n)
  448.     (delete-horizontal-space)
  449.     ;; Insert the fill prefix at start of each line.
  450.     ;; Set prefixcol so whitespace in the prefix won't get lost.
  451.     (and (not (eobp)) fill-prefix (not (equal fill-prefix ""))
  452.          (progn
  453.            (insert fill-prefix)
  454.            (setq prefixcol (current-column))))
  455.     ;; Justify the line just ended, if desired.
  456.     (and justify-flag (not (eobp))
  457.          (progn
  458.            (forward-line -1)
  459.            (justify-current-line)
  460.            (forward-line 1)))))))
  461.  
  462. ;;; This version of lisp-mode-variables (originally from "lisp-mode.el" in GNU
  463. ;;; Emacs 18.58) has been modified to set comment-start-skip to ";+[ \t]*".
  464. ;;; (Should it be ";[; \t]*"?  Simply ";+[ \t]*" seems to be good enough.)  The
  465. ;;; changed line is marked with my initials (ENE).
  466.  
  467. (defun lisp-mode-variables (lisp-syntax)
  468.   (cond (lisp-syntax
  469.       (if (not lisp-mode-syntax-table)
  470.           (progn (setq lisp-mode-syntax-table
  471.                (copy-syntax-table emacs-lisp-mode-syntax-table))
  472.              (modify-syntax-entry ?\| "\"   "
  473.                       lisp-mode-syntax-table)
  474.              (modify-syntax-entry ?\[ "_   "
  475.                       lisp-mode-syntax-table)
  476.              (modify-syntax-entry ?\] "_   "
  477.                       lisp-mode-syntax-table)))
  478.       (set-syntax-table lisp-mode-syntax-table)))
  479.   (setq local-abbrev-table lisp-mode-abbrev-table)
  480.   (make-local-variable 'paragraph-start)
  481.   (setq paragraph-start (concat "^$\\|" page-delimiter))
  482.   (make-local-variable 'paragraph-separate)
  483.   (setq paragraph-separate paragraph-start)
  484.   (make-local-variable 'paragraph-ignore-fill-prefix)
  485.   (setq paragraph-ignore-fill-prefix t)
  486.   (make-local-variable 'indent-line-function)
  487.   (setq indent-line-function 'lisp-indent-line)
  488.   (make-local-variable 'comment-start)
  489.   (setq comment-start ";")
  490.   (make-local-variable 'comment-start-skip)
  491.   (setq comment-start-skip ";+[ \t]*") ;; ENE: Used to be ";+ *".
  492.   (make-local-variable 'comment-column)
  493.   (setq comment-column 40)
  494.   (make-local-variable 'comment-indent-hook)
  495.   (setq comment-indent-hook 'lisp-comment-indent))
  496.  
  497. ;; End of file.
  498.