summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp-mnt.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2000-09-17 01:00:09 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2000-09-17 01:00:09 +0000
commit438cdcdeb04b08aefdc5450d7eddbffa21e44f2d (patch)
tree5b3d897825635c5b1460792385283f5ea813e43b /lisp/emacs-lisp/lisp-mnt.el
parent40716cd9c4d41db83dd06cb88dd087eede602f01 (diff)
downloademacs-438cdcdeb04b08aefdc5450d7eddbffa21e44f2d.tar.gz
(lm-get-header-re): Allow spaces between the header and the colon.
(lm-header-prefix): Cleanup the regexp. (lm-header): Allow $ in non-RCS headers. (lm-header-multiline): Put the strings back into order. Stop at an empty line. Don't require two space chars if the line is clearly not another header line.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mnt.el')
-rw-r--r--lisp/emacs-lisp/lisp-mnt.el37
1 files changed, 20 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index 2f50541fe6f..c5e61dfbd1e 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -120,7 +120,7 @@
:prefix "lm-"
:group 'maint)
-(defcustom lm-header-prefix "^;;*[ \t]+\\(@\(#\)\\)?[ \t]*\\([\$]\\)?"
+(defcustom lm-header-prefix "^;+[ \t]+\\(@(#)\\)?[ \t]*\\$?"
"Prefix that is ignored before the tag.
For example, you can write the 1st line synopsis string and headers like this
in your Lisp package:
@@ -157,10 +157,9 @@ then $identifier: doc string $ is used by GNU ident(1)"
"Return regexp for matching HEADER.
If called with optional MODE and with value `section',
return section regexp instead."
- (cond ((eq mode 'section)
- (concat "^;;;;* " header ":[ \t]*$"))
- (t
- (concat lm-header-prefix header ":[ \t]*"))))
+ (if (eq mode 'section)
+ (concat "^;;;;* " header ":[ \t]*$")
+ (concat lm-header-prefix header "[ \t]*:[ \t]*")))
(defun lm-get-package-name ()
"Return package name by looking at the first line."
@@ -201,11 +200,14 @@ If AFTER is non-nil, return the location of the next line."
"Return the contents of the header named HEADER."
(goto-char (point-min))
(let ((case-fold-search t))
- (if (and (re-search-forward (lm-get-header-re header) (lm-code-mark) t)
- ;; RCS ident likes format "$identifier: data$"
- (looking-at "\\([^$\n]+\\)")
- (match-end 1))
- (match-string-no-properties 1))))
+ (when (and (re-search-forward (lm-get-header-re header) (lm-code-mark) t)
+ ;; RCS ident likes format "$identifier: data$"
+ (looking-at
+ (if (save-excursion
+ (skip-chars-backward "^$" (match-beginning 0))
+ (= (point) (match-beginning 0)))
+ "[^\n]+" "[^$\n]+")))
+ (match-string-no-properties 0))))
(defun lm-header-multiline (header)
"Return the contents of the header named HEADER, with continuation lines.
@@ -216,14 +218,15 @@ The returned value is a list of strings, one per line."
(when res
(setq res (list res))
(forward-line 1)
- (while (and (looking-at (concat lm-header-prefix "[\t ]+"))
- (progn
- (goto-char (match-end 0))
- (looking-at "\\(.*\\)"))
- (match-end 1))
- (setq res (cons (match-string-no-properties 1) res))
+ (while (and (or (looking-at (concat lm-header-prefix "[\t ]+"))
+ (and (not (looking-at
+ (lm-get-header-re "\\sw\\(\\sw\\|\\s_\\)*")))
+ (looking-at lm-header-prefix)))
+ (goto-char (match-end 0))
+ (looking-at ".+"))
+ (setq res (cons (match-string-no-properties 0) res))
(forward-line 1)))
- res)))
+ (nreverse res))))
;; These give us smart access to the header fields and commentary