Previously, many functions in vtable.el called 'vtable--cache',
which computed 'vtable--cache-key' based on the current selected
window and frame; this could cause vtable functions to fail or
misbehave if they were not called from the selected window and
frame that 'vtable-insert' was last called in.
Now, the vtable cache is stored with the text of the vtable, so
that functions which need to interact with some vtable text can
do so reliably without having to use the same selected window
and frame.
Also, 'vtable-update-object' has always required TABLE to be
present at point in the current buffer; now its docstring states
this.
* lisp/emacs-lisp/vtable.el (vtable--current-cache)
(vtable--cache-widths, vtable--cache-lines): Add.
(vtable-insert): Save cache in 'vtable-cache.
(vtable--ensure-cache, vtable--recompute-cache): Inline into
'vtable-insert'.
(vtable--widths, vtable--cache): Delete.
(vtable-update-object): Use 'vtable--current-cache' and
update docstring. (Bug#69837)
(vtable-remove-object, vtable-insert-object): Use
'vtable--current-cache' and save cache in 'vtable-cache'.
(vtable--sort, vtable--alter-column-width)
(vtable-previous-column, vtable-next-column): Use
'vtable--current-cache'.
Hopefully, this one is for good.
Use `file-truename` on all the input file/dir names to try and
make sure we don't get bitten any more by symlinks or driver
letter capitalization.
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Revert last change.
(loaddefs-generate--excluded-files): Remove test that's not needed any
more now that we use all relative names.
(loaddefs-generate--emacs-batch): Apply truename to all input files/dirs.
Rather than preload the `lisp-indent-function` property for
autoloaded macros, auto-load them to fetch their property.
In terms of cost, this slightly reduces the heap size at
startup, while tending to increase the heap size while editing
ELisp code since more packages will be (auto)loaded.
The benefit is elsewhere: by loading the definition the macro we
will also load other (non-autoloaded) definitions, so we get
better behavior for things like `ert.el` and `inline.el` where
only some of the macros are autoloaded, because there's a good
chance that we'll end up loading them to indent the autoloaded
macro, after which indentation of the other macros will be
performed correctly (bug#68818).
* lisp/emacs-lisp/byte-run.el (byte-run--dont-autoload): New function.
(macro-declarations-alist): Use it to override `byte-run--set-indent`.
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-function): Auto-load macros
if needed to get the indent info.
* lisp/emacs-lisp/warnings.el (display-warning): For warnings/errors
on the initial daemon frame use 'after-make-frame-functions'
to postpone their display until the first client frame is created.
(warning--display-buffer): New internal function refactored out of
'display-warning'.
* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Take the name of the .info file from the name of the source file,
instead of from the name of the package.
* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Use the buffer name of the output buffer instead of the buffer
name of the current buffer.
Chdir once and for all at the beginning to simplify the code.
Eliminate some redundant `expand-file-name`s and fix a broken use
of `expand-file-name` where we passed a list as second arg.
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Rename DIR to
DIRS, to clarify that it can be a list. Use `ensure-list`.
Don't pass DIR(S) directly to `expand-file-name`.
Remove redundant `expand-file-name`.
(loaddefs-generate--excluded-files): Add sanity checks.
Return relative file names since `loaddefs-generate` will make them
absolute anyway. Simplify.
(loaddefs-generate--emacs-batch): Chdir to `lisp-directory` and
simplify the rest accordingly.
This results in a healthy reduction of .elc file size (> 300 KiB saved)
as well as less memory use.
* lisp/emacs-lisp/bytecomp.el (byte-compile-get-constant):
Use 'equal-including-properties' as equivalence relation for all
constants, not just strings.
* etc/NEWS: Mention it. Strictly speaking it's not an incompatible
change because it doesn't break any earlier promises, but for people
having code that made incorrect assumptions, this provides a useful
explanation.
* lisp/emacs-lisp/cond-star.el (cond*): Document 'bind-and*'.
(bind-and*): Add a stub to raise an error if 'bind-and*' is used
outside of 'cond*'.
(cond*-convert-condition): Implement a new type of condition.
* lisp/emacs-lisp/map.el (map-contains-key): Hide old
implementation prior to f60fc128 behind a `fboundp', as the
package is distributed on ELPA and should be backwards
compatible to Emacs 26. (Bug#79711)
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Use the 'read-key'
branch only when the variable 'y-or-n-p-use-read-key' is non-nil.
Add a new cond-branch to read from the minibuffer.
Add a special case when def is nil in a kmacro in batch mode (bug#67836).
* test/lisp/files-tests.el (files-tests--with-buffer-offer-save):
Let-bind 'y-or-n-p-use-read-key' to t.
* doc/lispref/commands.texi (Reading One Event): Mention
'read-char-choice-use-read-key'.
* lisp/emacs-lisp/rmc.el (rmc--show-help): Show non-selected
resized Help window at bottom. Inhibit useless message.
Remove unnecessary call to 'pop-to-buffer'.
(read-multiple-choice): Call 'read-multiple-choice--from-minibuffer'
when 'read-char-choice-use-read-key' is nil.
(read-multiple-choice--from-minibuffer): New function.
* test/lisp/emacs-lisp/rmc-tests.el (test-rmc--with-minibuffer-setup):
New macro.
(test-read-multiple-choice, test-read-multiple-choice-help):
Test both values of 'read-char-choice-use-read-key'.
* lisp/emacs-lisp/cl-macs.el (cl-deftype): Support dispatch on
types that take arguments, as long as they can be used without arguments.
* lisp/emacs-lisp/cl-generic.el (cl--generic-derived-mode-specializers):
Rename from `cl--generic-derived-specializers` to clarify it's about
derived modes and not derived types.
(cl--generic-derived-mode-generalizer): Adjust accordingly and rename
from `cl--generic-derived-generalizer` for the same reason.
Ignore additional args in the tagcode function.
(cl-generic-generalizers) <derived-mode>: Adjust accordingly.
* lisp/emacs-lisp/macroexp.el (macroexp--dynamic-variable-p): Simplify.
* lisp/emacs-lisp/cl-extra.el (cl--types-of-memo): Delete var.
(cl--derived-type-specializers-memo): New var.
(cl-types-of): Delete function.
(cl--derived-type-specializers): New function.
(cl--derived-type-dispatch-list): Delete var.
(cl--derived-type-generalizer): Use the `:need-specializers` API instead.
(cl--derived-type-generalizers): Don't fill
`cl--derived-type-dispatch-list` any more.
* lisp/emacs-lisp/cl-preloaded.el (cl--derived-type-list): Delete var.
(cl--define-derived-type): Don't add type to `cl--derived-type-list`.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-types-test): Adjust.
Sometimes, the computation of the tag (or the computations of
the list of specializers corresponding to a tag) can be sped up
if we know the set of specializers we're looking for.
So we add a new API for both the TAGCODE-FUNCTION and SPECIALIZERS-FUNCTION
that lets them receive the set of specializers they need to consider (or any
information they can precompute from that), i.e. the set of specializers
handled by the same generalizer currently used by the generic function
for the the specific argument on which we're currently dispatching.
* lisp/emacs-lisp/cl-generic.el (cl-generic-define-generalizer):
Document new API.
(cl--generic-collect-specializers, cl--generic-filter-specializers)
(cl--generic--tagcode-with-specializers): New helper functions.
(cl--generic-get-dispatcher): Use them to support new API.
* lisp/emacs-lisp/bytecomp.el (byte-compile-get-constant):
No reason not to use 'assoc' to search for strings as well.
Previously we kept searching even after having found the string!
Calls to these functions were previously rewritten in terms of other
functions both in the optimiser and during codegen, for no good reason.
This also resulted in poor diagnostics: wrong-arity calls to 'atom' and
'nlistp' produced doubled but slightly-different warnings, and no
warnings at all for '/='.
Using compiler macros fixes the problems. The generated code is the same.
* lisp/emacs-lisp/bytecomp.el (byte-compile-negated)
(byte-compile-negation-optimizer): Replace with...
(bytecomp--define-negated): ...this compiler macro defining macro.
* lisp/emacs-lisp/bytecomp.el (byte-compile-cmp):
Don't assume that N-ary comparisons have been normalised, which is done
in the optimiser. Reported by Pip Cet.
Replace the use of 'elisp-scope-face(-1)' for analyzing face
specifications with 'elisp-scope-1' calls with an
appropriate OUTSPEC argument. This allows us to analyze
face specifications even when they are not passed directly
to relevant functions, but rather appear in a tail position
of a form that evaluates to a face specification.
* lisp/emacs-lisp/elisp-scope.el
(elisp-scope--match-spec-to-arg): Add new 'face' spec.
Use it instead of...
(elisp-scope-face, elisp-scope-face-1): ...these functions.
Remove them, no longer used.
* test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el:
Add test.
* lisp/emacs-lisp/inline.el (define-inline): Add `noinline` declaration.
* doc/lispref/functions.texi (Inline Functions): Mention it.
* lisp/emacs-lisp/cl-macs.el (cl--do-arglist): Avoid %s for lists in
format string.
(cl-dolist, cl-dotimes): Remove obsolete optimization.
(cl-defstruct): Use `define-inline` instead of `cl-defsubst` for accessors.
This removes the bespoke analyzer for 'let-alist'. It
required special accommodations in 'elisp-scope--symbol'
(which is otherwise very generic), and didn't bring any
concrete benefit for semantic highlighting purposes.
Instead, we rely on 'elisp-scope-1' macro-expanding
'let-alist' forms and analyzing the result.
* lisp/emacs-lisp/elisp-scope.el: Delete bespoke analyzer
definition for 'let-alist'.
(elisp-scope--current-let-alist-form): Remove, no longer used.
(elisp-scope--symbol, elisp-scope--handle-quoted): Simplify.
* lisp/emacs-lisp/elisp-scope.el: Require `cl-lib`.
[ We could instead replace the `cl-case`s with `pcase`. ]
(elisp-scope-cl-lambda-rest, elisp-scope-cl-lambda-key): Simplify.
* lisp/emacs-lisp/bytecomp.el (byte-compile--check-arity-bytecode)
(byte-compile-warn-about-unresolved-functions, byte-compile-form)
(byte-compile-free-vars-warn):
Delay checking whether a warning is enabled until we are about to emit
such a warning, since most warnings are enabled most of the time but
finding something to warn about is rare.
Some global minor modes require initialization. Those that are preloaded
currently abuse `custom-initialize-delay` for that, but it's suboptimal
and doesn't help those that aren't preloaded.
So introduce a new function to fill that need.
While at it, make `define-globalized-minor-mode` use it
automatically when useful.
* lisp/custom.el (custom-initialize-after-file-load): New function.
* lisp/tooltip.el (tooltip-mode):
* lisp/paren.el (show-paren-mode):
* lisp/rfn-eshadow.el (file-name-shadow-mode):
* lisp/epa-hook.el (auto-encryption-mode):
* lisp/minibuffer.el (minibuffer-regexp-mode, minibuffer-nonselected-mode):
* lisp/electric.el (electric-indent-mode): Use it instead of
`custom-initialize-delay` since the value does not depend on the
runtime context.
(electric-quote-mode): Don't use `custom-initialize-delay` since
the default value is nil anyway.
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Automatically add `:initialize` if needed.
* lisp/emacs-lisp/eldoc.el (global-eldoc-mode): Remove `:initialize`,
now provided automatically.
* doc/lispref/customize.texi (Variable Definitions):
* doc/lispref/modes.texi (Defining Minor Modes): Document and Suggest
`custom-initialize-after-file-load` instead of `custom-initialize-delay`.