From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id MKPIDh6d8WWivAAAqHPOHw:P1 (envelope-from ) for ; Wed, 13 Mar 2024 13:33:34 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id MKPIDh6d8WWivAAAqHPOHw (envelope-from ) for ; Wed, 13 Mar 2024 13:33:34 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=mZ6SfXTT; 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"; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1710333214; 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=K8y7Duq8lkTouS2NRKqBf0TIV1KoxQyXVYlQnq83qsg=; b=EswrsCMUbdkVdDCkyqV5ZSaYQ4zCh095Rfu3yw/Q9S1aBb7N4TU8YMeXUn750VLz7fScvi ISNcTFcGeH65nUMcxT2Gsgj+rgyBLYhnnqqNtG7gwbUY/GiFiZCuhDpSwXPSbDrTz8AQ0g CIZC7hbvJU9STGEmivNyaC8HtrgEmlxw/0P0ze8vcRe1IjP/Rn28nAknnpdUY2ThUrgweP vKB0Jsu9Wr2p2eXIaQMJikJ3nUYePrzTT2Qt8Rgxp+fh1Vy7Yv5sVntXWJKlw5ZOkqI/Gb 998PK0k5gzM0xZW+5zlaY8eIi8M1LtvugMXe1Fsh7R0jbVxq+nEkjdHcYA/sGA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=mZ6SfXTT; 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"; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca ARC-Seal: i=1; s=key1; d=yhetil.org; t=1710333214; a=rsa-sha256; cv=none; b=WRbdU1SN3TXMj6KkuWdOgdq0Mzf9wXRn48Gru2qz8M9GuxOcwGM3lbaHafPtViWeNoxHty 9bGWpTbGBm9IDfvzo/WXccjsrWnS7GuLK2p7EiBEF9XHDiaVnLHjI7hwIjyZd+0ZlBZMM0 onlG+j/sRnMH3fF18byBHFSO0kZ3ZCJipet8gS3ROxA990p9+ojBALfI2vR6yzAfnggDhR /6GpaE2kk6rCefltnVtk3cr5WPpCXQBnu0acdo5OWxxFR/OmTs80Jl64EfvEJhJz+wE1s5 BmRh26J7XrhYMiOA00jdQq+l62P2vcfvQHjxb/2fTrxEprAcvyFEe7QXZyFJmQ== 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 DACED56C29 for ; Wed, 13 Mar 2024 13:33:33 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkNmn-0001r9-KS; Wed, 13 Mar 2024 08:32:45 -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 1rkNmW-0001oj-Jx for emacs-orgmode@gnu.org; Wed, 13 Mar 2024 08:32:30 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkNmT-0005wX-Va for emacs-orgmode@gnu.org; Wed, 13 Mar 2024 08:32:28 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D12E2100170; Wed, 13 Mar 2024 08:32:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1710333140; bh=3XNH01jWtFYmqha2NWBeGY8u9sSJhhNvSjVfOn3hr04=; h=From:To:Subject:Date:From; b=mZ6SfXTTrlFlr+bWpZSERbinMDs0O+M0LJ85A/nGmTGX0aiKth/X1R8NKw78p/YkJ PqXIJhUmHOfUmGZPabQxQLSykxw+igdVC+GYqzthu5tu4TuRwAQXqlSiz7kecLDhWT FF4lv3xqhJV7aATlSdJNflL2fsQTk5zswVAOSAFOxof7PuDBzlBKR2TUzA+4xePN8S 0M0FvQNthW39aZdSiip0rOeQlp9PkXWwL/B9DD+X6WXy2KUHh7+i2p+BGZAwsaFW6h WuQuZWlhYY7HjVereTiSnuooB3LOzcNRhstB0ISqmrVb7spETNt4S4TozqqM40OwEe cpXqtKkA0WWUw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CBDAA10005D; Wed, 13 Mar 2024 08:32:20 -0400 (EDT) Received: from pastel (unknown [216.154.27.181]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ABCA6120478; Wed, 13 Mar 2024 08:32:20 -0400 (EDT) From: Stefan Monnier To: emacs-orgmode@gnu.org Subject: Minor patch Message-ID: Date: Wed, 13 Mar 2024 08:32:19 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -11.03 X-Spam-Score: -11.03 X-Migadu-Queue-Id: DACED56C29 X-Migadu-Scanner: mx13.migadu.com X-TUID: peIbu/OXkzgZ --=-=-= Content-Type: text/plain The minor patch below clarifies what the computation is about and removes the assumption that point-min == 1, while arguably making the the code ever so slightly more efficient. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-src-font-lock-fontify-block-Clarify-offset-compu.patch >From d386af0653ff75956cc20e0df8ddb5bfa86fec9d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 13 Mar 2024 08:31:11 -0400 Subject: [PATCH] (org-src-font-lock-fontify-block): Clarify offset computation * lisp/org-src.el (org-src-font-lock-fontify-block): Improve the translation of local positions into org-buffer positions, and get rid of assumption about the value of `point-min` while we're at it. --- lisp/org-src.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index de8d6ee42c..bec13427c2 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -681,7 +681,9 @@ as `org-src-fontify-natively' is non-nil." (unless (eq major-mode lang-mode) (funcall lang-mode)) (setq native-tab-width tab-width) (font-lock-ensure) - (let ((pos (point-min)) next) + (let ((pos (point-min)) next + ;; Difference between positions here and in org-buffer. + (offset (- start (point-min)))) (while (setq next (next-property-change pos)) ;; Handle additional properties from font-lock, so as to ;; preserve, e.g., composition. @@ -695,7 +697,7 @@ as `org-src-fontify-natively' is non-nil." (when new-prop (if (not (eq prop 'invisible)) (put-text-property - (+ start (1- pos)) (1- (+ start next)) prop new-prop + (+ offset pos) (+ offset next) prop new-prop org-buffer) ;; Special case. `invisible' text property may ;; clash with Org folding. Do not assign @@ -727,7 +729,7 @@ as `org-src-fontify-natively' is non-nil." (when invisibility-spec (add-to-invisibility-spec invisibility-spec)) (put-text-property - (+ start (1- pos)) (1- (+ start next)) + (+ offset pos) (+ offset next) 'org-src-invisible new-prop org-buffer))))))) (setq pos next))) -- 2.43.0 --=-=-=--