Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let clojure-ts-mode derive from clojure-mode for Emacs 30+ #53

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

daanturo
Copy link
Contributor

@daanturo daanturo commented Sep 29, 2024

Emacs 30 defines the function derived-mode-add-parents that is used for the built-in *-ts-mode, this will make (provided-mode-derived-p 'clojure-ts-mode 'clojure-mode) return true just like other treesit major modes.


Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):

  • You've run M-x checkdoc and fixed any warnings in the code you've written.
  • You've updated the changelog (if adding/changing user-visible functionality).
  • You've updated the readme (if adding/changing user-visible functionality).

@daanturo daanturo force-pushed the derived-mode-add-parents branch 2 times, most recently from 3a4e694 to f348d03 Compare September 29, 2024 10:50
@@ -966,6 +966,9 @@ See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
(when (fboundp 'transpose-sexps-default-function)
(setq-local transpose-sexps-function #'transpose-sexps-default-function)))))

(when (fboundp #'derived-mode-add-parents)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest adding a comment here explaining this, given that this API is fairly new and unknown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I've done.

Emacs 30 defines the function `derived-mode-add-parents` that is used for the
built-in *-ts-mode, this will make (provided-mode-derived-p 'clojure-ts-mode
'clojure-mode) return true just like other treesit major modes.
@daanturo daanturo force-pushed the derived-mode-add-parents branch from f348d03 to fe1b9ea Compare September 29, 2024 15:56
@bbatsov bbatsov merged commit fd7e5da into clojure-emacs:main Sep 30, 2024
1 of 3 checks passed
@bbatsov
Copy link
Member

bbatsov commented Sep 30, 2024

Seems this change broke the CI's lint check. Please, take a look at the build failure when you can.

@sogaiu
Copy link

sogaiu commented Sep 30, 2024

Is this part of the problem?

[26:06.983]  Debugger entered--Lisp error: (bad-signature "buttercup-1.36.tar.sig")
               signal(bad-signature ("buttercup-1.36.tar.sig"))

@bbatsov
Copy link
Member

bbatsov commented Sep 30, 2024

I don't think so. Most like we're not running the lint job on Emacs 30, and this results in:

In end of data:
clojure-ts-mode.el:971:18: Warning: the function ‘derived-mode-add-parents’ is not known to be defined.
Indenting region... 
Indenting region...done
clojure-ts-mode.el:971:18 (byte-compile) Warning: the function ‘derived-mode-add-parents’ is not known to be defined.

@bbatsov
Copy link
Member

bbatsov commented Sep 30, 2024

Although I thought that the use of fboundp would be enough to make this pass on any Emacs version. Perhaps using boundp instead would solve this?

@daanturo
Copy link
Contributor Author

For some reasons removing the # in the fboundp check makes the linting complaint go away: daanturo@3014b15.

I tested locally with EMACS=emacs-29.4 eldev lint.

@bbatsov
Copy link
Member

bbatsov commented Sep 30, 2024

Yeah, it seems this has to be a regular symbol. I'll apply the fix now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants