Mercurial > hg > xemacs-beta
comparison lisp/simple.el @ 4946:9b5d4b35f8d7
(main branch) redo capitalize-string-as-title
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-01-24 Ben Wing <ben@xemacs.org>
* simple.el (capitalize-string-as-title):
Use `with-string-as-buffer-contents' instead of emulating it.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sun, 24 Jan 2010 00:27:03 -0600 |
parents | e533a9912ef1 |
children | db2db229ee82 |
comparison
equal
deleted
inserted
replaced
4945:99e465e2da2e | 4946:9b5d4b35f8d7 |
---|---|
3833 "\\)\\>")) | 3833 "\\)\\>")) |
3834 | 3834 |
3835 (defun capitalize-string-as-title (string) | 3835 (defun capitalize-string-as-title (string) |
3836 "Capitalize the words in the string, except for small words (as in titles). | 3836 "Capitalize the words in the string, except for small words (as in titles). |
3837 The words not capitalized are specified in `uncapitalized-title-words'." | 3837 The words not capitalized are specified in `uncapitalized-title-words'." |
3838 (let ((buffer (get-buffer-create " *capitalize-string-as-title*"))) | 3838 (with-string-as-buffer-contents string |
3839 (unwind-protect | 3839 (capitalize-region-as-title (point-min) (point-max)))) |
3840 (progn | |
3841 (insert-string string buffer) | |
3842 (capitalize-region-as-title 1 (point-max buffer) buffer) | |
3843 (buffer-string buffer)) | |
3844 (kill-buffer buffer)))) | |
3845 | 3840 |
3846 (defun capitalize-region-as-title (b e &optional buffer) | 3841 (defun capitalize-region-as-title (b e &optional buffer) |
3847 "Capitalize the words in the region, except for small words (as in titles). | 3842 "Capitalize the words in the region, except for small words (as in titles). |
3848 The words not capitalized are specified in `uncapitalized-title-words'." | 3843 The words not capitalized are specified in `uncapitalized-title-words'." |
3849 (interactive "r") | 3844 (interactive "r") |