Add docstring, new trivial function
[muse-el.git] / muse-regexps.el
blobdd6e1e728834e4e0932132b8fdd9f2321b843b4a
1 ;;; muse-regexps.el --- Define regexps used by Muse
3 ;; Copyright (C) 2004 Free Software Foundation, Inc.
5 ;; Emacs Lisp Archive Entry
6 ;; Filename: muse-regexps.el
7 ;; Version: 3.00 ALPHA
8 ;; Date: 2004-12-29
9 ;; Keywords: hypermedia
10 ;; Author: Michael Olson (mwolson AT gnu DOT org)
11 ;; Maintainer: Michael Olson (mwolson AT gnu DOT org)
12 ;; URL: http://www.mwolson.org/projects/MuseMode.html
13 ;; Compatibility: Emacs21
15 ;; This file is not part of GNU Emacs.
17 ;; This is free software; you can redistribute it and/or modify it under
18 ;; the terms of the GNU General Public License as published by the Free
19 ;; Software Foundation; either version 2, or (at your option) any later
20 ;; version.
22 ;; This is distributed in the hope that it will be useful, but WITHOUT
23 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 ;; for more details.
27 ;; You should have received a copy of the GNU General Public License
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the
29 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 ;; MA 02111-1307, USA.
32 ;;; Commentary:
34 ;; This file is the part of the Muse project that describes regexps
35 ;; that are used throughout the project.
37 ;;;_ + Startup
39 ;; To be written.
41 ;;;_ + Usage
43 ;;;_ + Contributors
45 ;;; Code:
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
49 ;; Muse Regular Expressions
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
53 (defun muse-extreg-usable-p ()
54 "Return non-nil if extended character classes can be used,
55 nil otherwise.
57 This is used when deciding the initial values of the muse-regexp
58 options."
59 (save-match-data
60 (string-match "^[0-9]+\\.[0-9]+\\.\\([0-9]+\\)"
61 emacs-version)
62 (cond ((featurep 'xemacs) nil) ; unusable on XEmacs
63 ((> emacs-major-version 21) t) ; usable if > 21
64 ((< emacs-major-version 21) nil)
65 ((< emacs-minor-version 3) nil)
66 ;; don't trust the 21.3.1 release or its predecessors
67 ((> (string-to-int (match-string 1 emacs-version)) 1) t)
68 (t nil))))
70 (defgroup muse-regexp nil
71 "Options relating to regular expressions as used in publishing
72 and syntax highlighting."
73 :group 'muse)
75 (defcustom muse-regexp-blank
76 (if (muse-extreg-usable-p)
77 "[:blank:]"
78 " \t")
79 "Regexp to use in place of \"[:blank:]\".
80 This should be something that matches spaces and tabs.
82 It is like a regexp, but should be embeddable inside brackets.
83 Muse will detect the appropriate value correctly most of
84 the time."
85 :type 'string
86 :options '("[:blank:]" " \t")
87 :group 'muse-regexp)
89 (defcustom muse-regexp-space
90 (if (muse-extreg-usable-p)
91 "[:space:]"
92 " \t\n")
93 "Regexp to use in place of \"[:space:]\".
94 This should be something that matches spaces, tabs, and newlines.
96 It is like a regexp, but should be embeddable inside brackets.
97 muse will detect the appropriate value correctly most of
98 the time."
99 :type 'string
100 :options '("[:space:]" " \t\n")
101 :group 'muse-regexp)
103 (defcustom muse-regexp-alnum
104 (if (muse-extreg-usable-p)
105 "[:alnum:]"
106 "A-Za-z0-9")
107 "Regexp to use in place of \"[:alnum:]\".
108 This should be something that matches all letters and numbers.
110 It is like a regexp, but should be embeddable inside brackets.
111 muse will detect the appropriate value correctly most of
112 the time."
113 :type 'string
114 :options '("[:alnum:]" "A-Za-z0-9")
115 :group 'muse-regexp)
117 (defcustom muse-regexp-lower
118 (if (muse-extreg-usable-p)
119 "[:lower:]"
120 "a-z")
121 "Regexp to use in place of \"[:lower:]\".
122 This should match all lowercase characters.
124 It is like a regexp, but should be embeddable inside brackets.
125 muse will detect the appropriate value correctly most of
126 the time."
127 :type 'string
128 :options '("[:lower:]" "a-z")
129 :group 'muse-regexp)
131 (defcustom muse-regexp-upper
132 (if (muse-extreg-usable-p)
133 "[:upper:]"
134 "A-Z")
135 "Regexp to use in place of \"[:upper:]\".
136 This should match all uppercase characters.
138 It is like a regexp, but should be embeddable inside brackets.
139 muse will detect the appropriate value correctly most of
140 the time."
141 :type 'string
142 :options '("[:upper:]" "A-Z")
143 :group 'muse-regexp)
145 (provide 'muse-regexps)
146 ;;; muse-regexps.el ends here