]> code.delx.au - gnu-emacs/blobdiff - lisp/generic.el
* term/mac-win.el (encoding-vector, mac-font-encoder-list)
[gnu-emacs] / lisp / generic.el
index bd6fa0608aa4f2091d7a69ae8cdd993ea2b13534..fe3c2c274af9fb14f761af4828d1467dd247cd89 100644 (file)
@@ -1,6 +1,6 @@
 ;;; generic.el --- defining simple major modes with comment and font-lock
 ;;
-;; Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
 ;;
 ;; Author:  Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Fri Sep 27 1996
@@ -188,9 +188,6 @@ regexp in `generic-find-file-regexp'.  If the value is nil,
                                 &optional description)
   "Create a new generic mode with NAME.
 
-Args: (NAME COMMENT-LIST KEYWORD-LIST FONT-LOCK-LIST AUTO-MODE-LIST
-            FUNCTION-LIST &optional DESCRIPTION)
-
 NAME should be a symbol; its string representation is used as the function
 name. If DESCRIPTION is provided, it is used as the docstring for the new
 function.
@@ -200,6 +197,7 @@ a one or two character string or a cons pair. If the entry is a character
 or a one-character string, it is added to the mode's syntax table with
 `comment-start' syntax.  If the entry is a cons pair, the elements of the
 pair are considered to be `comment-start' and `comment-end' respectively.
+\(The latter should be nil if you want comments to end at end of line.)
 Note that Emacs has limitations regarding comment characters.
 
 KEYWORD-LIST is a list of keywords to highlight with `font-lock-keyword-face'.
@@ -292,13 +290,15 @@ Some generic modes are defined in `generic-x.el'."
 
     ;; Go through all the comments
     (dolist (start comment-list)
-      (let ((end ?\n) (comstyle ""))
+      (let ((end nil) (comstyle ""))
        ;; Normalize
        (when (consp start)
          (setq end (or (cdr start) end))
          (setq start (car start)))
        (when (char-valid-p start) (setq start (char-to-string start)))
-       (when (char-valid-p end)   (setq end (char-to-string end)))
+       (cond
+        ((char-valid-p end)   (setq end (char-to-string end)))
+        ((zerop (length end)) (setq end "\n")))
 
        ;; Setup the vars for `comment-region'
        (if comment-start
@@ -408,14 +408,14 @@ INI file.  This hook is NOT installed by default."
 The regexp is highlighted with FACE."
   (unless (listp keywords-list)
     (error "Keywords argument must be a list of strings"))
-  (list (concat prefix "\\<"
+  (list (concat prefix "\\_<"
                ;; Use an optimized regexp.
                (regexp-opt keywords-list t)
-               "\\>" suffix)
+               "\\_>" suffix)
        1
        face))
 
 (provide 'generic)
 
-;;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea
+;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea
 ;;; generic.el ends here