M gnu/local.mk => gnu/local.mk +1 -0
@@ 1210,6 1210,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-disable-jit-compilation.patch \
+ %D%/packages/patches/emacs-elisp-autofmt-fix-region-send.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-gnus-alias-reference-signature.patch \
M gnu/packages/emacs-xyz.scm => gnu/packages/emacs-xyz.scm +30 -19
@@ 372,8 372,8 @@ buffer, a file on your disk, or a string from the kill ring.")
(license license:gpl3+))))
(define-public emacs-elisp-autofmt
- (let ((commit "fa30ffc2320c41fc3827e2a800d40d7d5bcaddbe")
- (revision "0"))
+ (let ((commit "c2765641a9bd2b4c979e7055030fb7a145b6c118")
+ (revision "1"))
(package
(name "emacs-elisp-autofmt")
(version (git-version "0.1" revision commit))
@@ 385,35 385,46 @@ buffer, a file on your disk, or a string from the kill ring.")
(commit commit)))
(file-name (git-file-name name version))
(sha256
- (base32 "174cmqszhx42blqc6fjjf3lgaz2hasj15743hcrzj6a97nhx4wsj"))))
+ (base32 "0hgmlbxabzhwc1kw59hxvi9xgk6fh0jar4k82sb8yn1zznzhr0lk"))
+ (patches
+ (search-patches "emacs-elisp-autofmt-fix-region-send.patch"))))
(build-system emacs-build-system)
- (inputs (list python))
(arguments
(list
- #:test-command #~(list "make" "tests")
+ #:test-command #~(list "make" "test")
#:include #~(cons* "elisp-autofmt.py"
+ "elisp-autofmt-cmd.py"
"elisp-autofmt.overrides.json"
%default-include)
#:phases
#~(modify-phases %standard-phases
- (add-after 'unpack 'patch-dependencies
- (lambda* (#:key inputs #:allow-other-keys)
- (substitute* "elisp-autofmt.el"
- (("\"python\"")
- (string-append "\""
- (search-input-file inputs "/bin/python3")
- "\"")))))
;; TODO Remove when fixed upstream. See:
- ;; https://codeberg.org/ideasman42/emacs-elisp-autofmt/issues/36
+ ;; <https://codeberg.org/ideasman42/emacs-elisp-autofmt/issues/36>.
(add-before 'check 'fix-tests
(lambda _
(setenv "HOME" (getenv "TMPDIR"))
- (with-atomic-file-replacement "Makefile"
- (lambda (in out)
- (dump-port in out)
- (display "\n.PHONY: tests\n" out)))
- (substitute* "Makefile"
- (("python") "python3")))))))
+ (substitute* '("tests/full_compare_data/spell-fu.autofmt.data"
+ "tests/full_compare_data/simple.autofmt.data")
+ (("error \"Expected cache-header to be list, not %S\"")
+ "error
+ \"Expected cache-header to be list, not %S\"")
+ (("error \"Require cache version %S, not %S\"")
+ "error
+ \"Require cache version %S, not %S\"")
+ (("error \"Expected cache to contain a hash-table, not %S\"")
+ "error
+ \"Expected cache to contain a hash-table, not %S\"")
+ (("error \"Don.t know how to handle action %S\"")
+ "error
+ \"Don't know how to handle action %S\"")
+ (("error \"Cannot indirectly clone a buffer in %s mode\" mode-name")
+ "error \"Cxnnot indirectly clone a buffer in %s mode\" mode-name")
+ (("error \"Cannot indirectly clone a buffer in %s mode\"")
+ "error
+ \"Cannot indirectly clone a buffer in %s mode\"")
+ (("error \"Cxnnot indirectly clone a buffer in %s mode\" mode-name")
+ "error \"Cannot indirectly clone a buffer in %s mode\" mode-name")))))))
+ (inputs (list python-minimal-wrapper))
(home-page "https://codeberg.org/ideasman42/emacs-elisp-autofmt")
(synopsis "Auto-format Emacs lisp")
(description "This is a package to auto-format Emacs lisp.")
A gnu/packages/patches/emacs-elisp-autofmt-fix-region-send.patch => gnu/packages/patches/emacs-elisp-autofmt-fix-region-send.patch +50 -0
@@ 0,0 1,50 @@
+Author: Danny Milosavljevic <dannym@friendly-machines.com>
+Date: 2025-10-14
+Subject: Fix stdin-buffer handling in make-process path
+
+On Windows, make-process hangs, so a workaround path uses call-process
+with a temporary stderr file instead. This workaround path correctly
+handles the stdin-buffer parameter: only sending input when stdin-buffer
+is non-nil.
+
+The make-process path (used on Unix-like systems) was missing this
+logic. It unconditionally sent data from whatever buffer was current at
+function entry, completely ignoring the stdin-buffer parameter.
+
+This caused two bugs in the make-process path:
+1. When stdin-buffer is nil, it incorrectly sent data instead of closing
+ stdin immediately.
+2. When stdin-buffer is non-nil, it sent data from the wrong buffer.
+
+The fix adds the same conditional logic as the workaround path.
+
+diff -ru orig/emacs-elisp-autofmt/elisp-autofmt.el emacs-elisp-autofmt/elisp-autofmt.el
+--- orig/emacs-elisp-autofmt/elisp-autofmt.el 2025-10-01 11:52:38.833698871 +0200
++++ emacs-elisp-autofmt/elisp-autofmt.el 2025-10-02 09:43:45.366455005 +0200
+@@ -518,8 +518,12 @@
+ (setq sentinel-called-expect 2)
+ (set-process-sentinel proc-err (lambda (_proc _msg) (incf sentinel-called))))
+
+- (process-send-region proc-out (point-min) (point-max))
+- (process-send-eof proc-out)
++ (if stdin-buffer
++ (with-current-buffer stdin-buffer
++ (process-send-region proc-out (point-min) (point-max))
++ (process-send-eof proc-out))
++ ;; If there is no input buffer, just close the process's stdin immediately.
++ (process-send-eof proc-out))
+
+ (while (/= sentinel-called sentinel-called-expect)
+ (accept-process-output))
+diff -ru orig/emacs-elisp-autofmt/tests/test_generate_defs.py emacs-elisp-autofmt/tests/test_generate_defs.py
+--- orig/emacs-elisp-autofmt/tests/test_generate_defs.py 2025-10-01 11:52:38.834538726 +0200
++++ emacs-elisp-autofmt/tests/test_generate_defs.py 2025-10-02 09:55:24.504676023 +0200
+@@ -101,7 +101,7 @@
+ def test_check_simple(self) -> None:
+ data = generate_defs_package_as_json("subr")
+ self.assertEqual(data['functions']['with-syntax-table'], ['macro', 1, 'many', {'indent': 1}])
+- self.assertEqual(data['functions']['defvar-local'], ['macro', 1, 'many', {'doc-string': 3, 'indent': 'defun'}])
++ self.assertEqual(data['functions']['defvar-local'], ['macro', 2, 3, {'doc-string': 3, 'indent': 2}])
+
+
+ class SimpleTestBuiltinPackage_Simple(unittest.TestCase):