emacs/lisp/+titlecase.el

27 lines
796 B
EmacsLisp

;;; +titlecase.el --- Titlecase extras -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(defun +titlecase-sentence-style-dwim ()
"Titlecase a sentence."
(interactive)
(titlecase-dwim 'sentence))
(defun +titlecase-org-headings ()
(interactive)
(save-excursion
(goto-char (point-min))
;; See also `org-map-tree'. I'm not using that function because I want to
;; skip the first headline. A better solution would be to patch
;; `titlecase-line' to ignore org-mode metadata (TODO cookies, tags, etc).
(let ((level (funcall outline-level)))
(while (and (progn (outline-next-heading)
(> (funcall outline-level) level))
(not (eobp)))
(titlecase-line)))))
(provide '+titlecase)
;;; +titlecase.el ends here