summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* Add two classic Common Lisp macro-writing macrosSean Whitton2022-04-111-0/+51
| | | | * lisp/emacs-lisp/cl-macs.el (cl-with-gensyms, cl-once-only): New macros.
* * lisp/emacs-lisp/macroexp.el (macroexp-let2*): Allow common shorthandStefan Monnier2022-04-111-3/+11
|
* Update docstrings for shortdoc.el FUNC lisp form APIKaushal Modi2022-04-101-15/+55
| | | | | * lisp/emacs-lisp/shortdoc.el (define-short-documentation-group): Updated docstrings.
* Improve package.el error messages on too-old EmacsenLars Ingebrigtsen2022-04-081-2/+6
| | | | | * lisp/emacs-lisp/package.el (package-compute-transaction): Give a better error message on too-old Emacs versions (bug#54747).
* OClosure: New function `function-documentation`Stefan Monnier2022-04-071-0/+6
| | | | | | | | | | | | | | | | | | As mentioned in the original OClosure commit, OClosures (ab)use the bytecode's docstring slot to hold the OClosure's type. This currently prevents OClosures from having their own docstring. Introduce a new generic function `function-documentation` to fetch the docstring of a function, which can then be implemented in various different ways depending on the OClosure's type. * lisp/simple.el (function-documentation): New generic function. (bad-package-check): Strength-reduce `eval` to `symbol-value`. * src/doc.c (Fdocumentation): Use it. * lisp/emacs-lisp/oclosure.el (oclosure--accessor-docstring): New function. * test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test): Add test for accessor's docstrings.
* Clarify read-answer-short/use-short-answers actionLars Ingebrigtsen2022-04-071-2/+8
| | | | | | | * lisp/emacs-lisp/map-ynp.el (read-answer-short): Clarify what this variable affects (bug#54754). * src/fns.c (Fyes_or_no_p): Mention `use-short-answers'.
* Fix minor-mode doc string quotingLars Ingebrigtsen2022-04-061-1/+1
| | | | | | * lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Fix double quoting of things like (default-value 'electric-pair-mode) (bug#54746).
* OClosure: add support for `slot-value`Stefan Monnier2022-04-042-47/+77
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/oclosure.el (oclosure--slot-index) (oclosure--slot-value, oclosure--set-slot-value): New functions. * lisp/emacs-lisp/eieio-core.el (eieio-oset, eieio-oref): Consolidate the type test. Use `oclosure--(set-)slot-value`. (eieio--validate-slot-value, eieio--validate-class-slot-value): Don't presume `class` is an EIEIO class. (eieio--class): Fix bogus `:type` info. (eieio--object-class): Simplify. (eieio--known-slot-name-p): New function. (eieio-oref, eieio-oref-default, eieio-oset-default): Use it. * test/lisp/emacs-lisp/oclosure-tests.el: Require `eieio`. (oclosure-test): Make `name` field mutable. (oclosure-test-slot-value): New test.
* Further fixes for cl--generic-describe and (function ...)Lars Ingebrigtsen2022-04-041-7/+6
| | | | | * lisp/emacs-lisp/cl-generic.el (cl--generic-describe): Fix the #' problem for defmethods, too (bug#54628).
* Rewrite string-greaterp and string> using string-lesspMattias Engdegård2022-04-041-0/+11
| | | | | | | | | Since string-lessp has its own byte-op, using it is much faster than calling string-greaterp even with the need to bind a temporary variable. * lisp/emacs-lisp/byte-opt.el (byte-optimize-string-greaterp): New. (string-greaterp, string>): Set byte-optimizer.
* ; * lisp/emacs-lisp/cl-macs.el (cl-struct-slot-value): Fix typo.Philipp Stephani2022-04-031-1/+1
|
* Have global minor modes say so in the doc stringLars Ingebrigtsen2022-04-031-9/+11
| | | | | | | * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Allow saying whether it's a global minor mode or not. (easy-mmode--mode-docstring): Use it. (define-minor-mode): Pass in the data.
* Fix bootstrap errors after previous easy-mmode changeLars Ingebrigtsen2022-04-022-33/+1
| | | | | | | | * lisp/subr.el (ensure-empty-lines, string-lines): Moved from subr-x so that they can be used in early bootstrap files. * lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Don't use string-empty-p because of bootstrap issues.
* Put the define-minor-mode boilerplate at the end of the doc stringsLars Ingebrigtsen2022-04-021-24/+42
| | | | | * lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Put the boilerplate at the end of the doc string.
* Further tweaks to cl--generic-describeLars Ingebrigtsen2022-04-021-1/+7
| | | | | * lisp/emacs-lisp/cl-generic.el (cl--generic-describe): Further tweak the look of the implementation output.
* cl-generic: Rework obsolescence checks for defmethodStefan Monnier2022-04-012-18/+15
| | | | | | | | | * lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Silence obsolescence warnings in the included methods. (cl-defmethod): Reuse standard obsolescence checks. * lisp/emacs-lisp/seq.el (seq-contains): Remove redundant `with-suppressed-warnings`.
* OClosure: Add support for defmethod dispatchStefan Monnier2022-04-013-18/+60
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/oclosure.el (oclosure--class): Add slot `allparents`. (oclosure--class-make): Add corresponding arg `allparents`. (oclosure, oclosure--build-class): Pass the new arg to the constructor. (oclosure--define): Make the predicate function understand subtyping. * lisp/emacs-lisp/cl-preloaded.el (cl--class-allparents): Move from `cl-generic.el`. * lisp/emacs-lisp/cl-generic.el (cl--generic-class-parents): Move to `cl-preloaded.el` and rename to `cl--class-allparents`. Adjust all callers. (cl--generic-oclosure-tag, cl-generic--oclosure-specializers): New functions. (cl-generic-generalizers) <oclosure-struct>: New generalizer. * test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test-gen): New generic function. (oclosure-test): Add test for dispatch on oclosure types.
* Tweak how functions are formatted in Implementation in *Help*Lars Ingebrigtsen2022-03-311-1/+1
| | | | | | | * lisp/emacs-lisp/cl-generic.el (cl--generic-describe): Include the function name in the implementations (bug#54628). This clarifies what we're talking about here, and avoids getting (function ...) translated into #'...
* cl-generic: Use OClosures for `cl--generic-isnot-nnm-p`Stefan Monnier2022-03-302-70/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite the handling of `cl-no-next-method` to get rid of the hideous hack used in `cl--generic-isnot-nnm-p` and also to try and move some of the cost to the construction of the effective method rather than its invocation. This speeds up method calls measurably when there's a `cl-call-next-method` in the body. * lisp/loadup.el ("emacs-lisp/oclosure"): Load. * lisp/emacs-lisp/oclosure.el (oclosure-define): Remove workaround now that we're preloaded. * lisp/emacs-lisp/cl-generic.el (cl--generic-method): Rename `uses-cnm` to `call-con` to reflect it's not a boolean any more. (cl-defmethod): Adjust to the new name and new values. (cl-generic-define-method): Adjust to the new name. (cl--generic-lambda): Use the new `curried` calling convention. (cl--generic-no-next-method-function): Delete function. (cl--generic-nnm): New type. (cl-generic-call-method): Rewrite to support the various calling conventions. (cl--generic-nnm-sample, cl--generic-cnm-sample): Delete consts. (cl--generic-isnot-nnm-p): Rewrite using `oclosure-type`. (cl--generic-method-info): Add support for new calling convention.
* EIEIO tests: Fix failure when `eieio-core.el` is interpretedStefan Monnier2022-03-301-3/+3
| | | | | * lisp/emacs-lisp/eieio-core.el (eieio--validate-slot-value) (eieio--slot-name-index): Use the `cl--class` accessor functions.
* * lisp/emacs-lisp/oclosure.el (oclosure--define): AutoloadStefan Monnier2022-03-291-0/+1
|
* Temporarily fix the oclosure bootstrapPo Lu2022-03-291-0/+2
| | | | | | * lisp/emacs-lisp/oclosure.el (oclosure-define): Load oclosure from source if `oclosure--define' is not defined during byte compilation.
* Add OClosures, a cross between functions and structsStefan Monnier2022-03-282-2/+538
| | | | | | | | | | | | | | | | | | We here just add the new type. It is not fully self-contained. It requires cooperation from `cconv.el` on the one hand, and it hijacks the docstring info to hold the type of OClosure objects. This does imply that OClosures can't have docstrings, tho this limitation will be lifted in subsequent patches. * lisp/emacs-lisp/oclosure.el: New file. * test/lisp/emacs-lisp/oclosure-tests.el: New file. * doc/lispref/functions.texi (OClosures): New section. * src/eval.c (Ffunction): Accept symbols instead of strings for docstrings. * src/doc.c (store_function_docstring): Avoid overwriting an OClosure type. * lisp/emacs-lisp/cconv.el (cconv--convert-function): Tweak ordering of captured variables. (cconv-convert): Add case for `oclosure--fix-type`.
* Improve pp-last-sexp ergonomicsLars Ingebrigtsen2022-03-251-0/+4
| | | | | | * lisp/emacs-lisp/pp.el (pp-last-sexp): Ignore ,@? before a sexp, because eval-ing that will always lead to an error (bug#54537).
* Handle invisible text in Eldoc when calculating sizeAugusto Stoffel2022-03-241-5/+8
| | | | | | | | | Co-authored-by: João Távora <joaotavora@gmail.com> * lisp/emacs-lisp/eldoc.el (eldoc--echo-area-substring, eldoc-display-in-echo-area): Take invisible text into consideration when counting lines to crop an echo-area message. (Version): Bump.
* Don't break autoload generation of `left-margin' isn't zeroLars Ingebrigtsen2022-03-211-0/+3
| | | | | * lisp/emacs-lisp/autoload.el (make-directory-autoloads): Fix autoload generation breakage is left-margin isn't zero (bug#54491).
* Make `command-modes' work for (native-compiled) subrs, tooLars Ingebrigtsen2022-03-191-2/+10
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-func): Add a command-modes slot. (comp-spill-lap-function, comp-intern-func-in-ctxt): Fill it. (comp-emit-for-top-level, comp-emit-lambda-for-top-level): Use it. * src/alloc.c (mark_object): Mark the command_modes slot. * src/comp.c (make_subr): Add a command_modes parameter. (Fcomp__register_lambda): Use it. (Fcomp__register_subr): Ditto. * src/data.c (Fcommand_modes): Output the command_modes data for subrs (bug#54437). * src/lisp.h (GCALIGNED_STRUCT): Add a command_modes slot. * src/pdumper.c (dump_subr): Update hash. (dump_subr): Dump the command_modes slot.
* * lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure): Minor optimizationStefan Monnier2022-03-181-2/+2
|
* Remove some early-bootstrap dependencies for `advice`Stefan Monnier2022-03-172-11/+30
| | | | | | | | | | | | | | | | | | | | | | | | The dependencies between `advice`, cl-generic`, `bytecomp`, `cl-lib`, `simple`, `help`, ... were becoming unmanageable. Break the reliance on `advice` (which includes making sure the compiler is not needed during the early bootstrap). * lisp/simple.el (pre-redisplay-function): Set without using `add-function`. * lisp/loadup.el (advice, simple): Move to after `cl-generic`. * lisp/help.el (command-error-function): Set without using `add-function`. (help-command-error-confusable-suggestions): Explicitly call `command-error-default-function` instead. * lisp/emacs-lisp/cl-macs.el (pcase--mutually-exclusive-p): Don't optimize during early-bootstrap. * lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Tiny simplification. (cl-defmethod): Label the obsolescence warning as it should. (cl--generic-compiler): New variable. (cl--generic-get-dispatcher): Use it. (cl--generic-prefill-dispatchers): Make freshly made dispatchers.
* * lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Warn suspicious argsStefan Monnier2022-03-171-0/+11
|
* (seq-contains-p): Refine the non-nil returned valueStefan Monnier2022-03-171-2/+3
| | | | | * lisp/emacs-lisp/seq.el (seq-contains-p): Like `cl-some` return the value returned by the test function rather than t.
* Make `?' work again in read-multiple-choiceLars Ingebrigtsen2022-03-171-5/+6
| | | | | * lisp/emacs-lisp/rmc.el (read-multiple-choice): Make the `?' key work again to show the help text.
* Format long help texts better in read-multiple-choiceFelician Nemeth2022-03-171-3/+9
| | | | | * lisp/emacs-lisp/rmc.el (rmc--show-help): Format long help texts better (bug#54430).
* Strip positions from symbols before the eval in eval-{when,and}-compile.Alan Mackenzie2022-03-161-4/+6
| | | | | | | | | This fixes bug #54079. * lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment): Change the position of 'byte-run-strip-symbol-positions' in the eval-when-compile entry. Add a call to `byte-run-strip-symbol-positions' in the eval-and-compile entry.
* * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Simplify Edebug specStefan Monnier2022-03-141-12/+3
|
* Make Edebug specification for 'cl-defstruct' more lenient.Philipp Stephani2022-03-141-1/+2
| | | | | | | | | For example, 'xref-item' uses the list form of ':noinline'. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Accept ':noinline' and ':named' with an argument. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct/edebug): New unit test.
* Really fix find-func for defgenericLars Ingebrigtsen2022-03-131-1/+1
| | | | | * lisp/emacs-lisp/find-func.el (find-function-regexp): Really add defgeneric.
* Make vtable sorting stableLars Ingebrigtsen2022-03-131-10/+14
| | | | | * lisp/emacs-lisp/vtable.el (vtable--sort): Make the sorting stable.
* Add cl-defgeneric to find-func, tooLars Ingebrigtsen2022-03-131-1/+1
| | | | | * lisp/emacs-lisp/find-func.el (find-function-regexp): Add cl-defgeneric, too (bug#54343).
* Make find-function-regexp also find cl-defun/defmethodLars Ingebrigtsen2022-03-121-0/+1
| | | | | * lisp/emacs-lisp/find-func.el (find-function-regexp): Also find cl-defun and cl-defmethod (bug#54343).
* Fix regression in vtable-goto-objectLars Ingebrigtsen2022-03-091-1/+1
| | | | | * lisp/emacs-lisp/vtable.el (vtable-goto-object): Fix moving to the object.
* (cl-macro-list): Simplify by unifying the variantsStefan Monnier2022-03-071-25/+13
| | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-macro-list): Add the &whole and the dotted tail cases from `cl-macro-list1`. (cl-macro-list1, cl-define-compiler-macro-list): Delete edebug elem specs. (cl-destructuring-bind, cl-define-compiler-macro): Use `cl-macro-list` instead, now that it covers all the cases we need.
* * lisp/emacs-lisp/seq.el (seq-concatenate): Accept non-`sequencep` sequencesStefan Monnier2022-03-071-0/+1
|
* Restore call to byte-run-strip-symbol-positions in byte-compile-outAlan Mackenzie2022-03-062-1/+7
| | | | | | | | | | Also increment a loop counter. This should fix bug #54248. * lisp/emacs-lisp/byte-run.el (byte-run--strip-vector/record): increment the loop counter 'i' in the main loop. * lisp/emacs-lisp/bytecomp.el (byte-compile-out): call byte-run-strip-symbol-positions on operands which are one-element lists.
* Merge from origin/emacs-28Stefan Kangas2022-03-061-1/+1
|\ | | | | | | | | 0090318c61 * lib-src/seccomp-filter.c (main): Use faccessat2 only if ... 3bb01a499b Fix regression in derived-mode-init-mode-variables
| * Fix regression in derived-mode-init-mode-variablesLars Ingebrigtsen2022-03-041-1/+1
| | | | | | | | | | * lisp/emacs-lisp/derived.el (derived-mode-init-mode-variables): Fix regression caused by lexical-binding derived.el (bug#54240).
* | trace.el: Preserve the line structureStefan Monnier2022-03-041-4/+7
| | | | | | | | | | | | | | | | | | Print newlines appearing inside values (i.e. inside strings) as \n rather than actual newlines so as to avoid messing up the main structure of the trace buffer. * lisp/emacs-lisp/trace.el (trace-entry-message) (trace-exit-message, trace--read-args): Quote newlines
* | Teach Edebug about the special '&whole' syntax for compiler macros.Philipp Stephani2022-03-031-1/+8
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-define-compiler-macro-list): New Edebug element specification. (cl-define-compiler-macro): Use it. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-define-compiler-macro/edebug): New unit test.
* | Clean up byte-compile-arglist-warnMattias Engdegård2022-02-281-26/+25
| | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-arglist-warn): Remove unnecessary sort (only need min and max). Reduce mutation.
* | Amend byte-run-strip-symbol-positions so that an unexec build buildsAlan Mackenzie2022-02-242-44/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug #54098. * lisp/emacs-lisp/byte-run.el (byte-run--strip-list) (byte-run--strip-vector/record): New functions. These alter a list or vector/record structure only where a symbol with position gets replaced by a bare symbol. (byte-run-strip-symbol-positions): Reformulate to use the two new functions. (function-put): No longer strip positions from the second and third arguments. * lisp/emacs-lisp/bytecomp.el (byte-compile-out): Remove the senseless "stripping" of putative symbol positions from OPERAND, which is nil or a number.