From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uJcdGm74SF9uEgAA0tVLHw (envelope-from ) for ; Fri, 28 Aug 2020 12:28:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id b3DAFW74SF+TewAAbx9fmQ (envelope-from ) for ; Fri, 28 Aug 2020 12:28:30 +0000 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 90E8D940AF7 for ; Fri, 28 Aug 2020 12:28:29 +0000 (UTC) Received: from localhost ([::1]:58024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBdUZ-00086m-Jz for larch@yhetil.org; Fri, 28 Aug 2020 08:28:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBdTx-00086C-0X for emacs-orgmode@gnu.org; Fri, 28 Aug 2020 08:27:49 -0400 Received: from mout02.posteo.de ([185.67.36.66]:58243) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBdTu-0001mp-Bk for emacs-orgmode@gnu.org; Fri, 28 Aug 2020 08:27:48 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 9CA282400FD for ; Fri, 28 Aug 2020 14:27:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1598617662; bh=7zJw1vgFWCVeutR9CeiJzWisRueYWRKGn+IfF9I+Hcg=; h=Subject:To:Cc:From:Date:From; b=Z+dzmBrXbfSGGfZhdmNenpZUpxjGsJF9OrgncR98eJ1eBo5uzOsRhJXo+7ZYFmfNT dc1AZ6adMNJD9PTKEF4/Gfsbv1X7B5x3wbEfOQXoSUOogWnIZQPeShM9MhLlbVNqUK hlOfTInyUrRl84aiRLSSUCS7YGgrJ9nA3rYMVxocUFTrMq9PY0Q6JZfcJWizUgQbJw D3NaSO63neaUULQXdBWpUo3fvxjcGmIEdsa+np9KWxW2o17r0U9Gk1Djmzlecue30v PYQtrISs9z068fRp36v1vgLqYBnSd0ewW82SRgzwsmQaaM+OcfQS2zr0cLObOQq6ug D4HxJp0NJ431w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BdJlL12Chz9rxf; Fri, 28 Aug 2020 14:27:41 +0200 (CEST) Subject: [PATCH] Re: Re: org-forward-heading-same-level and the invisible-ok argument To: Ihor Radchenko References: <87a6yi42ie.fsf@localhost> <61342cad-ed4c-59ef-d2fe-685de58df5de@posteo.net> <87tuwo2tr3.fsf@localhost> From: D Message-ID: <67d953fc-3396-8038-4302-6e1ad4cde72c@posteo.net> Date: Fri, 28 Aug 2020 14:27:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <87tuwo2tr3.fsf@localhost> Content-Type: multipart/mixed; boundary="------------7A5696DCB0E6F07DC8C3C385" Content-Language: en-US Received-SPF: pass client-ip=185.67.36.66; envelope-from=d.williams@posteo.net; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/28 08:27:43 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Z+dzmBrX; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: 0ukKkaom3WIS This is a multi-part message in MIME format. --------------7A5696DCB0E6F07DC8C3C385 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit > I do not think that setting visibility the leading stars is a correct > approach to control the movement commands. After second though about the > issue you raised in the first email, I think that it would make more > sense for org-forward-heading-same-level to check if any part of the > heading line is visible to decide if we need to skip it (instead of > current approach checking only the point at the beginning of the > headline). Any mode aiming to make org-forward-heading-same-level skip a > heading will then just need to make the whole heading invisible. > Skipping partially visible headlines would be a violation of the > docstring. Good point! I think this would be a more or less reasonable patch, then. Cheers, D. --------------7A5696DCB0E6F07DC8C3C385 Content-Type: text/x-patch; charset=UTF-8; name="0001-org.el-let-heading-navigation-check-the-entire-headi.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-org.el-let-heading-navigation-check-the-entire-headi.pa"; filename*1="tch" >From 4c0f638104f689780de317af5f715384152459bd Mon Sep 17 00:00:00 2001 From: "D. Williams" Date: Fri, 28 Aug 2020 14:15:31 +0200 Subject: [PATCH] org.el: let heading navigation check the entire heading for visibility * org.el (org-forward-heading-same-level): check complete heading instead of the first char TINYCHANGE --- lisp/org.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 71dbc611e..26f815e19 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20478,6 +20478,15 @@ entry." ((looking-at-p re) (forward-line)) (t (throw 'exit t)))))))) +(defun org--line-visible-p () + "Return t if the current line is partially visible." + (and + (memq nil + (mapcar #'org-invisible-p + (number-sequence (line-beginning-position) + (1- (line-end-position))))) + t)) + (defun org-forward-heading-same-level (arg &optional invisible-ok) "Move forward to the ARG'th subheading at same level as this one. Stop at the first and last subheadings of a superior heading. @@ -20499,8 +20508,7 @@ non-nil it will also look at invisible ones." (cond ((< l level) (setq count 0)) ((and (= l level) (or invisible-ok - (not (org-invisible-p - (line-beginning-position))))) + (org--line-visible-p))) (cl-decf count) (when (= l level) (setq result (point))))))) (goto-char result)) -- 2.26.2 --------------7A5696DCB0E6F07DC8C3C385--