help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Waiting on compilation to finish before executing another function


From: Óscar Fuentes
Subject: Re: Waiting on compilation to finish before executing another function
Date: Fri, 16 Aug 2013 01:11:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Rami A <rami.ammari@gmail.com> writes:

> Ok. I tried something like this, but I keep getting errors, any pointers?
>
> (setq compilevar nil)  
> (defun compile-hgpull ()
>   (interactive)
>   (save-all-buffers)
>   (setq compilevar 1)
>   (compile-pkg "hg pull -u"))
>
> (defun notify-compilation-result ()
>   (if compilevar (revert-all-buffers))
>   (setq compilevar nil)
>   )
>
> (add-to-list 'compilation-finish-functions
>            'notify-compilation-result)

For assigning a buffer-local variable you use `setq-local', which sets
the variable associated to the *current* buffer. That's the other piece
missing in your code. So make sure that `compile-pkg' returns the buffer
returned by `compile' and replacing your compile-hgpull with this should
do the trick:

(defun compile-hgpull ()
  (interactive)
  (save-all-buffers)
  (with-current-buffer (compile-pkg "hg pull -u")
     (setq-local compilevar 1))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]