From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wBF9EH5RUmSPOwEASxT56A (envelope-from ) for ; Wed, 03 May 2023 14:20:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YNBLEH5RUmScPgAA9RJhRA (envelope-from ) for ; Wed, 03 May 2023 14:20:14 +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 0CEBB8863 for ; Wed, 3 May 2023 14:20:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puBSJ-0007uI-Vy; Wed, 03 May 2023 08:19:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psWrR-0005KV-CL for emacs-orgmode@gnu.org; Fri, 28 Apr 2023 18:46:41 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1psWrP-0000Ff-En for emacs-orgmode@gnu.org; Fri, 28 Apr 2023 18:46:41 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-63b620188aeso654946b3a.0 for ; Fri, 28 Apr 2023 15:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682721994; x=1685313994; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=x7T5j0w2qwgSdAhgl8FC2ewOUpR9RKVPy+J9IF8W9VE=; b=W0aXJPUYURz2LkMSYMLvEtGmHbkmt/SqnKA2/nLrAhJICvZXcO66zKHwe+SH403RHt kMr76Ct8cZkzW9PPmIBy+DmOmhNWbA6Z8AkXRopbz/KaC8SJe9LG5eGyOHexMi6IPgOq RzJGk/lyAKnK3AX2In7DdvNiIrh55hFsGZqPQmsakGkXVeeHJqGSSY9G3E+OMcrZh3+7 PVh0Tl6XRJX/Rd5zpBQ0v5eMwCdchc5LS84aVUPj8no+in0TQ73L1sMBU1Lx218dTiIE khmD7YeUpFE1ZfU4rbjqyUo2++UiVY4EjXgAyBy+aJ5dhIvqcln1Qwa3A/rpNc2TNmkV 1A/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682721994; x=1685313994; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=x7T5j0w2qwgSdAhgl8FC2ewOUpR9RKVPy+J9IF8W9VE=; b=KhjTJc4PHpSjclejUbp+N3U1BDwbq2Mh8KbOkOsgIB4AOprA9kjLIKTUnxE47x1d3z r1zGlW9whs78gg3DwBidzEK4M7lsG/1bHaNHVBD6kjvX3+SpGuZCmVJfNnUxcWCgInTm HHUcHP5NYstR2mBO5+wMS+hqH5nsVDCE5adC17WMqaxEcRmOnPXVzZUF/FuATTymI+Qz QcXoZVQOdM9hXxwEspFAGFkmfGgqFIQrosfySKqsvOK2qBOzuXNfMYcQ+xRr4Oq2YAD9 v5ZGwnDNaS0GCW4BlY2MyjsabullkoDLr1qSJFVBLzHcyqvPgrUPlmpMq13p1FFcXvUt kvWQ== X-Gm-Message-State: AC+VfDytyiyxjI2kBCdH3t+e/zhx/3dUDNL5Yl26xCXvnKlPgVQnxwp6 M8Tm9lT8ACvpUbR+Lee74J6Mh2Ii2fbbng== X-Google-Smtp-Source: ACHHUZ4+72MHkJ3cM18xya576z7OpTydjZjzZY2TBSCwQu3LCpinT9q8wkeeJGrA0LlMab5VQg8XiA== X-Received: by 2002:a05:6a20:54aa:b0:d5:9216:9182 with SMTP id i42-20020a056a2054aa00b000d592169182mr9220649pzk.9.1682721994363; Fri, 28 Apr 2023 15:46:34 -0700 (PDT) Received: from localhost (124-168-15-253.tpgi.com.au. [124.168.15.253]) by smtp.gmail.com with ESMTPSA id fe5-20020a056a002f0500b0062de9ef6915sm15472819pfb.216.2023.04.28.15.46.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 15:46:33 -0700 (PDT) From: =?utf-8?Q?Sebastian_W=C3=A5linder?= To: emacs-orgmode@gnu.org Subject: Babel results don't respect narrowing Date: Sat, 29 Apr 2023 08:46:29 +1000 Message-ID: <87mt2r39ru.fsf@nixos.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=s.walinder@gmail.com; helo=mail-pf1-x436.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 03 May 2023 08:19:35 -0400 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683116414; a=rsa-sha256; cv=none; b=by2ExtarBofLxu0AZTC3Nz6iEXS455hm3w6bQYlMQyM5/aVnhq/CmnuJXE1g3hgJniNkIa viSfErh5WLywAhd5Z+e+UBjwfs8CTm3sbQqwK72fspcXlKMXME0BDr6E2yCL2jXdr910bZ 7KjX33d1omh3tpj9k7w1vokRb5vvkU4wRRrHMG65zVf/2RFwJm4FZlVX3MBuiKirb8YMr7 ZISk4IzT1EZSuZm7s3K4VuQYl2+uRmTRxPNQlJMIlLueaIePfUmwIWVw11UzPuQiqMrPXs bRwI2kkGY0ZGzdSYFqn4ScNNdvPR7W+d2p9OHG/dAvnBJMQGVr5IkF+EQQbmgQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=W0aXJPUY; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683116414; h=from:from:sender:sender: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=x7T5j0w2qwgSdAhgl8FC2ewOUpR9RKVPy+J9IF8W9VE=; b=UmBPpthF/Sinj8bGgWO2AsSwDTHcjsxLKc+XI82Uz2l8GMIcwbNnZXH1XBek2InmxsFEbL c9D88wzL9/m78Sh1NIIqOIgW72A+ApSZLzqXI3Q2PwJ8yH9CO1QTsYB3pMaSjnMYTtMSQ5 Xoj6YGcUb1cKziUhsNgXPVwoJ4zQ06BmmvQsnEEREZuRgrPBw8B9VftD5fL4dQ2k3CCTzh mqqW1WyAkNyWJWJ4Vt8olcs3zHbRhWwP80KjiRXJ9+evxHQ0FwOGz1WfrwrWdk6FAJhFwF PuxYngAY4y8qImuLR4UEMs8GnLdsh06zm6tDDHJSjUpvCidSZ/omTFNEcwrWfw== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=W0aXJPUY; 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: -5.41 X-Spam-Score: -5.41 X-Migadu-Queue-Id: 0CEBB8863 X-TUID: ksgHgFHtUCQq Hello! When org-babel inserts results after evaluating a org-babel block, the current narrowing isn't respected. Org searches outside of the current narrowing to find a result block, then updates that. Here's a example to illustrate it: ``` #+CAPTION: 1. Evaluate this to narrow to the elisp block (I put :results raw here so that it's impossible for it to narrow to the first block) #+BEGIN_SRC emacs-lisp :results raw (narrow-to-region (progn (re-search-forward "#\\+BEGIN_SRC emacs-lisp$") (beginning-of-line) (point)) (progn (re-search-forward "#\\+END_SRC") (next-line) (point))) #+END_SRC #+CAPTION: 2. Evaluate this #+BEGIN_SRC emacs-lisp (+ 1 2) #+END_SRC #+RESULTS: 2 ``` So, if you narrow so that only the elisp (+ 1 2) src block is in view, and then evaluate it, the result that's outside of view will be updated to '3'. This is an issue primarily with libraries that insert IDs where the results are. Then, when the library searches for that ID it inserted in the narrowed buffer that doesn't contain the RESULTS tag, it won't be able to find it, as it's outside the view. I believe the proper behavior to be for org-mode to create a new RESULTS tag, and insert 3 in there. Thoughts? Best, Sebastian