emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/beancount 546163fd2c 102/103: flymake-bean-check: Send buf


From: ELPA Syncer
Subject: [nongnu] elpa/beancount 546163fd2c 102/103: flymake-bean-check: Send buffer contents over stdin
Date: Mon, 29 Apr 2024 15:59:49 -0400 (EDT)

branch: elpa/beancount
commit 546163fd2ccc007f28812faf5170eb954d3ca979
Author: Illia Ostapyshyn <ilya.ostapyshyn@gmail.com>
Commit: Martin Blais <blais@furius.ca>

    flymake-bean-check: Send buffer contents over stdin
---
 flymake-bean-check.el | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/flymake-bean-check.el b/flymake-bean-check.el
index 67d542c035..f4416a4ad2 100644
--- a/flymake-bean-check.el
+++ b/flymake-bean-check.el
@@ -53,6 +53,12 @@
 
 (defvar-local flymake-bean-check-process nil)
 
+(defun flymake-bean-check-cache-filename (file)
+  "Create the bean-check cache file name for FILE."
+  (let* ((backup-directory-alist (list (cons ".*" temporary-file-directory)))
+        (name (make-backup-file-name-1 file)))
+    (concat name ".~flymake-bean-check~")))
+
 ;;;###autoload
 (defun flymake-bean-check-enable ()
   "Enable checking via flymake."
@@ -72,15 +78,17 @@ in the enabled buffer. REPORT-FN is a function."
   (when (and flymake-bean-check-process
              (process-live-p flymake-bean-check-process))
     (kill-process flymake-bean-check-process))
-  (let ((source (current-buffer))
-        (buffer (generate-new-buffer "*flymake-bean-check*")))
+  (let* ((source (current-buffer))
+         (buffer (generate-new-buffer "*flymake-bean-check*"))
+         (cache-file (flymake-bean-check-cache-filename (buffer-file-name))))
     (setq flymake-bean-check-process
           (make-process :buffer buffer
                         :name "flymake-bean-check"
                         :noquery t
                         :connection-type 'pipe
                         :command (list flymake-bean-check-executable
-                                       (expand-file-name (buffer-file-name)))
+                                       "/dev/stdin"
+                                       "--cache-filename" cache-file)
                         :sentinel
                         (lambda (proc _event)
                           (when (memq (process-status proc) '(exit signal))
@@ -99,7 +107,9 @@ in the enabled buffer. REPORT-FN is a function."
                                                                        :error 
message)
                                               result)))
                                     (funcall report-fn (nreverse result))))
-                              (kill-buffer buffer))))))))
+                              (kill-buffer buffer))))))
+    (process-send-region flymake-bean-check-process (point-min) (point-max))
+    (process-send-eof flymake-bean-check-process)))
 
 (provide 'flymake-bean-check)
 ;;; flymake-bean-check.el ends here



reply via email to

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