diff options
| author | Richard M. Stallman | 1996-09-22 21:48:30 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-09-22 21:48:30 +0000 |
| commit | 7a953756b02ad52d480f66b71e61d698921dfeed (patch) | |
| tree | 4a328b1326bcd6887277b8d06743628c25d2bc33 | |
| parent | e9dac1e100f4fd2b93ad2143e88b99b08c30a500 (diff) | |
| download | emacs-7a953756b02ad52d480f66b71e61d698921dfeed.tar.gz emacs-7a953756b02ad52d480f66b71e61d698921dfeed.zip | |
(bib-capitalize-title-stop-words): Renamed from capit...
(bib-capitalize-title-stop-regexp): Renamed from capit...
(bib-capitalize-title-region): Renamed from capitalize...
(bib-capitalize-title): Renamed from capitalize...
| -rw-r--r-- | lisp/textmodes/bib-mode.el | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el index 55456fdd814..42de7459ee0 100644 --- a/lisp/textmodes/bib-mode.el +++ b/lisp/textmodes/bib-mode.el | |||
| @@ -163,7 +163,7 @@ the car of an entry is followed by one beginning with the cdr. | |||
| 163 | (if (and (not empty) bib-auto-capitalize | 163 | (if (and (not empty) bib-auto-capitalize |
| 164 | (looking-at bib-capitalized-fields)) | 164 | (looking-at bib-capitalized-fields)) |
| 165 | (save-excursion | 165 | (save-excursion |
| 166 | (capitalize-title-region (+ (point) 3) end-current))) | 166 | (bib-capitalize-title-region (+ (point) 3) end-current))) |
| 167 | (goto-char beg-current) | 167 | (goto-char beg-current) |
| 168 | (if empty | 168 | (if empty |
| 169 | (kill-line nil) | 169 | (kill-line nil) |
| @@ -195,17 +195,16 @@ named by variable `unread-bib-file'." | |||
| 195 | (append-to-file (mark) (point) unread-bib-file))) | 195 | (append-to-file (mark) (point) unread-bib-file))) |
| 196 | 196 | ||
| 197 | 197 | ||
| 198 | (defvar capitalize-title-stop-words | 198 | (defvar bib-capitalize-title-stop-words |
| 199 | (concat | 199 | (concat |
| 200 | "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|" | 200 | "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|" |
| 201 | "by\\|with\\|that\\|its") | 201 | "by\\|with\\|that\\|its") |
| 202 | "Words not to be capitalized in a title (unless they're the first word | 202 | "Words not to be capitalized in a title (unless the first word).") |
| 203 | in the title).") | ||
| 204 | 203 | ||
| 205 | (defvar capitalize-title-stop-regexp | 204 | (defvar bib-capitalize-title-stop-regexp |
| 206 | (concat "\\(" capitalize-title-stop-words "\\)\\(\\b\\|'\\)")) | 205 | (concat "\\(" bib-capitalize-title-stop-words "\\)\\(\\b\\|'\\)")) |
| 207 | 206 | ||
| 208 | (defun capitalize-title-region (begin end) | 207 | (defun bib-capitalize-title-region (begin end) |
| 209 | "Like `capitalize-region', but don't capitalize stop words, except the first." | 208 | "Like `capitalize-region', but don't capitalize stop words, except the first." |
| 210 | (interactive "r") | 209 | (interactive "r") |
| 211 | (let ((case-fold-search nil) (orig-syntax-table (syntax-table))) | 210 | (let ((case-fold-search nil) (orig-syntax-table (syntax-table))) |
| @@ -221,20 +220,20 @@ in the title).") | |||
| 221 | (if (looking-at "[A-Z][a-z]*[A-Z]") | 220 | (if (looking-at "[A-Z][a-z]*[A-Z]") |
| 222 | (forward-word 1) | 221 | (forward-word 1) |
| 223 | (if (let ((case-fold-search t)) | 222 | (if (let ((case-fold-search t)) |
| 224 | (looking-at capitalize-title-stop-regexp)) | 223 | (looking-at bib-capitalize-title-stop-regexp)) |
| 225 | (downcase-word 1) | 224 | (downcase-word 1) |
| 226 | (capitalize-word 1))) | 225 | (capitalize-word 1))) |
| 227 | )) | 226 | )) |
| 228 | (set-syntax-table orig-syntax-table)))) | 227 | (set-syntax-table orig-syntax-table)))) |
| 229 | 228 | ||
| 230 | 229 | ||
| 231 | (defun capitalize-title (s) | 230 | (defun bib-capitalize-title (s) |
| 232 | "Like `capitalize', but don't capitalize stop words, except the first." | 231 | "Like `capitalize', but don't capitalize stop words, except the first." |
| 233 | (save-excursion | 232 | (save-excursion |
| 234 | (set-buffer (get-buffer-create "$$$Scratch$$$")) | 233 | (set-buffer (get-buffer-create "$$$Scratch$$$")) |
| 235 | (erase-buffer) | 234 | (erase-buffer) |
| 236 | (insert s) | 235 | (insert s) |
| 237 | (capitalize-title-region (point-min) (point-max)) | 236 | (bib-capitalize-title-region (point-min) (point-max)) |
| 238 | (buffer-string))) | 237 | (buffer-string))) |
| 239 | 238 | ||
| 240 | (provide 'bib-mode) | 239 | (provide 'bib-mode) |