emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add org-meta*-final-hook
@ 2020-09-28 22:37 Jay Bosamiya
  2021-04-25  6:31 ` Timothy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jay Bosamiya @ 2020-09-28 22:37 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 233 bytes --]

Hi all,

Similar to org-shiftup-final-hook, org-shiftdown-final-hook, etc, I have
added org-metaup-final-hook, org-metadown-final-hook, etc. Please see
attached patch.

Please do let me know if any changes are required.

Cheers,
Jay

[-- Attachment #1.2: Type: text/html, Size: 360 bytes --]

[-- Attachment #2: 0001-lisp-org.el-Introduce-org-meta-final-hook.patch --]
[-- Type: text/x-patch, Size: 3688 bytes --]

From 1568c1ab790edd2bb63aba32e8fcd2e3ad3d99fc Mon Sep 17 00:00:00 2001
From: Jay Bosamiya <jaybosamiya@gmail.com>
Date: Mon, 28 Sep 2020 18:22:50 -0400
Subject: [PATCH] lisp/org.el: Introduce org-meta*-final-hook

* lisp/org.el: Introduce org-meta*-final-hook.
These hooks, similar to org-shift*-final-hook are run at the end of
meta-directionkey after all other options have been exhausted.
---
 lisp/org.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 26f3f4dd7..6fcb8f0a0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16795,15 +16795,31 @@ before indentation and \t insertion takes place.")
 (defvar org-metaleft-hook nil
   "Hook for functions attaching themselves to `M-left'.
 See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-metaleft-final-hook nil
+  "Hook for functions attaching themselves to `M-left'.
+This one runs after all other options have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
 (defvar org-metaright-hook nil
   "Hook for functions attaching themselves to `M-right'.
 See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-metaright-final-hook nil
+  "Hook for functions attaching themselves to `M-right'.
+This one runs after all other options have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
 (defvar org-metaup-hook nil
   "Hook for functions attaching themselves to `M-up'.
 See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-metaup-final-hook nil
+  "Hook for functions attaching themselves to `M-up'.
+This one runs after all other options have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
 (defvar org-metadown-hook nil
   "Hook for functions attaching themselves to `M-down'.
 See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-metadown-final-hook nil
+  "Hook for functions attaching themselves to `M-down'.
+This one runs after all other options have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
 (defvar org-shiftmetaleft-hook nil
   "Hook for functions attaching themselves to `M-S-left'.
 See `org-ctrl-c-ctrl-c-hook' for more information.")
@@ -16974,6 +16990,7 @@ and returns at first non-nil value."
 	       (org-at-item-p))))
     (when (org-check-for-hidden 'items) (org-hidden-tree-error))
     (call-interactively 'org-outdent-item))
+   ((run-hook-with-args-until-success 'org-metaleft-final-hook))
    (t (call-interactively 'backward-word))))
 
 (defun org-metaright (&optional _arg)
@@ -17012,6 +17029,7 @@ and returns at first non-nil value."
 	       (org-at-item-p))))
     (when (org-check-for-hidden 'items) (org-hidden-tree-error))
     (call-interactively 'org-indent-item))
+   ((run-hook-with-args-until-success 'org-metaright-final-hook))
    (t (call-interactively 'forward-word))))
 
 (defun org-check-for-hidden (what)
@@ -17069,6 +17087,7 @@ for more information."
    ((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up))
    ((org-at-heading-p) (call-interactively 'org-move-subtree-up))
    ((org-at-item-p) (call-interactively 'org-move-item-up))
+   ((run-hook-with-args-until-success 'org-metaup-final-hook))
    (t (org-drag-element-backward))))
 
 (defun org-metadown (&optional _arg)
@@ -17099,6 +17118,7 @@ commands for more information."
    ((org-at-table-p) (call-interactively 'org-table-move-row))
    ((org-at-heading-p) (call-interactively 'org-move-subtree-down))
    ((org-at-item-p) (call-interactively 'org-move-item-down))
+   ((run-hook-with-args-until-success 'org-metadown-final-hook))
    (t (org-drag-element-forward))))
 
 (defun org-shiftup (&optional arg)
-- 
2.20.1


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

* Re: [PATCH] Add org-meta*-final-hook
  2020-09-28 22:37 [PATCH] Add org-meta*-final-hook Jay Bosamiya
@ 2021-04-25  6:31 ` Timothy
  2021-04-27 20:37 ` Bastien
  2021-05-15 13:24 ` Bastien
  2 siblings, 0 replies; 5+ messages in thread
From: Timothy @ 2021-04-25  6:31 UTC (permalink / raw)
  To: Jay Bosamiya; +Cc: emacs-orgmode


Hi Jay,

Apologies for how incredibly long it's taken for someone to reply to
your email. It looks like this is your first contribution, so please
don't think this is the norm 😅, you just seemed to slip through the
cracks.

Jay Bosamiya <jaybosamiya@gmail.com> writes:

> Similar to org-shiftup-final-hook, org-shiftdown-final-hook, etc, I have
> added org-metaup-final-hook, org-metadown-final-hook, etc. Please see
> attached patch.

This seems consistent with what we already have, and so a good addition 👍.

> Please do let me know if any changes are required.

It looks like you have >15 lines changed here, so this is not eligible
to be a TINYCHANGE, i.e. we require FSF assignment
(see: https://orgmode.org/contribute.html#copyright) if you haven't got
this already.

--
Timothy


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

* Re: [PATCH] Add org-meta*-final-hook
  2020-09-28 22:37 [PATCH] Add org-meta*-final-hook Jay Bosamiya
  2021-04-25  6:31 ` Timothy
@ 2021-04-27 20:37 ` Bastien
  2021-05-15 13:24 ` Bastien
  2 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2021-04-27 20:37 UTC (permalink / raw)
  To: Jay Bosamiya; +Cc: emacs-orgmode

Hi Jay,

Jay Bosamiya <jaybosamiya@gmail.com> writes:

> Similar to org-shiftup-final-hook, org-shiftdown-final-hook, etc, I
> have added org-metaup-final-hook, org-metadown-final-hook, etc.
> Please see attached patch.

Can you give a concrete example of a hook here?

And thanks for the patch.

As Timothy suggested, you may need to sign the FSF paper before we can
accept it (although in this case, "original" lines are probably below
the limit of 15 lines).

Would you agree to sign https://orgmode.org/request-assign-future.txt?

This would secure future contributions too.


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

* Re: [PATCH] Add org-meta*-final-hook
  2020-09-28 22:37 [PATCH] Add org-meta*-final-hook Jay Bosamiya
  2021-04-25  6:31 ` Timothy
  2021-04-27 20:37 ` Bastien
@ 2021-05-15 13:24 ` Bastien
  2021-05-23  2:29   ` Jay Bosamiya
  2 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2021-05-15 13:24 UTC (permalink / raw)
  To: Jay Bosamiya; +Cc: emacs-orgmode

Hi,

Jay Bosamiya <jaybosamiya@gmail.com> writes:

> Similar to org-shiftup-final-hook, org-shiftdown-final-hook, etc, I
> have added org-metaup-final-hook, org-metadown-final-hook, etc.

Without a concrete example of why this would be needed, I suggest to
set this aside (i.e. no need to add this code just for consistency.)

Jay, if you actually use this patch for your own needs, let us know
with an example.

Thanks,

-- 
 Bastien


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

* Re: [PATCH] Add org-meta*-final-hook
  2021-05-15 13:24 ` Bastien
@ 2021-05-23  2:29   ` Jay Bosamiya
  0 siblings, 0 replies; 5+ messages in thread
From: Jay Bosamiya @ 2021-05-23  2:29 UTC (permalink / raw)
  To: Bastien, Timothy; +Cc: emacs-orgmode

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

Hi Bastien and Timothy,

Thanks for taking a look at this. Apologies for the delay in getting back
to you.

First: I've started the FSF assignment process. I'd be happy to ping again
on this thread again once I hear back from there, if we need to wait for
that to complete.

Second: I indeed do use this patch regularly. I use these final hooks to
provide the same windmove bindings that I use regularly outside org-mode
too. Specifically, I use windmove with `(windmove-default-keybindings
'meta)` which means that rather than the "standard" default (of
shift-direction keys for which the solution for the keybinding conflict in
https://orgmode.org/manual/Conflicts.html is to use the
shift*-final-hooks), I use meta-direction keys, and thus need to have a
meta*-final-hooks, to be able to continue using windmove alongside org-mode.

Thanks again!

Cheers,
Jay



On Sat, May 15, 2021 at 9:24 AM Bastien <bzg@gnu.org> wrote:

> Hi,
>
> Jay Bosamiya <jaybosamiya@gmail.com> writes:
>
> > Similar to org-shiftup-final-hook, org-shiftdown-final-hook, etc, I
> > have added org-metaup-final-hook, org-metadown-final-hook, etc.
>
> Without a concrete example of why this would be needed, I suggest to
> set this aside (i.e. no need to add this code just for consistency.)
>
> Jay, if you actually use this patch for your own needs, let us know
> with an example.
>
> Thanks,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 2056 bytes --]

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

end of thread, other threads:[~2021-05-23  2:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-28 22:37 [PATCH] Add org-meta*-final-hook Jay Bosamiya
2021-04-25  6:31 ` Timothy
2021-04-27 20:37 ` Bastien
2021-05-15 13:24 ` Bastien
2021-05-23  2:29   ` Jay Bosamiya

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