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 4GmBFu32N19yQQAA0tVLHw (envelope-from ) for ; Sat, 15 Aug 2020 14:53:33 +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 UO9dEu32N1+OWQAAB5/wlQ (envelope-from ) for ; Sat, 15 Aug 2020 14:53:33 +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 DC76B940416 for ; Sat, 15 Aug 2020 14:53:32 +0000 (UTC) Received: from localhost ([::1]:59186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6xYp-0001P9-On for larch@yhetil.org; Sat, 15 Aug 2020 10:53:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6xYK-0001N0-2y for emacs-orgmode@gnu.org; Sat, 15 Aug 2020 10:53:00 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:40773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6xYI-0003pr-6G for emacs-orgmode@gnu.org; Sat, 15 Aug 2020 10:52:59 -0400 Received: by mail-pl1-x62f.google.com with SMTP id u10so5425767plr.7 for ; Sat, 15 Aug 2020 07:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cYSHwsShltIcKEnQexlAjFb/8UO9sKxmir8w1iiqUMM=; b=rYAu3xnSyW+Nqh8bwBVmL7Ma0gM+j9BHIpZxT5wVcFy/7a5ufom5x1UWdTeUh1dx2C QqT3AmofoP7BVbGTmnfzHes7JvjI/4NPwlrwCFCcO+GLf+g4RWIl1t55F27HPNAexajP q3ihBhAmyyWd9FvMoNXafx8J7IQwx0p0k1W7Rv5KHOJ1z0RuQ9cBCpT+IGbVSWFSt+HD 9k3rpmCsr5tyFtE5wBhDNX3oPpd4N/f7Qycy+VrXFWdVacuLE7KN1i3ZGYES+I3WQ+lI dIfw5uHrX3tFz57NXDQjZ/2NYXunU11LHxszRUx3Gcr2ltKkJQrNKYajjYblHEeWyqE9 7/2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cYSHwsShltIcKEnQexlAjFb/8UO9sKxmir8w1iiqUMM=; b=Ick0sScAq4cGckRjfQF9+qOXKhQav4cKmgeWxeaVMAnd3ac615QLqf/4btANLBYv2I 9rNwWRVnOfu1ujVPH1UZXoMxofvwjRlGt9odZ3i/+SDqGPprKZp2WSUzMz5qRYUqpBX7 S2OR2v/GD3e9bJxeW97mJ0zijBq9dn4YuPk5jAA2fcWlwOXj/FsjzQ3plyPBxnrg6Tgv tsINhpI66mlYFOvnL8nva4ct5OTHLgHfyw1q24gXBquWvyP6ELJkr1jFMns62yq0ElDX qkMWjasX9lZ1SsBPEUryUKWcUSD8Ap8zuMIxZn0TRGSJJ00CI14I9w6z7pYcJmnzZS1l DkoA== X-Gm-Message-State: AOAM533jQGrS6hvvzSoeFsgMZjYloht2B1pZdwSJyuF+jl0Fv43qKRGm Ve5w7rS8ZonfQtaJJPcaLQqRYu5CLBwFg37/7GQ9K63QiNTT X-Google-Smtp-Source: ABdhPJyAeeG/wpu4haQioCKY6qVN69vR8GRSwveXWl3YzWXz4O+p6U+bj80grY5l7TC/mCD8DZIYD1ZGdm7A5eXwhn4= X-Received: by 2002:a67:985:: with SMTP id 127mr3620483vsj.17.1597469657033; Fri, 14 Aug 2020 22:34:17 -0700 (PDT) MIME-Version: 1.0 References: <877du1olkf.fsf@localhost> In-Reply-To: <877du1olkf.fsf@localhost> From: "numbchild@gmail.com" Date: Sat, 15 Aug 2020 13:34:09 +0800 Message-ID: Subject: Re: How to detect current in logbook drawer? To: Ihor Radchenko Content-Type: multipart/alternative; boundary="00000000000072714a05ace3e3cf" Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=numbchild@gmail.com; helo=mail-pl1-x62f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-mode 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=gmail.com header.s=20161025 header.b=rYAu3xnS; dmarc=pass (policy=none) header.from=gmail.com; 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.29 X-TUID: G4HSiYi3VDDO --00000000000072714a05ace3e3cf Content-Type: text/plain; charset="UTF-8" I tried this helper function. ```elisp (defun org-link-beautify--in-logbook-drawer-p (position) "Detect whether point is in Org logbook drawer using `org-logbook-drawer-re'." (and (> (point) (save-excursion (re-search-backward (rx (seq bol (0+ (any "\t ")) ":LOGBOOK:" (0+ (any "\t ")) "\n"))))) (< (point) (save-excursion (re-search-forward (rx (seq bol (0+ (any "\t ")) ":END:" (0+ (any "\t ")) eol))))))) ``` But it's logic is wrong. I becomes global buffer scope. Is there any better correct solution? [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Fri, Aug 14, 2020 at 1:15 PM Ihor Radchenko wrote: > > I want to get around this problem. So need to know how to detect > currently > > in logbook drawer or something else which used to record clocking note, > > `org-add-note`, etc. > > You may try to use `org-logbook-drawer-re'. > > > When I toggle org-log-mode and related options in org-agenda buffer. I > > found my org-link-beautify will caused long time suspend and no stop. > After > > debug, I found org-link-beautify text-property caused this problem. > > Could you provide more details how your text property is causing the > problem in org-agenda? Which function in agenda is slow? > > Best, > Ihor > > > "numbchild@gmail.com" writes: > > > I have a org-mode extension: > > > https://github.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L71 > > > > It will beautify links with text-properties. > > > > When I toggle org-log-mode and related options in org-agenda buffer. I > > found my org-link-beautify will caused long time suspend and no stop. > After > > debug, I found org-link-beautify text-property caused this problem. > > > > I want to get around this problem. So need to know how to detect > currently > > in logbook drawer or something else which used to record clocking note, > > `org-add-note`, etc. > > > > Or maybe org-agenda upstream can do something to work around this > > text-properties issue? > > > > [stardiviner] GPG key ID: 47C32433 > > IRC(freeenode): stardiviner Twitter: @numbchild > > Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 > > Blog: http://stardiviner.github.io/ > --00000000000072714a05ace3e3cf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I tried this helper function.

```elisp
(defun org-link-beautify--in-logbook-drawer-p (position)
=C2=A0 "D= etect whether point is in Org logbook drawer using `org-logbook-drawer-re&#= 39;."
=C2=A0 (and (> (point)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (save-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (re-search= -backward
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(rx (seq bol (= 0+ (any "\t ")) ":LOGBOOK:" (0+ (any "\t ")) = "\n")))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(< (point)
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (save-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (re-search-forward
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(rx (seq bol (0+ (any "\t ")) ":END:" (0+ (an= y "\t ")) eol)))))))
```
But it's logic is wrong. I= becomes global buffer scope. Is there any better correct solution?

[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 <Hack this world!>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID= : 47C32433
IRC(freeenode): stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Twitter:=C2=A0 @numbchild
Key fingerprint =3D 9BAA 92BC CDDD B9EF= 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
<= /div>


On Fri, Aug 14, 2020 at 1:15 PM Ihor Radchenko &= lt;yantar92@gmail.com> wrote:<= br>
> I want to g= et around this problem. So need to know how to detect currently
> in logbook drawer or something else which used to record clocking note= ,
> `org-add-note`, etc.

You may try to use `org-logbook-drawer-re'.

> When I toggle org-log-mode and related options in org-agenda buffer. I=
> found my org-link-beautify will caused long time suspend and no stop. = After
> debug, I found org-link-beautify text-property caused this problem.
Could you provide more details how your text property is causing the
problem in org-agenda? Which function in agenda is slow?

Best,
Ihor


"numbchild@gm= ail.com" <numbchild@gmail.com> writes:

> I have a org-mode extension:
> https://gi= thub.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L71=
>
> It will beautify links with text-properties.
>
> When I toggle org-log-mode and related options in org-agenda buffer. I=
> found my org-link-beautify will caused long time suspend and no stop. = After
> debug, I found org-link-beautify text-property caused this problem. >
> I want to get around this problem. So need to know how to detect curre= ntly
> in logbook drawer or something else which used to record clocking note= ,
> `org-add-note`, etc.
>
> Or maybe org-agenda upstream can do something to work around this
> text-properties issue?
>
> [stardiviner]=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<Hack this wo= rld!>=C2=A0 =C2=A0 =C2=A0 GPG key ID: 47C32433
> IRC(freeenode): stardiviner=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Twitter:=C2=A0 @numbchild
> Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3= 2433
> Blog: http://stardiviner.github.io/
--00000000000072714a05ace3e3cf--