diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-04-14 02:47:23 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-04-14 02:47:23 +0200 |
commit | c3b6cfda3621c61634a6be37cbc3d62406daee00 (patch) | |
tree | 1ac4cbf3992bb49a23a87a3102f78ce9e6d73c48 /lisp/emacs-lisp | |
parent | ffb7612d2cf84ca1863a10873eb4a9721ffc720d (diff) | |
download | emacs-c3b6cfda3621c61634a6be37cbc3d62406daee00.tar.gz emacs-c3b6cfda3621c61634a6be37cbc3d62406daee00.tar.bz2 emacs-c3b6cfda3621c61634a6be37cbc3d62406daee00.zip |
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/vtable.el | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 03fe54c94e9..f14c9ae9a65 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -758,9 +758,12 @@ This also updates the displayed table." "Minor mode for buffers with vtables with headers." :keymap vtable-header-mode-map) -(defun vtable-narrow-current-column () - "Narrow the current column." - (interactive) +(defun vtable-narrow-current-column (&optional n) + "Narrow the current column by N characters. +If N isn't given, N defaults to 1. + +Interactively, N is the prefix argument." + (interactive "p") (let* ((table (vtable-current-table)) (column (vtable-current-column)) (widths (vtable--widths table))) @@ -768,18 +771,23 @@ This also updates the displayed table." (user-error "No column under point")) (setf (aref widths column) (max (* (vtable--char-width table) 2) - (- (aref widths column) (vtable--char-width table)))) + (- (aref widths column) + (* (vtable--char-width table) (or n 1))))) (vtable-revert))) -(defun vtable-widen-current-column () - "Widen the current column." - (interactive) +(defun vtable-widen-current-column (&optional n) + "Widen the current column by N characters. +If N isn't given, N defaults to 1. + +Interactively, N is the prefix argument." + (interactive "p") (let* ((table (vtable-current-table)) (column (vtable-current-column)) (widths (nth 1 (vtable--cache table)))) (unless column (user-error "No column under point")) - (cl-incf (aref widths column) (vtable--char-width table)) + (cl-incf (aref widths column) + (* (vtable--char-width table) (or n 1))) (vtable-revert))) (defun vtable-previous-column () |