[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [h-e-w] Advice to compile ouput to buffer
From: |
Underwood, Jonathan |
Subject: |
RE: [h-e-w] Advice to compile ouput to buffer |
Date: |
Sat, 19 Oct 2002 16:21:12 -0400 |
Hi Scott,
Here's a function i hacked together to call an external program (indent) and
place it's output into a buffer if there is any, this may point you in the
right (or wrong:) ) direction.
jonathan.
(defun indent-c-buffer ()
"Indents the current buffer using indent-program. Saves prior to running
indent."
;; note: to save mark etc should prob use save-excursion, and let and
;; deactivate-mark. For another day.
(interactive)
(save-buffer)
(shell-command (concat indent-program " "
indent-args " "
(shell-quote-argument buffer-file-name)))
(revert-buffer t t)
(recenter)
(setq srcbuf (current-buffer))
(set-buffer "*Shell Command Output*") ;check output for errors
(if (not (eq (buffer-substring 1 7) "indent"))
(display-buffer "*Shell Command Output*")) ;display errors if any
(set-buffer srcbuf)
(message (concat (file-name-nondirectory buffer-file-name) "saved and
indented."))
)
> -----Original Message-----
> From: Scott Goldstein [mailto:address@hidden
> Sent: October 18, 2002 1:59 PM
> To: address@hidden
> Subject: [h-e-w] Advice to compile ouput to buffer
>
>
> I've created an advice function to compile. The advice
> function uses the
> built in call-process function to start a process outside of
> emacs. I would
> like the output of this process to appear at the beginning of
> the compilation
> buffer, *Compile-Log*.
>
> Could someone tell me how this can be done?
>
> Thanks.
>
> Scott
>
> ------------------------------------------------------------
> "Just a mirror for the sun...
> My smiling eyes are just a mirror for the sun."
> ------------------------------------------------------------
>
>
>