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

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

Re: moy-compilation-schedule-execute.el


From: Matthieu Moy
Subject: Re: moy-compilation-schedule-execute.el
Date: Tue, 10 Feb 2004 18:08:39 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

Kevin Rodgers <address@hidden> writes:

>  > ;;;###autoload
>  > (defvar compilation-end-hook-once nil)
>  >
>  > ;;;###autoload
>  > (defvar compilation-end-hook nil)

> Why are the functions removed from the hook?  (That means they have to
> be added again each time you compile, right?)

You have  both options :  compilation-end-hook is a  "permanent hook",
and compilation-end-hook-once  is the set  of functions to run  at the
end of /this/ compilation. 

the typical use is this :

(defun moy-execute-in-ansi-term (buffer)
  (switch-to-buffer buffer)
  (term-send-raw-string "\n")
  )

;;;###autoload
(defun moy-compilation-schedule-execute-in-ansi-term ()

[...]

  (interactive)
  (moy-compilation-schedule-execute 'moy-execute-in-ansi-term))

I mapped it to C-M-RET, and the typical use is

Edit the source code
M-x recompile RET
switch to the shell buffer
./name_of_the_executable C-M-RET
Drink a coffee
When I come back, the compilation  is over and the executable has been
run.

But I don't want it to be run more than once ! 

> Why don't you use compilation-finish-functions, instead of defining a
> new hook variable (that in turn requires you to advise
> compilation-handle-exit to run it)?

Probably because I wasn't aware of this ^_^ ! 

(M-x apropos RET -hook$ RET didn't find it ...)

-- 
Matthieu


reply via email to

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