emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Carlos Pita <carlosjosepita2@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] Re: org-metashiftleft/right should honor org-support-shift-select
Date: Tue, 23 Nov 2021 21:27:54 +0800	[thread overview]
Message-ID: <87zgpvf1d1.fsf@localhost> (raw)
In-Reply-To: <CAEOO5Tdg6sdjNfAg=J_DVQ50xx1oxaFaVyyYnda6O_-t3hG2jg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

Carlos Pita <carlosjosepita2@gmail.com> writes:

> Hi all,
>
> on macOS option-shift-left / right extend the selection by one word.
> Emacs by default binds meta-shift-left / right in a way that is
> compatible with the system shortcuts. But org-mode interferes with
> these bindings even when org-support-shift-select is t. OTOH, an
> effort has been done to support shift selection in
> org-shiftcontrolleft / right. The problem is that macOS uses option
> instead of control to achieve selection by word.

Can you test the attached patch? I am not using MacOS.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-org-shiftmetaleft-org-shiftmetaright-honour-shi.patch --]
[-- Type: text/x-diff, Size: 1822 bytes --]

From 77312a266c200a65a4a8cf63040e32357304396c Mon Sep 17 00:00:00 2001
Message-Id: <77312a266c200a65a4a8cf63040e32357304396c.1637674022.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Tue, 23 Nov 2021 21:24:52 +0800
Subject: [PATCH] Make org-shiftmetaleft/org-shiftmetaright honour shift-select
 on MacOS

* lisp/org.el (org-shiftmetaleft):
(org-shiftmetaright): Honour shift-select bound to meta-arrow on
MacOS when `org-support-shift-select' is non-nil.

Fixes https://orgmode.org/list/CAEOO5Tdg6sdjNfAg=J_DVQ50xx1oxaFaVyyYnda6O_-t3hG2jg@mail.gmail.com
---
 lisp/org.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 048abb142..a86ad301f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17378,6 +17378,10 @@ (defun org-shiftmetaleft ()
 individual commands for more information."
   (interactive)
   (cond
+   ((and (eq system-type 'darwin)
+         (or (eq org-support-shift-select 'always)
+             (and org-support-shift-select (org-region-active-p))))
+    (org-call-for-shift-select 'backward-char))
    ((run-hook-with-args-until-success 'org-shiftmetaleft-hook))
    ((org-at-table-p) (call-interactively 'org-table-delete-column))
    ((org-at-heading-p) (call-interactively 'org-promote-subtree))
@@ -17394,6 +17398,10 @@ (defun org-shiftmetaright ()
 individual commands for more information."
   (interactive)
   (cond
+   ((and (eq system-type 'darwin)
+         (or (eq org-support-shift-select 'always)
+             (and org-support-shift-select (org-region-active-p))))
+    (org-call-for-shift-select 'forward-char))
    ((run-hook-with-args-until-success 'org-shiftmetaright-hook))
    ((org-at-table-p) (call-interactively 'org-table-insert-column))
    ((org-at-heading-p) (call-interactively 'org-demote-subtree))
-- 
2.32.0


  reply	other threads:[~2021-11-23 13:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  3:47 org-metashiftleft/right should honor org-support-shift-select Carlos Pita
2021-11-23 13:27 ` Ihor Radchenko [this message]
2022-07-31  7:30   ` [PATCH] " Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgpvf1d1.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=carlosjosepita2@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).