# HG changeset patch # User Richard M. Stallman # Date 728365404 0 # Node ID 1c7d06764d0d02e320692a119183ca170324f895 # Parent 5ad6249d10d44b56dae56f6634232d8e3e5939e6 (c-macro-expand): Use expanded name to write or delete. Send two eofs. diff -r 5ad6249d10d4 -r 1c7d06764d0d lisp/progmodes/cmacexp.el --- a/lisp/progmodes/cmacexp.el Sat Jan 30 02:16:57 1993 +0000 +++ b/lisp/progmodes/cmacexp.el Sat Jan 30 03:43:24 1993 +0000 @@ -41,8 +41,10 @@ (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 @@ ;; 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)