Function: TeX-font-replace-macro
TeX-font-replace-macro is a byte-compiled function defined in tex.el.
Signature
(TeX-font-replace-macro START END)
Documentation
Replace font specification around point with START and END.
For modes with font specifications like \font{text}.
See also TeX-font-replace and TeX-font-replace-function.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-font-replace-macro (start end)
"Replace font specification around point with START and END.
For modes with font specifications like `\\font{text}'.
See also `TeX-font-replace' and `TeX-font-replace-function'."
(let ((font-list TeX-font-list)
cmds strings regexp)
(while font-list
(setq strings (cdr (car font-list))
font-list (cdr font-list))
(and (stringp (car strings)) (null (string= (car strings) ""))
(setq cmds (cons (car strings) cmds)))
(setq strings (cdr (cdr strings)))
(and (stringp (car strings)) (null (string= (car strings) ""))
(setq cmds (cons (car strings) cmds))))
(setq regexp (mapconcat #'regexp-quote cmds "\\|"))
(save-excursion
(catch 'done
(while t
(if (/= ?\\ (following-char))
(skip-chars-backward "a-zA-Z "))
(skip-chars-backward (regexp-quote TeX-esc))
(if (looking-at regexp)
(throw 'done t)
(up-list -1))))
;; Use stripped syntax table in order to get stuff like "\emph{(}" right.
(with-syntax-table (TeX-search-syntax-table ?\{ ?\})
(forward-sexp 2))
(save-excursion
(replace-match start t t))
(delete-char -1)
(insert end))))