Skip to content

jira-issues fails to load: rx error "Bad character set: space" in jira-edit.el (Emacs 29.3) #78

Description

@leopoldfajtak

Summary

M-x jira-issues (and effectively the whole package, since jira.el requires jira-issuesjira-actionsjira-docjira-edit) fails to load on Emacs 29.3 because of an invalid rx expression in jira-edit.el.

Environment

  • jira.el version: 2.21.1 (also reproduced on current main, commit 1b1a436)
  • Emacs version: GNU Emacs 29.3
  • Installed via: package.el / elpa

Steps to reproduce

emacs -Q --batch --eval "(require 'jira)"

or simply (require 'jira) / M-x jira-issues in a normal Emacs session.

Actual behavior

Loading fails with:


Eager macro-expansion failure: (error "Bad character set: space")

Error: error ("Eager macro-expansion failure: (error \"Bad character set: space\")")
  ...
  internal-macroexpand-for-load((defvar jira-mark-keywords `((,(jira-edit--mark-matcher (rx "*" (not (or "*" space)) ...
  load-with-code-conversion(".../jira-edit.el" ...)
  require(jira-edit)
  load-with-code-conversion(".../jira-doc.el" ...)
  require(jira-doc)
  load-with-code-conversion(".../jira-actions.el" ...)
  require(jira-actions)
  load-with-code-conversion(".../jira-issues.el" ...)
  require(jira-issues)
  load-with-code-conversion(".../jira.el" ...)
  require(jira)

Because jira-edit.el fails to load, the require chain jirajira-issuesjira-actionsjira-docjira-edit aborts, so none of the package's commands (including jira-issues) work at all.

Root cause

In jira-edit.el, jira-mark-keywords uses two rx forms that mix a literal character with the named character class space inside (not (or ...)):

https://github.com/unmonoqueteclea/jira.el/blob/main/jira-edit.el#L81
https://github.com/unmonoqueteclea/jira.el/blob/main/jira-edit.el#L86

(rx "*" (not (or "*" space)) (*? (or "\\*" (not (or "\r" "\n")))) "*")
...
(rx bow "-" (not (or "-" space)) (+? (or "\\-" (not (or "\r" "\n")))) "-" eow)

rx's not/or combinator can build a negated character set when all alternatives are single literal characters (e.g. (not (or "\r" "\n")) works fine), but it cannot do so when one of the alternatives is a named character class such as space. This can be reproduced in isolation:

(require 'rx)
(rx (not (or "*" space)))
;; => error: "Bad character set: space"

(rx (not (any "*" space)))
;; => "[^*[:space:]]"   (works)

Suggested fix

Use any instead of or when building the negated character set, since any (unlike or) is designed to combine literal characters and named classes into a single character set:

(rx "*" (not (any "*" space)) (*? (or "\\*" (not (any "\r" "\n")))) "*")
...
(rx bow "-" (not (any "-" space)) (+? (or "\\-" (not (any "\r" "\n")))) "-" eow)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions