Function: f90-change-keywords
f90-change-keywords is a byte-compiled function defined in f90.el.gz.
Signature
(f90-change-keywords CHANGE-WORD &optional BEG END)
Documentation
Change the case of F90 keywords in the region (if specified) or buffer.
CHANGE-WORD should be one of upcase-word, downcase-word, capitalize-word.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/f90.el.gz
;; Change the keywords according to argument.
(defun f90-change-keywords (change-word &optional beg end)
"Change the case of F90 keywords in the region (if specified) or buffer.
CHANGE-WORD should be one of `upcase-word', `downcase-word', `capitalize-word'."
(save-excursion
(setq beg (or beg (point-min))
end (or end (point-max)))
(let ((keyword-re
(concat "\\("
f90-keywords-re "\\|" f90-procedures-re "\\|"
f90-hpf-keywords-re "\\|" f90-operators-re "\\)"))
(ref-point (point-min))
(modified (buffer-modified-p))
state saveword back-point)
(goto-char beg)
(unwind-protect
(while (re-search-forward keyword-re end t)
(unless (progn
(setq state (parse-partial-sexp ref-point (point)))
(or (nth 3 state) (nth 4 state)
;; GM f90-directive-comment-re?
(save-excursion ; check for cpp directive
(beginning-of-line)
(skip-chars-forward " \t0-9")
(looking-at "#"))))
(setq ref-point (point)
;; FIXME this does not work for constructs with
;; embedded space, eg "sync all".
back-point (save-excursion (backward-word-strictly 1)
(point))
saveword (buffer-substring back-point ref-point))
(funcall change-word -1)
(or (string= saveword (buffer-substring back-point ref-point))
(setq modified t))))
(or modified (restore-buffer-modified-p nil))))))