aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-22 21:45:39 +0000
committerRichard M. Stallman1996-09-22 21:45:39 +0000
commite9dac1e100f4fd2b93ad2143e88b99b08c30a500 (patch)
tree2a972369de57f8adefa78983b10d9de8ba7c92ea
parenta5a973dde7b8a695285b1cde46018cf59cbc14f1 (diff)
downloademacs-e9dac1e100f4fd2b93ad2143e88b99b08c30a500.tar.gz
emacs-e9dac1e100f4fd2b93ad2143e88b99b08c30a500.zip
(r2b-capitalize-title-stop-words): Renamed from capit...
(r2b-capitalize-title-stop-regexp): Renamed from capit... (r2b-capitalize-title-region): Renamed from capitalize... (r2b-capitalize-title): Renamed from capitalize...
-rw-r--r--lisp/textmodes/refbib.el32
1 files changed, 15 insertions, 17 deletions
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index c006b910a9b..6b45a307bf8 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -110,9 +110,8 @@ in `r2b-proceedings-list' (although it wouldn't cause an error).")
110 110
111(defvar r2b-additional-stop-words 111(defvar r2b-additional-stop-words
112 "Some\\|What" 112 "Some\\|What"
113 "Words other than the `capitalize-title-stop-words' 113 "Words not to be used to build the citation key.
114which are not to be used to build the citation key") 114This is in addition to the `r2b-capitalize-title-stop-words'.")
115
116 115
117(defvar r2b-delimit-with-quote 116(defvar r2b-delimit-with-quote
118 t 117 t
@@ -121,17 +120,16 @@ which are not to be used to build the citation key")
121;********************************************************** 120;**********************************************************
122; Utility Functions 121; Utility Functions
123 122
124(defvar capitalize-title-stop-words 123(defvar r2b-capitalize-title-stop-words
125 (concat 124 (concat
126 "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|" 125 "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|"
127 "by\\|with\\|that\\|its") 126 "by\\|with\\|that\\|its")
128 "Words not to be capitalized in a title (unless they are the first 127 "Words not to be capitalized in a title (unless the first word).")
129word in the title)")
130 128
131(defvar capitalize-title-stop-regexp 129(defvar r2b-capitalize-title-stop-regexp
132 (concat "\\(" capitalize-title-stop-words "\\)\\(\\b\\|'\\)")) 130 (concat "\\(" r2b-capitalize-title-stop-words "\\)\\(\\b\\|'\\)"))
133 131
134(defun capitalize-title-region (begin end) 132(defun r2b-capitalize-title-region (begin end)
135 "Like `capitalize-region', but don't capitalize stop words, except the first." 133 "Like `capitalize-region', but don't capitalize stop words, except the first."
136 (interactive "r") 134 (interactive "r")
137 (let ((case-fold-search nil) (orig-syntax-table (syntax-table))) 135 (let ((case-fold-search nil) (orig-syntax-table (syntax-table)))
@@ -147,20 +145,20 @@ word in the title)")
147 (if (looking-at "[A-Z][a-z]*[A-Z]") 145 (if (looking-at "[A-Z][a-z]*[A-Z]")
148 (forward-word 1) 146 (forward-word 1)
149 (if (let ((case-fold-search t)) 147 (if (let ((case-fold-search t))
150 (looking-at capitalize-title-stop-regexp)) 148 (looking-at r2b-capitalize-title-stop-regexp))
151 (downcase-word 1) 149 (downcase-word 1)
152 (capitalize-word 1))) 150 (capitalize-word 1)))
153 )) 151 ))
154 (set-syntax-table orig-syntax-table)))) 152 (set-syntax-table orig-syntax-table))))
155 153
156 154
157(defun capitalize-title (s) 155(defun r2b-capitalize-title (s)
158 "Like capitalize, but don't capitalize stop words, except the first." 156 "Like `capitalize', but don't capitalize stop words, except the first."
159 (save-excursion 157 (save-excursion
160 (set-buffer (get-buffer-create "$$$Scratch$$$")) 158 (set-buffer (get-buffer-create "$$$Scratch$$$"))
161 (erase-buffer) 159 (erase-buffer)
162 (insert s) 160 (insert s)
163 (capitalize-title-region (point-min) (point-max)) 161 (r2b-capitalize-title-region (point-min) (point-max))
164 (buffer-string))) 162 (buffer-string)))
165 163
166;********************************************************* 164;*********************************************************
@@ -170,14 +168,14 @@ word in the title)")
170 (makunbound 'r2b-journal-abbrevs) 168 (makunbound 'r2b-journal-abbrevs)
171 (makunbound 'r2b-booktitle-abbrevs) 169 (makunbound 'r2b-booktitle-abbrevs)
172 (makunbound 'r2b-proceedings-list) 170 (makunbound 'r2b-proceedings-list)
173 (makunbound 'capitalize-title-stop-words) 171 (makunbound 'r2b-capitalize-title-stop-words)
174 (makunbound 'capitalize-title-stop-regexp) 172 (makunbound 'r2b-capitalize-title-stop-regexp)
175 (makunbound 'r2b-additional-stop-words) 173 (makunbound 'r2b-additional-stop-words)
176 (makunbound 'r2b-stop-regexp)) 174 (makunbound 'r2b-stop-regexp))
177 175
178(defvar r2b-stop-regexp 176(defvar r2b-stop-regexp
179 (concat "\\`\\(\\(" 177 (concat "\\`\\(\\("
180 r2b-additional-stop-words "\\|" capitalize-title-stop-words 178 r2b-additional-stop-words "\\|" r2b-capitalize-title-stop-words
181 "\\)\\('\\w*\\)?\\W+\\)*\\([A-Z0-9]+\\)")) 179 "\\)\\('\\w*\\)?\\W+\\)*\\([A-Z0-9]+\\)"))
182 180
183 181
@@ -278,7 +276,7 @@ title if CAPITALIZE is true. Returns value of VAR."
278 ) 276 )
279 ) 277 )
280 (if (and val capitalize) 278 (if (and val capitalize)
281 (setq val (capitalize-title val))) 279 (setq val (r2b-capitalize-title val)))
282 (set var val) 280 (set var val)
283 (if (and (null val) required) 281 (if (and (null val) required)
284 (r2b-require var)) 282 (r2b-require var))