From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
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 6LnZOGkVCGfERwEAqHPOHw:P1
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 10 Oct 2024 17:56:58 +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 6LnZOGkVCGfERwEAqHPOHw
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 10 Oct 2024 19:56:57 +0200
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=SrJa6fZA;
	dmarc=pass (policy=none) header.from=posteo.net;
	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=1728582654; a=rsa-sha256; cv=none;
	b=avOQzS0n3qcSnOtn3XFCyxgsJDvRV7FaAlggDiKbUq0zaVoX13mmg3Tqh5FGxr7+vvS2AD
	K/cXP6cpgR8p2hpuHfygiHcXwx3o4uz1WrkgYIlCJ2wzMcIL0FpyPnXQ5hohvurE4+Cwwm
	S1FjYyCki/ZglQRmhYIgIgCmorqUKjGN/cg6xkzqPhv+J++/N9yD0tWWUlXwErlBYt80eZ
	9c4vaePlrke87XS3hmJBmPv7e+bCP8D7SzfwRdonI3UXg+JaIFcgctlat9VYjC8y3MfpE3
	bL5YmvGoTce61FgFu5uY+PtOlu5OPlYh0eascmBQm7n8jTSzl1RowJbHuWpOng==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=SrJa6fZA;
	dmarc=pass (policy=none) header.from=posteo.net;
	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=1728582654;
	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=1HosOKJ501oRgz8YJiSusp/YBn1+BkRgba8GFLKbgJU=;
	b=VaOjYvOd6OmDewMV2Zp0e78N/nvWgKTSn1/laSlbZaLJg4Y4Ml+KVPak7ah2wr3xeemPEb
	OGshIGFk/456JXXpFBqrHmssvYx4QraVIp0pGCkMck9VmTH1ZePzttHZUrujzlauiXRq5E
	GaSM4S/H+eZ5B9qX+bijQdISgsNgzXe6bywjPFtGTqAY2qOb0W07Z9VIVJ9Oov2p3CdHr3
	uexTGIxz7tbdU1Rlm8rKsqw8Fga14d9CiiScYJze65GfPaPntCgQvlqPoV2Z1xH4PA3ONO
	EsUaR/JqilaAKpnQIhxd9fXre7aai0sMRaDLd8vT7CIttVUcdZlTw07lSQIiuQ==
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 28A8782978
	for <larch@yhetil.org>; Thu, 10 Oct 2024 19:50:54 +0200 (CEST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1syxIU-00073Q-NJ; Thu, 10 Oct 2024 13:49:58 -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 <yantar92@posteo.net>)
 id 1syxIQ-00073E-Qs
 for emacs-orgmode@gnu.org; Thu, 10 Oct 2024 13:49:55 -0400
Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@posteo.net>)
 id 1syxIM-0005hY-WE
 for emacs-orgmode@gnu.org; Thu, 10 Oct 2024 13:49:53 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 5DD14240101
 for <emacs-orgmode@gnu.org>; Thu, 10 Oct 2024 19:49:45 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1728582585; bh=Thqh4YtMgQzOiH4H7MCRts+J7rOh4pWD0CoLugjY4E8=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=SrJa6fZAKnxU7idD3bT4GssEMEqR/FlETCqbyGHI560uwCOowNChNCXF2rRoV9rm7
 JeOiAh8C4b6asuGa5KtwH5i7+9ASF9q8tLfBSrGyXAUzvstLQs9pJqf+vxUE77kns4
 D0KnFWkc2EY+aQde6IQqA95ik4Vi/Yjk+dhMViR/CZSgH3N5Lf6PKsjHp+BEHOWXg4
 QlUCzZc5AgcO2X65YhWBoDKpMsG+G4BtURF0Sq/dxy+xdEEssUPJ9ShEUsqml9baNB
 e2Wr/D1RW3O6rQ6Uq+iwWsdW1eflD0Ockv7r4wfnNzjJ8tK/keIp6DhyCiO2Wb36bQ
 j6G0LSWpsjpcw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4XPchm5ZTJz6twb;
 Thu, 10 Oct 2024 19:49:44 +0200 (CEST)
From: Ihor Radchenko <yantar92@posteo.net>
To: Nick Dokos <ndokos@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-babel-header-arg-expand is rather cavalier about
 "appropriate context" [9.8-pre (release_9.7.10-127-g07dd3b @
 /usr/local/share/emacs/site-lisp/org/)]
In-Reply-To: <87zfnrb2nu.fsf@pierrot.dokosmarshall.org>
References: <87zfnrb2nu.fsf@pierrot.dokosmarshall.org>
Date: Thu, 10 Oct 2024 17:51:34 +0000
Message-ID: <87iktzkfrt.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 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." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=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.30
X-Spam-Score: -1.30
X-Migadu-Queue-Id: 28A8782978
X-Migadu-Scanner: mx12.migadu.com
X-TUID: v+XmOVbWHMHD

Nick Dokos <ndokos@gmail.com> writes:

> This was reported by user @Addlai on Emacs SE. See
> https://emacs.stackexchange.com/questions/82276/stop-org-cycle-from-prompting-for-header-args
>
> `org-babel-header-arg-expand' is added to the hook
> `org-cycle-tab-first-hook' so when a TAB is pressed, the function is
> called to check whether the context is approrpiate to call
> `org-babel-enter-header-arg-w-completion'.
>
> But the only thing it checks is whether the preceding character is a
> colon and whether we are in a source block (by calling
> `org-babel-where-is src-block-head'), so if one presses TAB inside a
> python source block after a colon, the context is deemed "appropriate"
> and you are asked for a header arg.

Confirmed.

> It should probably check that it's *on* the header line of the source
> block, not just that it is *inside* the header block.

Agree.
We need to compare the return value of
`org-babel-where-is-src-block-head' with point.

Would you be interested to submit a patch that fixes the issue?

-- 
Ihor Radchenko // yantar92,
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>