emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals-release/org 97a780f0be: org-table-justify-field-maybe:


From: ELPA Syncer
Subject: [elpa] externals-release/org 97a780f0be: org-table-justify-field-maybe: Do not allow newlines inside cells
Date: Wed, 7 Dec 2022 09:57:59 -0500 (EST)

branch: externals-release/org
commit 97a780f0be734ac661460c39526f97ad41ea0bac
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-table-justify-field-maybe: Do not allow newlines inside cells
    
    * lisp/org-table.el (org-table-justify-field-maybe): Remove newlines
    from cell values, when present.  Newlines will alter the table cell
    structure.
    
    Reported-by: Julien Palard <julien@palard.fr>
    Link: https://orgmode.org/list/638faf1b.050a0220.2bd96.904b@mx.google.com
---
 lisp/org-table.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 8e0e8e6cf8..70ebde205f 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -4448,6 +4448,13 @@ FIELD is a string.  WIDTH is a number.  ALIGN is either 
\"c\",
 (defun org-table-justify-field-maybe (&optional new)
   "Justify the current field, text to left, number to right.
 Optional argument NEW may specify text to replace the current field content."
+  ;; FIXME: Prevent newlines inside field.  They are currently not
+  ;; supported.
+  (when (and (stringp new) (string-match-p "\n" new))
+    (message "Removing newlines from formula result: %S" new)
+    (setq new (replace-regexp-in-string
+               "\n" " "
+               (replace-regexp-in-string "\\(^\n+\\)\\|\\(\n+$\\)" "" new))))
   (cond
    ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway
    ((org-at-table-hline-p))



reply via email to

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