Function: mantemp-insert-cxx-syntax
mantemp-insert-cxx-syntax is a byte-compiled function defined in
mantemp.el.gz.
Signature
(mantemp-insert-cxx-syntax)
Documentation
Insert C++ syntax around each template class and function.
Insert template class for classes, template for
functions and add the statement delimiter ; at the end of
the lines.
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/mantemp.el.gz
(defun mantemp-insert-cxx-syntax ()
"Insert C++ syntax around each template class and function.
Insert `template class' for classes, `template' for
functions and add the statement delimiter `;' at the end of
the lines."
(save-excursion
;; Insert ';' at the end of each nonempty line.
(goto-char (point-min))
(message "Inserting `;' at the ends")
(while (re-search-forward ".+$" nil t)
(progn
(insert ";")
(if (not (equal (point) (point-max)))
(forward-char))))
;; We first insert 'template class' at each nonempty line and
;; subsequently remove 'class' for functions so we don't need to
;; both scan for classes and functions.
(goto-char (point-min))
(message "Inserting `template class' for classes")
(while (re-search-forward "^.+" nil t)
(progn
(beginning-of-line)
(if (looking-at "struct[\\t ]+\\|class[\\t ]+")
(insert "template ")
(insert "template class "))))
(goto-char (point-min))
(message "Inserting `template' for functions")
(while (re-search-forward
"^template class [a-zA-Z :&*<>~=,0-9+!]*(" nil t nil)
(progn
(beginning-of-line)
(forward-word-strictly 1)
(delete-region (point) (progn (forward-word-strictly 1) (point)))))))