From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id +IH0CXbDnmSAhAAASxT56A (envelope-from ) for ; Fri, 30 Jun 2023 13:58:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 8LTJCXbDnmRyugAA9RJhRA (envelope-from ) for ; Fri, 30 Jun 2023 13:58:46 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F1297DECE for ; Fri, 30 Jun 2023 13:58:45 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; none Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFCks-0003AC-96; Fri, 30 Jun 2023 07:57:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qF0B6-0003c7-DO for emacs-orgmode@gnu.org; Thu, 29 Jun 2023 18:31:52 -0400 Received: from out-34.mta0.migadu.com ([91.218.175.34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qF0B3-0000oC-H1 for emacs-orgmode@gnu.org; Thu, 29 Jun 2023 18:31:52 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lipklim.org; s=key1; t=1688077907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=74y5Gxmp+Fms4W17qd86bfjfNV7GTZUQiDpqkc+0cUk=; b=336XpnVij9WG5qJZ9SMUOleX1wkvG7vg0VZUFQk5dzA6w6KOLoXDVccqmr2SdS39aUMW3t vhXisbOtXRGXTTF4BwQd6e9isoqTdeZI4i6+PclJaeoYOAfc3fllIA3XAUfoiaqJTf5Me0 p0w5yVa2Q+e8RrQyFQHaUwfoJrvDLv8= From: Evgenii Klimov To: emacs-orgmode@gnu.org Cc: Evgenii Klimov Subject: [PATCH 1/3] lisp/org.el: Add final hooks to the M-cursor commands Date: Thu, 29 Jun 2023 23:31:27 +0100 Message-Id: <20230629223129.17191-2-eugene.dev@lipklim.org> In-Reply-To: <20230629223129.17191-1-eugene.dev@lipklim.org> References: <20230629223129.17191-1-eugene.dev@lipklim.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=91.218.175.34; envelope-from=eugene.dev@lipklim.org; helo=out-34.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 30 Jun 2023 07:57:35 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -4.00 X-Spam-Score: -4.00 X-Migadu-Queue-Id: F1297DECE X-TUID: bvZIQSk/zjq6 * 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