From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SNrZDTAjTF/RTAAA0tVLHw (envelope-from ) for ; Sun, 30 Aug 2020 22:07:44 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OL2cCTAjTF+SUAAA1q6Kng (envelope-from ) for ; Sun, 30 Aug 2020 22:07:44 +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 5EAD29401CD for ; Sun, 30 Aug 2020 22:07:43 +0000 (UTC) Received: from localhost ([::1]:53274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCVUC-00038R-I4 for larch@yhetil.org; Sun, 30 Aug 2020 18:07:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCVTs-00037q-F2 for emacs-orgmode@gnu.org; Sun, 30 Aug 2020 18:07:20 -0400 Received: from mout02.posteo.de ([185.67.36.66]:48395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCVTp-0005TM-P1 for emacs-orgmode@gnu.org; Sun, 30 Aug 2020 18:07:20 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 440FF2400FB for ; Mon, 31 Aug 2020 00:07:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1598825233; bh=dacV21YaGlu1FsIcmTg4Y1jAyupZev+KgTYTVSFQBxo=; h=Subject:To:Cc:From:Date:From; b=PYdUV8A6RZ3x9o184fQHPK7Ki3/puZJc6IL2ILjvmhOKAeQH4L6SvJHRtcaNA2R7f YAW9U9u5RKSsbBsnsK4lPRAThUXXo3cojqP2AIboQUEMzrjdKKaym8wLUZg6LutnTU EVsPfwfeTZtMeGf8J9viYxTe2Ga9igcjVetlKWmHMMXubYLoOo03wrTT8IAufjol0w ZaCMVQ/0720pYGSqEE5j/arqODrUGflm20vQKTXMk8RUdPadHPHRtB2GvJwiDN4WDi QgUW8W/bZ8wcIXZQeEQLVxexA9220OKZX8Jvv9VT4RkWsSUqIuojCwCqJL3w4gk5iZ icDY+3xXIH4SA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BfnW44sYKz9rxP; Mon, 31 Aug 2020 00:07:12 +0200 (CEST) Subject: [PATCH] Re: 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> <67d953fc-3396-8038-4302-6e1ad4cde72c@posteo.net> <87tuwm7uo3.fsf@localhost> <8e63089c-ba3e-788a-f80f-c05b14d3228d@posteo.net> <87364611hw.fsf@localhost> From: D Message-ID: <7365d467-2a31-85b4-4f0b-8c8871c4e180@posteo.net> Date: Mon, 31 Aug 2020 00:07:12 +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: <87364611hw.fsf@localhost> Content-Type: multipart/mixed; boundary="------------91776469E71C8695E5AEE845" 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/30 18:07:13 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] 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.01, RCVD_IN_MSPIKE_WL=-0.01, 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=PYdUV8A6; 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: pGqTcaMIB9Tv This is a multi-part message in MIME format. --------------91776469E71C8695E5AEE845 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit > Probably, it is easier if you just use seq-every-p instead of > mapcar on (number-sequence max-pos min-pos -1). The result of > seq-every-p will be inverse of the currently used expression. Oh yeah, that's much nicer. I also made the predicate check right-to-left, which just causes it to check the text bit of a heading first, which is useful for the cases where the predicate returns t and makes no difference otherwise. I again ran the tests and it seems ready to go. Cheers, D. --------------91776469E71C8695E5AEE845 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 9ae3dd4b73b2b9b41244bb7f9c610ed3f4777398 Mon Sep 17 00:00:00 2001 From: "D. Williams" Date: Sun, 30 Aug 2020 23:58:55 +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 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 71dbc611e..f44f94ec4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20478,6 +20478,14 @@ 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." + (not + (seq-every-p #'org-invisible-p + (number-sequence (1- (line-end-position)) + (line-beginning-position) + -1)))) + (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 +20507,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 --------------91776469E71C8695E5AEE845--