8000 GitHub · Where software is built
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
emacs-lisp checker reports false positives when function is called in rx macro #2117
Open
@pkryger

Description

@pkryger

Thank you for taking the time to report an issue and improve Flycheck. This template is for actual bugs you observed. If you have trouble setting up Flycheck, or if you have a question, please use the relevant issue template instead.

Checklist

  • I have checked existing issues for potential duplicates before creating this one.
  • I have read the Troubleshooting guide.

Bug description

When a function is called during rx macro expansion the function is reported as void.

For example, when using a a sample codefrom Info node (elisp) Extending Rx:

(defun n-tuple-rx (n element)
  `(seq "<"
        (group-n 1 ,element)
        ,@(mapcar (lambda (i) `(seq ?, (group-n ,i ,element)))
                  (number-sequence 2 n))
        ">"))
(rx-define n-tuple (n element) (eval (n-tuple-rx n 'element)))

(rx (n-tuple 3 (+ (in "0-9"))))

flycheck reports the following error in *Flycheck errors* buffer:

Symbol's function definition is void: n-tuple-rx

Steps to reproduce

Steps to reproduce the behavior:

  1. Start emacs -Q
  2. Evaluate the following:
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-refresh-contents)
(package-install 'flycheck)
  1. Find a new file, for example /tmp/foo.el
  2. Enable flycheck-mode
  3. Paste the following:
;; -*- lexical-binding: t -*-

(defun n-tuple-rx (n element)
`(seq "<"
      (group-n 1 ,element)
      ,@(mapcar (lambda (i) `(seq ?, (group-n ,i ,element)))
                (number-sequence 2 n))
      ">"))
(rx-define n-tuple (n element) (eval (n-tuple-rx n 'element)))

(rx (n-tuple 3 (+ (in "0-9"))))
  1. See error in *Flychek errors* buffer
  2. Call M-x elisp-byte-compile-file -> no error is reported.

[x] I have read https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems## Expected behavior

A clear and concise description of what you expected to happen.

flycheck should not report errors when calling functions inside rx macro.

Screenshots

Image

System configuration

Syntax checkers for buffer foo.el in emacs-lisp-mode:

First checker to run:

  emacs-lisp
    - may enable:    yes
    - may run:       t
    - executable:    Found at /nix/store/emacs/bin/emacs
    - next checkers: emacs-lisp-checkdoc

Checkers that are compatible with this mode, but will not run until properly configured:

  emacs-lisp-checkdoc (manually disabled) enable
    - may enable: yes
    - executable: Found at /nix/store/emacs/bin/emacs

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 20250226.1541
Emacs version:    31.0.50
System:           aarch64-unknown-linux-gnu
Window system:    nil

Emacs configuration:

  • Plain Emacs / Custom configuration
  • Spacemacs
  • Doom Emacs
  • Other shared configuration

Additional notes

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0