After afcd418, dockerfile-mode fails to load with:
File mode specification error: (file-missing Cannot open load file No such file or directory s)
This is because dockerfile-mode depends now on the function s-replace,
which is provided by the s package. This commit adds s to the list of
dependencies of dockerfile-mode.
Fixes#83.
In Emacs 29.1 the `point-at-bol` and `point-at-eol` functions are
obsolete. This removes the following warnings when compiling the file:
In dockerfile-indent-line-function:
dockerfile-mode.el:159:41: Warning: ‘point-at-bol’ is an obsolete function (as
of 29.1); use ‘line-beginning-position’ or ‘pos-bol’ instead.
dockerfile-mode.el:163:37: Warning: ‘point-at-eol’ is an obsolete function (as
of 29.1); use ‘line-end-position’ or ‘pos-eol’ instead.
dockerfile-mode.el:164:32: Warning: ‘point-at-eol’ is an obsolete function (as
of 29.1); use ‘line-end-position’ or ‘pos-eol’ instead.
dockerfile-mode.el:166:27: Warning: ‘point-at-bol’ is an obsolete function (as
of 29.1); use ‘line-beginning-position’ or ‘pos-bol’ instead.
It is safe to use these new functions as they were introduced as of
Emacs 20.
Rather than doing skips and arithmetics (and also hardcoding the empty
space — note that there's more "empty" code characters than just tabs
and spaces), let's just have a single "empty line" regexp.
The older code has been always deleting the whitespace, even if
indentation is already as expected. Fix that by replacing `indent-to`
with `indent-line-to` which avoids modifying the line if there's
nothing to modify.
As a bonus, this simplifies the code.
some terminals won't handle ANSI escape codes very well. By default, docker build uses "auto" for this flag but it is desirable in several cases to use "plain" as a value here.
The old pattern would match the following filenames:
- *Dockerfile
- *Dockerfile.*
This is because the pattern does not start with a slash indicating the
beginning of the basename. Personally this led to a few false positives,
like for example "siren-dockerfile.el" that sets up and configures
dockerfile-mode in my Emacs configuration.
This change restricts the patterns to:
- Dockerfile
- Dockerfile.*
- *.dockerfile
I believe this is still wide enough to capture all common naming
conventions for Dockerfiles.
`tab-width` is not the size of an indentation step.
> NOTE: This controls the display width of a TAB character, and not the size of an indentation step.
>
> see `describe-variable` `tab-width`
So, I add dockerfile-indent-offset and respect `standard-indent`.