Function: bib-capitalize-title-region

bib-capitalize-title-region is an interactive and byte-compiled function defined in bib-mode.el.gz.

Signature

(bib-capitalize-title-region BEGIN END)

Documentation

Like capitalize-region, but don't capitalize stop words, except the first.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bib-mode.el.gz
(defun bib-capitalize-title-region (begin end)
   "Like `capitalize-region', but don't capitalize stop words, except the first."
   (interactive "r")
   (let ((case-fold-search nil) (orig-syntax-table (syntax-table)))
      (unwind-protect
	 (save-restriction
	    (set-syntax-table text-mode-syntax-table)
	    (narrow-to-region begin end)
	    (goto-char (point-min))
	    (if (looking-at "[A-Z][a-z]*[A-Z]")
	       (forward-word 1)
	       (capitalize-word 1))
	    (while (re-search-forward "\\<" nil t)
	       (if (looking-at "[A-Z][a-z]*[A-Z]")
		  (forward-word 1)
		  (if (let ((case-fold-search t))
			 (looking-at bib-capitalize-title-stop-regexp))
		     (downcase-word 1)
		     (capitalize-word 1)))
	       ))
	 (set-syntax-table orig-syntax-table))))