* lisp/org.el (org-metaleft-final-hook, org-metaright-final-hook, org-metaup-final-hook, org-metadown-final-hook): Define final hooks for S-cursor commands. (org-metaleft, org-metaright, org-metaup, org-metadown): Add final hooks to M-commands and document them in the docstring. --- lisp/org.el | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el index 4063ba98f..b396456a2 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16714,15 +16714,27 @@ 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'. +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'. +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'. +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'. +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.") @@ -16879,7 +16891,8 @@ default `backward-word'. See the individual commands for more information. This function runs the hook `org-metaleft-hook' as a first step, -and returns at first non-nil value." +`org-metaleft-final-hook' as the penultimate step, and returns at +first non-nil value." (interactive "P") (cond ((run-hook-with-args-until-success 'org-metaleft-hook)) @@ -16902,6 +16915,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) @@ -16915,7 +16929,8 @@ With no specific context, calls the Emacs default `forward-word'. See the individual commands for more information. This function runs the hook `org-metaright-hook' as a first step, -and returns at first non-nil value." +`org-metaright-final-hook' as the penultimate step, and returns +at first non-nil value." (interactive "P") (cond ((run-hook-with-args-until-success 'org-metaright-hook)) @@ -16940,6 +16955,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) @@ -16973,7 +16989,11 @@ this function returns t, nil otherwise." "Move subtree up or move table row up. Calls `org-move-subtree-up' or `org-table-move-row' or `org-move-item-up', depending on context. See the individual commands -for more information." +for more information. + +This function runs the hook `org-metaup-hook' as a first step, +`org-metaup-final-hook' as the penultimate step, and returns at +first non-nil value." (interactive "P") (cond ((run-hook-with-args-until-success 'org-metaup-hook)) @@ -17030,13 +17050,18 @@ for more information." (org-drag-element-backward)) ((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) "Move subtree down or move table row down. Calls `org-move-subtree-down' or `org-table-move-row' or `org-move-item-down', depending on context. See the individual -commands for more information." +commands for more information. + +This function runs the hook `org-metadown-hook' as a first step, +`org-metadown-final-hook' as the penultimate step, and returns at +first non-nil value." (interactive "P") (cond ((run-hook-with-args-until-success 'org-metadown-hook)) @@ -17089,6 +17114,7 @@ commands for more information." (org-drag-element-forward)) ((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.34.1