31 lines
1.0 KiB
EmacsLisp
31 lines
1.0 KiB
EmacsLisp
;;; +titlecase.el --- Titlecase extras -*- lexical-binding: t; -*-
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
(defun +titlecase-sentence-style-dwim (&optional arg)
|
|
"Titlecase a sentence.
|
|
With prefix ARG, toggle the value of
|
|
`titlecase-downcase-sentences' before sentence-casing."
|
|
(interactive "P")
|
|
(let ((titlecase-downcase-sentences (if arg (not titlecase-downcase-sentences)
|
|
titlecase-downcase-sentences)))
|
|
(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
|