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 ms0.migadu.com with LMTPS id wHwnClRNNWIGggEAgWs5BA (envelope-from ) for ; Sat, 19 Mar 2022 04:26:12 +0100 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 AKSLB1RNNWJjiwAA9RJhRA (envelope-from ) for ; Sat, 19 Mar 2022 04:26:12 +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 8131229F1C for ; Sat, 19 Mar 2022 04:26:11 +0100 (CET) Received: from localhost ([::1]:46186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVPjG-0001oZ-9v for larch@yhetil.org; Fri, 18 Mar 2022 23:26:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVPi1-0001oA-ID for emacs-orgmode@gnu.org; Fri, 18 Mar 2022 23:24:53 -0400 Received: from [2a00:1450:4864:20::42f] (port=45621 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVPhz-0006XH-M9 for emacs-orgmode@gnu.org; Fri, 18 Mar 2022 23:24:53 -0400 Received: by mail-wr1-x42f.google.com with SMTP id p9so13957595wra.12 for ; Fri, 18 Mar 2022 20:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=seWIaHxG3FGg53VEfAD0ZbJwRReLpZ+chqjJePOv5bQ=; b=e1Sg0qLrGRdPN+2KWN1hvrTgyTQQST355itzwdGoZDyyFE1vbQuHSfzloMF3Dw6i7u rEgCSxS/cIpj/PpDXTtAJYYaJ2La7yK7aAEEHlDnLB/nFjPkZx2/51j1k7b96mUbPx1Z KC4rqNVIgUhiBteTpkJNG8ziFVvgatXVhTWd04zN6BwtzFmi2mYLaxLAPWxTCSZX7BXs AeB0dJsGdtAHd88xb3fGkeErrzqoSnUhdH6lywg+0j89sWPLxNV55vWc15xApQ7rRZMW ZRCteC+W3ffTve9c8GMqBYeKeOVJF4TSdkR1//3YSjqBIaRR53rEMPjrg0ZU9X4azRtR H9LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=seWIaHxG3FGg53VEfAD0ZbJwRReLpZ+chqjJePOv5bQ=; b=xISXdmpbvQvhjfcBXkUmZ9760i1XHcVsMjReHgHc8htT2u6rubuyZ5rQRgWceKbqcv mHYE5aN4CI5IwtRb7qNi9UrsmBHdGNatS3oxNWN0keUC6Rke4of0Rp2M7aY84oWBu0Z0 tVfKr+7eGExqPgJ8wodLuGQfEKJUnSdsvVeMrQgkm6820sk0iUjOeMiJ0fNP6yYF/0N4 1mBsEprobiy0N/0T5KL/DIZJK+j4XE73xXpjHz6HpsdtRF2Rb8WbaqLRUWSFMLnd491y jHt7nvfmGjzUOUkPXtuEKOC6YMH9d8RSP8jwrLxEiRiypmDxXQE+3jXYyPfpcATtkmKg gInA== X-Gm-Message-State: AOAM530tElHTfyuikkVnoNt8it1MIP/7oLCsVNF7jQYHFdCiRKE187G5 2cBWVKGB3NzgsUm2lrnA2qM7W++aJSM= X-Google-Smtp-Source: ABdhPJzh7xEfLcMoR3Ht6/i/8mO6IQbGav6C7OXNZGgaHv+EAeAHtaqStBwtok3FpV21raPiAnF07Q== X-Received: by 2002:a05:6000:144b:b0:1fe:ac08:7038 with SMTP id v11-20020a056000144b00b001feac087038mr10066164wrx.318.1647660289830; Fri, 18 Mar 2022 20:24:49 -0700 (PDT) Received: from pluto.localnet (aaubervilliers-654-1-6-220.w83-200.abo.wanadoo.fr. [83.200.23.220]) by smtp.gmail.com with ESMTPSA id u15-20020a5d6daf000000b00203db33b2e4sm7868203wrs.26.2022.03.18.20.24.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 20:24:49 -0700 (PDT) From: chris To: orgmode Subject: Re: Using backticks for the inline code delimeter? Date: Sat, 19 Mar 2022 04:24:48 +0100 Message-ID: <3171007.aeNJFYEL58@pluto> In-Reply-To: <4396644.LvFx2qVVIh@pluto> References: <4396644.LvFx2qVVIh@pluto> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=inkbottle007@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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=1647660371; 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=seWIaHxG3FGg53VEfAD0ZbJwRReLpZ+chqjJePOv5bQ=; b=RoM2sviIG21SOB/JfOy/SSG6dCVkna4Kk86WzOqHfQBgNhLVTKLozt1ql+NVTg2LZuXcHu JXKSSfidZXUj4rCkjc4dYKebsGfxsJ2MHcpT9ZDdKkI/smrICXAEgPq7Ai+P31+k2CMWi4 MpC6V05tLYO+ttikegYcJKjPxWW40OePGGe2TDGG5awpzrQ0PlZHXTfqzReernyzcDs7oH LRhbeXjvmxb8VfamrWsbhYNp5bSY4E//HwWgxMWMbaoXhUyqWgRLWlcReRWwdwVMyNsxtx XloxcwYiL2cWgMU7satzLtz4cn+JHptsOpkDFQTPiCzNaqX8cABurrHCinxfug== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647660371; a=rsa-sha256; cv=none; b=KRQ8s3hrK6g34q1Mt8uT66LFDSLBpdXYUYcj/z0P2XA/3zlLmNdqxm/q++HzntdmIxN6iG gqhldZB7fLyo+5gQvMS6Eey9QwKB1RG59bPganlW08vyCk5NowBTuPtqF+RQbXePbqWMsw rKlgRbjFo0jGCyBmTjpoZjiHmvi4f+BEZjVpFaPVTa76mK0ik+5x+CBr5gPtBPmS6qYowE fDrWgJAWgLSVWoYsK48c8ti8wZreggdSUHm/OCu/rXu/bHX/CIpPhXddKCfybY8bWpQrdF vN26YhRr6AA9VQbrLc6MUmlhr52KkRcCSsZp+PhgGrw6P0Wiw5SrZn7jWalMKw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=e1Sg0qLr; 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: -6.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=e1Sg0qLr; 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: 8131229F1C X-Spam-Score: -6.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4zy7OJ+tgcl7 email got truncated the 1st time, hope it's bee better this time. > 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= =20 `init.org` / `init.el`, before anything `org-mode` related (save for two=20 `hook`): (Note it is an almost exact copy from `org.el`, I've only changed a few=20 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 (<=3D 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 "=3D~`"))))) (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]\\|^\\)\\([~`=3D*/_+]\\)" (car org-emphasis-regexp-components)))) (catch :exit (while (re-search-forward quick-re limit t) (let* ((marker (match-string 2)) (verbatim? (member marker '("~" "`" "=3D")))) (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 intangibl= e=20 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)))))))) (advice-add 'org-do-emphasis-faces :override #'org-do-emphasis-faces-fixe= d) #+end_src #+begin_src emacs-lisp (custom-set-variables '(org-emphasis-alist '(("*" bold) ("/" italic) ("_" underline) ("=3D" org-verbatim verbatim) ("`" org-code verbatim) ("~" org-code verbatim) ("+" (:strike-through t))))) #+end_src Just before: #+begin_src emacs-lisp (straight-use-package 'org) #+end_src And it seems it works. I've tried the "cosmetic" version from bellow, but it wasn't working so wel= l,=20 with either `visual-fill-colum` or `org-indent-mode`? Well, it wasn't working well. I don't know if the hack above is playing mor= e=20 nicely. Because I've only tested it on one example. Chris > > For the cosmetic part, there's this piece of code from > https://archive.casouri.cat/note/2020/better-looking-verbatim-markup-in-o= rg-mode/index.html > that displays org's `=3D` and `~` markers as ```. > > -- > S=C3=A9bastien Miquel