[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/valign 80cf682 121/198: Remove some internal variables
From: |
Stefan Monnier |
Subject: |
[elpa] externals/valign 80cf682 121/198: Remove some internal variables |
Date: |
Tue, 1 Dec 2020 18:19:30 -0500 (EST) |
branch: externals/valign
commit 80cf682806f6378eb481ea32266275ff041847af
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Remove some internal variables
* valign.el (valign-table-1): Remove 'separator-row-point-list',
'rev-list', 'at-sep-row'. Move initialization of 'ssw' and 'bar-width'
up.
---
valign.el | 34 +++++++++++-----------------------
1 file changed, 11 insertions(+), 23 deletions(-)
diff --git a/valign.el b/valign.el
index 1ccc7f3..fd75762 100644
--- a/valign.el
+++ b/valign.el
@@ -481,10 +481,16 @@ You need to restart valign mode for this setting to take
effect."
(defun valign-table-1 ()
"Visually align the table at point."
- (let (end column-width-list column-idx pos ssw bar-width
- separator-row-point-list rev-list
- column-alignment-list at-sep-row right-bar-pos
- row-idx)
+ (let (end column-width-list column-idx pos
+ column-alignment-list right-bar-pos row-idx
+ (ssw (save-excursion
+ (search-forward " ")
+ (valign--pixel-width-from-to
+ (match-beginning 0) (match-end 0))))
+ (bar-width (save-excursion
+ (search-forward "|")
+ (valign--pixel-width-from-to
+ (match-beginning 0) (match-end 0)))))
(ignore row-idx)
;; ‘separator-row-point-list’ marks the point for each
;; separator-row, so we can later come back and align them.
@@ -519,28 +525,12 @@ You need to restart valign mode for this setting to take
effect."
;; Pixel width of the cell.
(cell-width (valign--cell-width))
tab-width tab-start tab-end)
- ;; single-space-width
- (unless ssw
- (setq ssw (save-excursion
- (search-forward " ")
- (valign--pixel-width-from-to
- (match-beginning 0) (match-end 0)))))
- (unless bar-width
- (setq bar-width (save-excursion
- (search-forward "|")
- (valign--pixel-width-from-to
- (match-beginning 0) (match-end 0)))))
;; Initialize some numbers when we are at a new
;; line. ‘pos’ is the pixel position of the
;; current point, i.e., after the left bar.
(when (eq column-idx 0)
- (when (valign--separator-p)
- (push (point) separator-row-point-list))
;; Render the first bar of the line.
(valign--maybe-render-bar (1- (point)))
- (unless (valign--separator-p)
- (setq rev-list nil))
- (setq at-sep-row (if (valign--separator-p) t nil))
(setq pos (valign--pixel-width-from-to
(line-beginning-position) (point))))
;; Align cell.
@@ -588,9 +578,7 @@ You need to restart valign mode for this setting to take
effect."
tab-start (point)
(+ pos tab-width))))))
;; Update ‘pos’ for the next cell.
- (setq pos (+ pos col-width bar-width ssw))
- (unless at-sep-row
- (push (- pos bar-width) rev-list)))))))))
+ (setq pos (+ pos col-width bar-width ssw)))))))))
;;; Mode intergration
- [elpa] externals/valign 44f065d 131/198: * valign.el: Bump version to 2.1.0, (continued)
- [elpa] externals/valign 44f065d 131/198: * valign.el: Bump version to 2.1.0, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 693f086 135/198: * valign.el (valign-mode): Change tab-advice to :after., Stefan Monnier, 2020/12/01
- [elpa] externals/valign eaa5cb1 104/198: Enable autoload mechanism, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 4c514ce 169/198: Use text properties for table.el tables, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 8e598bf 170/198: ; * test.org: Add a test table., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 316452b 163/198: Change fancy bar to use overlay, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 06d9e1a 192/198: Prepare for ELPA, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 5729733 178/198: * valign.el: Move user land code down below (re-layout)., Stefan Monnier, 2020/12/01
- [elpa] externals/valign b189102 194/198: ; * test.org: New test., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 44c747b 136/198: * valign.el (valign-table): Clean up table if error occurs., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 80cf682 121/198: Remove some internal variables,
Stefan Monnier <=
- [elpa] externals/valign 9daeab8 071/198: * valign.el (valign-table-quite): Really ignore errors., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 09e89aa 105/198: * valign.el (valign--at-table-p): Don’t align org blocks., Stefan Monnier, 2020/12/01
- [elpa] externals/valign e91abf2 112/198: Extract out boilerplate from valign-table, Stefan Monnier, 2020/12/01
- [elpa] externals/valign d799e31 181/198: ; * valign.el (valign--cell-content-config): Fix typo., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 9fc0c11 149/198: Use new function to calculate space and bar width, Stefan Monnier, 2020/12/01
- [elpa] externals/valign d18aea8 183/198: Improve error handling, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 62766e7 184/198: Add custom group, Stefan Monnier, 2020/12/01
- [elpa] externals/valign bf68d39 171/198: Remove single-column style, Stefan Monnier, 2020/12/01
- [elpa] externals/valign ce1a53c 188/198: ; * test.org: Update., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 82be45d 198/198: Bug fix, Stefan Monnier, 2020/12/01