[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex-cont-latexmk 2a48f822c9 084/100: Deactivate when
From: |
ELPA Syncer |
Subject: |
[elpa] externals/auctex-cont-latexmk 2a48f822c9 084/100: Deactivate when the compilation buffer is killed |
Date: |
Thu, 6 Jun 2024 03:57:58 -0400 (EDT) |
branch: externals/auctex-cont-latexmk
commit 2a48f822c9ce9a9d392a13242397ca2108b23d6e
Author: Paul Nelson <ultrono@gmail.com>
Commit: Paul Nelson <ultrono@gmail.com>
Deactivate when the compilation buffer is killed
---
tex-continuous.el | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/tex-continuous.el b/tex-continuous.el
index fc809324ce..783b2be226 100644
--- a/tex-continuous.el
+++ b/tex-continuous.el
@@ -254,8 +254,10 @@ report diagnostics."
(defvar-local tex-continuous--subscribed-buffers nil
"List of buffers subscribed to the current LaTeX compilation.")
-(defun tex-continuous--unsubscribe ()
- "Unsubscribe from LaTeX compilation if the current buffer is in the list."
+(defun tex-continuous--unsubscribe (&optional nokill)
+ "Unsubscribe from LaTeX compilation if the current buffer is in the list.
+This kills the compilation buffer when its subscriber list becomes
+empty, except when NOKILL is non-nil."
(let ((buf (current-buffer))
(comp-buf tex-continuous--compilation-buffer)
done)
@@ -271,7 +273,25 @@ report diagnostics."
(interrupt-process process)
(sit-for 0.1)
(delete-process process))
- (kill-buffer comp-buf))))))
+ (unless nokill
+ (kill-buffer comp-buf)))))))
+
+(defvar-local tex-continuous--disable-function nil
+ "Function to disable `tex-continuous' features.
+This will be either `tex-continuous-mode-disable' or
+`tex-continuous-turn-off'.")
+
+(defun tex-continuous--disable ()
+ "Disable `tex-continuous' features."
+ (when tex-continuous--disable-function
+ (funcall tex-continuous--disable-function)))
+
+(defun tex-continuous--cancel-subscriptions ()
+ "Cancel all subscriptions to LaTeX compilation.
+This is called from the compilation buffer when it is killed."
+ (dolist (buf tex-continuous--subscribed-buffers)
+ (with-current-buffer buf
+ (tex-continuous--disable))))
(defun tex-continuous-mode-disable ()
"Disable `tex-continuous-mode' in all buffers."
@@ -298,9 +318,11 @@ report diagnostics."
(get-buffer comp-buf-name))
(special-mode)
(add-hook 'after-change-functions #'tex-continuous--update-time nil
t)
+ (add-hook 'kill-buffer-hook #'tex-continuous--cancel-subscriptions
nil t)
(push buf tex-continuous--subscribed-buffers))))
(add-hook 'kill-buffer-hook 'tex-continuous--unsubscribe nil t)
- (add-hook 'after-set-visited-file-name-hook 'tex-continuous-mode-disable
nil t)
+ (setq tex-continuous--disable-function 'tex-continuous-mode-disable)
+ (add-hook 'after-set-visited-file-name-hook 'tex-continuous--disable nil t)
(when tex-continuous--timer
(cancel-timer tex-continuous--timer)
(setq tex-continuous--timer nil))
@@ -309,7 +331,7 @@ report diagnostics."
(t
(tex-continuous--unsubscribe)
(remove-hook 'kill-buffer-hook 'tex-continuous--unsubscribe t)
- (remove-hook 'after-set-visited-file-name-hook
'tex-continuous-mode-disable t)
+ (remove-hook 'after-set-visited-file-name-hook 'tex-continuous--disable t)
(when tex-continuous--report-fn
(setq tex-continuous--report-fn nil)))))
@@ -326,8 +348,7 @@ Also set `flymake-diagnostic-functions' to
`tex-continuous-flymake'."
flymake-diagnostic-functions)
(setq-local flymake-diagnostic-functions '(tex-continuous-flymake))
(flymake-mode 1)
- (remove-hook 'after-set-visited-file-name-hook 'tex-continuous-mode-disable
t)
- (add-hook 'after-set-visited-file-name-hook 'tex-continuous-turn-off nil t)
+ (setq tex-continuous--disable-function 'tex-continuous-turn-off)
(message "tex-continuous-mode and flymake-mode enabled"))
(defun tex-continuous-turn-off ()
@@ -338,7 +359,6 @@ Also restore `flymake-diagnostic-functions'."
(flymake-mode 0)
(setq-local flymake-diagnostic-functions
tex-continuous--saved-flymake-diagnostic-functions)
- (remove-hook 'after-set-visited-file-name-hook 'tex-continuous-turn-off t)
(message "tex-continuous-mode and flymake-mode disabled"))
;;;###autoload
- [elpa] externals/auctex-cont-latexmk b208286d55 083/100: Add some tips to README, (continued)
- [elpa] externals/auctex-cont-latexmk b208286d55 083/100: Add some tips to README, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk a769d92a2c 100/100: rename: tex-continuous -> auctex-cont-latexmk, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 91870fa1a2 075/100: add ":after latex" to the use-package declaration, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk d2f6dbaae4 073/100: correct use-package declaration, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 1ffdaaf722 080/100: Add some clarifications and remarks to the readme, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 831be210d9 082/100: Deactivate upon file rename, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 5c367ff46e 091/100: Replace tex-continuous--build-file with TeX-master-output-file, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 6a9518e566 097/100: indentation, swap cl for seq, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk acfaf552b7 011/100: Add .html to .gitignore, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 119577bfdf 076/100: Allow latexmk completion to be detected based on timing, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 2a48f822c9 084/100: Deactivate when the compilation buffer is killed,
ELPA Syncer <=
- [elpa] externals/auctex-cont-latexmk 35cb9fac09 089/100: Check if compilation buffer has been killed before unsubscribing, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 5e9df47daf 086/100: Put errors without file or line number at end of buffer, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 78a651c254 093/100: add missing docstring, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk f30652de43 099/100: Preserve Flymake status and selected Flymake backends, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 79948cf651 066/100: tweaks, docs, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk b73ac67b86 085/100: New command tex-continuous-help-at-point, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 1c5248a3ac 087/100: expand README tips, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 654f3570a7 095/100: undo one change in last commit, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 531429b321 096/100: capitalize Flymake, ELPA Syncer, 2024/06/06
- [elpa] externals/auctex-cont-latexmk 8ed7904de5 055/100: maybe did ok, ELPA Syncer, 2024/06/06