From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id OmcDHU0POF8JfgAA0tVLHw (envelope-from ) for ; Sat, 15 Aug 2020 16:37: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 mp1 with LMTPS id YI6jGE0POF9cSAAAbx9fmQ (envelope-from ) for ; Sat, 15 Aug 2020 16:37: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 0BA5394005D for ; Sat, 15 Aug 2020 16:37:33 +0000 (UTC) Received: from localhost ([::1]:51052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6zBU-0000pr-0z for larch@yhetil.org; Sat, 15 Aug 2020 12:37:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6zB3-0000o9-HK for emacs-orgmode@gnu.org; Sat, 15 Aug 2020 12:37:05 -0400 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]:40773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6zB1-00069u-G2 for emacs-orgmode@gnu.org; Sat, 15 Aug 2020 12:37:05 -0400 Received: by mail-qt1-x836.google.com with SMTP id s16so9288186qtn.7 for ; Sat, 15 Aug 2020 09:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=tIXbFbAh1TQHH915NMimaxhnHApY8EB9M4kDix108mI=; b=hI3oADb652TQSqBiX5Y/+7M3O0QAdNF16eNT59+oM5fCIRzMWVIvJe03nG9pFkc58c kJCdrFku1HeboW9SvNzGJhqR1O2E+uhHFjUMvlOaSi/cht0E7XzSWlhhnAp3dc7dIpKZ MI8EqtBeKFc3/ktjJ74GXJEiLZkx3f/alAAfpV3erRxfWvmaI1NDZb4RwXKWScYlgkA2 gVrR1L6Ig4TWPVsR4I4qVx2hjCt67ebD7y0ICoksPurjLPYuG+ZCP5EG4iRhBRUhOUVP oXDytGI2SCt7z+kDxcz7R5AQbFSPJV2XRLg0RpJF8I1vt6bd6EcB6OH7Ilm8tvau4aJz WG1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=tIXbFbAh1TQHH915NMimaxhnHApY8EB9M4kDix108mI=; b=KaXZfmPMXL1L22LNLllU9e/A8JquzdVuv6J3Fenxb2taeHpmW4easKxM1gopmi6sSk 9XmmCnlKEao6ga1O5LWbkRr+Rn1VrownC3z4UaEFU7CIIcU6BEJsrlcpGYZEGFVxW+mI DS+ILBEdKMeTUMbKTqtRMDQndz359LCejFyIx1zjWC4XvrUp2Dagl4GesUip+WEx80Ad OOHR4Ugc3NJF+ZFIvQUbwuiuyISYy9OjBj7S1DRdQbNbxXxZAD8TNTqZmsr0kApWKZfH F73YDrObqZzFsQnyZ63gZ4B+RO/gsLRe+EhUBVkaur1W92IbYT7v6Gnvjdk3eNQIB+wz R/SA== X-Gm-Message-State: AOAM531U/2b9uEnuxnplxo0ZM5/n6kcYKebnuUE7Delriu4FYEVnZRHR mnp4RFxBfu3q+Ju7+cKTbJZhDcYqdEnFlA== X-Google-Smtp-Source: ABdhPJzTD7EV76gM0lB1kIyVDDoS/FLIqOYGuUO1fVFcZAjxQ35XrqIfDhlpA3A/MEL5sLnexE006A== X-Received: by 2002:aed:3728:: with SMTP id i37mr5182936qtb.347.1597471661842; Fri, 14 Aug 2020 23:07:41 -0700 (PDT) Received: from localhost ([208.167.241.222]) by smtp.gmail.com with ESMTPSA id h24sm10618043qkk.72.2020.08.14.23.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 23:07:41 -0700 (PDT) From: Ihor Radchenko To: "numbchild@gmail.com" Subject: Re: How to detect current in logbook drawer? In-Reply-To: References: <877du1olkf.fsf@localhost> Date: Sat, 15 Aug 2020 14:06:39 +0800 Message-ID: <87sgcotpcg.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::836; envelope-from=yantar92@gmail.com; helo=mail-qt1-x836.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: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, 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=hI3oADb6; 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: 3.79 X-TUID: La/+9ftmobOp I think you may do something like the following: 1. search backward for drawer-re, but limit search to the beginning of headline 2. it should not be :END: 2. search next drawer-re from the point of previous search, but limit search to next headline 3. make sure the drawer line at point is :END: 4. check if point is within the boundaries Hope it helps. Best, Ihor "numbchild@gmail.com" writes: > 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/ >>