aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/mantemp.el27
1 files changed, 20 insertions, 7 deletions
diff --git a/lisp/progmodes/mantemp.el b/lisp/progmodes/mantemp.el
index 16fc9b14e76..6c1ca3af27d 100644
--- a/lisp/progmodes/mantemp.el
+++ b/lisp/progmodes/mantemp.el
@@ -47,8 +47,8 @@
47;; turn this output into manual template instantiations, copy from the 47;; turn this output into manual template instantiations, copy from the
48;; first name of an objective file (here this is AFile.o) to right 48;; first name of an objective file (here this is AFile.o) to right
49;; after the very last `'' of the output. Put this in a buffer and 49;; after the very last `'' of the output. Put this in a buffer and
50;; call mantemp-make-mantemps-buffer with the point in the buffer. 50;; call `mantemp-make-mantemps-buffer' with the point in the buffer.
51;; You can also use mantemp-make-mantemps-region directly on the 51;; You can also use `mantemp-make-mantemps-region' directly on the
52;; region if the output is already in Emacs. 52;; region if the output is already in Emacs.
53;; 53;;
54;; The resulting buffer yields (connect the three output lines above 54;; The resulting buffer yields (connect the three output lines above
@@ -67,6 +67,17 @@
67;; which can be included in your C++ program. However, its probably 67;; which can be included in your C++ program. However, its probably
68;; better to include the necessary header files in the buffer and 68;; better to include the necessary header files in the buffer and
69;; compile it as a stand alone implementation file. 69;; compile it as a stand alone implementation file.
70;;
71;; Sometimes, an uninstantiated template may cause a message like the
72;; following
73;;
74;; main.cc:66: invalid use of undefined type
75;; `struct valarray<double,arrayminusopclass<double,c_array<double> > >'
76;;
77;; Follow the same procedure as above and the line is changed to
78;;
79;; template struct valarray<double,
80;; arrayminusopclass<double,c_array<double> > >;
70 81
71;; g++ does not output the templates that are needed by the 82;; g++ does not output the templates that are needed by the
72;; uninstantiated templates. Therefore you will often get new error 83;; uninstantiated templates. Therefore you will often get new error
@@ -139,7 +150,9 @@ the lines."
139 (while (re-search-forward "^.+" nil t) 150 (while (re-search-forward "^.+" nil t)
140 (progn 151 (progn
141 (beginning-of-line) 152 (beginning-of-line)
142 (insert "template class "))) 153 (if (looking-at "struct[\\t ]+\\|class[\\t ]+")
154 (insert "template ")
155 (insert "template class "))))
143 (goto-char (point-min)) 156 (goto-char (point-min))
144 (message "Inserting 'template' for functions") 157 (message "Inserting 'template' for functions")
145 (while (re-search-forward 158 (while (re-search-forward
@@ -167,12 +180,12 @@ should otherwise be empty.
167See the commentary in file mantemp.el for an example of use." 180See the commentary in file mantemp.el for an example of use."
168 (interactive) 181 (interactive)
169 (mantemp-make-mantemps) 182 (mantemp-make-mantemps)
170 (message "mantemp-make-mantemps-buffer is done")) 183 (message "Done"))
171 184
172(defun mantemp-make-mantemps-region () 185(defun mantemp-make-mantemps-region ()
173 "Make manual template instantiations from g++ error messages in the region. 186 "Make manual template instantiations from g++ error messages in the region.
174This function does the same as 187This function does the same thing as `mantemp-make-mantemps-buffer',
175'mantemp-make-mantemps-buffer' but operates on the region." 188but operates on the region."
176 (interactive) 189 (interactive)
177 (let ((cur-buf (current-buffer)) 190 (let ((cur-buf (current-buffer))
178 (mantemp-buffer (generate-new-buffer "*mantemp*"))) 191 (mantemp-buffer (generate-new-buffer "*mantemp*")))
@@ -186,7 +199,7 @@ This function does the same as
186 (set-buffer cur-buf) 199 (set-buffer cur-buf)
187 (yank) 200 (yank)
188 (kill-buffer mantemp-buffer)) 201 (kill-buffer mantemp-buffer))
189 (message "mantemp-make-mantemps-region is done")) 202 (message "Done"))
190 203
191(provide 'mantemp) 204(provide 'mantemp)
192 205