From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id yPXWC6HkRGeBtwAA62LTzQ:P1 (envelope-from ) for ; Mon, 25 Nov 2024 20:57:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id yPXWC6HkRGeBtwAA62LTzQ (envelope-from ) for ; Mon, 25 Nov 2024 21:57:05 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=notyourcomputer.net header.s=key1 header.b=JXdTEUTh; 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=notyourcomputer.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1732568225; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=tpLAmwXoVz1UOw2VbbfeOdzKZ8soMdOBry8BjPYXFk4=; b=deD7IhXQB/LBwrZfhSF4gtthgezM/SQMLovFqd8Acu2hOdjs38euyehXhtjeT5NHY5I78+ OfvHQeu8Y4LzKfPMB3TjjiXsJdEmy0PN+6Uom8TkflNU1jSwCyW9wPiBK9cs92KT+r1Oo6 COWcgdDuS8yrcTt+GVDaF8unb6tSF2Jml2zKL/nqYAfKZLqiWKHjyJ3NAocWItzIeyQ9/6 6mTKHw812kfGrBS9o7o4WbIdu8ocmgShzLPoqliRsRbLOh7FwtBuPH2eB0cmvAsgHG3XyL XUCuKNAhKRVcltxsMqHcn2VXS6CKrNEI6gros+q4rm3x50mlml45mTaVg5JsJA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=notyourcomputer.net header.s=key1 header.b=JXdTEUTh; 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=notyourcomputer.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1732568225; a=rsa-sha256; cv=none; b=d0gaIL64zue/98SvU7se3gfT7HoyWEjP62kD2j26M4aFuoDcINVnJCsExU+ziYqRuuhJg0 iPB4dGMSSOVHd2JgLyQGHXC+5DWQaz2ogjyf25ulT1umhcKYEbtIgW6NZkvnI1hg97fw+0 NoNC52FYSb1I+RwTCmcumRcrJbr9XCuljly9HQFaZaF0uZeegKMGsTtKo+R033NvKv2Ovy FCHzk+KYOP4njEtLie8PC6h8uqkZENzESUZ55KwyDU7KwAlLdFr/Ee7hizqm2ddGPVbYWM BB3jO2aWxCe6NeJj9WtS2qXV4mEJJWMN2QzWeSoEBi/+y3AshXo8/uePJBgdeg== 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 77A6085025 for ; Mon, 25 Nov 2024 21:57:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFg7y-0007MF-CM; Mon, 25 Nov 2024 15:56:14 -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 1tFg7w-0007M2-Lw for emacs-orgmode@gnu.org; Mon, 25 Nov 2024 15:56:12 -0500 Received: from out-171.mta0.migadu.com ([91.218.175.171]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFg7t-0005uv-VP for emacs-orgmode@gnu.org; Mon, 25 Nov 2024 15:56:12 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=notyourcomputer.net; s=key1; t=1732568166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=tpLAmwXoVz1UOw2VbbfeOdzKZ8soMdOBry8BjPYXFk4=; b=JXdTEUTheLilovFINNFfK4EEGDiQHkZPgGZWJ+InI6djhEXZW3ZZwmHoj6vONi9q8ACEcm rrEWonx60akINFS/36ceV3Bl/NB2mIiiZHleNMSaqpxNdFPsWH95WiGU8biK2/XOTAnzrv +Y8QXlsApxxnwENWESoc/Flu78C84wGDKlo64xd57iq3dnJzl+LWNIAF139aXG4xLvmC/H ONPyfFCV+qP7P3UZ/eVi8X2915Q8ZG4lFE4Dk6uux+vxoAXKCvmJXRoqhPR9+OekpT1B3l sZA/ImRSkuw6EqS9CSdpUdfnijfNObvjyD5oERLCz8TZnZLVS6v4j9d4ZlC9lA== From: Shao-yu Tseng To: emacs-orgmode@gnu.org Cc: Shao-yu Tseng Subject: [PATCH] Fix org-do-latex-and-related at buffer start Date: Mon, 25 Nov 2024 15:55:32 -0500 Message-ID: <20241125205531.416893-2-dev@notyourcomputer.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=91.218.175.171; envelope-from=dev@notyourcomputer.net; helo=out-171.mta0.migadu.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 2.06 X-Spam-Score: 2.06 X-Migadu-Queue-Id: 77A6085025 X-TUID: 6i03peWzsbZ9 When org-mode is called at the start of a buffer that starts with a latex fragment, it produces an error "Beginning of buffer" caused by attempt to call backward-char. A minimal example to reproduce: 1. Open a scratch buffer 2. Insert text \(\Omega\) 3. Turn on org-mode The observable effect of this bug is that org-export-string-as does not work for strings beginning with a latex fragment, example: (org-export-string-as "\\(\\Omega\\)" 'html t '(:with-toc nil)) This does not return an html string as expected # modified: lisp/org-src.el --- lisp/org-src.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 4b05789c6..e754feb41 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -744,7 +744,7 @@ as `org-src-fontify-natively' is non-nil." (goto-char start) (let ((indent-offset (if (org-src-preserve-indentation-p) 0 - (+ (progn (backward-char) + (+ (progn (when (> (point) (point-min)) (backward-char)) (org-current-text-indentation)) org-edit-src-content-indentation)))) (while (re-search-forward "^[ ]*\t" end t) -- 2.47.1