From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id ACLJI2/yw2NYlQAAbAwnHQ (envelope-from ) for ; Sun, 15 Jan 2023 13:32:47 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id T1TcI2/yw2MgKgAA9RJhRA (envelope-from ) for ; Sun, 15 Jan 2023 13:32:47 +0100 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 4EF0DE38E for ; Sun, 15 Jan 2023 13:32:47 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pH2An-0007EB-7t; Sun, 15 Jan 2023 07:31:41 -0500 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 1pH2Ai-0007Dl-Cz for emacs-orgmode@gnu.org; Sun, 15 Jan 2023 07:31:40 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pH2Ag-0005HC-EF for emacs-orgmode@gnu.org; Sun, 15 Jan 2023 07:31:36 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 99C8E24010D for ; Sun, 15 Jan 2023 13:31:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1673785892; bh=7By+ZXcBPH7YpsMlGF0P9u9TEAgjVMGiIB9rPCY8o2M=; h=From:To:Cc:Subject:Date:From; b=MeocuTwSjVI5ycXMNprWOsGWbDR5NsYfuHVG9GNXE1cK4C3PCMcYzS5Z5iRM7rUhN lKnRYNgTyb6ZeGet5ljt+jLqzZvdx/tzSV142YUluL5FZQYKd17tdj8sl5jufG3yk6 JH79t8SQWlWCE0z3QlbzG/mgOehiT4VzO0wHG8dIwPiSYARJN54WXeicHCOTWsNFSO ycHRrqC9VECc5p8+bwsL278Fcrn/pVzkgPs/8ZfklMTd33eNlgKdSedImJ7x7UCrY3 xJWfQCJ5SdbURaTqP4oAlfhRw/w6R9U1nemyxiIMp2wi+UsAkggMiVtHGwrKFq8xJb UyzGL57w0YGgw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NvvfC64HBz6tm9; Sun, 15 Jan 2023 13:31:30 +0100 (CET) From: Ihor Radchenko To: emacs-orgmode@gnu.org Cc: Ihor Radchenko Subject: [PATCH 2/4] Preserve active region when toggling heading state Date: Sun, 15 Jan 2023 12:31:30 +0000 Message-Id: <5719a8163427849f48d81c17648e0089dfbdae2d.1673785107.git.yantar92@posteo.net> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673785967; a=rsa-sha256; cv=none; b=CnU0t17IoLcj4WHVd2nJrZGkl+KoBrWZk38sFX6/eN4eCXpWtpVn7/jllY0IKKVTPAMflg TL30MGZ5STLDsgQGOT2ZhraLyBz/2QOOfyLw2O2sQY7F/5R1rSnOLqIlgzVdAvbGg72+Go PSsvSDIonigHeJYfgWWT1QfnixgSXLePyRwJpuM9b74SLfdzeM17ub7/9z6GsUFR68sVmu Pd9IyYVNpi7oTyj/3Mt2E1600xdsseqBDrG5uStcwBbc8MEGBSuCNnrtkGW4iG53LTVUwx J1aYLJWATG74Ukf3dQF7pH+VHAjmAfyg49VT85E7zvgU0I5vbcPSB8L/y5SdxA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=MeocuTwS; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673785967; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=5AeDo9i/YNgoOnae+h/TQAL+5NyoLeeUnVPiCm0ligU=; b=HCU5XsQ1731IZ0iL759EXLNYGT+cEcdxxQD+5ztxMEhXN47TNE5kiQ0UGc3tWyG8WObfGO AUxSTnU8UiTHlKyKyutskAojVCtCyiI9dZnpa9iLoVVAX8eiJa8RxrhJtey5kKSL094ZmQ BtDDDEbDb55m1yXhIOkAj9IpAwJI3TxQ9WAcDmeve6+m8rSJmIBxSIvu0Gz+SH9GwdhqG1 XipAQ745FNPHfcqtG2ZYR4QFdNo9UwbXGFfdgF5sIuV6Q2ECdwmWycH7nSUY4ijW9OpWqC /FB6QqWb/1kJEv6fMKu93gFdNCk91BsBi9fWopytuj4jJ83ey03bGwoktlrTXg== X-Migadu-Spam-Score: -3.56 X-Spam-Score: -3.56 X-Migadu-Queue-Id: 4EF0DE38E X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=MeocuTwS; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net X-TUID: kvfwaBg5AIT7 * lisp/org.el (org-todo): (org-deadline): (org-schedule): (org-set-tags-command): Do not deactivate region after applying edits. --- lisp/org.el | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 58a3434f4..9fd8189a7 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9184,7 +9184,8 @@ (defun org-todo (&optional arg) (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) 'region-start-level 'region)) - org-loop-over-headlines-in-active-region) + org-loop-over-headlines-in-active-region + (deactivate-mark nil)) (org-map-entries (lambda () (org-todo arg)) nil cl @@ -10155,13 +10156,14 @@ (defun org-deadline (arg &optional time) can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) - (org-map-entries - (lambda () (org--deadline-or-schedule arg 'deadline time)) - nil - (if (eq org-loop-over-headlines-in-active-region 'start-level) - 'region-start-level - 'region) - (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))) + (let ((deactivate-mark nil)) + (org-map-entries + (lambda () (org--deadline-or-schedule arg 'deadline time)) + nil + (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level + 'region) + (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))) (org--deadline-or-schedule arg 'deadline time))) (defun org-schedule (arg &optional time) @@ -10176,13 +10178,14 @@ (defun org-schedule (arg &optional time) either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) - (org-map-entries - (lambda () (org--deadline-or-schedule arg 'scheduled time)) - nil - (if (eq org-loop-over-headlines-in-active-region 'start-level) - 'region-start-level - 'region) - (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))) + (let ((deactivate-mark nil)) + (org-map-entries + (lambda () (org--deadline-or-schedule arg 'scheduled time)) + nil + (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level + 'region) + (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))) (org--deadline-or-schedule arg 'scheduled time))) (defun org-get-scheduled-time (pom &optional inherit) @@ -11633,7 +11636,8 @@ (defun org-set-tags-command (&optional arg) ((and (org-region-active-p) org-loop-over-headlines-in-active-region) (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) 'region-start-level 'region)) - org-loop-over-headlines-in-active-region) ; hint: infinite recursion. + org-loop-over-headlines-in-active-region ; hint: infinite recursion. + (deactivate-mark nil)) (org-map-entries #'org-set-tags-command nil cl -- 2.39.0