Commit graph

8327 commits

Author SHA1 Message Date
Lars Ingebrigtsen
807682de1e Allow dragging dividers in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Allow
dragging dividers.
(vtable--drag-resize-column): Adjust function.
2022-04-14 19:48:59 +02:00
Lars Ingebrigtsen
be54c25dbb Allow resizing vtable columns by dragging
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Allow
resizing by dragging headers.
(vtable--drag-resize-column): New function.
(vtable-narrow-current-column): Refactor out common bits.
(vtable--alter-column-width): To here.
(vtable-widen-current-column): Rewrite to use
vtable-narrow-current-column.
2022-04-14 19:39:01 +02:00
Lars Ingebrigtsen
f498d055a4 Make vtable remember user-altered column widths
* lisp/emacs-lisp/vtable.el (vtable-narrow-current-column)
(vtable-widen-current-column): Store the size to that it's
respected on `g'.
2022-04-14 18:03:58 +02:00
Lars Ingebrigtsen
e7f7930a61 Ensure that commands like { work on all frames in vtable
* lisp/emacs-lisp/vtable.el (vtable--recompute-cache)
(vtable--ensure-cache): New functions.
(vtable-insert): Use it.
(vtable--widths): Ditto.
2022-04-14 16:25:41 +02:00
Lars Ingebrigtsen
c3b6cfda36 Make vtable narrow/widen functions take a prefix
* lisp/emacs-lisp/vtable.el (vtable-narrow-current-column)
(vtable-widen-current-column): Allow using the prefix to say how
much to narrow/widen the columns.
2022-04-14 02:47:23 +02:00
Lars Ingebrigtsen
ffb7612d2c Copy edit make-vtable code
* lisp/emacs-lisp/vtable.el (make-vtable): Clean up code slightly.
2022-04-14 02:41:27 +02:00
Lars Ingebrigtsen
8969836cb8 Edit some vtable doc strings
* lisp/emacs-lisp/vtable.el (make-vtable, vtable): Improve doc
strings.
2022-04-14 02:37:44 +02:00
Lars Ingebrigtsen
5a9e4f2230 Further divider fixes for vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Don't
insert the divider at the end.
(vtable-narrow-current-column, vtable-widen-current-column): Don't
error out when being called on the divider.
2022-04-14 02:18:01 +02:00
Lars Ingebrigtsen
574ae74caa Fix dividers in vtable header lines
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Put the
divider in the correct place in the header line.
2022-04-14 01:56:15 +02:00
Lars Ingebrigtsen
a96679b742 Allow having dividers between columns in vtable
* doc/misc/vtable.texi (Making A Table): Document it.
* lisp/emacs-lisp/vtable.el (vtable): Add a divider slot.
(make-vtable): Accept :divider and :divider-width arguments.
(vtable--insert-line, vtable--insert-header-line): Display the
divider.
2022-04-14 01:36:36 +02:00
Lars Ingebrigtsen
800998808a Allow putting alternating colors on vtable rows
* doc/misc/vtable.texi (Making A Table): Document it.
* lisp/emacs-lisp/vtable.el (vtable): Add :row-colors.
(make-vtable): Ditto.
(vtable--compute-colors, vtable--color-blend): New functions.
(vtable--insert-line): Take a line number argument and adjust
callers.
2022-04-14 01:00:44 +02:00
Lars Ingebrigtsen
6c3869a104 Add a new `vtable' face
* doc/misc/vtable.texi (Introduction): Document it.

* lisp/emacs-lisp/vtable.el (vtable): Add a new face.
2022-04-13 23:19:10 +02:00
Lars Ingebrigtsen
29fae93d1c Add support for column background colors in vtable
* doc/misc/vtable.texi (Making A Table): Document it.

* lisp/emacs-lisp/vtable.el (vtable): Add a column color element.
(make-vtable): Use it.
(vtable--insert-line): Insert the colors here.
2022-04-13 16:26:01 +02:00
Lars Ingebrigtsen
918669cb3d Make list-times not include zero elements
* doc/lispref/os.texi (Time Parsing): Mention %x.
* lisp/calendar/time-date.el (format-seconds): Accept a new %x
spec that removes trailing zeros (bug#54904).

* lisp/emacs-lisp/timer-list.el (list-timers): Don't display
trailing zero bits.
2022-04-13 15:31:34 +02:00
Po Lu
8259e36800 Fix marking upgrades for packages from ELPA or NonGNU ELPA
* lisp/emacs-lisp/package.el (package-menu--find-upgrades): Look
inside ``external'' packages as well when searching for
upgrades.  (bug#54117)
2022-04-13 07:17:30 +00:00
Lars Ingebrigtsen
5ee959aa87 Add a comment about cl-concatenate
* lisp/emacs-lisp/cl-extra.el (cl-concatenate): Add a comment.
2022-04-13 06:11:51 +02:00
Lars Ingebrigtsen
ab2b822b9b Revert "Make cl-concatenate an alias of seq-concatenate"
This reverts commit 78f76fe16e.

The commit made calls to cl-concatenate bug out, since
autoloading defalises doesn't work very well (bug#54901).
2022-04-13 06:11:51 +02:00
Lars Ingebrigtsen
88a04ea985 Tweak how `M-q' in emacs-lisp-mode works
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Only fill as
strings inside strings (bug#31656).
(lisp--fill-line-simple): New function to do simple sexp-based
filling.
2022-04-13 05:07:47 +02:00
Sean Whitton
451eeb512d Fix eager macroexpansion cycle in cl-once-only
* lisp/emacs-lisp/cl-macs.el (cl-once-only): Use different cl-loop
syntax, with no functional change, but such that the loop does not
expand into cl-psetq.
2022-04-12 17:59:22 +02:00
Sean Whitton
2e9111813b Add two classic Common Lisp macro-writing macros
* lisp/emacs-lisp/cl-macs.el (cl-with-gensyms, cl-once-only): New macros.
2022-04-11 23:01:55 -07:00
Stefan Monnier
6a480c830b * lisp/emacs-lisp/macroexp.el (macroexp-let2*): Allow common shorthand 2022-04-11 15:10:51 -04:00
Kaushal Modi
cca47ae555 Update docstrings for shortdoc.el FUNC lisp form API
* lisp/emacs-lisp/shortdoc.el (define-short-documentation-group):
Updated docstrings.
2022-04-10 13:52:49 +02:00
Lars Ingebrigtsen
e2f3b0f16e Improve package.el error messages on too-old Emacsen
* lisp/emacs-lisp/package.el (package-compute-transaction): Give a
better error message on too-old Emacs versions (bug#54747).
2022-04-08 14:46:14 +02:00
Stefan Monnier
39e8fd357d OClosure: New function function-documentation
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.
2022-04-07 15:59:09 -04:00
Lars Ingebrigtsen
4c8e23d5d7 Clarify read-answer-short/use-short-answers action
* 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'.
2022-04-07 13:37:16 +02:00
Stefan Monnier
4161a36849 cl-generic.el: Fix bug#46722
Fix longstanding bug due to unexpected interference via side-effect.

* lisp/emacs-lisp/cl-generic.el (cl--generic-get-dispatcher):
Copy the `dispatch` arg before storing it into the hash-table.

Backport from `master` (cherrypick from commit 61f8f7f68f).
2022-04-06 14:26:40 -04:00
Lars Ingebrigtsen
406da54bc6 Fix minor-mode doc string quoting
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Fix
double quoting of things like (default-value 'electric-pair-mode)
(bug#54746).
2022-04-06 13:47:46 +02:00
Stefan Monnier
1f4f6b956b OClosure: add support for slot-value
* 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.
2022-04-04 15:06:47 -04:00
Lars Ingebrigtsen
773d4104a5 Further fixes for cl--generic-describe and (function ...)
* lisp/emacs-lisp/cl-generic.el (cl--generic-describe): Fix the #'
problem for defmethods, too (bug#54628).
2022-04-04 12:48:47 +02:00
Mattias Engdegård
f4833c88bb Rewrite string-greaterp and string> using string-lessp
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.
2022-04-04 09:49:31 +02:00
Philipp Stephani
3c6524140b ; * lisp/emacs-lisp/cl-macs.el (cl-struct-slot-value): Fix typo. 2022-04-03 17:51:04 +02:00
Lars Ingebrigtsen
5e429e21d9 Have global minor modes say so in the doc string
* 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.
2022-04-03 14:08:04 +02:00
Lars Ingebrigtsen
781c43de3d Fix bootstrap errors after previous easy-mmode change
* 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.
2022-04-02 16:53:24 +02:00
Lars Ingebrigtsen
ec464789df Put the define-minor-mode boilerplate at the end of the doc strings
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Put
the boilerplate at the end of the doc string.
2022-04-02 15:55:38 +02:00
Lars Ingebrigtsen
338f5667f4 Further tweaks to cl--generic-describe
* lisp/emacs-lisp/cl-generic.el (cl--generic-describe): Further
tweak the look of the implementation output.
2022-04-02 15:19:15 +02:00
Stefan Monnier
6cb6886840 cl-generic: Rework obsolescence checks for defmethod
* 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`.
2022-04-01 10:02:32 -04:00
Stefan Monnier
ff067408e4 OClosure: Add support for defmethod dispatch
* 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.
2022-04-01 08:54:55 -04:00
Lars Ingebrigtsen
af0ea35ea0 Tweak how functions are formatted in Implementation in *Help*
* 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 #'...
2022-03-31 13:38:33 +02:00
Stefan Monnier
6f973faa91 cl-generic: Use OClosures for cl--generic-isnot-nnm-p
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.
2022-03-30 17:08:28 -04:00
Stefan Monnier
b12ad270eb EIEIO tests: Fix failure when eieio-core.el is interpreted
* lisp/emacs-lisp/eieio-core.el (eieio--validate-slot-value)
(eieio--slot-name-index): Use the `cl--class` accessor functions.
2022-03-30 17:08:28 -04:00
Stefan Monnier
2b5ea36ce9 * lisp/emacs-lisp/oclosure.el (oclosure--define): Autoload 2022-03-29 03:23:38 -04:00
Po Lu
55932a65ed Temporarily fix the oclosure bootstrap
* lisp/emacs-lisp/oclosure.el (oclosure-define): Load oclosure
from source if `oclosure--define' is not defined during byte
compilation.
2022-03-29 13:58:40 +08:00
Stefan Monnier
52d5771e0a Add OClosures, a cross between functions and structs
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`.
2022-03-28 10:53:14 -04:00
Lars Ingebrigtsen
3e7257c3ed Improve pp-last-sexp ergonomics
* lisp/emacs-lisp/pp.el (pp-last-sexp): Ignore ,@?
before a sexp, because eval-ing that will always lead to an error
(bug#54537).
2022-03-25 16:44:30 +01:00
Augusto Stoffel
45978f97be Handle invisible text in Eldoc when calculating size
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.
2022-03-24 15:06:05 +00:00
Lars Ingebrigtsen
fd5fe11211 Don't break autoload generation of `left-margin' isn't zero
* lisp/emacs-lisp/autoload.el (make-directory-autoloads): Fix
autoload generation breakage is left-margin isn't zero (bug#54491).
2022-03-21 19:15:55 +01:00
Lars Ingebrigtsen
71b8f1fc63 Make `command-modes' work for (native-compiled) subrs, too
* 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.
2022-03-19 15:11:37 +01:00
Stefan Monnier
ab8a34ce8a * lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure): Minor optimization 2022-03-18 16:07:42 -04:00
Stefan Monnier
06ea82e4e3 Remove some early-bootstrap dependencies for advice
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.
2022-03-17 19:07:59 -04:00
Stefan Monnier
693484d36b * lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Warn suspicious args 2022-03-17 10:07:35 -04:00