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

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

[elpa] externals-release/org eedbe28: lisp/org-table.el: Fix bug with `o


From: ELPA Syncer
Subject: [elpa] externals-release/org eedbe28: lisp/org-table.el: Fix bug with `org-table-wrap-region'
Date: Sat, 1 May 2021 23:57:10 -0400 (EDT)

branch: externals-release/org
commit eedbe286efeb32f23051cb206353e189c3b1cede
Author: Bastien <bzg@gnu.org>
Commit: Bastien <bzg@gnu.org>

    lisp/org-table.el: Fix bug with `org-table-wrap-region'
    
    * lisp/org-table.el (org-table-copy-region): Only display a
    message when called interactively.
    (org-table-wrap-region): Prevent `org-table-cut-region' from
    losing track of the region beginning.
    
    Reported-by: Marko Schuetz-Schmuck <marko.schutz@upr.edu>
    Link: 
https://orgmode.org/list/875z84fnwv.fsf@tpad-m.i-did-not-set--mail-host-address--so-tickle-me/
---
 lisp/org-table.el | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index a6bc254..cbed2f0 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1941,8 +1941,9 @@ of lists of fields."
        (forward-line))
       (set-marker end nil))
     (when cut (org-table-align))
-    (message (substitute-command-keys "Cells in the region copied, use \
-\\[org-table-paste-rectangle] to paste them in a table."))
+    (when (called-interactively-p 'any)
+      (message (substitute-command-keys "Cells in the region copied, use \
+\\[org-table-paste-rectangle] to paste them in a table.")))
     (setq org-table-clip (nreverse region))))
 
 ;;;###autoload
@@ -4679,19 +4680,24 @@ blank, and the content is appended to the field above."
   (if (org-region-active-p)
       ;; There is a region: fill as a paragraph.
       (let ((start (region-beginning)))
-       (org-table-cut-region (region-beginning) (region-end))
-       (when (> (length (car org-table-clip)) 1)
-         (user-error "Region must be limited to single column"))
-       (let ((nlines (cond ((not arg) (length org-table-clip))
-                           ((< arg 1) (+ (length org-table-clip) arg))
-                           (t arg))))
-         (setq org-table-clip
-               (mapcar #'list
-                       (org-wrap (mapconcat #'car org-table-clip " ")
-                                 nil
-                                 nlines))))
-       (goto-char start)
-       (org-table-paste-rectangle))
+        (save-restriction
+          (narrow-to-region
+           (save-excursion (goto-char start) (move-beginning-of-line 1))
+           (save-excursion (org-forward-paragraph) (point)))
+          (org-table-cut-region (region-beginning) (region-end))
+          (when (> (length (car org-table-clip)) 1)
+            (user-error "Region must be limited to single column"))
+          (let ((nlines (cond ((not arg) (length org-table-clip))
+                              ((< arg 1) (+ (length org-table-clip) arg))
+                              (t arg))))
+            (setq org-table-clip
+                  (mapcar #'list
+                          (org-wrap (mapconcat #'car org-table-clip " ")
+                                    nil
+                                    nlines))))
+          (goto-char start)
+          (org-table-paste-rectangle))
+        (org-table-align))
     ;; No region, split the current field at point.
     (unless (org-get-alist-option org-M-RET-may-split-line 'table)
       (skip-chars-forward "^\r\n|"))



reply via email to

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