From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id eDIzOzp9Vl/bJwAA0tVLHw (envelope-from ) for ; Mon, 07 Sep 2020 18:34:34 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id QBsENzp9Vl9/LwAAB5/wlQ (envelope-from ) for ; Mon, 07 Sep 2020 18:34:34 +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 3B5B0940142 for ; Mon, 7 Sep 2020 18:34:34 +0000 (UTC) Received: from localhost ([::1]:35436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFLyK-0005An-MD for larch@yhetil.org; Mon, 07 Sep 2020 14:34:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFLvh-00019W-8Z for emacs-orgmode@gnu.org; Mon, 07 Sep 2020 14:31:49 -0400 Received: from mout02.posteo.de ([185.67.36.66]:34355) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFLve-0005r7-KX for emacs-orgmode@gnu.org; Mon, 07 Sep 2020 14:31:48 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 00B7C2400FF for ; Mon, 7 Sep 2020 20:31:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1599503501; bh=PWN0q6IrdDw8BmQNmPVhEJPVlwRE2S3zhQCmVfcEGMw=; h=Subject:To:Cc:From:Date:From; b=ODzi6c/4/sjLxAdpN0LEQyhbE7yatGbKSO5SkCB0vrZbuK9AGp+ga7J8aDxGfQMKh cPiYDE1e2udfvszBVCf1nfRT1Xr7Ap8KUmfaSYDJdO7Kw125gQC486wcm6iliLvYSw X9eAPHGzGkdV29zIpLyEfyRsFtQQjlLGBCrRdvUOUiLetq48XIZf7BGLM7t9stDJSF gQ13oZm4RaVIFyTwEKxbGzqE3h5sDgCnSUa5VDQ2EfQMkYNssA76POVrZUBBash+nO rq1HL2bz7uDxByExFxpG6mibh2akUBFwIgca1BQ+O0aFW8QR/TdCuUpUoy0pL1ivMA SSePRnDUcAMSA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BlcLh1k0bz6tmB; Mon, 7 Sep 2020 20:31:40 +0200 (CEST) Subject: Re: [PATCH] Re: Re: Re: org-forward-heading-same-level and the invisible-ok argument To: Ihor Radchenko , Bastien References: <87a6yi42ie.fsf@localhost> <61342cad-ed4c-59ef-d2fe-685de58df5de@posteo.net> <87tuwo2tr3.fsf@localhost> <67d953fc-3396-8038-4302-6e1ad4cde72c@posteo.net> <87tuwm7uo3.fsf@localhost> <8e63089c-ba3e-788a-f80f-c05b14d3228d@posteo.net> <87364611hw.fsf@localhost> <7365d467-2a31-85b4-4f0b-8c8871c4e180@posteo.net> <87eenfl8ey.fsf@bzg.fr> <7fc400e9-07bb-dafa-951f-56c98b170901@posteo.net> <87h7saqiod.fsf@gnu.org> <87bliiyufz.fsf@localhost> From: D Message-ID: <51b41109-997c-db37-c0ed-44e8d0154cee@posteo.net> Date: Mon, 7 Sep 2020 20:31:39 +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: <87bliiyufz.fsf@localhost> Content-Type: multipart/mixed; boundary="------------44974EB265BA323BCB92D55C" 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/09/07 13:19:38 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -38 X-Spam_score: -3.9 X-Spam_bar: --- X-Spam_report: (-3.9 / 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, NICE_REPLY_A=-1.825, RCVD_IN_DNSWL_NONE=-0.0001, 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=ODzi6c/4; 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: Adimm1klO2gG This is a multi-part message in MIME format. --------------44974EB265BA323BCB92D55C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit > Then, can as well use `mapcar', or even simply manual loop over line > positions. How about this? --------------44974EB265BA323BCB92D55C 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 2324d745f12fe8e8d4f7864307eb55c46fc49504 Mon Sep 17 00:00:00 2001 From: "D. Williams" Date: Mon, 7 Sep 2020 14:13:12 +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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index bc74cedc7..040cfad61 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20512,6 +20512,16 @@ 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." + (let ((line-beg (line-beginning-position)) + (line-pos (1- (line-end-position))) + (is-invisible t)) + (while (and (< line-beg line-pos) is-invisible) + (setq is-invisible (org-invisible-p line-pos)) + (cl-decf line-pos)) + (not is-invisible))) + (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. @@ -20533,8 +20543,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 --------------44974EB265BA323BCB92D55C--