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

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