From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id wFfXBiczqGVdFgAA62LTzQ:P1 (envelope-from ) for ; Wed, 17 Jan 2024 21:05:59 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id wFfXBiczqGVdFgAA62LTzQ (envelope-from ) for ; Wed, 17 Jan 2024 21:05:59 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=fiCjtGbU; dmarc=pass (policy=none) header.from=posteo.eu; 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=1705521959; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=q+8FRm58zLz0PgrYEOYZdWqt6TC7sOXYuJwBXXbQQyw=; b=gxX7sQvBne/McDYlgbF7yRhBXzOVt6KhV/KR7qAYUDdwNULv8RvAv/bxQCQuhyVaqSEr0n IKSoiMnZZXoYWyOf0zHZA8w+0mWxVAaq3Eezhf/E1hVVGsUCDah+FZUZVai4qpDJMYdB6c 8tGWI321ppJeNa2J1jrWWwwD3E/VBifJZfyhWLBX+sb/IFOK29xiECsopdrglmRwQ2TIFZ eXE9QzcqfphPLjai594/XFEQSCEjcQB7hgVYrE+KKAIGZEjo/z5eu3/uKqG4DteUbPPONM l0LVWeSyfZkDuvR/0IxllzO0aUhq6d76GHtXaVzYip7c1khP/ya2FtNkF2pF6w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705521959; a=rsa-sha256; cv=none; b=tVyGT552JU2Hxz3CW4FS2XQf58jAq6qBKg6zVux0FzzakWVjosDJCirhCuZSE+Q5OgLx/a tyF/4vbr/qTpyQYM91blHmxPGNljxGZjqpqfBo8I+5uLnfCGBd0u21AbCqNK1KQYYyzx0x F1aX1/VB8F0AagsD36709HYek/YKHvSjRall9PUqmfaEvEj7fL9qHLcOygNid7D7ttrvEC loXqE/0ZxOokbXaLOKTkLVdAhKbMGX2WAiNCzbbeveLPX9b218oI6O9TAWiIp1B78PkYNM YSaO8Nd/XLMWYfbNO5tcBQdm0bSRkzfjTTlalekPi9mr+C/CKgCyCdVFJBrcCQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=fiCjtGbU; dmarc=pass (policy=none) header.from=posteo.eu; 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" 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 A0CDF739A0 for ; Wed, 17 Jan 2024 21:05:58 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQC9s-00024r-N9; Wed, 17 Jan 2024 15:05:08 -0500 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 1rQC9p-00024U-6t for emacs-orgmode@gnu.org; Wed, 17 Jan 2024 15:05:05 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQC9m-0008S0-Tq for emacs-orgmode@gnu.org; Wed, 17 Jan 2024 15:05:04 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5CC75240029 for ; Wed, 17 Jan 2024 21:04:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1705521898; bh=q+8FRm58zLz0PgrYEOYZdWqt6TC7sOXYuJwBXXbQQyw=; h=Message-ID:Date:MIME-Version:Subject:To:From:Reply-To: Content-Type:Content-Transfer-Encoding:From; b=fiCjtGbUb12vtpPcsfedRCuAqaU12EaX62559aT5FMFCvnTP9FfaSERUlDI/bF5Ok vfnkJFebkbEdxdWLA28/CMapPnH/ghc7BaSMavkGXICyYcaklQKQr7wvGPhL13HiO2 1dt06AYpZow1vUejx7J/NRFlYAc6QxpNRi4mVlDdRVVB3vmd4I3gwusUFnw6JXIj3E BHrxQcR/ofou1OM+CMPJGUfkaG2slfX8+6QrCF9mOjlXlQ/Jy9OdXwJCKtl1jwleyL qjWPxvft06YAZKZyShshbfxUL132/bgO6F4fjCerOz3Ycog8cHJTkfD4epVrppx17Y zl2Ds2EmduZ4A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TFcL16XX7z6twp for ; Wed, 17 Jan 2024 21:04:57 +0100 (CET) Message-ID: Date: Wed, 17 Jan 2024 20:04:57 +0000 MIME-Version: 1.0 Subject: Re: [BUG] defaults make it hard to edit Elisp blocks in org buffers Content-Language: fr To: emacs-orgmode@gnu.org References: From: =?UTF-8?Q?S=C3=A9bastien_Miquel?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.65; envelope-from=sebastien.miquel@posteo.eu; helo=mout01.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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-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: , Reply-To: sebastien.miquel@posteo.eu 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-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -5.23 X-Spam-Score: -5.23 X-Migadu-Queue-Id: A0CDF739A0 X-TUID: 99cTBVbxMNlV Hi, The issue is that when you press return, you insert a newline, with no indentation, then call =org-indent-line= which edits the block in a native buffer. This is supposed to remove any common indentation, but there is now none. Then it reinserts the code in the org-buffer, adding a new common indentation to the block. If I recall correctly, in order to fix this, in =org-indent-line=, before calling =TAB= in the native buffer, one should check the current line indentation and if it is less than =block-content-ind=, start by adding this much indentation to the current line. This could be a bit fragile, and in particular it assumes that the rest of the block has this =block-content-ind=, which might not be the case. One could possibly at least check that the first line of the block does have this much indentation. If it doesn't, just do whatever. -- Sébastien Miquel