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

Address linting errors and restore support for Emacs <28 #77

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kisaragi-hiu
Copy link

@kisaragi-hiu kisaragi-hiu commented Apr 9, 2024

20240410T015614+0900

The errors in question

Each commit in this PR fixes a class of issues. This PR also turns on lexical-binding. Ths issues are:

  • 7d9054e string-replace was added in Emacs 28, so up until now this package only worked on Emacs 28 or above. This could be fixed by:

    • depending on compat.el (new feature polyfills for old Emacs versions)
    • declaring Emacs 28 as a requirement
    • or using s-replace from s.el.

    I chose to depend on s.el because (a) it's on MELPA as well, (b) this package was already copying s-blank? inline (as s-blank, with the wrong package prefix), and (c) there is no need to drop Emacs pre-28 here.

    I replaced the s-blank function previously defined by this package with s-blank? from s.el, and string-replace with s-replace.

  • c3ecb78 Package should have a Homepage or URL header. Previously this package was using a nonstandard "Website" header.

  • 8bd143e 2b25d09 Docstrings should:

    • include all arguments
    • have a first line that is a complete sentence less than 80 characters long
    • not have indentation for normal paragraphs (they would make it into the docstring, not be trimmed like in Python, and end up looking weird in *Help* pages)

    Moreover, there is a strong nudge to add docstrings to all functions and variables. There was just one function without a docstring, so I wrote one for it.

The parentheses and indentation style should also be updated to be more conventional for Emacs Lisp, to make it less painful to edit without introducing lots of style noise. That is not in scope of this PR though, to make this PR easier to review.

@gandarez gandarez requested a review from alanhamlett April 9, 2024 17:43
@kisaragi-hiu kisaragi-hiu changed the title Address linting errors Address linting errors and restore support for Emacs <28 Apr 21, 2024
Despite adding a third party dependency, this actually lowers the
version requirement down from Emacs 28.

This also removes the questionable "s-blank" function defined outside of
this package's namespace convention.
- The first line should be a full sentence, ending with a period.
- Despite that, it shouldn't be longer than 80 characters.
- The second line should not be indented. It reads weirdly in *Help* otherwise.
- Error messages should NOT end with a period.
This package does not appear to depend on dynamic binding. Lexical
binding has been a thing since Emacs 24. "Special" variables (those
defined with defvar and similar) are still dynamic in lexical binding
mode.

In general, lexical binding is either a bit faster or has zero impact,
and should always be turned on. Details:
https://nullprogram.com/blog/2016/12/22/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants