[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/latex-table-wizard 9ce3165694 32/70: Add center and rig
From: |
ELPA Syncer |
Subject: |
[elpa] externals/latex-table-wizard 9ce3165694 32/70: Add center and right alignment |
Date: |
Sat, 13 May 2023 08:59:12 -0400 (EDT) |
branch: externals/latex-table-wizard
commit 9ce3165694f84be20e6ea58cf3f62fea8f7f3643
Author: Enrico Flor <nericoflor@gmail.com>
Commit: Enrico Flor <nericoflor@gmail.com>
Add center and right alignment
---
latex-table-wizard.el | 40 +++++++++++++++++++++++++++++++---------
readme.org | 6 ++++--
2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/latex-table-wizard.el b/latex-table-wizard.el
index 4a8d8c4c3a..79902348a6 100644
--- a/latex-table-wizard.el
+++ b/latex-table-wizard.el
@@ -5,7 +5,7 @@
;; Author: Enrico Flor <enrico@eflor.net>
;; Maintainer: Enrico Flor <enrico@eflor.net>
;; URL: https://github.com/enricoflor/latex-table-wizard
-;; Version: 0.2.1
+;; Version: 0.3.0
;; Package-Requires: ((emacs "27.1") (auctex "12.1") (transient "0.3.7"))
@@ -403,9 +403,8 @@ Each value is an integer, S and E are markers."
(point-marker)))
(hash (secure-hash 'sha256
(buffer-substring-no-properties env-beg env-end)))
- (col-re
- (latex-table-wizard--disjoin
- latex-table-wizard--current-col-delims))
+ (col-re (latex-table-wizard--disjoin
+ latex-table-wizard--current-col-delims))
(row-re (latex-table-wizard--disjoin
latex-table-wizard--current-row-delims)))
(if (and (equal `(,env-beg . ,env-end) (nth 0 latex-table-wizard--parse))
@@ -850,13 +849,19 @@ Don't print any message if NO-MESSAGE is non-nil."
(goto-char x)
(just-one-space)))))
+(defvar-local latex-table-wizard--align-status '(left center right))
+
(defun latex-table-wizard-align ()
"Align and format table at point.
Have every row start on its own line and vertically align column
-delimiters."
+delimiters.
+
+Cycle through three modes of alignment for the text in the cells:
+align left, center and right."
(interactive)
- (let ((max-col (thread-last (latex-table-wizard--parse-table)
+ (let ((mode (car latex-table-wizard--align-status))
+ (max-col (thread-last (latex-table-wizard--parse-table)
(mapcar (lambda (x) (plist-get x :column)))
(delete-dups)
(apply #'max))))
@@ -879,9 +884,26 @@ delimiters."
(dolist (cell line)
(goto-char (plist-get cell :end))
(when (< (current-column) longest)
- (insert (make-string (- longest (current-column))
- (string-to-char " ")))))))
- (setq count (1+ count)))))))
+ (let* ((tot (- longest (current-column)))
+ (pre (/ tot 2))
+ (post (- tot pre)))
+ (cond ((eq mode 'left)
+ (insert (make-string tot
+ (string-to-char " "))))
+ ((eq mode 'right)
+ (goto-char (plist-get cell :start))
+ (insert (make-string tot
+ (string-to-char " "))))
+ ((eq mode 'center)
+ (insert (make-string post
+ (string-to-char " ")))
+ (goto-char (plist-get cell :start))
+ (insert (make-string pre
+ (string-to-char " "))))))))))
+ (setq count (1+ count)))))
+ (setq latex-table-wizard--align-status
+ (append (cdr latex-table-wizard--align-status)
+ (list (car latex-table-wizard--align-status))))))
(defun latex-table-wizard-right (&optional n)
"Move point N cells to the right.
diff --git a/readme.org b/readme.org
index 056f6a15ff..0060567735 100644
--- a/readme.org
+++ b/readme.org
@@ -199,8 +199,10 @@ table by removing excess white space at the edges of each
cell, call
~latex-table-wizard-clean-whitespace~.
Call ~latex-table-wizard-align~ if you want the columns to be vertically
-aligned too (and each row starting on its own line). This alignment
-command tries to be smart and not be fooled by column or row
+aligned too (and each row starting on its own line). If you call this
+command repeatedly, it will cycle through three modes of alignment of
+the text in the cells: align text left, center, and right. This
+alignment command tries to be smart and not be fooled by column or row
delimiters embedded in a cell.
| Command | Default key |
- [elpa] externals/latex-table-wizard de5a922da6 14/70: Remove useless calls to format, (continued)
- [elpa] externals/latex-table-wizard de5a922da6 14/70: Remove useless calls to format, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard e3119802f7 15/70: Expand Commentary section, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 3b53c528c7 19/70: Clarify commentary and fix typo, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 1abac6974f 08/70: Fix problem when no space before delimiters, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 809dff99ef 11/70: Make syntax-quoted forms everywhere, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 74d169f8df 20/70: Two bug fixes, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 4f3f4011ab 22/70: Add group for face and remove before-save-hook, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard acdd4d8b56 23/70: New interactive function that calls transient prefix, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard da4a2e3540 24/70: Made into a minor mode, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f9fb0ae878 28/70: Cleanup and some bug fixed, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 9ce3165694 32/70: Add center and right alignment,
ELPA Syncer <=
- [elpa] externals/latex-table-wizard e3553c7759 34/70: Add feedback about cell jumps, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 13359e40f6 44/70: rename readme, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f290f87949 45/70: add empty changelog file, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 3bafcbefeb 49/70: Update commentary section, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 36e68b0fd8 48/70: Add .elpaignore, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 85af90dac4 52/70: Use TeX-comment-forward, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard ff8c832ad0 53/70: Version 1.1.0, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 71b7b2c252 55/70: Update copyright year and fix bug, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 2544236eb3 57/70: New commands to kill row and column content, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 1f4effedfa 59/70: NOCYCLE argument added to movement commands, ELPA Syncer, 2023/05/13