emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5a9e4f2230: Further divider fixes for vtable


From: Lars Ingebrigtsen
Subject: master 5a9e4f2230: Further divider fixes for vtable
Date: Wed, 13 Apr 2022 20:18:16 -0400 (EDT)

branch: master
commit 5a9e4f2230e76d53499cdd574a2cca61c9c3a1d0
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/emacs-lisp/vtable.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el
index de7b9b7cdf..943ede159a 100644
--- a/lisp/emacs-lisp/vtable.el
+++ b/lisp/emacs-lisp/vtable.el
@@ -570,7 +570,8 @@ This also updates the displayed table."
 
 (defun vtable--insert-header-line (table widths spacer)
   ;; Insert the header directly into the buffer.
-  (let* ((start (point)))
+  (let ((start (point))
+        (divider (vtable-divider table)))
     (seq-do-indexed
      (lambda (column index)
        (let* ((name (propertize
@@ -594,8 +595,9 @@ This also updates the displayed table."
                       (list 'space :width
                             (list (+ (- (elt widths index)
                                         (string-pixel-width displayed))
-                                     (if last 0 spacer)))))
-          (or (vtable-divider table) ""))
+                                     (if last 0 spacer))))))
+         (when (and divider (not last))
+           (insert divider))
          (put-text-property start (point) 'vtable-column index)))
      (vtable-columns table))
     (insert "\n")
@@ -762,6 +764,8 @@ This also updates the displayed table."
   (let* ((table (vtable-current-table))
          (column (vtable-current-column))
          (widths (vtable--widths table)))
+    (unless column
+      (user-error "No column under point"))
     (setf (aref widths column)
           (max (* (vtable--char-width table) 2)
                (- (aref widths column) (vtable--char-width table))))
@@ -773,6 +777,8 @@ This also updates the displayed table."
   (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))
     (vtable-revert)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]