Commit graph

8425 commits

Author SHA1 Message Date
Lars Ingebrigtsen
2736e61274 Fix define-obsolete-function-alias formatting in loaddefs-gen.el
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form):
Fix formatting of define-obsolete-function-alias statements
(bug#56292).
2022-06-30 21:33:46 +02:00
Stefan Monnier
15b2138719 (syntax-wholeline-max): New var
Try and reduce the pain caused by font-lock and syntax-propertize's
wholeline-based operation in buffers made up of a few very long lines
(bug#45898).

* lisp/emacs-lisp/syntax.el (syntax-wholeline-max): New var.
(syntax--lbp): New function.
(syntax-propertize-wholelines): Use it.

* lisp/jit-lock.el (jit-lock--antiblink-post-command): Use `syntax--lbp`.

* lisp/font-lock.el (font-lock-extend-region-wholelines): Rewrite,
using `syntax-propertize-wholelines`.
2022-06-30 13:20:33 -04:00
Mattias Engdegård
77e99dcacb ; * lisp/emacs-lisp/rx.el: Don't set indentation prop for repeat. 2022-06-30 15:19:15 +02:00
Mattias Engdegård
a68508c10b Don't say that macro-expansion error is a warning
* lisp/emacs-lisp/gv.el:
* lisp/emacs-lisp/macroexp.el (internal-macroexpand-for-load): Since
eager macro-expansion errors are no longer warnings, don't say so.
2022-06-30 15:08:02 +02:00
Mattias Engdegård
00dbc5937d Don't change indentation rules for >= and =
* lisp/emacs-lisp/rx.el: `>=` and `=` are much more likely functions
than RX constructs and the indentation machinery currently has
no way to tell them apart.
Suggested by Michael Herdeegen.
2022-06-30 14:41:20 +02:00
Stefan Kangas
b77d8617e7 ; * lisp/emacs-lisp/testcover.el: Remove duplicate provide. 2022-06-30 14:12:12 +02:00
Lars Ingebrigtsen
80cf13a3d2 Make "eager macro-expansion" warning into an error
* doc/lispref/loading.texi (How Programs Do Loading): Update
documentation.

* lisp/emacs-lisp/macroexp.el:
(internal-macroexpand-for-load): We've been warning about eager
macro expansion for many years, so finally change that into an
error (bug#18154).
2022-06-30 13:18:15 +02:00
Lars Ingebrigtsen
2f0ed2280e Add find-function-setup-keys bindings for find-library commands
* lisp/emacs-lisp/find-func.el (find-function-setup-keys): Add `L'
bindings for the find-library family of commands (bug#51240).
2022-06-30 12:49:40 +02:00
Lars Ingebrigtsen
febefd6adb Add provide to testcover
* lisp/emacs-lisp/testcover.el (testcover): Provide (bug#55388).
2022-06-30 10:58:14 +02:00
Mattias Engdegård
3447e79f24 * lisp/emacs-lisp/rx.el: Indent some rx constructs correctly.
This includes group-n, submatch-n, =, >=, ** and repeat, whose first 1
or 2 arguments are special.
2022-06-29 17:27:30 +02:00
Stefan Monnier
7a9353d444 (cl--generic-compiler): Revert last change
That change (introduced to circumvent an error now that `seq.el` is
preloaded) caused all dispatchers to be left uncompiled, which slows down
method dispatch very significantly.  Fix the problem in the old way,
i.e. by adding an explicit call to `cl--generic-prefill-dispatchers`.

* lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Revert last change.
Add (cl--generic-prefill-dispatchers 1 integer) instead to handle
the new dispatchers needed for `seq.el`.
(cl--generic-prefill-generalizer-sample): New function.
(cl--generic-get-dispatcher): Use it to signal an error giving precise
instructions for what to do if we're about the load the byte-compiler
during the preload.
(cl--generic-oclosure-generalizer): Rename from
`cl-generic--oclosure-generalizer` for consistency with all
other generalizers.
2022-06-29 08:58:13 -04:00
Lars Ingebrigtsen
98c9105f05 Allow using define-short-documentation-group without loading shortdoc
* lisp/emacs-lisp/shortdoc.el (define-short-documentation-group):
Allow using without loading shortdoc.el (bug#56260).
2022-06-28 14:43:03 +02:00
Lars Ingebrigtsen
513acdc9b4 Allow plist-get/plist-put/plist-member to take a comparison function
* doc/lispref/lists.texi (Plist Access): Document it.

* lisp/filesets.el (filesets-reset-fileset)
(filesets-ingroup-cache-get):
(filesets-ingroup-cache-put):
(filesets-build-menu-now): Don't use lax-plist functions.

* lisp/simple.el (lax-plist-put, lax-plist-get): Moved here from
fns.c and make obsolete.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Don't mark
plist functions as side-effect-free or pure.

* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Adjust type.

* lisp/emacs-lisp/shortdoc.el (list): Don't document deprecated
functions.

* src/xdisp.c (build_desired_tool_bar_string):
(display_mode_element):
(store_mode_line_string):
(display_string):
(produce_stretch_glyph):
(note_mode_line_or_margin_highlight):
(note_mouse_highlight):
* src/w32.c (serial_configure):
* src/sysdep.c (serial_configure):
* src/sound.c (parse_sound):
* src/process.c (Fset_process_buffer):
(Fset_process_sentinel):
(Fprocess_contact):
(Fmake_process):
(Fmake_pipe_process):
(Fset_network_process_option):
(Fserial_process_configure):
(Fmake_serial_process):
(set_network_socket_coding_system):
(finish_after_tls_connection):
(connect_network_socket):
(Fmake_network_process):
(server_accept_connection):
* src/lread.c (ADDPARAM):
(hash_table_from_plist):
* src/keyboard.c (make_lispy_position):
* src/indent.c (check_display_width):
* src/image.c (postprocess_image):
* src/gnutls.c (gnutls_verify_boot):
(Fgnutls_boot):
(gnutls_symmetric):
(Fgnutls_hash_mac):
(Fgnutls_hash_digest):
* src/dired.c (filter):
* src/data.c (add_to_function_history):
* src/coding.c (Fcoding_system_put): Adjust callers from
Fplist_put (etc) to plist_put.

* src/fns.c (plist_get):
(plist_put):
(plist_member): New functions (without optional third parameter)
to be used in C code.

* src/fns.c (Fplist_get, Fplist_put, Fplist_member): Take an
optional predicate parameter (bug#47425).

* src/lisp.h: Declare new plist_put, plist_get and plist_member
functions.

* test/lisp/json-tests.el (test-json-add-to-plist): Use plist-get.

* test/src/fns-tests.el (test-cycle-lax-plist-get):
(test-cycle-lax-plist-put):
(lax-plist-get/odd-number-of-elements):
(test-plist): Remove lax-plist tests, since semantics have changed
(they no longer error out on cycles).
2022-06-27 12:22:05 +02:00
Mattias Engdegård
f2a5d48e89 Optimise away functions in for-effect context
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Turn functions into nil when compiled for-effect since they have no
side-effects on their own.  This may enable further improvements such
as the elimination of variable bindings.
`unwind-protect` forms can be treated as plain function call at this
point.  In particular, their unwind function argument should be
not optimised for effect since it's a function.
2022-06-26 20:43:28 +02:00
Lars Ingebrigtsen
8f5d9d0abd Fix a recent Lisp mode filling test failure
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Restore the
"fill first line separately" logic.
2022-06-26 16:31:43 +02:00
Stefan Monnier
6a96d17734 * lisp/emacs-lisp/syntax.el: Rework the handling of nested calls.
Nested calls to `syntax-ppss` and `syntax-propertize` can easily
happen unexpectedly via ondemand propertizing or `forward-sexp`.
Refine the handling of nested calls so we detect them more reliably
(e.g. also within `syntax-propertize-extend-region-functions`)
and so that the `syntax-ppss` cache is automatically flushed in case
it might have been filled with data that's become obsolete since.

(syntax-propertize--inhibit-flush): Delete var.
(syntax-propertize--in-process-p): New function to replace it.
(syntax-ppss-flush-cache): Use it.
(syntax-ppss--updated-cache): New var.
(syntax-propertize): Make `syntax-propertize--done` binding apply to
`syntax-propertize-extend-region-functions` as well, as intended (fixes
bug#46713).  Use `syntax-ppss--updated-cache` to flush
syntax-ppss cache at the end when needed.
Don't bind `syntax-propertize--inhibit-flush` any more.
(syntax-ppss): Set `syntax-ppss--updated-cache` when applicable.
2022-06-26 08:59:38 -04:00
Lars Ingebrigtsen
040c03cae2 Make `M-q' work on the first line of a multi-line string again
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Exclude the
quote marks from the region so that filling works (bug#56197).
2022-06-25 14:58:17 +02:00
Lars Ingebrigtsen
2f346b0ab1 Re-fix build warnings about subr-x defsubsts
* lisp/term/haiku-win.el (require):
* lisp/progmodes/elisp-mode.el (require):
* lisp/isearch.el (require): Require subr-x at compile time, since
these use defsubsts/macros from there.

* lisp/emacs-lisp/subr-x.el (string-empty-p): Move from here...
* lisp/simple.el (string-empty-p): ... to here.  This is to help
with a build problem where files.el is using the defsubst, but
requiring subr-x.el at compile time leads to load errors.
2022-06-25 12:20:05 +02:00
Mattias Engdegård
253a4a2c68 Bytecode opcode comments update
This is a cosmetic change only; there is no change in behaviour.

* lisp/emacs-lisp/bytecomp.el:
* src/bytecode.c (BYTE_CODES, exec_byte_code):
Update and/or remove incorrect, outdated or useless comments.
Clarify.  Reorder where appropriate.  Rename Bsave_current_buffer to
Bsave_current_buffer_OBSOLETE and Bsave_current_buffer_1 to
Bsave_current_buffer, reflecting the state since 1996.
2022-06-24 11:48:42 +02:00
Lars Ingebrigtsen
0c784a483f Update seq.el comment
* lisp/emacs-lisp/seq.el: Update comment.
2022-06-24 11:15:19 +02:00
Lars Ingebrigtsen
bed9fd41ef Allow read-multiple-choice to do long-form answers
* doc/lispref/commands.texi (Reading One Event): Document it.

* lisp/emacs-lisp/rmc.el (read-multiple-choice): Allow using
long-form answers instead of single character ones.
(read-multiple-choice--long-answers): New function.
(read-multiple-choice--short-answers): Refactored out from the
main function.
2022-06-24 11:04:51 +02:00
Lars Ingebrigtsen
49910adf87 Fix cl-generic bootstrap problems
* lisp/sqlite-mode.el (require):
* lisp/net/eudc.el (require):
* lisp/arc-mode.el (require): Require subr-x, since these files
are using macros from there.
* lisp/emacs-lisp/subr-x.el (with-memoization): Move from here...
* lisp/subr.el (with-memoization): ... to here, as it's used from
the preloaded cl-generic.el file.

* lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Don't use
the autoloaded `byte-compile' function during bootstrap.
(cl--generic-get-dispatcher): Don't require subr-x, either.

cl-generic has been preloaded since 2015, and most usages of it (in
preloaded files) work fine.  In particular, using `cl-defgeneric' is
unproblematic.  However, `cl-defmethod' would end up pulling in the
byte compiler (at load time), which would make it impossible to use
`cl-defmethod' in pre-loaded files, and this change fixes that (but
possibly not in the most self-evidently correct way).
2022-06-24 11:04:51 +02:00
Lars Ingebrigtsen
bd1f20eea1 Make debug-early-backtrace more resilient
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Allow
outputting backtraces during bootstrap.
2022-06-24 11:04:51 +02:00
Mattias Engdegård
48248c901d Remove unused function in bytecomp.el
* lisp/emacs-lisp/bytecomp.el (byte-compile-delete-first): Remove.
2022-06-23 17:04:56 +02:00
Richard Hansen
55c2102560 bindat (strz): Null terminate fixed-length strings if there is room
* lisp/emacs-lisp/bindat.el (bindat--pack-strz): For fixed-length strz
fields, explicitly write a null terminator after the packed string if
there is room (bug#56048).
* doc/lispref/processes.texi (Bindat Types): Update documentation.
* test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc):
Update tests.
2022-06-22 16:55:40 +03:00
Richard Hansen
eff42dc0af ; bindat (strz): Move all pack logic to pack function (bug#56048)
Motivation/rationale:
  * Improve code readability.  Now `bindat--pack-strz` is used for all
    `strz` packing, not just variable-length `strz` packing.
  * Make it easier to change the behavior of fixed-length `strz`
    packing without also affecting the behavior of `str` packing.  (A
    future commit will modify `strz` to write a null terminator if
    there is room.)
2022-06-22 16:54:54 +03:00
Michael Heerdegen
406fd97921 Fix autoload generation of iter-defun forms
This fixes Bug#54648.

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload):
Add `iter-defun' and `cl-iter-defun' to the list of "complex cases"
that are macro-expanded and recursed on.
2022-06-21 19:50:10 +02:00
Philipp Stephani
dbbf38d43f Document and test 'no-byte-compile' behavior.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Document behavior
if 'no-byte-compile' is set.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-compile-file/no-byte-compile): New unit test.
* test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el: New test
file.
2022-06-21 19:11:05 +02:00
Lars Ingebrigtsen
acf9dcdc51 Check defface doc strings
* lisp/emacs-lisp/bytecomp.el
(byte-compile-file-form-custom-declare-variable): We already warn
about missing groups from byte-compile-normal-call, so this would
be a double warning.
(custom-declare-face)
(byte-compile-file-form-custom-declare-face): Add doc string
checking for defface.
2022-06-21 19:08:25 +02:00
Alan Mackenzie
4ae315f7c3 Fix potential (goto-char nil) in byte-compile-warning-prefix
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): Replace a wrong
'or' form involving OFFSET with simply OFFSET.  This prevents OFFSET from
possibly being nil in the first branch of the containing `if' form.
2022-06-20 18:31:05 +00:00
Pip Cet
3947037a33 Fix bytecompiler infloop compiling infloops
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Don't apply
optimization if we can't change anything (bug#46906).
2022-06-20 01:59:49 +02:00
Lars Ingebrigtsen
d181e410fc Fix edebug parsing of .,
* lisp/emacs-lisp/edebug.el (edebug-next-token-class): Parse .,
correctly (bug#37653).
2022-06-19 14:25:44 +02:00
Lars Ingebrigtsen
196eebda16 Make checkdoc-defun-info parsing slightly less wrong
* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info): Disregard
`interactive' in nested parts of the defun (bug#56052).
2022-06-19 14:17:05 +02:00
Lars Ingebrigtsen
93b018c664 Add mechanism for gradually phasing in new byte compilation warnings
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): Enable all byte
compilation warnings.
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): Add
docstrings-non-ascii-quotes and document new semantics for `all'
and t.
(byte-compile--emacs-build-warning-types): New constant.
(byte-compile-warning-enabled-p): Implement the new semantics.
(byte-compile-docstring-style-warn): Reinstate the Unicode quote
warning.
2022-06-19 13:37:10 +02:00
Stefan Kangas
6d0148c541 Merge from origin/emacs-28
422f958030 Fix invalid defcustom :group when :predicate is used
2022-06-19 06:30:29 +02:00
Mattias Engdegård
2ebe0524e8 More aggressive bytecode split between top-level forms (bug#55972)
* lisp/emacs-lisp/bytecomp.el (byte-compile-keep-pending):
Allow bytecode split between all kinds of top-level forms, not just
those with chunk handlers, to prevent individual chunks from growing
too large.  In particular this helps compilation of
package-quickstart.el.
2022-06-18 15:19:57 +02:00
Lars Ingebrigtsen
608f349cd2 Fix checkdoc--fix-y-or-n-p query
* lisp/emacs-lisp/checkdoc.el (checkdoc--fix-y-or-n-p): Fix the
query to match what's done (bug#56053).
2022-06-18 14:17:45 +02:00
Richard Hansen
422f958030 Fix invalid defcustom :group when :predicate is used
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
invalid `:group' argument for the `-modes' defcustom that is created
when `:predicate' is used (bug#56049).
2022-06-18 14:11:01 +02:00
Lars Ingebrigtsen
606275e91e Allow pretty-printing results from `C-x C-e' in edebug
* doc/lispref/edebug.texi (Edebug Eval): Document it.

* lisp/emacs-lisp/edebug.el (edebug-eval-expression): Allow
displaying the full value in a different buffer.
2022-06-18 13:26:23 +02:00
Stefan Kangas
b28debadf3 Merge from origin/emacs-28
d671cd57c4 Update cl-struct-sequence-type doc string
017bdb1611 Fix a tagging problem in tramp.texi
e0bac17bbc Mention face quirks after the final line in the lispref ma...
ad74677cf3 Delete reference to obsolete library complete.el
2022-06-18 06:31:18 +02:00
Lars Ingebrigtsen
0d103e6f79 Extend 'e' in edebug to pretty-print the values
* doc/lispref/edebug.texi (Edebug Eval): Document it.

* lisp/emacs-lisp/edebug.el (edebug-eval-expression): Allow
displaying the full value in a different buffer.
2022-06-18 00:17:40 +02:00
Mattias Engdegård
4311bd0bd7 Slightly faster hash-table-keys and hash-table-values
* lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values):
Omit the reversal of the returned list.  It is not ordered anyway.
* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x--hash-table-keys-and-values): New test.
2022-06-17 19:16:52 +02:00
Lars Ingebrigtsen
f515d658e5 Don't quote numbers in byte-run--set-*
* lisp/emacs-lisp/byte-run.el (byte-run--set-doc-string)
(byte-run--set-indent): Don't quote numbers (bug#48145).
2022-06-17 19:11:24 +02:00
Lars Ingebrigtsen
a53c34d76a Don't quote the `when' form in obsoletions
* lisp/emacs-lisp/byte-run.el (byte-run--set-obsolete): The `when'
is a string (or nil), so don't quote it (bug#48145).
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form):
Adjust folding.
2022-06-17 18:12:38 +02:00
Mattias Engdegård
73e75e18d1 Warn about misplaced or duplicated function/macro declarations
Doc strings, `declare` and `interactive` forms must appear in that
order and at most once each.  Complain if they don't, instead of
silently ignoring the problem (bug#55905).

* lisp/emacs-lisp/byte-run.el (byte-run--parse-body)
(byte-run--parse-declarations): New.
(defmacro, defun): Check for declaration well-formedness as
described above.  Clarify doc strings.  Refactor some common code.
* test/lisp/emacs-lisp/bytecomp-resources/fun-attr-warn.el:
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-fun-attr-warn):
New test.
2022-06-17 17:25:29 +02:00
Lars Ingebrigtsen
d671cd57c4 Update cl-struct-sequence-type doc string
* lisp/emacs-lisp/cl-macs.el (cl-struct-sequence-type): Fix doc
string to reflect what it does (bug#46523).
2022-06-17 16:48:02 +02:00
Lars Ingebrigtsen
decb64fd83 Make package-recompile delete all .elc files first
* lisp/emacs-lisp/package.el (package-recompile): Delete all .elc
files under the package directory.
2022-06-16 14:25:47 +02:00
Lars Ingebrigtsen
feb654b460 Add new package.el commands for recompilation
* doc/emacs/package.texi (Package Installation): Document them.

* lisp/emacs-lisp/package.el (package-recompile):
(package-recompile-all): New commands (bug#27253).
2022-06-16 13:49:11 +02:00
Richard Hansen
6c3b6149d9 bindat (strz): Write null terminator after variable length string
* lisp/emacs-lisp/bindat.el (bindat--pack-strz): Explicitly write a
null byte after packing a variable-length string to ensure proper
termination when packing to a pre-allocated string.
* doc/lispref/processes.texi (Bindat Types): Update documentation.
* test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc):
Update tests.
2022-06-16 09:55:49 +03:00
Lars Ingebrigtsen
0d383b592c Fix ;;;###autoload scanning from (some) packages
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
Fix autoloads scanning from packages.
2022-06-15 14:05:17 +02:00