From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id rpp9CHjDnmQibgEASxT56A (envelope-from ) for ; Fri, 30 Jun 2023 13:58:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8KQxB3jDnmTNLgAAauVa8A (envelope-from ) for ; Fri, 30 Jun 2023 13:58:48 +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 C80783DBD9 for ; Fri, 30 Jun 2023 13:58:47 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFCkr-00038N-9G; Fri, 30 Jun 2023 07:57:37 -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 1qF0B9-0003dE-S8 for emacs-orgmode@gnu.org; Thu, 29 Jun 2023 18:31:55 -0400 Received: from out-2.mta0.migadu.com ([91.218.175.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qF0B3-0000oK-L2 for emacs-orgmode@gnu.org; Thu, 29 Jun 2023 18:31:55 -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=Inkqd9eVMW47o2ob1cxlf2HPMToGfEEBnpHuQOHHArA=; b=rFiyDeoUVO4kipRaIXNeygULgQPFUdhGIOOe/6esiWVfaaRXRUKe5ZagmsUdUJnQeLMsiz sAuWNEidrk9c9SC2yhGC5oJOOAz9XbR0KSADJMOVq+iA00DwRSjh3TtWGU686jxhtUhP+n wGZ+gF7+wBpCwRTYEsG/sH5vV9rGLvo= From: Evgenii Klimov To: emacs-orgmode@gnu.org Cc: Evgenii Klimov Subject: [PATCH 3/3] lisp/org.el: Add final hooks to the S-M-cursor commands Date: Thu, 29 Jun 2023 23:31:29 +0100 Message-Id: <20230629223129.17191-4-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.2; envelope-from=eugene.dev@lipklim.org; helo=out-2.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: scn1.migadu.com X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; none X-Migadu-Queue-Id: C80783DBD9 X-Spam-Score: -4.00 X-TUID: K+AsBlr4lgpN * lisp/org.el (org-shiftmetaleft-final-hook, org-shiftmetaright-final-hook, org-shiftmetaup-final-hook, org-shiftmetadown-final-hook): Define final hooks for the S-M-cursor commands. (org-shiftmetaleft, org-shiftmetaright, org-shiftmetaup, org-shiftmetadown): Add final hooks to the S-M-cursor commands and document hooks in the docstring. --- lisp/org.el | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index bf61062b1..326d3eed9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16738,15 +16738,27 @@ 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.") +(defvar org-shiftmetaleft-final-hook nil + "Hook for functions attaching themselves to `M-S-left'. +See `org-ctrl-c-ctrl-c-hook' for more information.") (defvar org-shiftmetaright-hook nil "Hook for functions attaching themselves to `M-S-right'. See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftmetaright-final-hook nil + "Hook for functions attaching themselves to `M-S-right'. +See `org-ctrl-c-ctrl-c-hook' for more information.") (defvar org-shiftmetaup-hook nil "Hook for functions attaching themselves to `M-S-up'. See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftmetaup-final-hook nil + "Hook for functions attaching themselves to `M-S-up'. +See `org-ctrl-c-ctrl-c-hook' for more information.") (defvar org-shiftmetadown-hook nil "Hook for functions attaching themselves to `M-S-down'. See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftmetadown-final-hook nil + "Hook for functions attaching themselves to `M-S-down'. +See `org-ctrl-c-ctrl-c-hook' for more information.") (defvar org-metareturn-hook nil "Hook for functions attaching themselves to `M-RET'. See `org-ctrl-c-ctrl-c-hook' for more information.") @@ -16814,7 +16826,11 @@ When ARG is a numeric prefix, show contents of this level." "Promote subtree or delete table column. Calls `org-promote-subtree', `org-outdent-item-tree', or `org-table-delete-column', depending on context. See the -individual commands for more information." +individual commands for more information. + +This function runs the hook `org-shiftmetaleft-hook' as a first +step, `org-shiftmetaleft-final-hook' as the penultimate step, and +returns at first non-nil value." (interactive) (cond ((and (eq system-type 'darwin) @@ -16828,13 +16844,18 @@ individual commands for more information." (save-excursion (goto-char (region-beginning)) (org-at-item-p))) (call-interactively 'org-outdent-item-tree)) + ((run-hook-with-args-until-success 'org-shiftmetaleft-final-hook)) (t (org-modifier-cursor-error)))) (defun org-shiftmetaright () "Demote subtree or insert table column. Calls `org-demote-subtree', `org-indent-item-tree', or `org-table-insert-column', depending on context. See the -individual commands for more information." +individual commands for more information. + +This function runs the hook `org-shiftmetaright-hook' as a first +step, `org-shiftmetaright-final-hook' as the penultimate step, +and returns at first non-nil value." (interactive) (cond ((and (eq system-type 'darwin) @@ -16848,6 +16869,7 @@ individual commands for more information." (save-excursion (goto-char (region-beginning)) (org-at-item-p))) (call-interactively 'org-indent-item-tree)) + ((run-hook-with-args-until-success 'org-shiftmetaright-final-hook)) (t (org-modifier-cursor-error)))) (defun org-shiftmetaup (&optional _arg) @@ -16855,13 +16877,18 @@ individual commands for more information." In a table, kill the current row. On a clock timestamp, update the value of the timestamp like `S-' but also adjust the previous clocked item in the clock history. -Everywhere else, drag the line at point up." +Everywhere else, drag the line at point up. + +This function runs the hook `org-shiftmetaup-hook' as a first +step, `org-shiftmetaup-final-hook' as the penultimate step, and +returns at first non-nil value." (interactive "P") (cond ((run-hook-with-args-until-success 'org-shiftmetaup-hook)) ((org-at-table-p) (call-interactively 'org-table-kill-row)) ((org-at-clock-log-p) (let ((org-clock-adjust-closest t)) (call-interactively 'org-timestamp-up))) + ((run-hook-with-args-until-success 'org-shiftmetaup-final-hook)) (t (call-interactively 'org-drag-line-backward)))) (defun org-shiftmetadown (&optional _arg) @@ -16869,13 +16896,18 @@ Everywhere else, drag the line at point up." In a table, insert an empty row at the current line. On a clock timestamp, update the value of the timestamp like `S-' but also adjust the previous clocked item in the clock history. -Everywhere else, drag the line at point down." +Everywhere else, drag the line at point down. + +This function runs the hook `org-shiftmetadown-hook' as a first +step, `org-shiftmetadown-final-hook' as the penultimate step, and +returns at first non-nil value." (interactive "P") (cond ((run-hook-with-args-until-success 'org-shiftmetadown-hook)) ((org-at-table-p) (call-interactively 'org-table-insert-row)) ((org-at-clock-log-p) (let ((org-clock-adjust-closest t)) (call-interactively 'org-timestamp-down))) + ((run-hook-with-args-until-success 'org-shiftmetadown-final-hook)) (t (call-interactively 'org-drag-line-forward)))) (defsubst org-hidden-tree-error () -- 2.34.1