From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Terje Larsen Newsgroups: gmane.emacs.devel Subject: recompile on save (not Elisp byte compilation) Date: Wed, 12 Jun 2024 00:48:30 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003e02e1061aa5119c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1966"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 12 08:09:46 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sHHB2-0000Lw-UE for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Jun 2024 08:09:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHHAS-00082F-0h; Wed, 12 Jun 2024 02:09:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHAIH-0001Ea-Ae for emacs-devel@gnu.org; Tue, 11 Jun 2024 18:48:45 -0400 Original-Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHAIF-0003wz-Of for emacs-devel@gnu.org; Tue, 11 Jun 2024 18:48:45 -0400 Original-Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-6ce533b6409so1255059a12.1 for ; Tue, 11 Jun 2024 15:48:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718146121; x=1718750921; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=wRcgtyH+WMAxA9DJfihDZwc+RpYqjaG4IEWvt647Y3o=; b=cCnZT11C8MC7jrfErY9WtV+ZfnWG8qXp+RA5H+9AmJNqM12lWuwd/VqcZVC++b/bWu NKuEZeRn8PuORUIoU+WoVnUEnU8b5apQRrQbXHvqzZGTfssChdEmqvkE2COz+cQ0TmRq XSoALflQ6OcmpTBkuvUFNQLVmcKSrM7KO3Bw0djL6qXleOjY2f09dYn6Lu0dRVPugLWB 7ospC88ltWRH2zvf1vUxOlRJl166jEj9sAMGr51lm2RXzuRZP/PK+FH+crgnvT7F1jOJ opq6OukMpL07YaRnmScqtq/xY3y91FZXsceqjDLolzYI6+SULq/ZXjiQ48B8eHpgGTmE /x/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718146121; x=1718750921; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wRcgtyH+WMAxA9DJfihDZwc+RpYqjaG4IEWvt647Y3o=; b=rYjeR+6MHhRP19g9pIvIS0kpVzfNJFPCgVAd9QPfFS+UpHy2+JzXhFgi2IFyNS7ZYP 7qow+wmNQS3ACTfKV685N29b18gLj2wKZxv0Qk+31fID+NhfNkFZYmqTRRN31Enhk3ge 34yhhcuos+H0zYw07jzdqirZxOeJf2wBusUHVXuZRy6inSJekmqWbeVHVHnIXXz2kug0 fMy/9FB+LSSH962yNW0O84+aAFQj6pB2uwguV4rmotZm+bc2PJhI0LwLz9kkhebk3gqc HfK2GQufr0UwkVXtRuPerWhMe/DeZWVbsdoBjauvMA8Wwwa+7rNdkV6fs53DBFwKNxQ8 Dugw== X-Gm-Message-State: AOJu0YxEeJmb8PWHznX/gtrGinpgIRDs7Cx4Yb+CpN2KVCSkhtbyrF4S zkSMZSdyEfZdCqGv1mXbOmMFMFfFcRbK40VWL0EAWOl3KkdlvaECHNPLbbUFOdTtN6Agz6G2ehS YZFV1jhqp9po9IzVF0AmD2Xjk30ZoWbRm X-Google-Smtp-Source: AGHT+IF40OkQwBDJ/EcvR7gu6ZL1LDR9N4SOSarsIDrfJHJVAkuXcp4dSUch5WDVQr4iu2vqL7APqoaqBdtvYI/BOyA= X-Received: by 2002:a05:6a20:3948:b0:1b5:d01d:1998 with SMTP id adf61e73a8af0-1b8a9b75f48mr415815637.10.1718146121463; Tue, 11 Jun 2024 15:48:41 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=terlar@gmail.com; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 12 Jun 2024 02:09:06 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319985 Archived-At: --0000000000003e02e1061aa5119c Content-Type: text/plain; charset="UTF-8" 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 --0000000000003e02e1061aa5119c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Greetings, I wonder if there is any functionality like rec= ompile on save for the regular 'recompile'=C2=A0command=C2=A0from t= he compile package.

A while ago I created this func= tionality like this:

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

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

I re-discove= red it today, when I thought it was something built-in to GNU Emacs, but re= alized it was my own thing. This got me thinking that this is probably some= thing 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 t= ests, generate diagrams etc.

--
Terje Larsen
=
--0000000000003e02e1061aa5119c--