From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id eMfoMU4dD2fDuQAAqHPOHw:P1 (envelope-from ) for ; Wed, 16 Oct 2024 01:56:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id eMfoMU4dD2fDuQAAqHPOHw (envelope-from ) for ; Wed, 16 Oct 2024 03:56:30 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hBYqmL5u; 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-Seal: i=1; s=key1; d=yhetil.org; t=1729043790; a=rsa-sha256; cv=none; b=EMieB9nVnZJlIyGRupU5unoikVPCa1pDvux737DmtHqil93ZJbtLntjov39R3TLQMqrIgt lZreYeIIY4E/YZtMJhGLJx44RI7cYip/fC8GKRd4X5iwvvJ1H6TUL0xfK5OYvAovxb1HFU q3Fn2FGvb6s4xCSSkWZLM47y0lHrQynlwUpr+KKCUnTSC8KtGUSF1548dh/KBv0Og9fWnI Ju2r6LxIASgQjmxUA7F+9WiYo7ICt5TZhddidatQcxpuqhS7RT6/SK8sZbhq34eOct7nLr ibgh+o2U0nb4i333+z8VPzgkFrPfHPxtHumOwQB+2ZyLn+wtDnP8T9tmRNc1ow== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hBYqmL5u; 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=1729043790; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oG3dZVn/OGkw7rEYqJ0NtEfkznaYdSmLrZmy7hKgpCY=; b=leBAYbqnsZUTrzXKdDObeV/Wmtr591GfHXXXQONvmwdNtlrMhSA4Z5PVGex0rUiJ0wGN6z 69dyRZ+TAEaWjdw2ZZcKltqbA6UV5mObQYoozG+vW9zmTiojjpETo241i3Xq+SBo11nfQQ eSeWGdxyoHRqOLQLG2a+wXML2QZyFAZoXdbU680EXzu4zazrKCsinD37s9w/KrZGMpIyBw DLhJey/D0HWMzpesR5/2khzK4NfVih0KMGXmlqMVxQMKOCqcCj+g/ATvjQW4YyDn2tTQUt WJPCoyLXb5piwgtHIZQ1AvSnr9AMXXnQjeQ9xG15hOD2hDOe7H3Mzq/iASRQow== 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 7B96C59C9 for ; Wed, 16 Oct 2024 03:56:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0tG9-0001AL-51; Tue, 15 Oct 2024 21:55:33 -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 1t0tG7-00019q-Tq for emacs-orgmode@gnu.org; Tue, 15 Oct 2024 21:55:31 -0400 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t0tG6-000355-0u for emacs-orgmode@gnu.org; Tue, 15 Oct 2024 21:55:31 -0400 Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-4608da1bea5so2251771cf.1 for ; Tue, 15 Oct 2024 18:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729043728; x=1729648528; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=oG3dZVn/OGkw7rEYqJ0NtEfkznaYdSmLrZmy7hKgpCY=; b=hBYqmL5uo3v3uY6cIc4+lb3sObUEnvarDpMyuByENZT5BBjvBY1OCRuKiFYMX2/6KY nHKuYFCX15ycL8cqxZF+Bv8Sve3YhuCcWMpqj/L6a6iYeo+zMg/SgGWDvEE5nH/E5ZZp klzKIECDa/dltYyhpJ53BAqt57HRFeUiLerR6/VprgWULxLJxETclzhGelA44R4b4IQV OzL6DVRNb1TR3Gu8JBNOe+rdymDsM5qTmsdzfn8qQpAMHaUc2ahx5QEXffjCvMPTRSvx TCMINWnANKNlhVgFVmBuy0pWLaFGm91gsVQTaCnaPvYaY/os6XcxGWXADZZucNkGpqcr 1+Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729043728; x=1729648528; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oG3dZVn/OGkw7rEYqJ0NtEfkznaYdSmLrZmy7hKgpCY=; b=dl8p9A5HdIl+iKbpoINfCy3O3BaIRBsutvTStzeWB1a/PhG73aGuxw7bwfjh/zbsfE +adsyvGV3mWpnO0+NRpDmAO1kO6SLoCDq3I9gA1gIAvhcEvI/vxOVylgtZHMMjaSxECm Ym2BqOrh5ry+v/YjG2y0LhHOyDJXZlzKp2OESQwn6tt7xfZMi+DuXAadQw5JQrUglAfB wcs9fe5gLQTkbm7NCJl5oP05aADggTroKSC3kug46q3HHXweAOYn6OpxMC9fY+p476Zp 05Z8RFjp3/SxOYdb5s+rY5P5Z0qTbAhu6JVmA8lU4YvtD6VuJcPhmFXwOEcf5l9CFtSV 8y5w== X-Forwarded-Encrypted: i=1; AJvYcCV35YFtTsmOE6p7r5snBFS8RkMXkCq1/KUUf4DhucldG2TdfnKAKKzD2W8P2kq0rThqM6kQhkSBVBFgApNJ@gnu.org X-Gm-Message-State: AOJu0YxHAsufh9bKJTBdldGkfZUWIehv/cwzAdyBINd8VE4/lQVibLc4 pN1oEwN6JJUALXtGzLGuRX+dfv1kS9anEa4mX8zEUMX4ZcQrRgh2Kit+x1qm X-Google-Smtp-Source: AGHT+IFx8AvbYBgnLKVL5rGMTAXFiEWE+HJ8nwHvG7OGJKzX6OMxTHmNgJ6j+4OsQHgxeppiC0xg4g== X-Received: by 2002:ac8:57d3:0:b0:460:89c3:f881 with SMTP id d75a77b69052e-4608a55df2amr26813761cf.52.1729043728209; Tue, 15 Oct 2024 18:55:28 -0700 (PDT) Received: from pierrot.dokosmarshall.org ([70.22.187.146]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cc229905c2sm12369746d6.143.2024.10.15.18.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 18:55:27 -0700 (PDT) From: Nick Dokos To: Nick Dokos Cc: Ihor Radchenko , emacs-orgmode@gnu.org Subject: [PATCH] `org-babel-header-arg-expand': more stringent check for appropriate context In-Reply-To: (Nick Dokos's message of "Thu, 10 Oct 2024 14:21:40 -0400") References: <87zfnrb2nu.fsf@pierrot.dokosmarshall.org> <87iktzkfrt.fsf@localhost> Date: Tue, 15 Oct 2024 21:55:26 -0400 Message-ID: <874j5c3j75.fsf_-_@pierrot.dokosmarshall.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::832; envelope-from=ndokos@gmail.com; helo=mail-qt1-x832.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.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 X-Migadu-Spam-Score: -1.59 X-Spam-Score: -1.59 X-Migadu-Queue-Id: 7B96C59C9 X-Migadu-Scanner: mx12.migadu.com X-TUID: q2p6QusjfSjX --=-=-= Content-Type: text/plain Patch attached. Thanks! -- Nick --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-babel-header-arg-expand-more-stringent-check-for.patch Content-Description: [PATCH] `org-babel-header-arg-expand': more stringent check for appropriate context >From b7ae1e8027b7b935098bb4354a957722b55afb1d Mon Sep 17 00:00:00 2001 From: Nick Dokos Date: Tue, 15 Oct 2024 21:28:32 -0400 Subject: [PATCH] `org-babel-header-arg-expand': more stringent check for appropriate context The check for appropriate context in `org-babel-header-arg-expand' was inadequate: a colon was deemed appropriate anywhere in the source block, not just in the header. * lisp/ob-core.el (org-babel-header-arg-expand): the function now uses `org-babel-in-src-block-header-p' to check for appropriate context. (org-babel-in-src-block-header-p): New function. Reported-by: use @Addlai on Emacs SE. Link: https://list.orgmode.org/orgmode/87zfnrb2nu.fsf@pierrot.dokosmarshall.org/ --- lisp/ob-core.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index e6db422c9d20..60705036cc7e 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1093,10 +1093,19 @@ completion from lists of common args and values." (unless (= (char-before (point)) ?\ ) (insert " ")) (insert ":" header-arg) (when value (insert " " value))))) +(defun org-babel-in-src-block-header-p () + "Check whether `point' is in the header line of the source block." + (let ((beg (org-babel-where-is-src-block-head))) + (when beg + (let ((end (save-excursion (goto-char beg) (end-of-line) (point)))) + (and (>= (point) beg) (<= (point) end)))))) + ;; Add support for completing-read insertion of header arguments after ":" (defun org-babel-header-arg-expand () - "Call `org-babel-enter-header-arg-w-completion' in appropriate contexts." - (when (and (equal (char-before) ?\:) (org-babel-where-is-src-block-head)) + "Call `org-babel-enter-header-arg-w-completion' in appropriate contexts +(the header line of a source block)." + (when (and (equal (char-before) ?\:) + (org-babel-in-src-block-header-p)) (org-babel-enter-header-arg-w-completion (match-string 2)))) (defun org-babel-enter-header-arg-w-completion (&optional lang) -- 2.46.0 --=-=-=--