summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cmacexp.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-01-30 03:43:24 +0000
committerRichard M. Stallman <rms@gnu.org>1993-01-30 03:43:24 +0000
commitc58455089774c50446a7599237220b1e29f8a2fd (patch)
treed32983df13c15d103ded52d0158f9ce3561e9f31 /lisp/progmodes/cmacexp.el
parentdf3bb2ab7c9fa7433e6e982e1c9df28dc2e45d18 (diff)
downloademacs-c58455089774c50446a7599237220b1e29f8a2fd.tar.gz
(c-macro-expand): Use expanded name to write or delete.
Send two eofs.
Diffstat (limited to 'lisp/progmodes/cmacexp.el')
-rw-r--r--lisp/progmodes/cmacexp.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el
index 1815bcd8d3b..144ac7ab56f 100644
--- a/lisp/progmodes/cmacexp.el
+++ b/lisp/progmodes/cmacexp.el
@@ -41,8 +41,10 @@ and macros to predefine."
(interactive "r")
(let ((outbuf (get-buffer-create "*Macroexpansion*"))
(tempfile "%%macroexpand%%")
+ expanded
process
last-needed)
+ (setq expanded (expand-file-name tempfile))
(save-excursion
(set-buffer outbuf)
(erase-buffer))
@@ -63,19 +65,21 @@ and macros to predefine."
;; Skip the last line of the macro definition we found.
(forward-line 1)
(setq last-needed (point)))))
- (write-region (point-min) last-needed tempfile nil 'nomsg)
+ (write-region (point-min) last-needed expanded nil 'nomsg)
;; Output comment ender in case last #-directive is inside a comment.
;; Also, terminate any string that we are in.
- (write-region "*//*\"*/\n" nil tempfile t 'nomsg)
- (write-region beg end (concat tempfile "x") nil 'nomsg)
+ (write-region "*//*\"*/\n" nil expanded t 'nomsg)
+ (write-region beg end (concat expanded "x") nil 'nomsg)
(process-send-string process (concat "#include \"" tempfile "\"\n"))
(process-send-string process "\n")
(process-send-string process (concat "#include \"" tempfile "x\"\n"))
+ (process-send-eof process)
+ ;; HPUX seems to want two eofs.
(process-send-eof process))
(while (eq (process-status process) 'run)
(accept-process-output))
- (delete-file tempfile)
- (delete-file (concat tempfile "x"))
+ (delete-file expanded)
+ (delete-file (concat expanded "x"))
(display-buffer outbuf)
(save-excursion
(set-buffer outbuf)