unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* recompile on save (not Elisp byte compilation)
@ 2024-06-11 22:48 Terje Larsen
  0 siblings, 0 replies; only message in thread
From: Terje Larsen @ 2024-06-11 22:48 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

Greetings, I wonder if there is any functionality like recompile on save
for the regular 'recompile' command from the compile package.

A while ago I created this functionality like this:

  (defun compile-on-save-start ()
    (let ((main-buffer (current-buffer))
          (compile-buffer (compilation-find-buffer)))
      (unless (get-buffer-process compile-buffer)
        (recompile)
        (switch-to-buffer-other-window main-buffer))))

  (define-minor-mode compile-on-save-mode
    "Minor mode to automatically call `recompile' whenever the
current buffer is saved. When there is ongoing compilation,
nothing happens."
    :lighter " CoS"
    (if compile-on-save-mode
        (progn  (make-local-variable 'after-save-hook)
                (add-hook 'after-save-hook 'compile-on-save-start nil t))
      (kill-local-variable 'after-save-hook)))

I re-discovered it today, when I thought it was something built-in to GNU
Emacs, but realized it was my own thing. This got me thinking that this is
probably something that would be nice to have as part of GNU Emacs.

What do you all think? Is there something like this already? Would it be
useful?

I have used it to compile things, run tests, generate diagrams etc.

-- 
Terje Larsen

[-- Attachment #2: Type: text/html, Size: 1718 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-11 22:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11 22:48 recompile on save (not Elisp byte compilation) Terje Larsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).