From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kJq4DeUp9WFafwEAgWs5BA (envelope-from ) for ; Sat, 29 Jan 2022 12:49:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cNRgCuUp9WEQ1AAAauVa8A (envelope-from ) for ; Sat, 29 Jan 2022 12:49:57 +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 A71BC2914B for ; Sat, 29 Jan 2022 12:49:56 +0100 (CET) Received: from localhost ([::1]:57798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDmEt-0001MD-R0 for larch@yhetil.org; Sat, 29 Jan 2022 06:49:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDm0f-0002IJ-6C for emacs-orgmode@gnu.org; Sat, 29 Jan 2022 06:35:13 -0500 Received: from [2607:f8b0:4864:20::436] (port=45832 helo=mail-pf1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDm0d-0000GW-NS; Sat, 29 Jan 2022 06:35:12 -0500 Received: by mail-pf1-x436.google.com with SMTP id 128so8511989pfe.12; Sat, 29 Jan 2022 03:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WJFaVeujsJ52ZKke0XvkIdc7rPds/I20t8xFRiJOAdc=; b=gILKy8GPCoe9F2Dx/1fPgTCQ86P5bpnhpSodn5AIuOQUfOke63IP/DcNg1duu0TjqS qTTrtYpZL06LuQwJX/ituE7nl0nix/pYA+hzH/KOnrLlMLU2DOR9e6dNssQB4cz3fm2l Xzm7A5kbYAwVfNf7kEuO3DF8t33EYeBD31YWOlS1qPRD3f/DfoVcIM8eJo4vg321xTuG 2DmaYzlyWsK+JgOiuxk2YGZ4j3AJBFz/Wxr0YZUtx+HzXrSOc7QNF2E8n71csjcN6b/K XyHAK4ZCSSVqqhcJSUm9E87vxYWoD+qca3SfZVOYYdZPd5hRFJUuHmh9Db6mz8xikPEI 7Qbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WJFaVeujsJ52ZKke0XvkIdc7rPds/I20t8xFRiJOAdc=; b=d8Pr31Ko+JzBTJVHg4abVRf+p418w7rApFdQDPRIYP9vBJ3esiK1a3L8hqFTnXCLm8 aNLZGTZ2oU3H+8CQNQBHp8yMJHvUiGHqqxhSi5ktOhcuNep/ZJdNrXNSMITHqLN/S1U9 ucRSl86QBYJDYHr/vSmWLQSWpAKmmjTZttLihBYWaVQt6hETANkGbXRxzWv4HgNXb6ZX 53FCSS7LAoB/jJf8Qf2RsE/Yu6WYh+WjZ8aYR2/QKqqTVsOjH7TkeXCv+qw0/n+N3wHU EWLHvZ2WnclHtKhd84CAugJ6h+yVuLc/Vju2sQ9itducX6WN16ohoLu7v67/bNPOsKut lh2g== X-Gm-Message-State: AOAM532vQgprwZ0WY3B0ExmkN3kb3SD3/NzEDYlUWrgtEvpXgJWBLqaJ 5pF5MOwbZq0IJj3QlAQRrYCfpTk8oE2+nIuw X-Google-Smtp-Source: ABdhPJxxCbcqeQU96yXNSa1vEWvzy2+XqMFfhmzx5JdSjcsl8W7WNVlIxQszMTL71+uDkUpswQOJ0A== X-Received: by 2002:a63:5255:: with SMTP id s21mr9800280pgl.131.1643456109802; Sat, 29 Jan 2022 03:35:09 -0800 (PST) Received: from localhost ([209.95.60.92]) by smtp.gmail.com with ESMTPSA id x17sm12102202pfa.105.2022.01.29.03.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 03:35:09 -0800 (PST) From: Ihor Radchenko To: Bastien , Kyle Meyer , Nicolas Goaziou , Karl Voit , Christian Heinrich , emacs-orgmode@gnu.org Subject: [PATCH 07/35] org-at-heading-p: Accept optional argument Date: Sat, 29 Jan 2022 19:37:59 +0800 Message-Id: <4922249727af7d126de48696cd09650b6f1742ac.1643454546.git.yantar92@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: <87y2cvloay.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.34.1" Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::436 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=yantar92@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Ihor Radchenko Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643456996; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=WJFaVeujsJ52ZKke0XvkIdc7rPds/I20t8xFRiJOAdc=; b=BQKHkd4SE6UfsuwsVePEW0/zQKvXJ456x/v4msbPpj/EHRIXGA9ddLjGYghq1naCTjAnQN 48JsDrYgw3MGij6AdWci0Js1UqeFZHO1A4eUMflO3bFFGg85RoQBtKJttrRWCxqwPVNzGq cQUEpuVBzflG6V1lekoq0uYuVKa+mDeGd1fPzeMj/6YimggOtRFWexcnVU11jFAGlfRXIw +djF+zY5MxshKVLxNv3IxmGEdpVoIh9Ni8hFcsP+Fp/OcNc9TkunbJ+o/2F7Ja+8zDB6ZR zRb0OB3U778GT4eE6WRcbFY75y2jd2klthQ8ozTEkdu4jPpsjrcgHqRrsgrZlw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643456996; a=rsa-sha256; cv=none; b=FwOI3pSu899hVVobK6To+8sPMGZHrGlkZNIf28e9X0liaEi5QVeBHOAnTkVe97kR1I0dLb 8++u2uGxlmM8LE/ZWgam9mcq7RJztRzJorRyv/NTR89Vz/PTkgKJ7r1EoCD1FkwtjRSZYu xT8amQ9spDifFMql5O+v79Z2aZ+KlN96ozpzXiH0qZYUXAyB4PDU41tsHuFGH3HeGyUC9s d1Q0h40mbSKqJcDZINs9ESMbai8s03W6g2sno11VoKWTx/A0HXXuxL8NTwOeAo4igCmFd7 Id/wOAjj4nGzxHTrTe+BQglNsAlwMjYFGIR47hcyKX5bGUqayB/J18B6oLpcAw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gILKy8GP; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -3.33 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gILKy8GP; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: A71BC2914B X-Spam-Score: -3.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: 4KUE6TSkIVsP This is a multi-part message in MIME format. --------------2.34.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit * lisp/org.el (org-at-heading-p): Use second argument to allow checking for visible headings. Note that by default, unlike `outline-on-heading-p', `org-at-heading-p' returns non-nil for invisible headings. Passing second argument is just like `(outline-on-heading-p)'. (org-indent-line): * lisp/org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): * lisp/org-colview.el (org-columns--call): (org-columns-store-format): Update arguments in `org-at-heading-p' calls. --- lisp/org-agenda.el | 2 +- lisp/org-colview.el | 4 ++-- lisp/org.el | 14 +++++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) --------------2.34.1 Content-Type: text/x-patch; name="0007-org-at-heading-p-Accept-optional-argument.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0007-org-at-heading-p-Accept-optional-argument.patch" diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 72292fb4e..cc7cb5527 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -10526,7 +10526,7 @@ (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2) (anniversary (or (re-search-forward "^\\*[ \t]+Anniversaries" nil t) (progn - (or (org-at-heading-p t) + (or (org-at-heading-p) (progn (outline-next-heading) (insert "* Anniversaries\n\n") diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 082d6def0..15cab35f0 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -699,7 +699,7 @@ (defun org-columns--call (fun) (let ((hide-body (and (/= (line-end-position) (point-max)) (save-excursion (move-beginning-of-line 2) - (org-at-heading-p t))))) + (org-at-heading-p))))) (unwind-protect (funcall fun) (when hide-body (outline-hide-entry))))) @@ -1026,7 +1026,7 @@ (defun org-columns-store-format () ;; No COLUMNS keyword in the buffer. Insert one at the ;; beginning, right before the first heading, if any. (goto-char (point-min)) - (unless (org-at-heading-p t) (outline-next-heading)) + (unless (org-at-heading-p) (outline-next-heading)) (let ((inhibit-read-only t)) (insert-before-markers "#+COLUMNS: " fmt "\n")))) (setq-local org-columns-default-format fmt)))))) diff --git a/lisp/org.el b/lisp/org.el index f59d2cfb0..b17a5477c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17243,7 +17243,7 @@ (defun org-toggle-heading (&optional nstars) ;; Case 1. Started at an heading: de-star headings. ((org-at-heading-p) (while (< (point) end) - (when (org-at-heading-p t) + (when (org-at-heading-p) (looking-at org-outline-regexp) (replace-match "") (setq toggled t)) (forward-line))) @@ -17844,7 +17844,7 @@ (defun org-context () (p (point)) clist o) ;; First the large context (cond - ((org-at-heading-p t) + ((org-at-heading-p) (push (list :headline (point-at-bol) (point-at-eol)) clist) (when (progn (beginning-of-line 1) @@ -19594,9 +19594,13 @@ (defun org-before-first-heading-p () (end-of-line) (null (re-search-backward org-outline-regexp-bol nil t)))))) -(defun org-at-heading-p (&optional _) - "Non-nil when on a headline." - (outline-on-heading-p t)) +(defun org-at-heading-p (&optional invisible-not-ok) + "Return t if point is on a (possibly invisible) heading line. +If INVISIBLE-NOT-OK is non-nil, an invisible heading line is not ok." + (save-excursion + (beginning-of-line) + (and (bolp) (or (not invisible-not-ok) (not (org-fold-folded-p))) + (looking-at outline-regexp)))) (defun org-in-commented-heading-p (&optional no-inheritance element) "Non-nil if point is under a commented heading. --------------2.34.1--