From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id APmzOaAZLWO7NgAAbAwnHQ (envelope-from ) for ; Fri, 23 Sep 2022 04:27:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0IxzOaAZLWN2OgAAauVa8A (envelope-from ) for ; Fri, 23 Sep 2022 04:27:44 +0200 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 AA10224DE1 for ; Fri, 23 Sep 2022 04:27:43 +0200 (CEST) Received: from localhost ([::1]:33642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obYPm-0005pn-1N for larch@yhetil.org; Thu, 22 Sep 2022 22:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obYP8-0005pU-Jh for emacs-orgmode@gnu.org; Thu, 22 Sep 2022 22:27:02 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:35716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obYP6-00056N-Pl for emacs-orgmode@gnu.org; Thu, 22 Sep 2022 22:27:02 -0400 Received: by mail-pl1-x62b.google.com with SMTP id t3so10532110ply.2 for ; Thu, 22 Sep 2022 19:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=ZyzBeD+uPqpDQO58SoWI7MNRWZbMNaLPYU8MwFkGvAY=; b=OdB1Q33mrgI+iEli7R67bewf2qhaw6XfHhrheyVWfDdcHlNBBwdfc/93IKCwPOLJo3 sRtZMIWy+hzfk0nRot9ZIiftsBPSi9EWsLFN6YhU8oMezLfKLCtnNvBvav3HaKUR2/fA JeP5Urne/QmXNK8+SB9ym8DMpRIF2/zDc5fkPZF66jdCOHFcU0CA7E2G0WgOGaNFlox2 E1hXtYf0FSrfSz7U6+UFlC7rtVSTFRzETVhZAamHwmn1aH8Zp+S9u25K1nJ/a/OW0ZZB S6TzrtubuKj0GW6U7kuPR5CRU0oRmhdVBX48ir6MuBePMtuWOX5bAE5Md81Z2v1EKJt4 wgZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=ZyzBeD+uPqpDQO58SoWI7MNRWZbMNaLPYU8MwFkGvAY=; b=57tuqgktwVqqU6VjJ4I2YxeqBw9Mu1YtaqhbS76K/gdJol11I/sSpwVAYJyCH5vUiU 7HF885j2OURelD2RBvkQdFQg80zd33v0Xa2eBXlCjXsbcFTZW4gXIaj/GiAAjGr0f9/L R1H/LPSpalMThTLjkFDull3MM5wif1zehfHVUmKuwFbDDxs5VP7LD4n4k8cfR+LDJxS5 82/mffPszv71ANyVn2qJRcHgfUOAcazZRJ3vFQbPB5GkHPyGHVVhZveE6VgDgq7j6fV7 0V1oi8ylq6XwRD+3l+uZbcPgRJ6E6pBG8INmzYbLK0fvP1l8iB7ScGZYSpFXd5BBw1xH dc6Q== X-Gm-Message-State: ACrzQf1aABJGQzMlx5rIVD//6y+NXpglay67mIiwtWFhPyffcUBr0b0i VG1bSo4RtPELYcFy6fnKOwSO8VSfa7Q= X-Google-Smtp-Source: AMsMyM5KmgsoBEsgSfUbjFGrW3DqrqLWqeZTPdGwSIIcPclxN53DgIdlOXnU83QOEJQ9feX1pRiiXA== X-Received: by 2002:a17:90a:9f07:b0:203:5a3:1d25 with SMTP id n7-20020a17090a9f0700b0020305a31d25mr19225894pjp.74.1663900018439; Thu, 22 Sep 2022 19:26:58 -0700 (PDT) Received: from localhost ([1.83.154.224]) by smtp.gmail.com with ESMTPSA id k17-20020a170902c41100b001750361f430sm4877172plk.155.2022.09.22.19.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 19:26:57 -0700 (PDT) From: Ihor Radchenko To: Timothy Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Babel evaluation: location and timing information In-Reply-To: <87o7v7998j.fsf@tec.tecosaur.net> References: <87edw9z81n.fsf@tec.tecosaur.net> <87r106qwhv.fsf@localhost> <87o7v7998j.fsf@tec.tecosaur.net> Date: Fri, 23 Sep 2022 10:27:49 +0800 Message-ID: <87sfki9656.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::62b; envelope-from=yantar92@gmail.com; helo=mail-pl1-x62b.google.com 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.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663900063; 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=ZyzBeD+uPqpDQO58SoWI7MNRWZbMNaLPYU8MwFkGvAY=; b=Iq1ghFetTujo29M/7oacVJ8NEYT/iR20GYZeYpQPG+MuvAy1aToCZFLqf/zpLtNwEhdyzH FHrWQaooz3o1KcCegzVdhV6TNHkidlMF+0lQ7O44YU2kefVoVhMzkH9Vp0Si61g017GBn8 yUR6xVNuSX/5mQKT+uWNswhOGUBVILmQbbSDdWwkK9BjpCgQIrYIY0QTKDHsjyHxX8QvE+ 8NO6NIr6OgNVqAf+iFU6OkAeB/9963/87sdqTmi7rj/0fqcSVDMZyzI0rhkJ0xvOT/0StN WRiUzQPGzkOXGdUsWQ+aLr7Pn/ddSVkNbnflSR0ELgi1NWAi0JIg0ig9dZ7B1g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663900063; a=rsa-sha256; cv=none; b=upEzQ2mJ2rzZ+E2KomH8QA8grtVpxISqI5WA6i3UifDxgSkjCQnIKToSKRJhl201FfFNuO yn+kHwIjKEz1AymC/43DaYID1nUmAKaLj0U7bG8FCSD5fixvsCTbaToZA1MpVHZkLcIff+ GREuYj3fL2QppKvyeT6LjZKjyNyWX+7OR8C5Rq0sO0MzLab16RUeQ9738FI9PVQWYloOlt 6kNgvHJ66PrwB9Kn5yVMowRRPGJ/E3lfijjzysLLh7AuVw8vo3TdeU9Q8RrFqyi+7cTRQR m3KSShwi39u27jJl7G9fU951uBQdKMeFMDhOSiUcJCO0lB/7LoCZHNKxgc2EPQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OdB1Q33m; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.85 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OdB1Q33m; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: AA10224DE1 X-Spam-Score: -1.85 X-Migadu-Scanner: scn1.migadu.com X-TUID: EB5fuxLExWsN Timothy writes: > Hi Ihor, > >>> - (message =E2=80=9Cexecuting %s code block%s=E2=80=A6=E2=80=9D >>> + (message =E2=80=9Cexecuting %s %s %s=E2=80=A6=E2=80=9D >>> (capitalize lang) >>> + (pcase (org-element-type (org-element-at-point)) >>> + (=E2=80=99src-block =E2=80=9Ccode block=E2=80= =9D) >>> + (=E2=80=99babel-call =E2=80=9Ccall=E2=80=9D) >>> + (=E2=80=99paragraph =E2=80=9Cinline code block= =E2=80=9D)) >> >> This will not work, for example, when inline src block is located inside >> a headline. One can think of various other non-paragraph scenarios as we= ll. > > Good point. Does assuming anything other than a src block or babel call i= s an > inline src block sound reasonable? Yes. All other elements (from org-element-all-elements) are non-source-blocks. It will be a good idea to spell out this fact right in the code (in comment). >> Also, even though org-element-at-point should be caching recent calls, >> I=E2=80=99d try to test the performance before/after the patch on large = number >> of src blocks (like in your config). org-element-at-point can add a fair >> bit of CPU load in some scenarios where we have fallback to the full >> O(Log N) AVL-tree lookup. > > I=E2=80=99ll see about giving this a shot at some point. Since parsing wo= uld be required > before this point I assumed the document structure would be cached and th= is > should be fairly cheap. Would `org-element-at-point-no-context' be better > potentially? No, `org-element-at-point-no-context' will not be better. It is only useful in very specific situations when buffer changes are large, frequent, affect large portions of cache, and parsing from the parent heading is faster than updating the change all the way to the top-parent org-data element. It will be better to re-use the element queried during src block execution. >>> + (let ((time-info >>> + (if (and exec-time (> (float-time exec-time) 0.= 05)) >>> + (format =E2=80=9C (took %.1fs)=E2=80=9D (fl= oat-time exec-time)) >> >> Why 0.05?? > > Because that=E2=80=99s half the resolution at which the time is displayed= at. The idea > is to only show the time when it will show something greater than zero. Makes sense. Could you please add this comment to the code? --=20 Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92