From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sMy2HFzHH2EucgAAgWs5BA (envelope-from ) for ; Fri, 20 Aug 2021 17:16:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id kH5RGFzHH2FCegAAbx9fmQ (envelope-from ) for ; Fri, 20 Aug 2021 15:16:44 +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 CAC711096E for ; Fri, 20 Aug 2021 17:16:43 +0200 (CEST) Received: from localhost ([::1]:37058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mH6G9-00069Y-Qx for larch@yhetil.org; Fri, 20 Aug 2021 11:16:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH6Fg-00067y-Hx for emacs-orgmode@gnu.org; Fri, 20 Aug 2021 11:16:12 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:34305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mH6Fe-0001iO-75 for emacs-orgmode@gnu.org; Fri, 20 Aug 2021 11:16:12 -0400 Received: by mail-pj1-x102f.google.com with SMTP id gz13-20020a17090b0ecdb0290178c0e0ce8bso9426374pjb.1 for ; Fri, 20 Aug 2021 08:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=4pFZCo5IQLh+tORrSpM6Qx+lgGxGsyRbXaksKj989Nc=; b=OyZpjBll1C0tf4WKepMUL2DiDznbKQnXzxgw1c7C2XcC4RyRlwyGFokQ0P5PpYpFRe IzFg5J6JTUNkzrEYtDQ5n5loN7pBcp+7LD9A88AJfs+WYXFyYtwJkhZZqqAnazAwHFgU D5zc3u4JIZ+BSrBg7JWYJJR1uVTRBwfjcy+bAPZouqrvDljaZYYj97mMyV0b2pZl6FTV 90P9IhfLcdCAWs3YoGLpYiolDdJABURNMaqonnLq0G+coRGFvvqgXl9xrpoA1j1Fw7U+ IofkfdEZazswWZWhyoSMwly31au0SOJ/QesJKV+auzE0XdKeUBvmHGIxZARqVPMfMEte jzJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=4pFZCo5IQLh+tORrSpM6Qx+lgGxGsyRbXaksKj989Nc=; b=mKr/8wYvsMnnE0lmm5qLxqesO8F2NL87WPP3VMY3tINdGyT9CpO4AqwmMtIsA6YErC 0a3o73mYoYOkNg5E2DksVuftwfKT4rAVRr0VUpnK7I9F7ov2XIfeUsdUGtU1vb3TIIBn oREmKdfYNNWtK3ooJtxxLeFiIq7W706vbXzeJlo2sEzR9Rsp7plQgILec9c679oeVF+D NEmMD3NjJaG8JKfpfHcTU25E4V0Xehshyb5nltkDlrWIAaKPwL7Bm19S4k1sXO8VdApD 9POze2TEJclDmETiC7hxiMZUdj84UP5yutlJsNf++skx74zMa773hREVEalXIQQIePLd O5Og== X-Gm-Message-State: AOAM530ks2S9Wj0u8lJkVAuv8WWXmFcNJWX9hkHaGCve/LydfLFn6ECM SVlvJ3BBVrnZU9z64+1rtw== X-Google-Smtp-Source: ABdhPJzQsO3fnxHHByIKEAJ8FKwBJD2iXCZhbZttABB1FLwvI/RAA/hOK1sp6ln5JMcNQzNJmDQjwQ== X-Received: by 2002:a17:90a:648b:: with SMTP id h11mr5235808pjj.141.1629472566519; Fri, 20 Aug 2021 08:16:06 -0700 (PDT) Received: from smtpclient.apple ([150.109.103.155]) by smtp.gmail.com with ESMTPSA id s46sm7375882pfw.89.2021.08.20.08.16.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Aug 2021 08:16:06 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: [SOLVED] Re: [QUESTION] Add advice on command org-add-note not working From: stardiviner In-Reply-To: <87wnogbj2w.fsf@gmail.com> Date: Fri, 20 Aug 2021 23:16:02 +0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <87wnogbj2w.fsf@gmail.com> To: Samuel Loury X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=numbchild@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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_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: Org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629472603; 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=4pFZCo5IQLh+tORrSpM6Qx+lgGxGsyRbXaksKj989Nc=; b=AmhyryfY7Z6ITGqkltJ1EWtU7G6G7wCdZfnGrPhYCLLXDScNwc6d8iz4LnzrVHzovKwKS1 Hi9L83LdbqmyLdRocYcxw1z7J3+qd/xi0BlpXBHy8u3sHXBY3Tiz/MDifG2r6rKCAdA152 S77EYGfV4xwV9dIw8GU5H/xxr4VgetfJhCJ/brfIBQiafWa5aLmSkLD+fyGiZltxNIAeQP S4HvI5Jasg41XLHnwFXMZibQhIf5cKL1tkts6Iwg50oYAiPWCeOf2Tyw0P1hdJ3F5VGBBc rDVEZZNTnQ3YjggY55tNegQIbyoyMYFmpjNQNJMRpj8dXf4gntQ/vlrpmVU7cQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629472603; a=rsa-sha256; cv=none; b=d4carXBYy4LKQhnowXXhkTWcceKPbbcUEZpAEP7VCvjWb9jEaiam3f0NEamyK1NN+aXIWq kgFS5lVNAP0hnkwIurMiSpsBjjAPzR3ghR3H7YnBK+H/NH2Jqmq9V4SnoK9mPA938fuCKW KESalROcRYq30o3KjT7LbDk6B/exYoedm3/VJFaR3r+OXde7W5AS2jjD5DpMhUHGfLgEv/ keQFK+tmZAn/T5RkY+vt6ZkoR3j88lFse3gmzfQeAOrToB9nprA5uAo2OAPyYK0kdpxo+a /E4ZxyfHzFTMzpI3OMcLXe6VPX7I5Kqaf5ikkXCmJDuIvGVqmwsNPdFyllNhjw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=OyZpjBll; 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-Migadu-Spam-Score: -2.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=OyZpjBll; 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-Migadu-Queue-Id: CAC711096E X-Spam-Score: -2.62 X-Migadu-Scanner: scn0.migadu.com X-TUID: Iae0Hk5sTnLy Thanks Samuel, using `org-store-log-note=E2=80=99 indeed solved the = problem. Great solution. > On Aug 20, 2021, at 4:45 PM, Samuel Loury wrote: >=20 > "Christopher M. Miles" writes: >=20 >> <#secure method=3Dpgpmime mode=3Dsign> >=20 > Beware this did not actually sign your message. >=20 >> I have following advice code: >>=20 >> #+begin_src emacs-lisp >> (defun my/org-add-note--auto-add-tag () >> "Auto add tag 'LOG' when add note log." >> (org-back-to-heading) >> ;; DEBUG: the following code is not executed. >> (message "DEBUG") >> (require 'seq) >> (org-set-tags (seq-uniq (cons "LOG" (org-get-tags nil t))))) >>=20 >> (advice-add 'org-add-note :after #'my/org-add-note--auto-add-tag) >> #+end_src >>=20 >> With Emacs Edebug, I found it only executed to = ~(org-back-to-heading)~, then stopped. The following >> "DEBUG" message is not printed and tag "LOG" is not added. >>=20 >> Does anybody have some clue for this issue? >=20 > `org-add-note` only sets up a side buffer to write the content of the > note. The "go back to the heading to actually write the note" is done = by > `org-store-log-note`, invoked using C-c C-c on your note. >=20 > So it is normal that `org-back-to-heading` fails in the org-note = buffer > that indeed does not have a heading. >=20 > Hint: press p when in edebug session to find out in which buffer = context > the code will apply. >=20 > I just tried applying the advice to `org-store-log-note` instead of > `org-add-note` and it worked fine :-). >=20 > My best, > --=20 > Konubinix > GPG Key : 7439106A > Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A