From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 8N5KHYNLZGVkTQEAauVa8A:P1 (envelope-from ) for ; Mon, 27 Nov 2023 08:55:47 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8N5KHYNLZGVkTQEAauVa8A (envelope-from ) for ; Mon, 27 Nov 2023 08:55:47 +0100 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 1A54A67B96 for ; Mon, 27 Nov 2023 08:55:47 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jd+6wc94; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1701071747; a=rsa-sha256; cv=none; b=NlAzgJAoZPsmA9itS1RaEmdgDlfbhTLp14Pv9okhhfS69dT3saFcss0QVI6D/WbdBAmsiJ A577FKoT+mI0h30iZSi3uX/V2uXC5mN05mxwn9U0ZY/Pj9W43yMoZHkTPHQhfkqxfGBxoA d3yjvhOcqJoOxiNHMfHC4lhbFOIQUMPA0ziwwPHSq3eEBcmvDV5lBV1OkVx+/FM7Bpz+7X twjKK4rquOJXD3+FNPTEL6ErVNVes7vp53GvrfT6NEG04eugV4ftz1M/Y4zImIKmCbASMY eaO0k8ezFXSZVzeQX/zgODPCYEgh83nn3Jrb/O4FIING2vtbwlSoeJCf7MI3Ig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jd+6wc94; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1701071747; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Ul9SL4VTTCY5+Juwul/Ixa/RF4Ip4qFs5AEREt7L4ls=; b=K2VdOrvrqsxm8qqiG5Fy8U09NK9RXdaRDO2RbGKwZofiY42XaX+llOiL8XqH63XvVvEAKu mi0FVEj1Fy6eQLdn4/Yq+DOJmJe/sVAQG2ynUgAE9i6onVnpL3RxElLKbtf3zYYST7kpyP 4KTj8Gv7KwOFuUwkwxFk1ubxKKm3RqvAa/wQ9QFK3VpB6i9DGp6gyXerabJ4FD0XlEpu8u L5HivaHPYyo59jILgK3YR61pCE/4Mmuy0S6mfsls3aaOSmi3m0ETIKUbVqYdUcwNS9Gp9w 4pKBkTUFBnecou6kbZlpGZ/MUH0wVoX/wkyfqE43Vrxk4L7BEJH7zjM91zYYAQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7WSK-00081U-Pu; Mon, 27 Nov 2023 02:55:00 -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 1r7WSC-00080e-Tf for emacs-orgmode@gnu.org; Mon, 27 Nov 2023 02:54:53 -0500 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7WSA-0006mS-D8 for emacs-orgmode@gnu.org; Mon, 27 Nov 2023 02:54:52 -0500 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c5056059e0so50220721fa.3 for ; Sun, 26 Nov 2023 23:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701071687; x=1701676487; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ul9SL4VTTCY5+Juwul/Ixa/RF4Ip4qFs5AEREt7L4ls=; b=jd+6wc948zpLocVCqOMYVceEiHcgvJDQ+fQUXiM3MUrAT8AMH5IkKOAtdW/qoRmV+s NkaIEkn+it6K3KJj/oA4FIj3FmOycBXLGabzlgM/wwC/H+X9L9zg3zKk6rh+2M2+B4C2 CfTRyWkXuNYuk3PI//QF6jUq4/GdIhnw4Mi3X3Gz25xOskWzHFTwnN1Pgkgc+MJVd8vJ p3OmQQzAuPWpsnbtvfUtvg18YJv5KaEkPBnWMFPEgAwOEoTQQq1QWl9AjwMldfpxFKEB InS6UGnOLqlBm647/Cvix8fZJZX3yAHQDJIJVfWrhjbFTsJmGXCA+RkQcan1DEVUQ0zB 3FjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701071687; x=1701676487; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ul9SL4VTTCY5+Juwul/Ixa/RF4Ip4qFs5AEREt7L4ls=; b=cHo4RIdxex9SaM3SZPxmxnW5yNmWDV7r/ETM8oyuwWv90ZrOH7v4BXhv2IV8I+x+92 ZH73TAQ6yWn79/5er23e/KYDP/KmU2wgZlwE4fl7hvVIbka+7HMZLZx6KYFEtZK4kDdA 9uM/UHczgn6Gn0T9z2hpmxB7QO+IKkvXUOWo5RXVgqeu2XiF/fMfDqF+ieUNrTz6O1+N vAPl9Ak4SezoxotwJ6kfUNXjGUbbzdotGykD7Zz2XyyBKJqFNgUcayqyeF2rKa9lpKMC 2gZOH7ZX31sHyw7xLOk9CUGFYkkYUGenAT/kUOlxVMtlLexXL2a5XaITVPGz/3BQRAoC +U7A== X-Gm-Message-State: AOJu0YyBRGbyvVLJ8bx3HVKjcel/STm4D0iqf5LBBYh69nidrXqISJLU y3voa4PoB5bEMb0G6aLc82cUIHeEgzc= X-Google-Smtp-Source: AGHT+IEjY4hTgEpmg6rHoagpFg55MAsxU4uHiaES21GYO54z1CjlgyKGL+yeFBImMqWfDA7wMgZhhA== X-Received: by 2002:a05:6512:31c6:b0:50b:a801:dce6 with SMTP id j6-20020a05651231c600b0050ba801dce6mr5442000lfe.66.1701071687340; Sun, 26 Nov 2023 23:54:47 -0800 (PST) Received: from nixos.localnet (alagny-155-1-18-206.w83-200.abo.wanadoo.fr. [83.200.51.206]) by smtp.gmail.com with ESMTPSA id fl8-20020a05600c0b8800b004030e8ff964sm13646426wmb.34.2023.11.26.23.54.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 23:54:46 -0800 (PST) From: chris To: orgmode Subject: Re: Using backticks for the inline code delimiter? (now with `org-publish-all`) Date: Mon, 27 Nov 2023 07:54:43 +0000 Message-ID: <5030515.31r3eYUQgx@nixos> In-Reply-To: <4396644.LvFx2qVVIh@pluto> References: <4396644.LvFx2qVVIh@pluto> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=inkbottle007@gmail.com; helo=mail-lj1-x22d.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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -8.44 X-Spam-Score: -8.44 X-Migadu-Queue-Id: 1A54A67B96 X-TUID: sNLO1CGTQ2sG The code below is working fine as long as I stay in `org-mode`. But it shows its limitations when I do `M-x org-publish-all`, at which time, instead of having the text with style verbatim, I get the text within backticks. Is there any improvement you could think of that would fix that? Thanks, Chris On Saturday, March 19, 2022 3:17:10 AM UTC you wrote: > > George Mauer writes: > >> is there a straightforward way to extend the org parser to do this? > > > > I don't think so. It seems the emphasis markers are hard-coded > > in various places. > > > > From a quick look at the code, you'd have to customize > > `org-emphasis-alist` and redefine `org-set-emph-re` and > > `org-do-emphasis-faces`. Maybe that'd be enough. > > I did just what you said, and I've inserted what's bellow, somewhere in my > `init.org` / `init.el`, before anything `org-mode` related (save for two > `hook`): (Note it is an almost exact copy from `org.el`, I've only changed > a few characters. And added the `advice-add override`.) > > #+begin_src emacs-lisp > (defun org-set-emph-re-fixed (var val) > "Set variable and compute the emphasis regular expression." > (set var val) > (when (and (boundp 'org-emphasis-alist) > (boundp 'org-emphasis-regexp-components) > org-emphasis-alist org-emphasis-regexp-components) > (pcase-let* > ((`(,pre ,post ,border ,body ,nl) org-emphasis-regexp-components) > (body (if (<= nl 0) body > (format "%s*?\\(?:\n%s*?\\)\\{0,%d\\}" body body nl))) > (template > (format (concat "\\([%s]\\|^\\)" ;before markers > "\\(\\([%%s]\\)\\([^%s]\\|[^%s]%s[^%s]\\)\\3\\)" > "\\([%s]\\|$\\)") ;after markers > pre border border body border post))) > (setq org-emph-re (format template "*/_+")) > (setq org-verbatim-re (format template "=~`"))))) > > (advice-add 'org-set-emph-re :override #'org-set-emph-re-fixed) > #+end_src > > #+begin_src emacs-lisp > (defun org-do-emphasis-faces-fixed (limit) > "Run through the buffer and emphasize strings." > (let ((quick-re (format "\\([%s]\\|^\\)\\([~`=*/_+]\\)" > (car org-emphasis-regexp-components)))) > (catch :exit > (while (re-search-forward quick-re limit t) > (let* ((marker (match-string 2)) > (verbatim? (member marker '("~" "`" "=")))) > (when (save-excursion > (goto-char (match-beginning 0)) > (and > ;; Do not match table hlines. > (not (and (equal marker "+") > (org-match-line > "[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ > \t]*$"))) ;; Do not match headline stars. Do not consider ;; stars of a > headline as closing marker for bold ;; markup either. > (not (and (equal marker "*") > (save-excursion > (forward-char) > (skip-chars-backward "*") > (looking-at-p org-outline-regexp-bol)))) > ;; Match full emphasis markup regexp. > (looking-at (if verbatim? org-verbatim-re org-emph-re)) > ;; Do not span over paragraph boundaries. > (not (string-match-p org-element-paragraph-separate > (match-string 2))) > ;; Do not span over cells in table rows. > (not (and (save-match-data (org-match-line "[ \t]*|")) > (string-match-p "|" (match-string 4)))))) > (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist)) > (m (if org-hide-emphasis-markers 4 2))) > (font-lock-prepend-text-property > (match-beginning m) (match-end m) 'face face) > (when verbatim? > (org-remove-flyspell-overlays-in > (match-beginning 0) (match-end 0)) > (remove-text-properties (match-beginning 2) (match-end 2) > '(display t invisible t intangible > t))) (add-text-properties (match-beginning 2) (match-end 2) > '(font-lock-multiline t org-emphasis t)) (when (and > org-hide-emphasis-markers > (not (org-at-comment-p))) > (add-text-properties (match-end 4) (match-beginning 5) > '(invisible t)) > (add-text-properties (match-beginning 3) (match-end 3) > '(invisible t))) > (throw :exit t))))))))