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 ms0.migadu.com with LMTPS id yCGNJN4FH2HYjgAAgWs5BA (envelope-from ) for ; Fri, 20 Aug 2021 03:31:10 +0200 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 ACNJIN4FH2GRbgAAB5/wlQ (envelope-from ) for ; Fri, 20 Aug 2021 01:31:10 +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 A3BC56A9E for ; Fri, 20 Aug 2021 03:31:09 +0200 (CEST) Received: from localhost ([::1]:48356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGtND-0000TF-LG for larch@yhetil.org; Thu, 19 Aug 2021 21:31:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGtMj-0000Rs-5N for emacs-orgmode@gnu.org; Thu, 19 Aug 2021 21:30:37 -0400 Received: from mail-db5eur01olkn0826.outbound.protection.outlook.com ([2a01:111:f400:fe02::826]:41480 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGtMg-0000Ch-ML for emacs-orgmode@gnu.org; Thu, 19 Aug 2021 21:30:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nRdMjfRvAj+8mdxO2GLCkKU/EaTMwKiBRxpo+uL97n3oB93gRgKlVTSBBaS3RckHY6tATCerBbb+qrnJi2JRWrDItzxvUirudIE0q2PeMHq3jvBHbxpT/LUlbSvj3WcWrK+SS882wf/DPKkChfQFV4to8+4WHfqiy1Roxfg26evYP0gzRdORpj+AUmOsTGWlj764HtFKwA37SwKQ4SMRByvd368bDoCI4lCLh/lHPJU04SiPW+tNbV0ExMxBc4/giJlDhOn6gVBCrAGWOVMfodMuba7goQ7ybPtnisXiQzH291KVlJgmC9gHvEEzczJNefvoff9X2q+VkHxFw5924Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qfh2C/bFodCbBexdZp9vZ6BwZ1Nopts8dzXnttvtE2g=; b=FwH78RQHHgcjBcISzIm+572oeNlRvRri2T8m4bt3f5gvnrIbZIAc7qCEZele5o+U7cyKVsbjiSnOrmfTWYUXG5zrZRFPVaY1tZhc8yN00x4ygqAvFuUNQ2+2wiKNwi6XNh0d3Jt45c59TjU3ex3vpjjNv0gDAcXtn0hNhRZYWYs9ILeee1i1JA/f6GOYRXlo4YPXqegtgMBkoro3re4mP5atSPCHtof0hI5462nFLy6uzvQHIJ6WigTkyunMpXRBLR3ivXurj+u4Pckj8WqZ0OHElFhKnweODmJbbLnSilTPOkYIY8co8Ee8NmhIpuZVR/GTPDrzJqtijBbvwwVlnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qfh2C/bFodCbBexdZp9vZ6BwZ1Nopts8dzXnttvtE2g=; b=YxcNF0cVqxGjV0Dzgsngua/q9jffeeRLVmxrGgARsSLRqy52UMsJdZ3jvsVA8lzjQTPBCdJQg8f4P/0/6jdhfd4yJ0S21ruE04FXvU8V2+yqV4tKvz0X2oRqJzp1kRr5w0g+bRSxTwPKLnmgK4gK8fu03KLn8htL/sRmnT2jquD/EvAs0A5kdg87nirHRn6oOM9Gn73qVFY3Z6EYOGyC87d5m3gxwCL8M1ApiRDZFdlRa+Mr2plBtXv2TGLN8vYL0THUrx2xE+dDvtrfbBHCcq/xzn1/aRxpDLhrxeUEJyMzGkqfE2sfl6A220TRZD/zxlJm8Xz/NnEVf1Ja1tDZ8g== Received: from PAXPR08MB6640.eurprd08.prod.outlook.com (2603:10a6:102:dd::5) by PA4PR08MB6045.eurprd08.prod.outlook.com (2603:10a6:102:ef::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Fri, 20 Aug 2021 01:25:30 +0000 Received: from PAXPR08MB6640.eurprd08.prod.outlook.com ([fe80::7529:3d13:60:b471]) by PAXPR08MB6640.eurprd08.prod.outlook.com ([fe80::7529:3d13:60:b471%8]) with mapi id 15.20.4436.019; Fri, 20 Aug 2021 01:25:29 +0000 User-agent: mu4e 1.6.2; emacs 28.0.50 From: "Christopher M. Miles" To: Org Mode (org-mode) Subject: [QUESTION] Add advice on command org-add-note not working Date: Fri, 20 Aug 2021 09:22:22 +0800 Message-ID: Content-Type: multipart/mixed; boundary="=-=-=" X-TMN: [/PyzmqkUGe2X0zdhpI2uyduSty05pvQP] X-ClientProxiedBy: HK2PR03CA0065.apcprd03.prod.outlook.com (2603:1096:202:17::35) To PAXPR08MB6640.eurprd08.prod.outlook.com (2603:10a6:102:dd::5) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 Received: from Mac-mini.local (183.246.144.44) by HK2PR03CA0065.apcprd03.prod.outlook.com (2603:1096:202:17::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.9 via Frontend Transport; Fri, 20 Aug 2021 01:25:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3bf1e19-f51c-4314-b267-08d963796599 X-MS-TrafficTypeDiagnostic: PA4PR08MB6045: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bsDssw5VJlos45ol4K0cu9opqPsaAT4cwalmAPoNIZTfs98QTWkK2xw8RrHv/x6cFgtiQjHw2yVU5sv3vi3knJnfCauHsixbybZeEY6GDes5xqAQhB9G0DP7ZiYUhXydmNbVf1bZOnmDaTWbDp1KkJgelpk3NqwhUST7GY8NuCkJhCcR4MOSSgpPsc4jptQcP/XnRigv3OPmmQ3ivsn8OoD2arH4N0lUDWNr1RJePGqjk105OFE9lTpcqlb5shaRbHc0TDcWzM5GFow3wHIEsgBjVUTi8w9Dwh5hQa9OEl4kIKtAQftbmzyNRcH1hWkvQX8i40Xrk6ugS1VsqXjvKjHk56hjAusJurxsphawWJhKjCvAR7ZJaAtWD+gaF9YemGk2jE+rSEo3EtlG6vG5OsqHw0RXs05wiYrbmwOij8Rt7pL+UahwTY88Q+lI89AX X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sm/BpOiU0EMvBZYqG5zyRiQ75gatzFMh3qLaJmgdLWSabYHc56Gw+Tvx6St7+qg8kahx8XVvTULmMKb2ogYyzcoohFJZxCefQYOVoIY+MqzHKd3cB5Dy2v/vjb/JbKVPEsR6Pve6jaforfT03W3kQg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3bf1e19-f51c-4314-b267-08d963796599 X-MS-Exchange-CrossTenant-AuthSource: PAXPR08MB6640.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2021 01:25:29.9406 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6045 Received-SPF: pass client-ip=2a01:111:f400:fe02::826; envelope-from=stardiviner@outlook.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: 31 X-Spam_score: 3.1 X-Spam_bar: +++ X-Spam_report: (3.1 / 5.0 requ) BAYES_50=0.8, DKIM_ADSP_CUSTOM_MED=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_FONT_LOW_CONTRAST=0.001, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0.001, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01 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: , Reply-To: numbchild@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629423070; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Qfh2C/bFodCbBexdZp9vZ6BwZ1Nopts8dzXnttvtE2g=; b=dt9mI4ZT60d1lFB4fduZM//kXj0kPr3JlFvupvQd7++rOtd+USttu4WiINxQcZyD4QBg4v EcHlipPxyVUgrLK13TNBTGr2qhzWcKP1FMBbUhY9S95vibcYNFBVunrIcv78a06f1KF+nY n/WTUlyjOidfzmp95X5NJ4lInUxeCE8feswOW6AGBjW69MeaFd8Tecw5jGLZtEssZFkgL2 SYov4yggtOG2MrypViGdVpUmEQu3lN8OvzZwgXQduDlphQt6QAv1VmiVy7kOuQbesxobOu aTMaIBwuSDIWz/9/Ln1XzCsP0Z0+uQnXMqM4JzEeG6Is2dMCgVkSAU36iyHFmw== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1629423070; a=rsa-sha256; cv=pass; b=eCa6EbRb8GYwffssIdgTI8RoShMuNNx5xgPOEhOqrgaQvw/nfx6MZRGKRxNU0nFFCTHtsv Xq6TnPkJZL1BbvfyGDjNbWA2oqzqhNnGhhP1w8N7beMLjPgaKkO4eNeqDwicC16z6M6UqN 23Z0IQz7AATZTvNcbc01r6UIj07G4A0KJXWluw5OE7XA3tXcgDN9fzIaN9mJOwfyoPulQR hqg9YheirwnWmJlWfY7CgQWg6Ivbb99q1YciI2x+0K2V18c2NMjEEycvHUhcXrmCrzMCD5 WagZDVT3HabuOQaWpCIMc/MGXXBeOpBqfyh3G8MbcRlCw1NEITdQZiitKR+tJg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=YxcNF0cV; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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: -1.52 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=YxcNF0cV; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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: A3BC56A9E X-Spam-Score: -1.52 X-Migadu-Scanner: scn0.migadu.com X-TUID: KRvZHf2GS+zD --=-=-= Content-Type: multipart/alternative; boundary="==-=-=" --==-=-= Content-Type: text/plain <#secure method=pgpmime mode=sign> I have following advice code: #+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))))) (advice-add 'org-add-note :after #'my/org-add-note--auto-add-tag) #+end_src 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. Does anybody have some clue for this issue? --==-=-= Content-Type: text/html

<#secure method=pgpmime mode=sign>

I have following advice code:

(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)))))

(advice-add 'org-add-note :after #'my/org-add-note--auto-add-tag)

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.

Does anybody have some clue for this issue?

--==-=-=-- --=-=-= Content-Type: text/plain -- [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-=--