aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-01-30 03:43:24 +0000
committerRichard M. Stallman1993-01-30 03:43:24 +0000
commitc58455089774c50446a7599237220b1e29f8a2fd (patch)
treed32983df13c15d103ded52d0158f9ce3561e9f31
parentdf3bb2ab7c9fa7433e6e982e1c9df28dc2e45d18 (diff)
downloademacs-c58455089774c50446a7599237220b1e29f8a2fd.tar.gz
emacs-c58455089774c50446a7599237220b1e29f8a2fd.zip
(c-macro-expand): Use expanded name to write or delete.
Send two eofs.
-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."
41 (interactive "r") 41 (interactive "r")
42 (let ((outbuf (get-buffer-create "*Macroexpansion*")) 42 (let ((outbuf (get-buffer-create "*Macroexpansion*"))
43 (tempfile "%%macroexpand%%") 43 (tempfile "%%macroexpand%%")
44 expanded
44 process 45 process
45 last-needed) 46 last-needed)
47 (setq expanded (expand-file-name tempfile))
46 (save-excursion 48 (save-excursion
47 (set-buffer outbuf) 49 (set-buffer outbuf)
48 (erase-buffer)) 50 (erase-buffer))
@@ -63,19 +65,21 @@ and macros to predefine."
63 ;; Skip the last line of the macro definition we found. 65 ;; Skip the last line of the macro definition we found.
64 (forward-line 1) 66 (forward-line 1)
65 (setq last-needed (point))))) 67 (setq last-needed (point)))))
66 (write-region (point-min) last-needed tempfile nil 'nomsg) 68 (write-region (point-min) last-needed expanded nil 'nomsg)
67 ;; Output comment ender in case last #-directive is inside a comment. 69 ;; Output comment ender in case last #-directive is inside a comment.
68 ;; Also, terminate any string that we are in. 70 ;; Also, terminate any string that we are in.
69 (write-region "*//*\"*/\n" nil tempfile t 'nomsg) 71 (write-region "*//*\"*/\n" nil expanded t 'nomsg)
70 (write-region beg end (concat tempfile "x") nil 'nomsg) 72 (write-region beg end (concat expanded "x") nil 'nomsg)
71 (process-send-string process (concat "#include \"" tempfile "\"\n")) 73 (process-send-string process (concat "#include \"" tempfile "\"\n"))
72 (process-send-string process "\n") 74 (process-send-string process "\n")
73 (process-send-string process (concat "#include \"" tempfile "x\"\n")) 75 (process-send-string process (concat "#include \"" tempfile "x\"\n"))
76 (process-send-eof process)
77 ;; HPUX seems to want two eofs.
74 (process-send-eof process)) 78 (process-send-eof process))
75 (while (eq (process-status process) 'run) 79 (while (eq (process-status process) 'run)
76 (accept-process-output)) 80 (accept-process-output))
77 (delete-file tempfile) 81 (delete-file expanded)
78 (delete-file (concat tempfile "x")) 82 (delete-file (concat expanded "x"))
79 (display-buffer outbuf) 83 (display-buffer outbuf)
80 (save-excursion 84 (save-excursion
81 (set-buffer outbuf) 85 (set-buffer outbuf)