@@ -1102,91 +1102,7 @@ set (i.e., OPERATION is \\='set). This excludes, e.g., let bindings."
11021102 (not (member (f-filename (f-parent (buffer-file-name ))) '(" tests" )))))))
11031103
11041104(setup flycheck-eldev
1105- (:elpaca t )
1106- (:when-loaded
1107- ; ; flycheck-eldev rewrites the command of the emacs-lisp checker
1108- ; ; and uses that. The emacs-lisp checker uses `source-inplace' ,
1109- ; ; which uses a temp `flycheck_' file next to the original source.
1110- ; ; This doesn't play well with custode and eldev which ends up
1111- ; ; seeing both files and generating autoloads for both, which in
1112- ; ; turn makes elpaca throw up when it can't find the `flycheck_'
1113- ; ; file later. We work around this by redefining the emacs-lisp
1114- ; ; checker to use `source' instead which saves the file to a
1115- ; ; temporary directory.
1116- (put 'emacs-lisp 'flycheck-command '(" emacs" (eval flycheck-emacs-args) (eval (let ((path (pcase flycheck-emacs-lisp-load-path (`inherit load-path) (p (seq-map #'expand-file-name p))))) (flycheck-prepend-with-option " --directory" path))) (option " --eval" flycheck-emacs-lisp-package-user-dir nil flycheck-option-emacs-lisp-package-user-dir) (option " --eval" flycheck-emacs-lisp-initialize-packages nil flycheck-option-emacs-lisp-package-initialize) (option " --eval" flycheck-emacs-lisp-check-declare nil flycheck-option-emacs-lisp-check-declare) " --eval" (eval (flycheck-emacs-lisp-bytecomp-config-form)) " --eval" (eval flycheck-emacs-lisp-check-form) " --" source ))
1117-
1118- ; ; However, this makes flycheck-eldev unable to detect the
1119- ; ; package. This works, pushed upstream:
1120- ; ; https://github.com/flycheck/flycheck-eldev/issues/2
1121- (defun flycheck-eldev--build-command-line ()
1122- `(" --quiet" " --no-time" " --color=never" " --no-debug" " --no-backtrace-on-abort"
1123- ,@(if (flycheck-eldev-project-trusted-p default-directory)
1124- ; ; If the standard Emacs Lisp checker provides a command line we don't expect,
1125- ; ; throw it away and replace with one based on Flycheck 32. Otherwise we
1126- ; ; rewrite the command line provided by the standard checker, so we get any
1127- ; ; future improvements for free.
1128- (let* ((super (let ((flycheck-emacs-lisp-load-path nil )
1129- (flycheck-emacs-lisp-initialize-packages nil ))
1130- (flycheck-checker-substituted-arguments 'emacs-lisp )))
1131- (head (-drop-last 2 super))
1132- (tail (-take-last 2 super))
1133- (filename (cadr tail))
1134- (real-filename (buffer-file-name ))
1135- eval-forms)
1136- (while head
1137- (when (string= (pop head) " --eval" )
1138- (if (string-match-p (rx " (" (or " setq" " setf" ) " package-user-dir" ) (car head))
1139- ; ; Just discard, Eldev will take care of this. Binding
1140- ; ; `flycheck-emacs-lisp-package-user-dir' to nil would not be enough.
1141- (pop head)
1142- (push (pop head) eval-forms))))
1143- (unless (and (string= (car tail) " --" )
1144- (--any (string-match-p (rx " (byte-compile" ) it) eval-forms)
1145- (--any (string-match-p (rx " command-line-args-left" ) it) eval-forms))
1146- ; ; If the command line is something we don't expect, use a failsafe.
1147- (setf eval-forms `(,(flycheck-emacs-lisp-bytecomp-config-form) ,flycheck-emacs-lisp-check-form )))
1148- ; ; Explicitly specify various options in case a user has different defaults.
1149- `(" --as-is" " --load-newer"
1150- ; ; Don't load file `Eldev' or `Eldev-local' if we are checking it.
1151- ,@(cond ((file-equal-p real-filename " Eldev" )
1152- `(" --setup-first" ,(flycheck-sexp-to-string '(setf eldev-skip-project-config t ))))
1153- ((file-equal-p real-filename " Eldev-local" )
1154- `(" --setup-first" ,(flycheck-sexp-to-string '(setf eldev-skip-local-project-config t )))))
1155- ; ; Ignore the original file for project initialization purposes. If
1156- ; ; `eldev-project-main-file' is specified, this does nothing.
1157- " --setup-first"
1158- ,(flycheck-sexp-to-string
1159- `(advice-add #'eldev--package-dir-info :around
1160- (lambda (original )
1161- (eldev-advised
1162- (#'insert-file-contents
1163- :around (lambda (original filename &rest arguments )
1164- (if (file-equal-p filename ,real-filename )
1165- ; ; Load the temp
1166- ; ; file instead.
1167- (apply original ,filename arguments)
1168- (apply original filename arguments))))
1169- (funcall original)))))
1170- ; ; When checking project's main file, use the temporary as the main file
1171- ; ; instead.
1172- " --setup"
1173- ,(flycheck-sexp-to-string
1174- `(when (and eldev-project-main-file (file-equal-p eldev-project-main-file ,real-filename ))
1175- (setf eldev-project-main-file ,filename )))
1176- ; ; Special handling for test files: load extra dependencies as if testing
1177- ; ; now. Likewise for loading roots.
1178- " --setup"
1179- ,(flycheck-sexp-to-string
1180- `(when (eldev-filter-files '(,real-filename ) eldev-test-fileset)
1181- (apply #'eldev-add-extra-dependencies 'exec (cdr (assq 'test eldev--extra-dependencies)))
1182- (apply #'eldev-add-loading-roots 'exec (cdr (assq 'test eldev--loading-roots)))))
1183- " exec" " --load" " --dont-require" " --lexical"
1184- ,(flycheck-sexp-to-string `(eldev-output ,flycheck-eldev--byte-compilation-start-mark ))
1185- ,(flycheck-sexp-to-string `(setf command-line-args-left (list " --" ,filename )))
1186- ,@(nreverse eval-forms)))
1187- `(" --setup-first"
1188- ,(flycheck-sexp-to-string
1189- `(signal 'eldev-error '(,flycheck-eldev-project-is-not-trusted-error )))))))))
1105+ (:elpaca t ))
11901106
11911107(setup flyover
11921108 (:elpaca :host github :repo " konrad1977/flyover" )
0 commit comments