emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH] org-shift*: Honor org-support-shift-select for table cell moveme


From: Kyle Meyer
Subject: [PATCH] org-shift*: Honor org-support-shift-select for table cell movement
Date: Wed, 08 Apr 2020 04:26:36 +0000

Kyle Meyer <address@hidden> writes:

> The change in behavior happened with 09f950723 (Added keybindings for
> `org-table-move-cell-*' functions), which was a part of the v9.3
> release.  Looking at that commit and scanning the associated thread [^],
> I'm guessing the interaction with org-support-shift-select was simply
> overlooked and those org-table-move-cell-* calls should be updated to
> inspect org-support-shift-select, like (some of) the other neighboring
> branches in the code.
>
> I'll take a look at doing that tomorrow.

Here's a patch that prevents calling org-table-move-cell-* when
org-support-shift-select is `always'.  I'll apply this in a day or two
if no one chimes in to explain why org-table-move-cell-* shouldn't
consider org-support-shift-select.

-- >8 --
Subject: [PATCH] org-shift*: Honor org-support-shift-select for table cell
 movement

* lisp/org.el (org-support-shift-select): Mention table context.
(org-shiftup):
(org-shiftdown):
(org-shiftright):
(org-shiftleft): Don't move table cells when org-support-shift-select
is `always'.

Reported-by: Vladimir Panteleev <address@hidden>
<CAHhfkvw8O4cSxe5CJXQ8L+ce+9wOhuM==address@hidden>
---
 lisp/org.el | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3d841dfa6..c1dffab3c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -854,6 +854,7 @@ (defcustom org-support-shift-select nil
 - in a plain list item, changing the bullet type
 - in a property definition line, switching between allowed values
 - in the BEGIN line of a clock table (changing the time block).
+- in a table, moving the cell in the specified direction.
 Outside these contexts, the commands will throw an error.
 
 When this variable is t and the cursor is not in a special
@@ -863,9 +864,9 @@ (defcustom org-support-shift-select nil
 if the cursor is exactly on the bullet.
 
 If you set this variable to the symbol `always', then the keys
-will not be special in headlines, property lines, and item lines,
-to make shift selection work there as well.  If this is what you
-want, you can use the following alternative commands:
+will not be special in headlines, property lines, item lines, and
+table cells, to make shift selection work there as well.  If this is
+what you want, you can use the following alternative commands:
 `\\[org-todo]' and `\\[org-priority]' \
 to change TODO state and priority,
 `\\[universal-argument] \\[universal-argument] \\[org-todo]' \
@@ -17435,7 +17436,9 @@ (defun org-shiftup (&optional arg)
    ((and (not org-support-shift-select) (org-at-item-p))
     (call-interactively 'org-previous-item))
    ((org-clocktable-try-shift 'up arg))
-   ((org-at-table-p) (org-table-move-cell-up))
+   ((and (not (eq org-support-shift-select 'always))
+        (org-at-table-p))
+    (org-table-move-cell-up))
    ((run-hook-with-args-until-success 'org-shiftup-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'previous-line))
@@ -17461,7 +17464,9 @@ (defun org-shiftdown (&optional arg)
    ((and (not org-support-shift-select) (org-at-item-p))
     (call-interactively 'org-next-item))
    ((org-clocktable-try-shift 'down arg))
-   ((org-at-table-p) (org-table-move-cell-down))
+   ((and (not (eq org-support-shift-select 'always))
+        (org-at-table-p))
+    (org-table-move-cell-down))
    ((run-hook-with-args-until-success 'org-shiftdown-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'next-line))
@@ -17499,7 +17504,9 @@ (defun org-shiftright (&optional arg)
         (org-at-property-p))
     (call-interactively 'org-property-next-allowed-value))
    ((org-clocktable-try-shift 'right arg))
-   ((org-at-table-p) (org-table-move-cell-right))
+   ((and (not (eq org-support-shift-select 'always))
+        (org-at-table-p))
+    (org-table-move-cell-right))
    ((run-hook-with-args-until-success 'org-shiftright-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'forward-char))
@@ -17537,7 +17544,9 @@ (defun org-shiftleft (&optional arg)
         (org-at-property-p))
     (call-interactively 'org-property-previous-allowed-value))
    ((org-clocktable-try-shift 'left arg))
-   ((org-at-table-p) (org-table-move-cell-left))
+   ((and (not (eq org-support-shift-select 'always))
+        (org-at-table-p))
+    (org-table-move-cell-left))
    ((run-hook-with-args-until-success 'org-shiftleft-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'backward-char))

base-commit: 561e9efd062e23321f3b56b2e3482ef3afc7416f
-- 
2.26.0




reply via email to

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