Commit graph

9623 commits

Author SHA1 Message Date
Mattias Engdegård
61190b5146 * lisp/emacs-lisp/byte-opt.el (byte-compile-nilconstp): Extend list. 2023-12-22 14:53:04 +01:00
Mattias Engdegård
c638a40d88 Ensure proper mode of *Compile-Log* buffer (bug#67920)
Reported by OGAWA Hirofumi.

* lisp/emacs-lisp/bytecomp.el (displaying-byte-compile-warnings):
Move most of the innards to...
(bytecomp--displaying-warnings): ...this new function, for ease
of maintenance.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
Wrap early warning about missing lexbind declaration in
`displaying-byte-compile-warnings` so that it doesn't cause the
creation of a compile-log buffer with the wrong mode.
2023-12-22 13:16:40 +01:00
Mattias Engdegård
9db1fe638e Encapsulate byte-compile-form-stack maintenance
* lisp/emacs-lisp/bytecomp.el (byte-compile-toplevel-file-form)
(byte-compile-form):
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
Use `macroexp--with-extended-form-stack` instead of explicit
push and pop.
2023-12-22 13:10:14 +01:00
Mattias Engdegård
25dc93c5c1 ; * lisp/emacs-lisp/cconv.el (cconv-convert): Reindent. 2023-12-21 13:20:27 +01:00
Mattias Engdegård
57fd0f47f6 Maintain byte-compile-form-stack in cconv-convert (bug#67483)
* lisp/emacs-lisp/macroexp.el (macroexp--with-extended-form-stack):
New.
* lisp/emacs-lisp/cconv.el (cconv-closure-convert, cconv-convert):
Push forms onto byte-compile-form-stack.
2023-12-21 13:20:27 +01:00
Mattias Engdegård
14ecc377ab Non-delayed warning for malformed function (bug#67483)
* lisp/emacs-lisp/cconv.el (cconv-convert): Use an immediate warning;
a delayed one made little sense as it's a matter of well-formedness.
2023-12-21 13:20:27 +01:00
João Távora
018cf86605 trace.el: use cl-print
Any non-trivial EIEO object in particular is impossible to read in the
*trace-output* buffer without this.  Functions, hash-tables, etc now
print as they do in backtrace buffers.

* lisp/emacs-lisp/trace.el (cl-print): Require it
(trace-entry-message, trace-exit-message): Use cl-prin1-to-string
2023-12-20 18:57:18 -06:00
Stefan Monnier
6937182a0e debug.el: Straighten the code that find the "base" of the backtrace
Let the caller tell us clearly where is the base of the backtrace,
if it's not `debug`.  This is done by passing a new `:backtrace-base`
keyword argument to `debug`.

Then use this info systematically in all the places where we access
the real C-level backtrace, to try and avoid inconsistencies and brittle
code that tries to enumerate the expected frames we're in.

* src/eval.c (get_backtrace_starting_at): Add support for offsets in the
`base` argument.
(Fbacktrace_debug): Add optional `base` argument.

* lisp/emacs-lisp/debug.el (debug, debugger-frame, debugger-frame-clear):
Use `debugger--backtrace-base` when calling `backtrace-debug`.
(debugger-setup-buffer): Use `debugger--backtrace-base`
when calling `backtrace-get-frames`.
(debugger-frame-number): Drop `skip-base` arg, assume it's never nil.
Add sanity check.
(debugger--backtrace-base): Use the `:backtrace-base` info
in `debugger-args`.
(debugger-eval-expression): Adjust call to `debugger-frame-number`.
(debug--implement-debug-on-entry): Pass appropriate `:backtrace-base`.
2023-12-18 17:52:58 -05:00
Stefan Kangas
06a12b0ccc ; Fix typos 2023-12-10 13:22:04 +01:00
Eli Zaretskii
486094126b Merge from origin/emacs-29
0f361cc985 ; Minor copyedits in description of ':box' face property
46fe7a17f5 Fix dragging mode line on text terminals with a mouse (bu...
12daf386f3 ; * doc/lispref/processes.texi (Network): Fix wording and...
037d858dc1 (rust-ts-mode): Set electric-indent-chars
dc9b733ab8 js-ts-mode: Highlight function parameters inside destruct...
4a72f13bdf js-ts-mode: Highlight property shorthands in assignments
83ed9018ed (js--treesit-font-lock-settings): Highlight parameters in...
ad0f87bb4c (js--treesit-font-lock-settings): Remove some duplicates
71c5f3694f ; Another fix of doc string of 'message-mail-user-agent' ...
04a39353ba ; * lisp/gnus/message.el (message-mail-user-agent): Doc f...
82ddcf37ec ; * doc/lispref/files.texi (Changing Files): Fix last cha...
89068516b3 Don't claim to signal an error when deleting a nonexistin...
4fd254e183 * lisp/indent.el (indent-rigidly): Improve prompt (bug#67...
5f923ff1a6 ; Fix typos
a1f88963f5 rust-ts-mode--comment-docstring: Handle block doc comments
a547b0e2e8 rust-ts-mode--comment-docstring: Fix/improve the previous...
2023-12-09 07:25:21 -05:00
Philip Kaludercic
1bb8d2327d Remove old VC packages from 'package-alist' after installing
* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Wait for all
system operations to have been completed, before proceeding to remove
old package descriptors from 'package-alist'.  This avoids loosing a
package if an error occurs during upgrades.
2023-12-09 10:04:35 +01:00
João Távora
dc744fe6f3 ElDoc: make eldoc-display-in-echo-are useful from M-x eldoc
M-x eldoc is ElDoc's interactive entry point for on-demand
documentation for users that don't want the behind-the-scenes idle
timer behaviour.

However, eldoc-display-in-echo-area, a member of
eldoc-display-functions, refused to do anything because it thought it
didn't have permission to use the echo area, which isn't true
in interactive use cases.  Fix that.

See also: https://github.com/joaotavora/eglot/discussions/1328

* lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Use
INTERACTIVE argument.  Rework comments.
(Version): Bump to 1.15.0
2023-12-05 15:53:43 -06:00
Stefan Monnier
df842a737d * lisp/emacs-lisp/package.el (package-activate-all): Fix second-order warning 2023-12-05 15:02:24 -05:00
Stefan Monnier
4f0239d814 (package-activate-all): Be more robust when quickstart fails
Quickstart can fail in all kinds of ways, for example if a package
was removed without updating the quickstart file.

* lisp/emacs-lisp/package.el (package-activate-all): Revert to the slow
path if the quickstart signals an error.
(package--activate-all): Fix compilation warning without an autoload.
2023-12-05 14:24:45 -05:00
Jens Schmidt
e670412a3e Update handling of advices during preload
* lisp/emacs-lisp/comp-common.el
(native-comp-never-optimize-functions): Remove macroexpand and
rename-buffer from default value.
* lisp/emacs-lisp/comp.el (comp-call-optim-form-call): Document call
optimization for advised primitives.
* lisp/emacs-lisp/nadvice.el (advice-add): Remove references to TODOs
that were completed already earlier.
* lisp/loadup.el: Disallow advices during preload.  (Bug#67005)
2023-12-04 21:43:31 +01:00
Andrea Corallo
f5e4524708 comp: Fix mvar dependency chain (bug#67239)
* lisp/emacs-lisp/comp.el (comp-add-cond-cstrs): Emit assume with
the original mvar as explicit rhs.
(comp-fwprop-insn): Add note.
* test/src/comp-tests.el (67239-1): Add new test.
* test/src/comp-resources/comp-test-funcs.el (comp-test-time)
(comp-test-67239-00-f, comp-test-67239-0-f, comp-test-67239-1-f):
Define.
2023-12-04 20:57:52 +01:00
Andrea Corallo
365114d3bd * lisp/emacs-lisp/comp.el (comp--native-compile): Better log. 2023-12-04 20:11:24 +01:00
Andrea Corallo
c8636b4635 comp: Rename some functions
* lisp/emacs-lisp/comp.el (comp--known-predicate-p)
(comp--pred-to-cstr, comp-edge, comp--edge-make)
(comp--block-preds, comp--gen-counter, comp-func)
(comp--equality-fun-p, comp--arithm-cmp-fun-p, comp--set-op-p)
(comp--assign-op-p, comp--call-op-p, comp--branch-op-p)
(comp--limple-insn-call-p, comp--type-hint-p)
(comp--func-unique-in-cu-p, comp--symbol-func-to-fun)
(comp--function-pure-p, comp--alloc-class-to-container)
(comp--add-const-to-relocs, comp--prettyformat-insn)
(comp--log-func, comp--log-edges, comp-emit-setimm)
(comp-emit-lambda-for-top-level, comp-add-cond-cstrs)
(comp-collect-calls, comp-compute-dominator-tree)
(comp-function-foldable-p, comp-function-call-maybe-fold)
(comp-func-in-unit, comp-call-optim-form-call)
(comp-dead-assignments-func, comp-tco)
(comp-remove-type-hints-func, comp-remove-type-hints)
(comp-compute-function-type, comp-finalize-relocs)
(comp-compile-ctxt-to-file): Rename and update.
2023-12-04 20:11:24 +01:00
Stefan Kangas
5f923ff1a6 ; Fix typos 2023-12-03 23:31:30 +01:00
Andrea Corallo
cf11fdfd8e * lisp/emacs-lisp/comp-run.el (bytecomp): Require it (bug#67590) 2023-12-03 22:25:12 +01:00
Stefan Monnier
9c1f24d7a4 * lisp/emacs-lisp/macroexp.el (macroexp-parse-body): Fix bug#67568
This fixes a regression introduced in commit f616edb4cc.
2023-12-03 14:22:48 -05:00
Vladimir Kazanov
c03d3fbf41 Add ert-font-lock
Add ert-font-lock as well as unit tests and testing resources.
* lisp/emacs-lisp/ert-font-lock.el: New library.
* test/lisp/emacs-lisp/ert-font-lock-resources/broken.js:
* test/lisp/emacs-lisp/ert-font-lock-resources/correct.js:
* test/lisp/emacs-lisp/ert-font-lock-tests.el: Unit tests.
(Bug#67460)
2023-12-03 15:17:58 +02:00
Eli Zaretskii
fb4b0b30a2 Revert "Ensure that directory is expanded in package-vc-checkout"
This reverts commit bf0b0c9c73.
It is only needed in Emacs 29.
2023-12-02 10:06:45 -05:00
Eli Zaretskii
14b62b1ae0 Merge from origin/emacs-29
cd477bf07d Fix behavior of 'split-root-window-*' with 'C-u'
2e5d47f578 ; * doc/lispintro/emacs-lisp-intro.texi (copy-to-buffer):...
c46700deb0 Add more text to clarify the behavior of 'with-current-bu...
687c416ce9 Fix example in Emacs user manual
835902179c ; Fix recent change in 'c-ts-mode'
169a5ff752 ; Fix typo in Gnus manual (bug#67469).
30841c71a5 Mention Titankey in Tramp, which has passed the tests
dab7cc241f Fix c-ts-mode indentation after if/else (bug#67417)
f8d9dc26c7 Fix indentation for else clause in c-ts-mode (bug#67417)
bf0b0c9c73 Ensure that directory is expanded in package-vc-checkout
e551dd72f7 * etc/PROBLEMS: Add entry about pinentry with gpgsm.  (Bu...
2023-12-02 10:05:50 -05:00
Mattias Engdegård
8525be6d5e Move malformed-function warning from byte-opt to cconv (bug#67483)
We shouldn't be warning inside the optimiser in the first place.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form):
Remove byte-compile-form-stack manipulation.
(byte-optimize-form-code-walker): Move malformed function warning
from here...
* lisp/emacs-lisp/cconv.el: ...to here.
2023-11-30 11:31:09 +01:00
Stefan Monnier
e3ed3bc755 * lisp/emacs-lisp/eieio-core.el (eieio-set-defaults): Silence errors
See bug#66938
2023-11-29 10:45:33 -05:00
Thierry Volpiatto
589e6ae1fb Improve register-preview (Fix bug#66394)
A minibuffer is used now instead of read-key.
Registers in preview buffer are now filtered according to type of
registers the current command requires.
Navigation with C-n/p or up/down is now provided and update
minibuffer.
Current register is highlighted in preview buffer.

* lisp/register.el: (register-preview-default-keys)
(register-use-preview): New user variables.
(register-preview-info): New structure to store various info for
 preview.
(register-command-info): New generic.
(register-preview-forward-line): New, provide navigation in preview
buffer.
(register-preview-next, register-preview-previous): New, navigation.
(register-type): New, returns register type.
(register--type): Generic fn, new, returns register type according
to value.
(register-of-type-alist): New, filter register-alist according to
type.
(register-preview): Signature changed, use TYPES now.
(register-preview-get-defaults): New generic, compute defauts
according to action.
(register-read-with-preview): Now use read-from-minibuffer and
minibuffer-setup-hook.

* lisp/emacs-lisp/cl-generic.el: Add a call to
'cl--generic-prefill-dispatchers' to fix a build error.
2023-11-29 15:52:52 +02:00
Alan Mackenzie
1dab381c82 Compiler optimizer: push forms onto byte-compile-form-stack
This fixes bug#67483.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form): Push and
pop FORM onto/off byte-compile-form-stack so that warning
messages get a position near to the erroneous source.
2023-11-27 15:36:36 +00:00
João Távora
36941e9e6a Font-lock shorthands with arbitrary punctuation (bug#67390)
* lisp/emacs-lisp/shorthands.el
(shorthands--mismatch-from-end): Rework and document.  Works like
CL's mismatch now.
(shorthands-font-lock-shorthands): Allow arbitrary punctuation
as separator for font-locking logic.
2023-11-26 15:49:59 -06:00
João Távora
f4bdc9b092 Add autoload cookie to autoload-compute-prefixes (bug#67325)
* lisp/emacs-lisp/loaddefs-gen.el (autoload-compute-prefixes): Add
autoload cookie.
2023-11-26 15:04:06 -06:00
Brandon
6c47931a1a Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)
Clones of instances of subclasses of 'eieio-instance-inheritor' didn't
delegate to their ':parent-instance' field when reading object fields
using ':accessor'.

* lisp/emacs-lisp/eieio.el (defclass): Remove 'slot-boundp' check for
:accessor's getter
* test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
(eieio-test-use-accessor-function-with-cloned-object): New test.

Copyright-paperwork-exempt: yes
2023-11-26 08:51:27 -05:00
Alan Mackenzie
6a01a1a856 .elc format: Record lambdas' doc strings lazily, not inline
Also refactor the pertinent part of bytecomp.el.

* lisp/emacs-lisp/bytecomp.el (byte-compile-output-file-form):
Use byte-compile-output-docform for all forms, not just those
with doc strings.
(byte-compile--output-docform-recurse): New function extracted
from byte-compile-output-docform.  This function recurses on
functions contained in the constants vector.
(byte-compile-output-docform): Extract parameter DOCINDEX from
the INFO list.  Add parameter CVECINDEX, the index of the
constants vector in FORM.
(byte-compile-file-form-defmumble): Several detailed
refactorings.  Call byte-compile-output-docform with the new
interface.
(byte-compile-output-as-comment): On exit, leave point after
the inserted text.  No longer assume that the output is being
inserted at the end of the buffer.
2023-11-26 12:25:30 +00:00
Joseph Turner
bf0b0c9c73 Ensure that directory is expanded in package-vc-checkout
* lisp/emacs-lisp/package-vc.el (package-vc-checkout): Expand
DIRECTORY.  (Bug#66115)
2023-11-26 12:40:27 +02:00
Eli Zaretskii
d8726dd382 Merge from origin/emacs-29
77ab00207d ; * admin/authors.el (authors-aliases): Add Noah Peart.
6f843f03dc typescript-ts-mode: Add missing 'operator' to treesit-fon...
0676a02931 Extend D-Bus doc and test
df094dd4bc Do not unregister a D-Bus service which is a unique name
e6ad97a333 Fix byte-compilation warnings about 'sqlite-rollback'
2023-11-25 06:42:53 -05:00
Eli Zaretskii
e6ad97a333 Fix byte-compilation warnings about 'sqlite-rollback'
* lisp/sqlite.el (sqlite-transaction, sqlite-commit)
(sqlite-rollback): Declare.
* lisp/emacs-lisp/multisession.el (sqlite-commit)
(sqlite-transaction): Remove declaration.
2023-11-24 09:30:53 +02:00
Po Lu
9db8c349f0 Merge from savannah/emacs-29
d72a4ed65c Fix 'with-sqlite-transaction' when BODY fails
a7b3c92373 ; * doc/emacs/cmdargs.texi (Initial Options): Fix last ch...
fd76a80864 ; Mention that -x and --script ignore file-locals
e0469ddb9d ; * doc/emacs/search.texi (Special Isearch): More accurat...
e521669fb3 Fix wording in ELisp Intro manual
da946ca692 Add missing python-ts-mode keyword (bug#67015)
0128495afd Fix string-pixel-width with global setting of display-lin...

# Conflicts:
#	etc/NEWS
2023-11-24 08:38:03 +08:00
Stefan Monnier
7705bdfa5b Adjust affected callers of derived-mode-p` to use the new convention
* lisp/align.el (align-rules-list): Prefer `derived-mode-p` over
`provided-mode-derived-p`.
(align--rule-should-run):
* lisp/window.el (display-buffer-reuse-mode-window):
* lisp/whitespace.el (whitespace-enable-predicate):
* lisp/transient.el (transient--do-suffix-p):
* lisp/so-long.el (so-long--set-auto-mode):
* lisp/simple.el (command-completion-with-modes-p):
* lisp/progmodes/tcl.el (tcl-current-word):
* lisp/progmodes/idlwave.el (idlwave-fix-keywords):
* lisp/progmodes/gdb-mi.el (gdb, gdb-locals-mode-map)
(gdb-registers-mode-map, gdb-function-buffer-p):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-style-setter)
(c-ts-mode-set-style):
* lisp/progmodes/bug-reference.el (bug-reference--try-setup-gnus-article):
* lisp/help-fns.el (help-fns--list-local-commands):
* lisp/emulation/viper.el (viper-mode)
(viper-this-major-mode-requires-vi-state):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--globalized-predicate-p):
* lisp/dired.el (dired-hide-details-mode, dired-click-to-select-mode):
* lisp/calendar/todo-mode.el (todo-reset-nondiary-marker)
(todo-reset-done-string, todo-reset-comment-string):
* lisp/vc/vc.el (vc-deduce-backend): Use new calling convention for
`derived-mode-p` and `provided-mode-derived-p`.
2023-11-23 11:59:49 -05:00
Andrea Corallo
7f359d2488 (package-quickstart-refresh): Generate marginally more efficient code
* lisp/emacs-lisp/package.el (package-quickstart-refresh): Include
only one copy of the file names.
2023-11-22 17:51:45 -05:00
Andrea Corallo
366c316a2f * Update 'native-comp-never-optimize-functions' version
* lisp/emacs-lisp/comp-common.el (native-comp-never-optimize-functions):
Update version.
2023-11-22 16:37:16 +01:00
Andrea Corallo
ea7a52dbae * Add 'eval' to 'native-comp-never-optimize-functions' (bug#67141)
* lisp/emacs-lisp/comp-common.el (native-comp-never-optimize-functions):
Add 'eval'.
2023-11-20 09:47:24 +01:00
Dmitry Gutov
0128495afd Fix string-pixel-width with global setting of display-line-numbers
* lisp/emacs-lisp/subr-x.el (string-pixel-width):
Instead of checking for display-line-numbers-mode, set the
display-line-numbers variable to nil (bug#67248).
2023-11-18 18:35:18 +02:00
Eli Zaretskii
f99de40efc Merge from origin/emacs-29
32a32853ce Typofix in the doc/lispref/modes.texi
f98637b51b ; Fix 'add-face-text-property' shortdoc
3fff22eb20 Fix spell-checking email message with citations
2023-11-18 06:07:47 -05:00
Eli Zaretskii
fe55361183 Merge from origin/emacs-29
5612fd21a0 Add two doc strings to cl-extra.el
2023-11-18 06:07:46 -05:00
Eli Zaretskii
bb64e3a798 Avoid loading cl-lib as result of invoking 'load-library'
* lisp/emacs-lisp/find-func.el (find-function--any-subform-p):
Don't use 'cl-destructuring-bind'.
(find-library--from-load-history): Don't use 'cl-loop'.
* lisp/thingatpt.el (thing-at-point): Don't use 'cl-loop'.  This
avoids loading cl-lib whenever thingatpt.el is loaded, for
example, as result of "M-x load-library".
2023-11-18 10:13:37 +02:00
Stefan Monnier
05213345c0 * lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates): Add null 2023-11-17 18:12:03 -05:00
Stefan Monnier
4194f9bd87 Merge branch 'derived-mode-add-parents' 2023-11-16 09:57:38 -05:00
Andrea Corallo
46c2fffd89 Clean-up some native-comp advice special handling.
* lisp/emacs-lisp/nadvice.el (advice--add-function): Clean-up
nativecomp special handling.
* lisp/emacs-lisp/advice.el (ad-add-advice): Likewise.
2023-11-16 10:33:13 +01:00
Andrea Corallo
4a2d39020c * lisp/emacs-lisp/nadvice.el (advice--add-function): Move func decl. 2023-11-16 09:05:27 +01:00
Spencer Baugh
7cfe088bc3 Don't infinite loop in map-y-or-n-p if at the end of kmacro
Previously, if map-y-or-n-p got -1 from read-event (indicating no
input due to the end of a keyboard macro), it would just infinite
loop.

Now it behaves like other commands which use read-event/read-char/etc,
and just errors when we try to look up -1 in our keymap and find
nothing.

Also, just for the sake of users, print a slightly prettier message
when this happens.

* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Don't loop if we reach
the end of a keyboard macro.  (Bug#67046)
2023-11-15 19:12:46 +02:00
Eshel Yaron
f98637b51b ; Fix 'add-face-text-property' shortdoc
* lisp/emacs-lisp/shortdoc.el (text-properties): Add missing
':no-eval' keyword.  (Bug#67138)
2023-11-14 16:10:37 +02:00