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 aJFfKWqCS18vDwAA0tVLHw (envelope-from ) for ; Sun, 30 Aug 2020 10:41:46 +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 QA0fJWqCS18XIQAAB5/wlQ (envelope-from ) for ; Sun, 30 Aug 2020 10:41:46 +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 1C2299402C8 for ; Sun, 30 Aug 2020 10:41:45 +0000 (UTC) Received: from localhost ([::1]:54452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCKmO-0007sk-I5 for larch@yhetil.org; Sun, 30 Aug 2020 06:41:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCKm3-0007se-Qg for emacs-orgmode@gnu.org; Sun, 30 Aug 2020 06:41:23 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:50654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCKm1-000089-Nq for emacs-orgmode@gnu.org; Sun, 30 Aug 2020 06:41:23 -0400 Received: by mail-pj1-x102f.google.com with SMTP id i13so1615670pjv.0 for ; Sun, 30 Aug 2020 03:41:20 -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:content-transfer-encoding; bh=RUcrz1cGkFo6BiIA7xabrNOzh4l/m2t8syatYP3PGV0=; b=Y+fXLNsiF7j94DRoKumDXbxeWLa6j1mFuMDg6H83QneREKCN7MhayU59Cyl5C+HzWH khYOXz2a4EghTqd/L3cAp3BArwBv7G5zQO8CAqRBboHXUjh+Wrh1iHdG5zDAfCLhoQaw H/g0Dd82TH/lgUBmjKo6lOBN+If8kvvQSU/sRaNLBIBhiqZhUyMMSIUKCLdVoIgz6Um1 eu/Bw4T1ppVq4UFkbjXAP6K0Xr9DII/tMz2+6VFV+KfHfPDIj4S5wazDItCysLLo3h1P Hhu6zgFy7oRfiDA6vvmyTxoJU6YCAd3W5EnBMqhjM7jufPOpe4F8Hc7tF4LaMxt74HsU 99gw== 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:content-transfer-encoding; bh=RUcrz1cGkFo6BiIA7xabrNOzh4l/m2t8syatYP3PGV0=; b=NjeaWVgkSeuPR6AP9F7Yi2DJtlZTBONkIsAqb2IoOSO+kvakzack75mPMM8VOypWfH nax8W+YvM9622Rqb8qvU8F3yc6KJADXaxWitXz7faXUlB3awrQB6MaR4134U4/zXWRVA QfUY2Mlf5aerIP/ATxYUfoLqDQOMUkhBnj751mMflqn4VRXmlx5OLC4IkfnQGPPl63fW sa10xuwwRxF6XiAlu2u1b2rtHcZFUTC+9zCtI8e6y5O2BLL5dRC0biWMluw4JHYIi/1F 4IcoAB1f+Xxdg+S/6d68rzpaMs1hMnzqVZ27Di6OjRaHQ6rYVoTDW/jR2x4zZU9hANJ5 vKCw== X-Gm-Message-State: AOAM531ifHJzVBAfsZUZFvUWY7zewW5TQGeHaC9yGyg1sfMPpi31Iycr dMEgyGBA+12LCJd7id4XeiRtv1SjhjInXA== X-Google-Smtp-Source: ABdhPJyIfTOvlkeFUz+6bioVdqYavbRePBL7Mi9R4DYFSIDHdPcZO/H0Ch6pNY/nEkGodYhLOkYtJQ== X-Received: by 2002:a17:90a:e292:: with SMTP id d18mr5854828pjz.96.1598784079600; Sun, 30 Aug 2020 03:41:19 -0700 (PDT) Received: from localhost ([104.250.131.79]) by smtp.gmail.com with ESMTPSA id fs12sm4013329pjb.21.2020.08.30.03.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Aug 2020 03:41:18 -0700 (PDT) From: Ihor Radchenko To: Nicolas Goaziou Subject: Re: [feature request] A new cookie type [!] showing the last note taken In-Reply-To: <87h7skldpt.fsf@nicolasgoaziou.fr> References: <87zh6eymxs.fsf@localhost> <87h7skldpt.fsf@nicolasgoaziou.fr> Date: Sun, 30 Aug 2020 18:40:19 +0800 Message-ID: <875z90xvqk.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102f.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: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, RCVD_IN_DNSWL_NONE=-0.0001, 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=gmail.com header.s=20161025 header.b=Y+fXLNsi; 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: 0.29 X-TUID: fezy50yl0Nvx > Notes are free-form; there is no syntax describing them. Org cannot tell > what is a "note". As a consequence, pointing to "the last note taken" is > not reliable, syntax wise. > Of course, under some assumptions (e.g., notes setup is fixed, you never > write notes by hand, ...), you could guess what the last note taken is. > But again, this is not reliable, and not portable. I was mainly referring to org-add-note. The last note taken with org-add-note can be found quite reliably. I am using the following code saving the last note into :SUMMARY: property upon exiting the note buffer. Though it may be an overkill, not sure how easy would it be to parse the note syntax for notes created by org-add-note. (defvar yant/last-note-taken "" "Text of the last note taken.") (define-advice org-store-log-note (:before (&rest args) yant/org-store-last= -note) "Store the last saved note into `yant/last-note-taken'." (let ((txt (buffer-string))) (while (string-match "\\`# .*\n[ \t\n]*" txt) (setq txt (replace-match "" t t txt))) (when (string-match "\\s-+\\'" txt) (setq txt (replace-match " " t t txt))) (when (string-match "\n" txt) (setq txt (replace-match " " t t txt))) (if (not (seq-empty-p txt)) (setq yant/last-note-taken txt)))) (define-advice org-store-log-note (:after (&rest args) yant/org-save-last-n= ote-into-summary-prop) "Save the last saved note into SUMMARY property." (when (and (not org-note-abort) (not (seq-empty-p yant/last-note-taken))) (if (eq major-mode 'org-agenda-mode) (org-with-point-at-org-buffer (org-set-property "SUMMARY" (or yant/last-note-taken ""))) (org-set-property "SUMMARY" (or yant/last-note-taken ""))) (setq yant/last-note-taken nil))) Best, Ihor Nicolas Goaziou writes: > Hello, > > Ihor Radchenko writes: > >> Over the years of using Org I often have a need to add a short note >> about how to proceed with some task: >> >> ***** REVIEW check again, subscribe | sindresorhus/awesome: =F0=9F=98=8E= Awesome lists about all kinds of interesting topics :BOOKMARK: >> :PROPERTIES: >> :CREATED: [2020-03-15 Sun 18:59] >> :Source: https://github.com/sindresorhus/awesome >> :END: >> :LOGBOOK: >> CLOCK: [2020-03-17 Tue 16:18]--[2020-03-17 Tue 17:46] =3D> 1:28 >> CLOCK: [2020-03-17 Tue 16:03]--[2020-03-17 Tue 16:18] =3D> 0:15 >> - Refiled on [2020-03-16 Mon 23:59] >> :END: >> >> In the above example, the short note is "check again, subscribe". >> The note is not fixed, but changes as I progress with completing the >> task. >> >> This is even more useful for delegated or HOLD tasks where I often need >> to add a short note why the task is delegated or put on hold: >> >> ** HOLD Finish the text prop org-mode | make babel support org file >> links in header args (:file or :dir) >> [[id:468e0645-68aa-4e14-86de-e5ce153538e3][[2017-09-22 Fri] >> CuNbARBshearstrength]] :HOLD: >> :PROPERTIES: >> :CREATED: [2020-07-20 Mon 16:53] >> :SHOWFROMDATE: 2020-08-15 >> :END: >> :LOGBOOK: >> - State "HOLD" from "NEXT" [2020-08-10 Mon 15:16] \\ >> Finish the text prop org-mode >> - Refiled on [2020-07-20 Mon 17:15] >> CLOCK: [2020-07-20 Mon 16:53]--[2020-07-20 Mon 16:54] =3D> 0:01 >> :END: >> >> Seeing this note directly in the headline without a need to dig into the >> task body / LOGBOOK drawer is really handy. >> >> In this last example, I had to duplicate the note taken using built-in >> note mechanism into headline, which was inconvenient. It would be handy >> if I could simply add a [!] cookie (similar to [/] or [%] cookies) to >> the headline to show the last note taken for this task. Then, I could >> easily see the reason why the task is blocked or what I am supposed to >> do with the task right in agenda view or in the folded headline. >> Something like the following >> >> ** HOLD [!] make babel support org... :HOLD: >> :LOGBOOK: >> - State "HOLD" from "NEXT" [2020-08-10 Mon 15:16] \\ >> Finish the text prop org-mode >> - Refiled on [2020-07-20 Mon 17:15] >> CLOCK: [2020-07-20 Mon 16:53]--[2020-07-20 Mon 16:54] =3D> 0:01 >> :END: >> >> The cookie would be replaced by the last note text, according to >> user-defined format (say, "[%s] |"): >> >> ** HOLD [Finish the text prop org-mode] | make babel support org... :HOL= D: >> :LOGBOOK: >> - State "HOLD" from "NEXT" [2020-08-10 Mon 15:16] \\ >> Finish the text prop org-mode >> - Refiled on [2020-07-20 Mon 17:15] >> CLOCK: [2020-07-20 Mon 16:53]--[2020-07-20 Mon 16:54] =3D> 0:01 >> :END: >> >> What do you think? > > Notes are free-form; there is no syntax describing them. Org cannot tell > what is a "note". As a consequence, pointing to "the last note taken" is > not reliable, syntax wise. > > Of course, under some assumptions (e.g., notes setup is fixed, you never > write notes by hand, ...), you could guess what the last note taken is. > But again, this is not reliable, and not portable. > > Regards, > --=20 > Nicolas Goaziou