emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jay Bosamiya <jaybosamiya@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Add org-meta*-final-hook
Date: Mon, 28 Sep 2020 18:37:42 -0400	[thread overview]
Message-ID: <CAOywxZg1cBL07THLZXHBBCzm6te2vMtqnmM0w63331gybrjZuw@mail.gmail.com> (raw)


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


             reply	other threads:[~2020-09-28 22:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 22:37 Jay Bosamiya [this message]
2021-04-25  6:31 ` [PATCH] Add org-meta*-final-hook Timothy
2021-04-27 20:37 ` Bastien
2021-05-15 13:24 ` Bastien
2021-05-23  2:29   ` Jay Bosamiya

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=CAOywxZg1cBL07THLZXHBBCzm6te2vMtqnmM0w63331gybrjZuw@mail.gmail.com \
    --to=jaybosamiya@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).