;;; mantemp.el --- create manual template instantiations from g++ 2.7.2 output
-;; Copyright (C) 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;; Free Software Foundation, Inc.
;; Author: Tom Houlder <thoulder@icor.fr>
;; Created: 10 Dec 1996
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published
-;; by the Free Software Foundation; either version 2, or (at your
+;; by the Free Software Foundation; either version 3, or (at your
;; option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful, but
"^[A-z :&*<>~=,0-9+]*>::operator " nil t nil)
(progn
(backward-char 11)
- (kill-line)))
+ (delete-region (point) (line-end-position))))
;; Remove other member function extensions.
(goto-char (point-min))
(message "Removing member function extensions")
(while (re-search-forward "^[A-z :&*<>~=,0-9+]*>::" nil t nil)
(progn
(backward-char 2)
- (kill-line)))))
+ (delete-region (point) (line-end-position))))))
(defun mantemp-sort-and-unique-lines ()
"Eliminate all consecutive duplicate lines in the buffer."
(progn
(forward-line -1)
(beginning-of-line)
- (kill-line 1)))))
+ (delete-region (point) (progn (forward-line 1) (point)))))))
(defun mantemp-insert-cxx-syntax ()
"Insert C++ syntax around each template class and function.
(progn
(beginning-of-line)
(forward-word 1)
- (kill-word 1)))))
+ (delete-region (point) (progn (forward-word 1) (point)))))))
(defun mantemp-make-mantemps ()
"Gathering interface to the functions modifying the buffer."
but operates on the region."
(interactive)
(let ((cur-buf (current-buffer))
- (mantemp-buffer (generate-new-buffer "*mantemp*")))
+ (mantemp-buffer (generate-new-buffer "*mantemp*"))
+ (str (buffer-substring (mark) (point))))
;; Copy the region to a temporary buffer, make the C++ code there
;; and copy the result back to the current buffer.
- (kill-region (mark) (point))
(set-buffer mantemp-buffer)
- (yank)
+ (insert str)
(mantemp-make-mantemps)
- (kill-region (point-min) (point-max))
+ (setq str (buffer-string))
(set-buffer cur-buf)
- (yank)
+ (insert str)
(kill-buffer mantemp-buffer))
(message "Done"))