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 ms5.migadu.com with LMTPS id IL/oLRbe+2IvBgEAbAwnHQ (envelope-from ) for ; Tue, 16 Aug 2022 20:12:38 +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 KHUCLhbe+2IQcQEA9RJhRA (envelope-from ) for ; Tue, 16 Aug 2022 20:12:38 +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 6F75238926 for ; Tue, 16 Aug 2022 20:12:38 +0200 (CEST) Received: from localhost ([::1]:57310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oO13N-0002wy-BE for larch@yhetil.org; Tue, 16 Aug 2022 14:12:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oO0g1-000428-P4 for emacs-orgmode@gnu.org; Tue, 16 Aug 2022 13:48:30 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:33683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oO0fz-0004F0-My for emacs-orgmode@gnu.org; Tue, 16 Aug 2022 13:48:29 -0400 Received: by mail-ed1-x531.google.com with SMTP id b96so14487116edf.0 for ; Tue, 16 Aug 2022 10:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc; bh=2Tsxu3LkLkTo3zjuGGW46LBahmcKjnwLtQhWU4hkxqk=; b=XwTObxrlRzvE9I6jTXpnBhFjbfe4eLDnEC4eHV+DHMib8RdE9qYrayhGq2maOmNi2F iaqUODWW2nvfFayHIa4KdbuK29PrR3PyxepZeyPw+DLm+zwb9CwQ+uO6d9botEQhhw7h 51dJM948ITjkK7AM39h/PuQEGJx+tf4e+3ZIp4Nvw0dQJREQHenhr+nhltAq/SJ7BSrd t5nVLwSeMWt8BOfGBM7CY5CnG883r00PM74wHiGtRm0jlwDFwKnm6B0dYdxh07BMrcwN JY3aHL8CcO3dgGXqt2qguKPuvTPoIjwYrtJKX8zANonciGWz9N/XJtEG+2eW1gdGMmfN GPwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc; bh=2Tsxu3LkLkTo3zjuGGW46LBahmcKjnwLtQhWU4hkxqk=; b=qtia7gmjaZWvhW3PokBGaRmkk2JDNsl6HY2erPsV8LNZDzZQ8FHK/CV59Cs3n6T7nH hpo3siklnjRYE2jKCbChedZNOUrwkeneOQu9k0j73iVZkhCgNHxHF5dheiu4IM6xMiak fVWHw1i4dzg97qbOM13yXViwSm8YyexDhJnkEZ15KCpjzypm5VhonqMGkNvXw7x2GTmQ l5JO/Hf28GQI6CJvUPuzEiY8AAXmqE8PGLYDF+t9N2A7d389KIV3XR6odLn/ubLPqnPz 9nfFiyLQ8VLDhmcBwaNMmxtgDcjteCOjAM9M1wkr87xmR3m5YUFWWNDrFwtFQkwI+/Dp ItRg== X-Gm-Message-State: ACgBeo1+LK5Qhka8sernbRNL/ShPQllX3UHjMHT+X5UueQNrjKR1c2H1 QKPCBtE/oCD2vFQchqWsQlCyQCU7wN2HnG9ThS/iFLSretU= X-Google-Smtp-Source: AA6agR5Ee7gf1LkfXLV2Y3/27j9sMjgyUpwkfL9L7EuwE+oFeS6cABGCLrsWeBZ4WJXAflDMu0qIVWGXm9/xFXksAvQ= X-Received: by 2002:a05:6402:518b:b0:43e:70be:97cd with SMTP id q11-20020a056402518b00b0043e70be97cdmr19930044edd.388.1660672105445; Tue, 16 Aug 2022 10:48:25 -0700 (PDT) MIME-Version: 1.0 From: Bhavin Gandhi Date: Tue, 16 Aug 2022 23:17:48 +0530 Message-ID: Subject: [BUG] Incorrect fontification of src blocks for indentation sensitive language modes To: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=bhavin7392@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, 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: , 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=1660673558; 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: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=2Tsxu3LkLkTo3zjuGGW46LBahmcKjnwLtQhWU4hkxqk=; b=GUdmc2e9U54OGHRBCBcCDxK5XqND4KiYZAC4n8AswhlEdtlvfaprsGWsqER3sKGGkRh7Zp 0/PicSkqoinXZhg8R0qPT8uOf5zoQiyDcesIku4KURNx+vvj40+yfc56mPVg2ZE1ZsTdoL 4pVCRMKL4070XDCfxi2GCfN77jzUiCbSguhS7JY7QzqjJrY0b2eCwbxr2t3pQVlIweIucz lBqN2zbbPzJdirUuXcc4sVUf4d/1DHrhMnPyJ5TNnY8QXcXajnjzuBY87Q/1w0jm0gH9Hz beg1I2fUq3s/VNA3SGJj8wwY62Bpevp2NbclqzFYXo70WupW9d3raXxvEZFwvQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660673558; a=rsa-sha256; cv=none; b=MUUNoUvDt6D7eS/8JhA+eg1EyDbdmTiCAGldB9IGuOKXHaVpFZJHwgoG0NPrkaaCMi0yI7 UyCBmqHi1tBFGBiYo13f1x2z6Om288Q9vewfZ0eKMgSXITmCm50a3aAu22/NVsZKb5DlMD 6Qp3VQRfDfQKrh11AfglNvILunG9nVoHO1VrTem0rk+DVsimpPKoSXOXoPh1g8Vze55fhT /sH2oW7QLqvjw0Yn2jxx8Kr+K+rzJLuI7tRIgiLSuMnz1GbQ3oAqUafbJLU00bYzluVo7x JW62tphyyBO+GqiDFpD9LFs4u+Oex8prNgxEWMVL9UtvrpNLhBgROEZEqKhGpg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=XwTObxrl; 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: -8.66 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=XwTObxrl; 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: 6F75238926 X-Spam-Score: -8.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4qfRiVBZpclZ In the following Org mode file, the Ledger mode source block is not highlighted correctly. How to reproduce: 1. Clone Ledger mode: git clone https://github.com/ledger/ledger-mode.git /tmp/ledger-mode 2. emacs -Q -L ~/src/org-mode/lisp 3. Evaluate the following in the *scratch* buffer. (add-to-list 'load-path "/tmp/ledger-mode") (require 'ledger-mode) 4. Create an Org mode file test.org with following content --8<---------------cut here---------------start------------->8--- * Some heading - Option one #+begin_src ledger 2022/08/16 Buy books Expenses:Books =E2=82=B9299 Assets:Cash #+end_src --8<---------------cut here---------------end--------------->8--- 5. The block is not fontified. 6. Now go to the src block and do C-c ', you will see the block correctly fontified, and after doing C-c ' again, we are back to incorrect fontification. I tried to debug this and found the function org-src-font-lock-fontify-block. Turns out that the code block is actually being fontified, but Ledger mode seems to get the block with indentation. I found this by adding a (message string) in this function. --8<---------------cut here---------------start------------->8--- 2022/08/16 Buy books Expenses:Books =E2=82=B9299 Assets:Cash --8<---------------cut here---------------end--------------->8--- Notice the extra indentation at the beginning of year 2022. This block is not valid Ledger mode content, so it just keeps it grayed out, instead of having colors. If we remove the indentation from the src block i= n the Org mode file, it gets fontified correctly. Setting org-adapt-indentation to t didn't make any difference. Value of org-src-fontify-natively is t by default. I even tried https://github.com/yantar92/org/tree/feature/org-font-lock-element, it had the same issue. I think the language mode should get the block without the extra indentation. Or am I missing something here? PS: I haven't looked at the code of org-src-font-lock-fontify-block in detail, so I could be wrong with this analysis. --=20 Bhavin Gandhi (bhavin192) | https://geeksocket.in