|
1 | 1 | #!/bin/sh |
2 | 2 | :;#-*- mode: emacs-lisp; lexical-binding:t -*- |
3 | 3 | :;test -n "$EMACS_BIN" || EMACS_BIN=emacs |
4 | | -:;exec "$EMACS_BIN" -batch -Q --eval '(setq debug-on-error t internal--get-default-lexical-binding-function `always)' -l "$0" -- "$@" |
| 4 | +:;exec "$EMACS_BIN" -Q --script "$0" -- "$@" |
5 | 5 |
|
6 | 6 | ;; editorconfig-el --- EditorConfig Core executable in Emacs Lisp |
7 | 7 |
|
|
36 | 36 |
|
37 | 37 | ;;; Code: |
38 | 38 |
|
| 39 | +(setq debug-on-error t) ;; Not sure why we do that, but let's keep it. |
| 40 | + |
39 | 41 | (when (getenv "EDITORCONFIG_CORE_LIBRARY_PATH") |
40 | 42 | (setq load-path |
41 | 43 | (append (split-string (getenv "EDITORCONFIG_CORE_LIBRARY_PATH") |
@@ -99,29 +101,17 @@ with required output." |
99 | 101 | (defun main (argv) |
100 | 102 | ;; TODO: Read file list from stdin if - is given as FILENAME |
101 | 103 | (let ((parsed (editorconfig-bin-parse-args argv))) |
102 | | - (cl-case (length (car parsed)) |
103 | | - (0 |
104 | | - nil) |
105 | | - (1 |
106 | | - (dolist (p (editorconfig-core-get-properties (caar parsed) |
107 | | - (nth 1 parsed) |
108 | | - (nth 2 parsed))) |
109 | | - (princ (format "%s=%s\n" |
110 | | - (car p) |
111 | | - (cdr p))))) |
112 | | - (otherwise |
113 | | - (dolist (file (car parsed)) |
114 | | - (princ (format "[%s]\n" |
115 | | - file)) |
116 | | - (dolist (p (editorconfig-core-get-properties file |
117 | | - (nth 1 parsed) |
118 | | - (nth 2 parsed))) |
119 | | - (princ (format "%s=%s\n" |
120 | | - (car p) |
121 | | - (cdr p)))))))) |
122 | | - 0) |
123 | | - |
124 | | -;; car of command-line-args-left is "--" |
125 | | -(kill-emacs (main (cdr command-line-args-left))) |
| 104 | + (dolist (file (car parsed)) |
| 105 | + (unless (eq 1 (length (car parsed))) |
| 106 | + (princ (format "[%s]\n" |
| 107 | + file))) |
| 108 | + (dolist (p (editorconfig-core-get-properties file |
| 109 | + (nth 1 parsed) |
| 110 | + (nth 2 parsed))) |
| 111 | + (princ (format "%s=%s\n" |
| 112 | + (car p) |
| 113 | + (cdr p))))))) |
| 114 | + |
| 115 | +(kill-emacs (main (cdr (member "--" command-line-args-left)))) |
126 | 116 |
|
127 | 117 | ;;; editorconfig-el ends here |
0 commit comments