From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cDCYITZuj2DnoQAAgWs5BA (envelope-from ) for ; Mon, 03 May 2021 05:29:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MMhTHTZuj2CNewAA1q6Kng (envelope-from ) for ; Mon, 03 May 2021 03:29:58 +0000 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 A98D3FB04 for ; Mon, 3 May 2021 05:29:57 +0200 (CEST) Received: from localhost ([::1]:48788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldPHP-0003SJ-QV for larch@yhetil.org; Sun, 02 May 2021 23:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldPGo-0003Ry-Pz for emacs-orgmode@gnu.org; Sun, 02 May 2021 23:29:18 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:35639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldPGi-0007kn-JS for emacs-orgmode@gnu.org; Sun, 02 May 2021 23:29:18 -0400 Received: by mail-pg1-x52f.google.com with SMTP id q10so2743481pgj.2 for ; Sun, 02 May 2021 20:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=50+HyGy774Rea3AidO2ZRMU6Tu6RQBd4sFjcaip5vG0=; b=iO8T7f/C9QrK2KYNzk49/lqiDpcmbYYm5DreMrGwuadRnP5WqPfAMskywVyZm0X+PB uTEfYgdr7eMJ3TEzRoZPMhwcN48/mAgJgYla1fZEhdmmmofDU9a6edAOP+oXUpXL2NxN xHWglXGxj/6xb+ZqQCcntOX/OX2Brb3QImySFsPEr8O1NRR/Pg48M9lrEIT71EULAImk oqTvTkin1bMGlYg143GFCwt1ND7j8je6YoDwJGD1EAZCRDkwSYwBHWXT1v9mVuQzXDrG ZxIX/wMtBdi0IWTwKuXjnWS3MJH/IMaL6IhtbW9ymFFb7eH+E9eUt95glBc3FuOGsAyX ZAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=50+HyGy774Rea3AidO2ZRMU6Tu6RQBd4sFjcaip5vG0=; b=UHtTv3Dyd8K+DZcYnSrpmTGIOXu2KEzqXfa4uhKMfVT2NkRgc7sTo+e8aY5wJLb3ac nI3Bg2nXngTxD0MCQzJPrO2JU+AIP9hCDoSQI/eQysxr6kH28BTLbv+8e1+n84xxBOpv KDmezldAgpYLTqljqU7W17OwhuiwzfwYGIl+dr4su4CSeRIz71KEFfwSxDdI6901NMlk 1DbTf34K4It6WzhJ8ky1Ltz0VeoMnRN7NcYbtfeJWgXI8Kic4KHM60/vNcpQDZmqbKhq ekBSLzVi+L/Zb6SNm/qMcbtzhzs13FObuqW/kLDeYelrIJR0gGBfsSJNmy5DPZCJdLDH M1ew== X-Gm-Message-State: AOAM5304gmd7f/MZJoQ/kLEaZLqwuONJmwG0S2pHta95/zBdTq4rnr2F TCJwgyWLKFyNiwfhdfFbjPs= X-Google-Smtp-Source: ABdhPJwXJjJcjvrONZ7sLQF0y6yUkmCv2StBfbSvPQ0o8Xrfg8GW9UDf17V2GmbSGGjz/sUJHnruZg== X-Received: by 2002:a63:4e5c:: with SMTP id o28mr16419923pgl.380.1620012550772; Sun, 02 May 2021 20:29:10 -0700 (PDT) Received: from localhost (180-150-91-8.b4965b.per.nbn.aussiebb.net. [180.150.91.8]) by smtp.gmail.com with ESMTPSA id u24sm8353414pga.78.2021.05.02.20.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 20:29:09 -0700 (PDT) References: <87pmzf4bd0.fsf@gmail.com> <87pmye51a3.fsf@gmail.com> <87zgxcgaba.fsf@gmail.com> User-agent: mu4e 1.4.15; emacs 28.0.50 From: Timothy To: Tom Gillespie Subject: Re: [PATCH] Fontification for inline src blocks In-reply-to: Message-ID: <878s4wtrzx.fsf@gmail.com> Date: Mon, 03 May 2021 11:29:06 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=tecosaur@gmail.com; helo=mail-pg1-x52f.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: org-mode-email Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620012598; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=tbx3md7HftPLNkvtlKJq/aC92novShcWCIIpwCkJM7k=; b=otSg+Qw8aqk8kNlNEM9q7JVkHfz22Nhutr55sQ5VZ2jCtKD90vokxBU/uesm7heSqyNco4 LtQi9t9URuelkkL4BD93ZB8bmwfJVtSeIKeT8upE6u0pVc0SfRz4TXCYTIPUOyRwGpsVPt 2WHTk8/UXoWNN7Lci+usKrpA5n9YJDFYBp8J4c7qtFsEslgIW+Jjgl+4L5aI06OKggfteS cbHNJYsj7Jc/O6qwLIwP9KcUnhchRXl5u9dLwtjQW/Swbmsv8sZGZS7j/jRenbtmh1/1KI 0h+RZ41Sb8XH0tUD7wLSNbo80hPIkNbGHIaVmCPEiyXMjcJAYNvgzQZRfM13Cw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620012598; a=rsa-sha256; cv=none; b=YBU3kENdIYiFBJDttoXMyqmmxRnTKU8VvUhLde/GTsvcSa4dYg1X3zBkvkd8/if/DY6hwn lj75qv6iwpjgKENBj6aFrYl6pCnanYPoIAuArluD5Ocqz0mCG989NOaeNoKNdFtcquVWeq a0vQCV/+pRUFSeqKE/VmohHK/TnOh6G9YpL7kWqBVj5phaUFqYj/63H534uLRFd27JYrTw 6khqbmu09O4Zc+b3bvcs5yKqx/SGGqiUCtOh9Wq3hoHRC4xJBcaM+/YdnFnsfVS1jvE5xG X5Ds1U39PPNQBezEcFwivqZ3jOaXdouYReiMbPi8ysk+R1UV3J5U3sxMtOFbOA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b="iO8T7f/C"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.36 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b="iO8T7f/C"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: A98D3FB04 X-Spam-Score: -1.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: gDdZh9HN9DsC --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Tom Gillespie writes: > 1. I think there needs to be a function to toggle > org-inline-src-prettify-results as there is e.g. for hyperlinks. I was > quite confused by the prettified results. Added org-toggle-inline-results-display. > 3. I'm not sure about the default choice for prettified delimiters. I > see there is already a way to customize the delimiters by providing a > cons. I think a default value of '("" . "") might be a better choice > since =E2=9F=A8 and =E2=9F=A9 being hardcoded seems like it introduces co= mpletely > alien characters. Going with empty strings also seems consistent with > the behavior for hyperlinks. Changed to your suggestion. Awaiting others' thoughts on 2. and 5. -- Timothy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-src-Implement-native-inline-src-fontification.patch >From 81c56a48ebe516890691420243efe966f3c50eef Mon Sep 17 00:00:00 2001 From: TEC Date: Mon, 3 May 2021 11:16:17 +0800 Subject: [PATCH] org-src: Implement native inline src fontification * lisp/org-src.el (org-fontify-inline-src-blocks, org-fontify-inline-src-blocks-1): Create a function to search the buffer up to a limit for inline src blocks. Light fontification is applied to matched inline src blocks. When `org-src-fontify-natively' is set, `org-src-font-lock-fontify-block' to the content. (org-fontify-inline-src-results): Search for {{{results(...)}}} constructs. Then when `org-inline-src-prettify-results` is non-nil, mimic prettify-symbols and use `compose-region' to substitute visually simpler elements for the wrapping around the value. * lisp/org.el (org-set-font-lock-defaults): Add `org-fontify-inline-src-blocks' to `org-font-lock-extra-keywords', which is locally bound inside `org-set-font-lock-defaults'. (org-inline-src-fontify-max-length, org-inline-src-prettify-results): Create variables for use in the new inline src/result fontification methods in org-src.el. --- lisp/org-src.el | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ lisp/org.el | 21 ++++++++++++- 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index a694e5595..1d09f03a8 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -623,6 +623,85 @@ (defun org-src-font-lock-fontify-block (lang start end) '(font-lock-fontified t fontified t font-lock-multiline t)) (set-buffer-modified-p modified))))) +(defun org-fontify-inline-src-blocks (limit) + "Try to apply `org-fontify-inline-src-blocks-1'." + (condition-case nil + (org-fontify-inline-src-blocks-1 limit) + (error (message "Org mode fontification error in %S at %d" + (current-buffer) + (line-number-at-pos))))) + +(defun org-fontify-inline-src-blocks-1 (limit) + "Fontify inline src_LANG blocks, from `point' up to LIMIT." + (let ((case-fold-search t) + (initial-point (point))) + (while (re-search-forward "\\_