flycheck-inline icon indicating copy to clipboard operation
flycheck-inline copied to clipboard

Flycheck inline clashes with some flycheck-package errors

Open mattiasdrp opened this issue 11 months ago • 1 comments

Hi, thanks for this package :-)

I wrote this minimal init file:

(defvar elpaca-installer-version 0.10)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
                              :ref nil :depth 1 :inherit ignore
                              :files (:defaults "elpaca-test.el" (:exclude "extensions"))
                              :build (:not elpaca--activate-package)))
(let* ((repo  (expand-file-name "elpaca/" elpaca-repos-directory))
       (build (expand-file-name "elpaca/" elpaca-builds-directory))
       (order (cdr elpaca-order))
       (default-directory repo))
  (add-to-list 'load-path (if (file-exists-p build) build repo))
  (unless (file-exists-p repo)
    (make-directory repo t)
    (when (<= emacs-major-version 28) (require 'subr-x))
    (condition-case-unless-debug err
        (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
                  ((zerop (apply #'call-process `("git" nil ,buffer t "clone"
                                                  ,@(when-let* ((depth (plist-get order :depth)))
                                                      (list (format "--depth=%d" depth) "--no-single-branch"))
                                                  ,(plist-get order :repo) ,repo))))
                  ((zerop (call-process "git" nil buffer t "checkout"
                                        (or (plist-get order :ref) "--"))))
                  (emacs (concat invocation-directory invocation-name))
                  ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
                                        "--eval" "(byte-recompile-directory \".\" 0 'force)")))
                  ((require 'elpaca))
                  ((elpaca-generate-autoloads "elpaca" repo)))
            (progn (message "%s" (buffer-string)) (kill-buffer buffer))
          (error "%s" (with-current-buffer buffer (buffer-string))))
      ((error) (warn "%s" err) (delete-directory repo 'recursive))))
  (unless (require 'elpaca-autoloads nil t)
    (require 'elpaca)
    (elpaca-generate-autoloads "elpaca" repo)
    (load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))

;; Install use-package support
(elpaca bind-key)

(elpaca elpaca-use-package
        ;; Enable :ensure use-package keyword.
        (elpaca-use-package-mode)
        ;; Assume :ensure t unless otherwise specified.
        (setq elpaca-use-package-by-default t))

(use-package flycheck
  :hook ((prog-mode markdown-mode git-commit-mode text-mode) . flycheck-mode))

(use-package flycheck-inline
    :hook (flycheck-mode . flycheck-inline-mode))

;; Fix current package-lint bug
(use-package package-lint
   :ensure (:type git :host github :repo "mattiasdrp/package-lint" :branch "mattiasdrp-fix-stdlib-changes-bug"))

(use-package flycheck-package
  :hook (flycheck-mode . (lambda () (flycheck-package-setup))))

If I put the point on the first line I have the following error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  min(1 nil nil nil)
  flycheck-inline-display-errors((#s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp :filename "/home/mattias/test_emacs/init.el" :line 1 :column 1 :message "file has no ‘lexical-binding’ directive on its first line" :level warning :id nil :group nil :-end-line nil :-end-column nil) #s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp-checkdoc :filename "/home/mattias/test_emacs/init.el" :line 0 :column nil :message "The first line should be of the form: \";;; package --- Summary\"" :level info :id nil :group nil :-end-line nil :-end-column nil) #s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp-checkdoc :filename "/home/mattias/test_emacs/init.el" :line 0 :column nil :message "You should have a section marked \";;; Commentary:\"" :level info :id nil :group nil :-end-line nil :-end-column nil) #s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp-checkdoc :filename "/home/mattias/test_emacs/init.el" :line 1 :column nil :message "You should have a section marked \";;; Code:\"" :level info :id nil :group nil :-end-line nil :-end-column nil)))
  flycheck-display-errors((#s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp :filename "/home/mattias/test_emacs/init.el" :line 1 :column 1 :message "file has no ‘lexical-binding’ directive on its first line" :level warning :id nil :group nil :-end-line nil :-end-column nil) #s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp-checkdoc :filename "/home/mattias/test_emacs/init.el" :line 0 :column nil :message "The first line should be of the form: \";;; package --- Summary\"" :level info :id nil :group nil :-end-line nil :-end-column nil) #s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp-checkdoc :filename "/home/mattias/test_emacs/init.el" :line 0 :column nil :message "You should have a section marked \";;; Commentary:\"" :level info :id nil :group nil :-end-line nil :-end-column nil) #s(flycheck-error :buffer #<buffer init.el> :checker emacs-lisp-checkdoc :filename "/home/mattias/test_emacs/init.el" :line 1 :column nil :message "You should have a section marked \";;; Code:\"" :level info :id nil :group nil :-end-line nil :-end-column nil)))
  flycheck-display-error-at-point()
  apply(flycheck-display-error-at-point nil)
  timer-event-handler([t 26557 54813 923453 nil flycheck-display-error-at-point nil nil 930000 nil])

If I disable flycheck-inline, I see this message in the minibuffer:

The first line should be of the form: ";;; package --- Summary"
You should have a section marked ";;; Commentary:"
You should have a section marked ";;; Code:"

mattiasdrp avatar Feb 25 '25 14:02 mattiasdrp

Getting the same error. See #26 . Please fix this.

hrehfeld avatar Apr 11 '25 12:04 hrehfeld