emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-shiftright etc. do not respect org-support-shift-select [9.3.6 (9.3.6-elpa @ /home/vladimir/.emacs.d/elpa/org-9.3.6/)]
@ 2020-04-05  8:40 Vladimir Panteleev
  2020-04-07  5:19 ` Kyle Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Panteleev @ 2020-04-05  8:40 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I have org-support-shift-select set to 'always. As such, when editing
tables, I expect that Shift + arrow keys to enable Emacs shift
selection. Instead, it moves table cells around.

This behavior did not exist in Org 9.1.9.

The documentation of org-support-shift-select should also be updated
to include tables in the list of contexts where shifted cursor keys
execute Org commands.

Thanks!

Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw
scroll bars) of 2019-09-07
Package: Org mode version 9.3.6 (9.3.6-elpa @
/home/vladimir/.emacs.d/elpa/org-9.3.6/)

current state:
==============
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
             org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-blank-before-new-entry '((heading . auto) (plain-list-item))
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-reveal-start-hook '(org-decrypt-entry)
 org-calc-default-modes '(calc-language c calc-internal-prec 12
calc-float-format
              (float 8) calc-angle-mode deg calc-prefer-frac nil
              calc-symbolic-mode nil calc-date-format
              (YYYY "-" MM "-" DD " " Www (" " hh ":" mm))
              calc-display-working-message t)
 org-mode-hook '(cs/org-mode-hook
         #[0 "\300\301\302\303\304$\207"
           [add-hook change-major-mode-hook org-show-all append local] 5]
         #[0 "\300\301\302\303\304$\207"
           [add-hook change-major-mode-hook org-babel-show-result-all append
            local]
           5]
         org-babel-result-hide-spec org-babel-hide-all-hashes
         #[0 "\301\211\207"
           [imenu-create-index-function org-imenu-get-tree] 2]
         )
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
          org-optimize-window-after-visibility-change)
 org-support-shift-select 'always
 org-speed-command-hook '(org-speed-command-activate
              org-babel-speed-command-activate)
 org-return-follows-link t
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link :export
            org-attach-export-link :complete org-attach-complete-link)
               ("id" :follow org-id-open)
               ("eww" :follow eww :store org-eww-store-link)
               ("rmail" :follow org-rmail-open :store org-rmail-store-link)
               ("mhe" :follow org-mhe-open :store org-mhe-store-link)
               ("irc" :follow org-irc-visit :store org-irc-store-link
            :export org-irc-export)
               ("info" :follow org-info-open :export org-info-export :store
            org-info-store-link)
               ("gnus" :follow org-gnus-open :store org-gnus-store-link)
               ("docview" :follow org-docview-open :export
            org-docview-export :store org-docview-store-link)
               ("bibtex" :follow org-bibtex-open :store
            org-bibtex-store-link)
               ("bbdb" :follow org-bbdb-open :export org-bbdb-export
            :complete org-bbdb-complete-link :store org-bbdb-store-link)
               ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
               ("shell" :follow org-link--open-shell)
               ("news" :follow
            #[257 "\301\300\302Q!\207" ["news" browse-url ":"] 5
              "\n\n(fn URL)"]
            )
               ("mailto" :follow
            #[257 "\301\300\302Q!\207" ["mailto" browse-url ":"] 5
              "\n\n(fn URL)"]
            )
               ("https" :follow
            #[257 "\301\300\302Q!\207" ["https" browse-url ":"] 5
              "\n\n(fn URL)"]
            )
               ("http" :follow
            #[257 "\301\300\302Q!\207" ["http" browse-url ":"] 5
              "\n\n(fn URL)"]
            )
               ("ftp" :follow
            #[257 "\301\300\302Q!\207" ["ftp" browse-url ":"] 5
              "\n\n(fn URL)"]
            )
               ("help" :follow org-link--open-help)
               ("file" :complete org-link-complete-file)
               ("elisp" :follow org-link--open-elisp)
               ("doi" :follow org-link--open-doi))
 org-link-elisp-confirm-function 'yes-or-no-p
 )


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: org-shiftright etc. do not respect org-support-shift-select [9.3.6 (9.3.6-elpa @ /home/vladimir/.emacs.d/elpa/org-9.3.6/)]
  2020-04-05  8:40 Bug: org-shiftright etc. do not respect org-support-shift-select [9.3.6 (9.3.6-elpa @ /home/vladimir/.emacs.d/elpa/org-9.3.6/)] Vladimir Panteleev
@ 2020-04-07  5:19 ` Kyle Meyer
  2020-04-08  4:26   ` [PATCH] org-shift*: Honor org-support-shift-select for table cell movement Kyle Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Kyle Meyer @ 2020-04-07  5:19 UTC (permalink / raw)
  To: Vladimir Panteleev; +Cc: emacs-orgmode

Vladimir Panteleev <thecybershadow@gmail.com> writes:

> I have org-support-shift-select set to 'always. As such, when editing
> tables, I expect that Shift + arrow keys to enable Emacs shift
> selection. Instead, it moves table cells around.
>
> This behavior did not exist in Org 9.1.9.

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.

> The documentation of org-support-shift-select should also be updated
> to include tables in the list of contexts where shifted cursor keys
> execute Org commands.

True.

Thanks for the report.


[^]: https://yhetil.org/orgmode/CAKj7sHGdxaor6Lwe+pg481Z7DyHXXr6DDWrBWGa2VCyX+RKy+w@mail.gmail.com/T/#u


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] org-shift*: Honor org-support-shift-select for table cell movement
  2020-04-07  5:19 ` Kyle Meyer
@ 2020-04-08  4:26   ` Kyle Meyer
  2020-04-10  2:32     ` Kyle Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Kyle Meyer @ 2020-04-08  4:26 UTC (permalink / raw)
  To: Vladimir Panteleev; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> 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 <thecybershadow@gmail.com>
<CAHhfkvw8O4cSxe5CJXQ8L+ce+9wOhuM==Xv9rB2NVhsCgYANdA@mail.gmail.com>
---
 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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] org-shift*: Honor org-support-shift-select for table cell movement
  2020-04-08  4:26   ` [PATCH] org-shift*: Honor org-support-shift-select for table cell movement Kyle Meyer
@ 2020-04-10  2:32     ` Kyle Meyer
  0 siblings, 0 replies; 4+ messages in thread
From: Kyle Meyer @ 2020-04-10  2:32 UTC (permalink / raw)
  To: Vladimir Panteleev; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

> 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.

Applied in 06c7a54f0.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-10  2:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05  8:40 Bug: org-shiftright etc. do not respect org-support-shift-select [9.3.6 (9.3.6-elpa @ /home/vladimir/.emacs.d/elpa/org-9.3.6/)] Vladimir Panteleev
2020-04-07  5:19 ` Kyle Meyer
2020-04-08  4:26   ` [PATCH] org-shift*: Honor org-support-shift-select for table cell movement Kyle Meyer
2020-04-10  2:32     ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).