Commit graph

29 commits

Author SHA1 Message Date
Lämppi Lütti
55c2180d2c Fix detection of vtable start and end
* lisp/emacs-lisp/vtable.el (vtable-beginning-of-table)
(vtable-end-of-table): Fix detection of vtable limits.  (Bug#58712)

Copyright-paperwork-exempt: yes
2023-09-07 22:23:24 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Lars Ingebrigtsen
5017f2573f Fix vtable-insert-object line insertion
* lisp/emacs-lisp/vtable.el (vtable-insert-object): Pass in the
correct ellipsis values (bug#58370).
(vtable--insert-line): Don't bug out on missing optional arguments.
2022-10-08 15:26:01 +02:00
Lars Ingebrigtsen
e2f2f6b9e8 Fix percentage width computation in vtable
* lisp/emacs-lisp/vtable.el (vtable--compute-width): Fix
percentage computation (bug#58067).
2022-09-26 13:28:30 +02:00
Lars Ingebrigtsen
2c0a01ee38 Don't make a header if the user hasn't specified columns in vtable
* lisp/emacs-lisp/vtable.el (vtable):
(make-vtable): Store whether the user has specified the columns.
(vtable-insert): Don't insert a header line or a header if the
user hasn't specified the columns (bug#55075).
2022-04-23 14:47:55 +02:00
Lars Ingebrigtsen
2d4c5f0b85 Enable dragging resizing final column in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-line): Insert the
divider after the final column, too, so that the size can be
dragged.
2022-04-15 14:06:33 +02:00
Lars Ingebrigtsen
68e6430959 Add some mouse-face bits to vtable
* lisp/emacs-lisp/vtable.el (make-vtable)
(vtable--insert-header-line): Put mouse-face on draggable bits.
2022-04-15 13:58:41 +02:00
Lars Ingebrigtsen
4bc36f09b9 Tweak sorting indicator placement in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Tweak
sorting indicator position.
2022-04-15 13:45:00 +02:00
Lars Ingebrigtsen
c4768cda7f Make the sorting indicator prettier in vtable
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Place
the sorting indicator flush right in the heading.
2022-04-15 13:37:13 +02:00
Lars Ingebrigtsen
f36ff9da17 Allow using faces for colors in vtable
* doc/misc/vtable.texi (Making A Table): Adjust color documentation.
* lisp/emacs-lisp/vtable.el (make-vtable): Mix more.
(vtable--compute-colors): Mix both foreground and background colors.
(vtable--make-color-face, vtable--face-blend): New functions.
(vtable--insert-line): Adjust usage.
2022-04-15 12:09:07 +02:00
Lars Ingebrigtsen
cc2a1b2780 Allow dragging the divider in vtable
* lisp/emacs-lisp/vtable.el (vtable): Add a keymap cache.
(make-vtable): Allow dragging the divider.
(vtable-insert): Don't put the table keymap over the entire line
-- avoid the divider, which has its own keymap.
(vtable--drag-resize-column): Adjust to the in-buffer divider
dragging.
2022-04-15 11:10:05 +02:00
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
525c01c43a Make vtable sorting stable
* lisp/emacs-lisp/vtable.el (vtable--sort): Make the sorting
stable.
2022-03-13 21:13:49 +01:00
Lars Ingebrigtsen
2353893bd0 Fix regression in vtable-goto-object
* lisp/emacs-lisp/vtable.el (vtable-goto-object): Fix moving to
the object.
2022-03-09 17:37:47 +01:00
Lars Ingebrigtsen
de003cb2b5 Improve vtable :keymap handling
* lisp/emacs-lisp/vtable.el (vtable-map, vtable--make-keymap):
Don't alter keymaps passed in, and respect parent keymaps.
2022-02-21 19:19:55 +01:00
Lars Ingebrigtsen
d98b6fbba2 Add column sorting order indicators to vtable
* lisp/emacs-lisp/vtable.el (vtable--indicator): New function.
(vtable--insert-header-line): Use it to display sorting order
indicators.
2022-02-19 14:21:19 +01:00
Lars Ingebrigtsen
dfaf150631 Add a new library to format variable-pitch tables
* doc/misc/vtable.texi (Index): New manual.

* lisp/emacs-lisp/vtable.el: New library.
2022-02-19 13:16:28 +01:00