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 SirSBdAqiV9TewAA0tVLHw (envelope-from ) for ; Fri, 16 Oct 2020 05:08:32 +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 qARIAdAqiV/4VgAAB5/wlQ (envelope-from ) for ; Fri, 16 Oct 2020 05:08:32 +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 914C09402A7 for ; Fri, 16 Oct 2020 05:08:31 +0000 (UTC) Received: from localhost ([::1]:33772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTHyg-00011K-97 for larch@yhetil.org; Fri, 16 Oct 2020 01:08:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTHxP-0000zZ-SQ for emacs-orgmode@gnu.org; Fri, 16 Oct 2020 01:07:11 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:54888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kTHxN-0004wm-TE for emacs-orgmode@gnu.org; Fri, 16 Oct 2020 01:07:11 -0400 Received: by mail-pj1-x102a.google.com with SMTP id az3so708664pjb.4 for ; Thu, 15 Oct 2020 22:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:user-agent:from:to:subject:reply-to:date:mime-version; bh=I6cEtb4CQfYghLPeFdPvvvYgswX69s2mfDcAzY2rItI=; b=H6W/denXjZR7olGj5PpfD1zQIKU8yUkSyVfvVUwx73vrTS3lZPmShigprd9ascd5yl QLBUJgIahrw/ITtX1vr6s0cdAPnME81FwLUj2QIbcw+TJTX5O/FwzTAF+shm7xQ2LK5s Su8V6dJzCfYwFK2u+Yn5mSea2HDjVzbplFfCbZJVFumOfREYtb10ivx8gKCHrDQeG+6N 3VFXmfuoQtR5AYe9u9y3wPCmHCCy3esNagTomqDi6rq/ZruMBuhgVB4WKBcdyBfCV87P vnhVsFDT9X9wih+caCYxUlRSD5fdv3CHmOY4/kUzsGO6HtqpPQo6U6ZoAi4mAtM+84nJ srgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:user-agent:from:to:subject:reply-to :date:mime-version; bh=I6cEtb4CQfYghLPeFdPvvvYgswX69s2mfDcAzY2rItI=; b=qTr1QHEuGFDn3jw5WbiLKaAjkIUl2YqUMQF8xrK2UAlaGWYruFGHlfB6roYMqDWqz/ pZ+bB+O1F91RzaRzCDV+dqO1vhcrjiU2slS/9CF6xaFR3RVjG4PZKmQ9ZzYvO5/ynlBG aGtoT83ImRIa0JRWL47VVpnqF5wkSMgcaUkauDaMRSpExKDPh+qtOninqRL8xxc2mvzF uwJ4DUyCec9Etp8HBgx4aqjl6Z1/RwbZOVlENIVop+REecBhYLtefPZWsp/WUit/+3iC hzVvsMj9qqhBhTvPc6mOCSURW+fzH4ySSjuildXcpwJtw++ArmjkA9ChY1D/R4nPFpa9 aeGA== X-Gm-Message-State: AOAM532LNmzKQn4iFl3vAhs9FlQtA+dKSn0HQREN7KnDz2ig8DuGbYCx Hp4OHpd3xRd4YSYQ/ySrlTfaGH6Gfg== X-Google-Smtp-Source: ABdhPJxhnPKSun03WSpzHcDjzPtP5dxMnSMqxqs/ZCBDPbnz16L3ygYQeZcekO9b65WuoCe+j1mwgg== X-Received: by 2002:a17:90a:7787:: with SMTP id v7mr2322041pjk.104.1602824827850; Thu, 15 Oct 2020 22:07:07 -0700 (PDT) Received: from dark.localdomain ([183.246.144.122]) by smtp.gmail.com with ESMTPSA id n3sm1087136pgf.11.2020.10.15.22.07.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 22:07:07 -0700 (PDT) Message-ID: <5f892a7b.1c69fb81.c0551.2f2e@mx.google.com> X-Google-Original-Message-ID: <87lfg6u5lq.fsf@numbchild@gmail.com> Received: by dark.localdomain (Postfix, from userid 1000) id CE24E3C024C; Fri, 16 Oct 2020 13:01:21 +0800 (CST) User-agent: mu4e 1.5.5; emacs 28.0.50 From: stardiviner To: Org Mode Subject: [Share] collect some idea about auto eval code when TAB expand headline Date: Fri, 16 Oct 2020 13:01:21 +0800 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=numbchild@gmail.com; helo=mail-pj1-x102a.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: -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, MSGID_FROM_MTA_HEADER=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: , Reply-To: numbchild@gmail.com 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=H6W/denX; 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.71 X-TUID: aDx/EX79KHae I write an elisp config for Org Mode to auto evaluate inline source block in property "EVAL". #+begin_src emacs-lisp (defcustom org-property-eval-keywords-list '("EVAL") "A list of property keywords for evaluate code." :type 'list :safe #'listp :group 'org) (defun org-property-eval-code (&optional state) "Evaluate Org inline source block in property value." (when (memq state '(children subtree)) (if-let ((inline-src-block (org-entry-get nil "EVAL" nil))) (with-temp-buffer (insert inline-src-block) (goto-char (point-min)) (require 'ob-async nil t) (setq-local org-babel-default-inline-header-args '((:results . "silent") (:async . t))) (let* ((context (org-element-context)) (src-block-info (org-babel-get-src-block-info nil context)) (type (org-element-type context))) (when (eq type 'inline-src-block) ;; ob-async: `org-babel-execute-src-block:async' (org-babel-execute-src-block nil src-block-info))))))) (add-hook 'org-cycle-hook #'org-property-eval-code) #+end_src A question: How to get all property keywords under headline? I want to use ~member~ to detect whether property keywords has member in defined custom list ~org-property-eval-keywords-list~. Second question: Do you have any good idea or suggest about this? Thanks for sharing your idea. -- [ 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