summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a recent Lisp mode filling test failureLars Ingebrigtsen2022-06-261-0/+12
| | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Restore the "fill first line separately" logic.
* * lisp/emacs-lisp/syntax.el: Rework the handling of nested calls.Stefan Monnier2022-06-261-23/+46
| | | | | | | | | | | | | | | | | | | | 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.
* Make `M-q' work on the first line of a multi-line string againLars Ingebrigtsen2022-06-251-2/+2
| | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Exclude the quote marks from the region so that filling works (bug#56197).
* Re-fix build warnings about subr-x defsubstsLars Ingebrigtsen2022-06-251-4/+0
| | | | | | | | | | | | * 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.
* Bytecode opcode comments updateMattias Engdegård2022-06-241-13/+14
| | | | | | | | | | | 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.
* Update seq.el commentLars Ingebrigtsen2022-06-241-2/+2
| | | | * lisp/emacs-lisp/seq.el: Update comment.
* Allow read-multiple-choice to do long-form answersLars Ingebrigtsen2022-06-241-3/+22
| | | | | | | | | | * 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.
* Fix cl-generic bootstrap problemsLars Ingebrigtsen2022-06-242-18/+4
| | | | | | | | | | | | | | | | | | | | | * 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).
* Make debug-early-backtrace more resilientLars Ingebrigtsen2022-06-241-1/+7
| | | | | * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Allow outputting backtraces during bootstrap.
* Remove unused function in bytecomp.elMattias Engdegård2022-06-231-12/+0
| | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-delete-first): Remove.
* bindat (strz): Null terminate fixed-length strings if there is roomRichard Hansen2022-06-221-7/+6
| | | | | | | | | * 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.
* ; bindat (strz): Move all pack logic to pack function (bug#56048)Richard Hansen2022-06-221-26/+23
| | | | | | | | | | 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.)
* Fix autoload generation of iter-defun formsMichael Heerdegen2022-06-211-1/+1
| | | | | | | | 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.
* Document and test 'no-byte-compile' behavior.Philipp Stephani2022-06-211-0/+3
| | | | | | | | | * 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.
* Check defface doc stringsLars Ingebrigtsen2022-06-211-6/+6
| | | | | | | | | | * 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.
* Fix potential (goto-char nil) in byte-compile-warning-prefixAlan Mackenzie2022-06-201-2/+1
| | | | | | * 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.
* Fix bytecompiler infloop compiling infloopsPip Cet2022-06-201-3/+3
| | | | | * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Don't apply optimization if we can't change anything (bug#46906).
* Fix edebug parsing of .,Lars Ingebrigtsen2022-06-191-1/+1
| | | | | * lisp/emacs-lisp/edebug.el (edebug-next-token-class): Parse ., correctly (bug#37653).
* Make checkdoc-defun-info parsing slightly less wrongLars Ingebrigtsen2022-06-191-5/+12
| | | | | * lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info): Disregard `interactive' in nested parts of the defun (bug#56052).
* Add mechanism for gradually phasing in new byte compilation warningsLars Ingebrigtsen2022-06-191-8/+33
| | | | | | | | | | | | * 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.
* Merge from origin/emacs-28Stefan Kangas2022-06-191-1/+1
|\ | | | | | | 422f958030 Fix invalid defcustom :group when :predicate is used
| * Fix invalid defcustom :group when :predicate is usedRichard Hansen2022-06-181-1/+1
| | | | | | | | | | | | * 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).
* | More aggressive bytecode split between top-level forms (bug#55972)Mattias Engdegård2022-06-181-5/+4
| | | | | | | | | | | | | | | | * 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.
* | Fix checkdoc--fix-y-or-n-p queryLars Ingebrigtsen2022-06-181-1/+1
| | | | | | | | | | * lisp/emacs-lisp/checkdoc.el (checkdoc--fix-y-or-n-p): Fix the query to match what's done (bug#56053).
* | Allow pretty-printing results from `C-x C-e' in edebugLars Ingebrigtsen2022-06-181-12/+16
| | | | | | | | | | | | | | * 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.
* | Merge from origin/emacs-28Stefan Kangas2022-06-181-2/+3
|\| | | | | | | | | | | | | 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
| * Update cl-struct-sequence-type doc stringLars Ingebrigtsen2022-06-171-2/+3
| | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-struct-sequence-type): Fix doc string to reflect what it does (bug#46523).
* | Extend 'e' in edebug to pretty-print the valuesLars Ingebrigtsen2022-06-181-20/+34
| | | | | | | | | | | | | | * 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.
* | Slightly faster hash-table-keys and hash-table-valuesMattias Engdegård2022-06-171-2/+6
| | | | | | | | | | | | | | * 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.
* | Don't quote numbers in byte-run--set-*Lars Ingebrigtsen2022-06-171-2/+6
| | | | | | | | | | * lisp/emacs-lisp/byte-run.el (byte-run--set-doc-string) (byte-run--set-indent): Don't quote numbers (bug#48145).
* | Don't quote the `when' form in obsoletionsLars Ingebrigtsen2022-06-172-1/+2
| | | | | | | | | | | | | | * 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.
* | Warn about misplaced or duplicated function/macro declarationsMattias Engdegård2022-06-171-91/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Make package-recompile delete all .elc files firstLars Ingebrigtsen2022-06-161-1/+2
| | | | | | | | | | * lisp/emacs-lisp/package.el (package-recompile): Delete all .elc files under the package directory.
* | Add new package.el commands for recompilationLars Ingebrigtsen2022-06-161-0/+28
| | | | | | | | | | | | | | * doc/emacs/package.texi (Package Installation): Document them. * lisp/emacs-lisp/package.el (package-recompile): (package-recompile-all): New commands (bug#27253).
* | bindat (strz): Write null terminator after variable length stringRichard Hansen2022-06-161-0/+3
| | | | | | | | | | | | | | | | | | * 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.
* | Fix ;;;###autoload scanning from (some) packagesLars Ingebrigtsen2022-06-151-1/+5
| | | | | | | | | | * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file): Fix autoloads scanning from packages.
* | Simplify byte-compiler assuming cconv normalisationsMattias Engdegård2022-06-142-36/+11
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker) (byte-optimize-let-form, byte-optimize-letX): * lisp/emacs-lisp/bytecomp.el (byte-compile-unwind-protect): Simplify source optimisation and codegen code that can now rely on normalised let/let* and unwind-protect forms.
* | Run cconv for dynbound code as wellMattias Engdegård2022-06-142-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | Make cconv work for dynamically bound code and always run it. This allows later stages to benefit from transformations and normalisations in cconv. * lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): Always run cconv. * lisp/emacs-lisp/cconv.el (cconv--analyze-function) (cconv-analyze-form): In dynbound code, treat all variable bindings as dynamic (lambda, let, let* and condition-case).
* | Normalise setq during macro-expansionMattias Engdegård2022-06-144-74/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Early normalisation of setq during macroexpand-all allows later stages, cconv, byte-opt and codegen, to be simplified and duplicated checks to be eliminated. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Normalise all setq forms to a sequence of (setq VAR EXPR). Emit warnings if necessary. * lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyze-form): * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): * lisp/emacs-lisp/bytecomp.el (byte-compile-setq): Simplify. * test/lisp/emacs-lisp/bytecomp-tests.el: Adapt and add tests. * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el; * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-odd.el: New files.
* | Leave the contents on the *Backtrace* buffer on `q'Lars Ingebrigtsen2022-06-141-6/+5
| | | | | | | | | | * lisp/emacs-lisp/debug.el (debug): Don't clear the contents of the buffer on `q' (bug#55863).
* | ; * lisp/emacs-lisp/cconv.el: Fix outdated comments.Mattias Engdegård2022-06-141-8/+5
| |
* | bindat (strz): Error on null byte if packing variable-length stringRichard Hansen2022-06-131-0/+5
| | | | | | | | | | | | * lisp/emacs-lisp/bindat.el (strz): Signal an error if a null byte is encountered while packing a string to a variable-length strz field. * test/lisp/emacs-lisp/bindat-tests.el (strz): Add tests (bug#55938).
* | Make `/ a' in *Package* filter by nameLars Ingebrigtsen2022-06-131-10/+8
| | | | | | | | | | | | * lisp/emacs-lisp/package.el (package-menu-filter-by-archive): Filter by package name instead of by regexp, so that if the user types "gnu", they won't get "nongnu", too (bug#55919).
* | bindat (str, strz): Reject non-ASCII, non-`eight-bit' charactersRichard Hansen2022-06-121-4/+6
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/bindat.el (str) (strz): Signal an error if the user attempts to pack a multibyte string containing characters other than ASCII and `eight-bit' characters (bug#55897). * doc/lispref/processes.texi (Bindat Types): Update documentation. * test/lisp/emacs-lisp/bindat-tests.el (str) (strz): Add tests.
* | * lisp/emacs-lisp/find-func.el (find-function-advised-original): SimplifyStefan Monnier2022-06-111-5/+1
| |
* | Recognize processes as a CL type againBasil L. Contovounesios2022-06-111-0/+1
| | | | | | | | | | | | | | | | For discussion, see: https://lists.gnu.org/r/emacs-devel/2022-06/msg00567.html * lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Include process as a type, to avoid cl-typep complaining about process objects.
* | Fix loaddefs installation of packages with no autoloadsLars Ingebrigtsen2022-06-111-50/+62
| | | | | | | | | | | | * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Always generate an output file if we have EXTRA-DATA. This fixes package installation of packages with no ;;;###autoload forms.
* | Bindat: Document `sint`; add `le` arg to `uint`; deprecate `uintr`Stefan Monnier2022-06-111-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bindat.el (bindat--type) <uint>: Add `le` optional arg. (bindat--type) <uintr>: Delete method. (uintr): Re-define as a bindat-macro instead. (bindat-type): Update docstring accordingly. (bindat--primitives): Update. (sint): Simplify. * doc/lispref/processes.texi (Bindat Types): Update `uint`, add `sint`, and remove `uintr`. * test/lisp/emacs-lisp/bindat-tests.el (data-bindat-spec): Use the new `le` arg of `uint` instead of `uintr`.
* | ; bindat (bindat--length-group): Fix indentationRichard Hansen2022-06-101-66/+66
| |
* | ; bindat (strz): Consistent length type check, take twoRichard Hansen2022-06-101-8/+13
| | | | | | | | | | | | | | | | | | | | | | Commit 30ec4a7347b2944818c6fc469ae871374ce7caa4 is incorrect -- the length computation logic uses a simple nilness test, not `numberp'. The `numberp' case is just an optimization if `len' is a literal number; it does not affect the behavior. Revert that commit, add some comments to help future readers avoid the same mistake, and update the pack logic to use the same optimization as the length computation for consistency.