Always end the published document with a newline.
[muse-el.git] / muse-regexps.el
blob57e6518a8f89d313c77a4f138673ff2f3dc9d5d4
1 ;;; muse-regexps.el --- Define regexps used by Muse.
3 ;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 ;; This file is not part of GNU Emacs.
7 ;; This is free software; you can redistribute it and/or modify it under
8 ;; the terms of the GNU General Public License as published by the Free
9 ;; Software Foundation; either version 2, or (at your option) any later
10 ;; version.
12 ;; This is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 ;; for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 ;; MA 02111-1307, USA.
22 ;;; Commentary:
24 ;; This file is the part of the Muse project that describes regexps
25 ;; that are used throughout the project.
27 ;;; Contributors:
29 ;;; Code:
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33 ;; Muse Regular Expressions
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 (defun muse-extreg-usable-p ()
38 "Return non-nil if extended character classes can be used,
39 nil otherwise.
41 This is used when deciding the initial values of the muse-regexp
42 options."
43 (save-match-data
44 (string-match "^[0-9]+\\.[0-9]+\\.\\([0-9]+\\)"
45 emacs-version)
46 (cond ((featurep 'xemacs) nil) ; unusable on XEmacs
47 ((> emacs-major-version 21) t) ; usable if > 21
48 ((< emacs-major-version 21) nil)
49 ((< emacs-minor-version 3) nil)
50 ;; don't use if version is of format 21.x
51 ((null (match-string 1 emacs-version)) nil)
52 ;; don't trust the 21.3.1 release or its predecessors
53 ((> (string-to-int (match-string 1 emacs-version)) 1) t)
54 (t nil))))
56 (defgroup muse-regexp nil
57 "Options relating to regular expressions as used in publishing
58 and syntax highlighting."
59 :group 'muse)
61 (defcustom muse-regexp-blank
62 (if (muse-extreg-usable-p)
63 "[:blank:]"
64 " \t")
65 "Regexp to use in place of \"[:blank:]\".
66 This should be something that matches spaces and tabs.
68 It is like a regexp, but should be embeddable inside brackets.
69 Muse will detect the appropriate value correctly most of
70 the time."
71 :type 'string
72 :options '("[:blank:]" " \t")
73 :group 'muse-regexp)
75 (defcustom muse-regexp-space
76 (if (muse-extreg-usable-p)
77 "[:space:]"
78 " \t\n")
79 "Regexp to use in place of \"[:space:]\".
80 This should be something that matches spaces, tabs, and newlines.
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 '("[:space:]" " \t\n")
87 :group 'muse-regexp)
89 (defcustom muse-regexp-alnum
90 (if (muse-extreg-usable-p)
91 "[:alnum:]"
92 "A-Za-z0-9")
93 "Regexp to use in place of \"[:alnum:]\".
94 This should be something that matches all letters and numbers.
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 '("[:alnum:]" "A-Za-z0-9")
101 :group 'muse-regexp)
103 (defcustom muse-regexp-lower
104 (if (muse-extreg-usable-p)
105 "[:lower:]"
106 "a-z")
107 "Regexp to use in place of \"[:lower:]\".
108 This should match all lowercase characters.
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 '("[:lower:]" "a-z")
115 :group 'muse-regexp)
117 (defcustom muse-regexp-upper
118 (if (muse-extreg-usable-p)
119 "[:upper:]"
120 "A-Z")
121 "Regexp to use in place of \"[:upper:]\".
122 This should match all uppercase 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 '("[:upper:]" "A-Z")
129 :group 'muse-regexp)
131 (provide 'muse-regexps)
132 ;;; muse-regexps.el ends here