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 ms13.migadu.com with LMTPS id SPClHDESOmc/YwAA62LTzQ:P1 (envelope-from ) for ; Sun, 17 Nov 2024 15:56:33 +0000 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 SPClHDESOmc/YwAA62LTzQ (envelope-from ) for ; Sun, 17 Nov 2024 16:56:33 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=VNR4nLXZ; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca; 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=1731858993; a=rsa-sha256; cv=none; b=MnrHTHSVwbv3RCyRBus41A6f7FJ/eSXqGT9nHh6aLfX7I95BAYL40MukVvg5/xkfALv4Dt xitSnRk+XTSBoOP/xIxMUReR30Jshi8Nc7/Nc5CaFSCb6px3Kg95YPxqVmFQ3t+HBH5T+R +TCW2Ie18aqPqFH17S4QAaey85IL44MVFetXd5odXAvUGeO83DhTVs6BoAu7GRYQjMCoow VC7mAX2K8vIGz501nWvrctiG23+oenyXlPfLT0eHQ3mLiSAP/9iAtcaIZT9jBNE1HXn4nU xZyBtzudrAwI56MFn7draA342Ra//T2jk4xlZp3nJhyfcQf5O06yfU+ZKkYoBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=VNR4nLXZ; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca; 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=1731858993; 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=9Fk8W3DHhl8D19XY7F3kqgvDqAp97m+3epcJEM1C/y4=; b=TkgIZcsc9jLNQY3/kEj8jTDTVvDW8mlPAabYW0yICRB2uLFgCmI6J3SDvVugZfmhZkzmql wdXXzNuoeHoIp7HSXQGF11CqFvKKY9+n8y9o8732K5Zc2dBZjEvWarDYFDu2nSqPnf6uIn K5poeQvLnBy4YqWENkHRjjHRWp0Ii15SsswUnLXwy79aI1a9Drg+VraMBdHG0drNTYwMcI NFQ6RSOcdLWtvQFFEk1KmrebIwDQYSBGqaVVTBx+EFvndXpl51Oi3XCniVVpviz2+YV0TB 0pdW7RZ8mGFwWl3zrGGzT4BHPif75xC2hPOA3zc2kiKU7zhI2Qo+WmaTtwxTsA== 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 93A2371C16 for ; Sun, 17 Nov 2024 16:56:32 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tChch-0007Ky-0V; Sun, 17 Nov 2024 10:55:39 -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 1tChcf-0007Ko-GJ for emacs-orgmode@gnu.org; Sun, 17 Nov 2024 10:55:37 -0500 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 1tChcb-00078f-La for emacs-orgmode@gnu.org; Sun, 17 Nov 2024 10:55:37 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D560E443516; Sun, 17 Nov 2024 10:55:30 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731858929; bh=xHiqSh6HkXTjgHRnkMvetD1wMhMqnGBVKXA5qOkVBj4=; h=From:To:Subject:Date:From; b=VNR4nLXZAmCVog1UYRIxqvQPPYQyjkg0a1meUVc7o5WEsP1ZWl/2rRBb+9DU9hzT/ ghFiU7DEmh4MTSXMWxdSfzQOEQrHVBK2M7HvSjsv52pK7uziVLX5fx6aLgTEK2acQ2 IkbQXBBEDZnu/n+x6uVOrXsMosbfATk2hr4jkJlsNlaLZ54kjnjfRKbS9iMNMPEVuL eN6L+DPPgrkWjw7/3zQQSdqA/mr68UEHdvWaQ5NFD2bSJyUsdJolbcZg+dFPn339nf F/bzmKrFSh0Gk5wM8RX5se2RCUZzRTCbvJXMScCfPoNlddcBtJ7Be2uGPP6WrmigWF DrAcc33sPiCaQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9D637442CA7; Sun, 17 Nov 2024 10:55:29 -0500 (EST) Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7D6EA1206DB; Sun, 17 Nov 2024 10:55:29 -0500 (EST) From: Stefan Monnier To: emacs-orgmode@gnu.org Subject: Mapping language to mode Message-ID: Date: Sun, 17 Nov 2024 10:55:28 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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." 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-Spam-Score: -10.39 X-Spam-Score: -10.39 X-Migadu-Queue-Id: 93A2371C16 X-Migadu-Scanner: mx10.migadu.com X-TUID: VFXHqNYPBqw6 Would the 100% untested patch below make sense? Stefan diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 229bf62e1c0..1f0306a1f98 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -970,11 +970,14 @@ org-src-do-key-sequence-at-code-block (defun org-src-get-lang-mode (lang) "Return major mode that should be used for LANG. LANG is a string, and the returned major mode is a symbol." - (intern - (concat - (let ((l (or (cdr (assoc lang org-src-lang-modes)) lang))) - (if (symbolp l) (symbol-name l) l)) - "-mode"))) + (let ((mode (intern + (concat + (let ((l (or (cdr (assoc lang org-src-lang-modes)) lang))) + (if (symbolp l) (symbol-name l) l)) + "-mode")))) + (if (fboundp 'major-mode-remap) + (major-mode-remap mode) + mode))) (defun org-src-edit-buffer-p (&optional buffer) "Non-nil when current buffer is a source editing buffer. diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 4eb3a511b00..002978e65c3 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -2355,8 +2355,7 @@ org-html-fontify-code (org-html-encode-plain-text code)) (t ;; Map language - (setq lang (or (assoc-default lang org-src-lang-modes) lang)) - (let* ((lang-mode (and lang (intern (format "%s-mode" lang))))) + (let* ((lang-mode (and lang (org-src-get-lang-mode lang)))) (cond ;; Case 1: Language is not associated with any Emacs mode ((not (functionp lang-mode)) diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index c6a70fe9cd8..1b2728d1a5d 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el @@ -3116,8 +3116,7 @@ org-odt-htmlfontify-string (defun org-odt-do-format-code (code info &optional lang refs retain-labels num-start) - (let* ((lang (or (assoc-default lang org-src-lang-modes) lang)) - (lang-mode (if lang (intern (format "%s-mode" lang)) #'ignore)) + (let* ((lang-mode (if lang (org-src-get-lang-mode lang) #'ignore)) (code-lines (org-split-string code "\n")) (code-length (length code-lines)) (use-htmlfontify-p (and (functionp lang-mode)