From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iFvtFSQT0WEqOQAAgWs5BA (envelope-from ) for ; Sun, 02 Jan 2022 03:51:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id qFF/DiQT0WHGGgAAG6o9tA (envelope-from ) for ; Sun, 02 Jan 2022 03:51:16 +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 A1F95904F for ; Sun, 2 Jan 2022 03:51:15 +0100 (CET) Received: from localhost ([::1]:52556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n3qxm-0000fq-KK for larch@yhetil.org; Sat, 01 Jan 2022 21:51:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3qxC-0000ff-Va for emacs-orgmode@gnu.org; Sat, 01 Jan 2022 21:50:39 -0500 Received: from [2a00:1450:4864:20::533] (port=46891 helo=mail-ed1-x533.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n3qxA-0002VN-Vu for emacs-orgmode@gnu.org; Sat, 01 Jan 2022 21:50:38 -0500 Received: by mail-ed1-x533.google.com with SMTP id n30so10532517eda.13 for ; Sat, 01 Jan 2022 18:50:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=IRNN0esRaGjtVfK3wysvxDoGTBWFCUoKMFFlXwUbt+E=; b=O2fEMqSjPaUMdwgjk6CZUPsY3HVrzaMRvInoEz9D03KYsdTeTfWCmvIZMk2cN4i3QD /+HPYUeczycu2HiOEMzF7/iVSSm1vpwyyLibPs16RQy912khL5jkVAIv34FeLoMYuy/5 JtYU00uZWxo3/fD19Y+ttIlkHjxV0cCegX/QRFYEOMgxsK94bPy8Zfm3n+gUYOa7bjbm Hbwf4zt7X69LQFYA/IIT5u6rFueOlNLfO4w68EpPu7DBdGJNq8X9AbLNpsSzaoA+zZZq gDgqHk/fc9FDzxZAzT5BjlIiOwF66K2neTrTSUFyiKSJuOD8cdpRFms/nYjNtSg7Ezdn loQg== 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:in-reply-to:references:date :message-id:mime-version; bh=IRNN0esRaGjtVfK3wysvxDoGTBWFCUoKMFFlXwUbt+E=; b=4AlK2aDgOgOIm0T59K0Y6TjaVSEl7rctid3lziX6NfVASZlvMAu3T7mqK949mNKMEM /3niE74DyGTsnH4w+/gwgafAES77xJEEyMFOzyclCgzCYCegI0XQg9/RTaacj4fY5Xd0 HHO2YAZ57hHIgdERHHOBZTrDTsz4Z25tgcjkyJi44DyQ0z8Ki/+VqHpQqO/8zB7owwbh BwN7wGXGzfPy4QFPqEiZAWckXmymVh/iQYjEstJV4pxrNvE32ihCOobLqfZXlMkl2has LBfUyRL6c3AGrkA2dg2WlnMSOEy/gftP+7ToQOBdyLbQi/GBxYd0Y1i/hJ8bnJmeT/H6 konQ== X-Gm-Message-State: AOAM533j9fKk7DEjIP0rtc89OFjbPWCpqnZ//aD6gVxN1O52nniMGe7Q d5cK8e77pdwNicgLa0m/su2fiOAQK9o= X-Google-Smtp-Source: ABdhPJytV6CsTfjBbbdYi/C5tsxWcbl9d8e37hL14W74sZKnpsweiN9llLVOA4Y9aCs4rcaUcI1IPg== X-Received: by 2002:a05:6402:2024:: with SMTP id ay4mr40271904edb.16.1641091834698; Sat, 01 Jan 2022 18:50:34 -0800 (PST) Received: from localhost ([91.210.107.150]) by smtp.gmail.com with ESMTPSA id la7sm7008022ejc.94.2022.01.01.18.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jan 2022 18:50:34 -0800 (PST) From: Ihor Radchenko To: Eduardo Suarez-Santana Subject: [PATCH] Re: Escaping org mode date properties In-Reply-To: <20220101200103.GB29829@itccanarias.org> References: <20220101122409.GA29829@itccanarias.org> <875yr31ogp.fsf@localhost> <20220101200103.GB29829@itccanarias.org> Date: Sun, 02 Jan 2022 10:51:54 +0800 Message-ID: <8735m626k5.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::533 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=yantar92@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) 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, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: emacs-orgmode@gnu.org 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=1641091875; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=IRNN0esRaGjtVfK3wysvxDoGTBWFCUoKMFFlXwUbt+E=; b=uSsNez1n4Ckr2ZpD+bK+sHoWdtSDpgta72V6QobjaSAv4I+SlrHPYtUhWdXBLDnfHHEvtH c5VY3s9SABAo6UHYbywFGGayzSRyzEhv71a98vydqyVbKPL0IJV+8uWFq+5b2YxLDpM2Im 3kzpNc36yZNQ8UIp71Pd/qX7hySZpOeTFHy7ygKEbkny2JNgFku8pSAvVDcxBru8+hxruh pfihHo88DnMj9+90ikWzG8w8UZG2clEU+pPZoAXMB2csIqgTY2ZQrxw+4nHv2WgpMWDll6 vHxknlm683BZQxYtWHyx4PgPDv6m+rrVQYzhC1X7jm/LpRSAKPXscJw6rlq1uw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641091875; a=rsa-sha256; cv=none; b=koIuETCW7LGD+BmgxuNmvg1g/IYzLH8DR1yYtba7gxWgj7y5EfL6dHoMWmcDSYSzHFLwF2 ioytUOOoGMnUpSxHsOQEVgCFB3G9eCTxUYq8J4h3jbRHiwphzAWlDv9nJ9dkcqYqk6BqOC Ao2AXiL3cAXdDQmFqynfOPKarDwSODMs4W/+dRJMMRUYK/Ftsm+LXb+8C7rpg7DzWDVif/ Mux0upxoHxJ0ervIksPP4ZklCgXNCldJMVyxdJDsQyeKEcT6AN3Q1S0NAfexyxYAyD0xEv tIqyVDSl2ZJd1Q2sh3sGkikOM1sQF3uN15d7DeSoGfgtRA6h9rvLZn3Gf/+yJg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=O2fEMqSj; 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: -5.08 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=O2fEMqSj; 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: A1F95904F X-Spam-Score: -5.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: u1yGg+nZz+zV --=-=-= Content-Type: text/plain Eduardo Suarez-Santana writes: >> I am unable to reproduce. What are your Org and Emacs versions? > > I'm using Spacemacs (develop branch). > > - Emacs 27.2 > - Org 9.5.1 > > I get a weird behaviour about it. These events appear when I start emacs. If I > edit somehow these entries they disappear from the agenda view (until I start > emacs again). Confirmed Thanks for the hint! I was able to reproduce entries disappearing from agenda view. The culprit is org-in-src-block-p. It relies on fontification to determine if we are inside a code block. However, when you strip a code block with SCHEDULED inside from begin/end lines, the fontification properties do not get removed. The attached patch should fix the issue. However, I need several people to test it first - the patch will make things slower without cache. >> Depending what you want, you may use org-agenda-todo-list-sublevels or >> add agenda filter excluding specific tags that you can then use to mark >> undesired subtrees. > > Could be a workaround. Thanks a lot. > > Anyway it looks like a bug to me. For future. You will make things much easier if you provide a clear sequence of steps to reproduce the problem. Your original report is not reproducible if I just copy-paste your code into a new org file. I had to guess what you did in order to see the problem. Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-in-src-block-p-Do-not-rely-on-fontification.patch >From 0f046ebe94bbe84ac2f167feda527022bfac4e6e Mon Sep 17 00:00:00 2001 Message-Id: <0f046ebe94bbe84ac2f167feda527022bfac4e6e.1641091542.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sun, 2 Jan 2022 10:30:03 +0800 Subject: [PATCH] org-in-src-block-p: Do not rely on fontification * lisp/org.el (org-in-src-block-p): New optional argument ELEMENT. The code now relies on org-element API to check if we are inside src-block. Fixes https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t --- lisp/org.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 8c09a057c..7ea8d65f3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18731,17 +18731,19 @@ (defun org-uuidgen-p (s) "Is S an ID created by UUIDGEN?" (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s))) -(defun org-in-src-block-p (&optional inside) +(defun org-in-src-block-p (&optional inside element) "Whether point is in a code source block. When INSIDE is non-nil, don't consider we are within a source -block when point is at #+BEGIN_SRC or #+END_SRC." - (let ((case-fold-search t)) - (or (and (eq (get-char-property (point) 'src-block) t)) - (and (not inside) - (save-match-data - (save-excursion - (beginning-of-line) - (looking-at ".*#\\+\\(begin\\|end\\)_src"))))))) +block when point is at #+BEGIN_SRC or #+END_SRC. +When ELEMENT is provided, it is considered to be element at point." + (save-match-data (setq element (or element (org-element-at-point)))) + (when (eq 'src-block (org-element-type element)) + (or (not inside) + (not (or (= (line-beginning-position) + (org-element-property :post-affiliated element)) + (= (1+ (line-end-position)) + (- (org-element-property :end element) + (org-element-property :post-blank element)))))))) (defun org-context () "Return a list of contexts of the current cursor position. -- 2.34.1 --=-=-=--