On Thu, Jan 25, 2018 at 3:17 PM Nicolas Goaziou wrote: > > I also like the blocks and keywords to be lower-cased. I see this in the > > latest commit on master: > > > https://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0 > > > > Did you do that lower-casing by hand? Or do you have an elisp snippet or > > some script that does that? > > IIRC, this was grep then eyeball and a macro to automatically convert > a line. > I got back to this task at hand, and this elisp command works just fine (based on export testing of a bunch of Org files). Let me know if I missed out on something (or did over-lower-casing) :) (defun modi/lower-case-org-keywords () "Lower case Org keywords and block identifiers. Example: \"#+TITLE\" -> \"#+title\" \"#+BEGIN_EXAMPLE\" -> \"#+begin_example\" Inspiration: https://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0 ." (interactive) (save-excursion (goto-char (point-min)) (let ((case-fold-search nil) (count 0)) ;; Match examples: "#+FOO bar", "#+FOO:", "=#+FOO=", "~#+FOO~", ;; ",#+FOO bar", "#+FOO_bar", "#+FOO". (while (re-search-forward "\\(?1:#\\+[A-Z_]+\\(?:_[[:alpha:]]+\\)*\\)\\(?:[ :=~]\\|$\\)" nil :noerror) (setq count (1+ count)) (replace-match (downcase (match-string-no-properties 1)) :fixedcase nil nil 1)) (message "Lower-cased %d matches" count)))) -- Kaushal Modi