From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UJeULh3kmGHOXgAAgWs5BA (envelope-from ) for ; Sat, 20 Nov 2021 13:03:41 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id WAcrKh3kmGF5bgAAbx9fmQ (envelope-from ) for ; Sat, 20 Nov 2021 12:03:41 +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 5B07C19B7A for ; Sat, 20 Nov 2021 13:03:37 +0100 (CET) Received: from localhost ([::1]:51072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1moP5h-0004Vn-Iv for larch@yhetil.org; Sat, 20 Nov 2021 07:03:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1moP5L-0004VQ-8M for emacs-orgmode@gnu.org; Sat, 20 Nov 2021 07:03:11 -0500 Received: from ciao.gmane.io ([116.202.254.214]:59518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1moP5J-0002LU-6Z for emacs-orgmode@gnu.org; Sat, 20 Nov 2021 07:03:11 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1moP5H-0007k7-Cu for emacs-orgmode@gnu.org; Sat, 20 Nov 2021 13:03:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: =?UTF-8?Q?Re=3a_c47b535bb_origin/main_org-element=3a_Remove_depende?= =?UTF-8?Q?ncy_on_=e2=80=98org-emphasis-regexp-components=e2=80=99?= Date: Sat, 20 Nov 2021 19:02:58 +0700 Message-ID: References: <87o86mw86r.fsf@localhost> <87fsrxkahq.fsf@nicolasgoaziou.fr> <87fsrxa1j5.fsf@localhost> <878rxoa6lk.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------62B0EC2FAC1B57FB1167EFC3" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <878rxoa6lk.fsf@localhost> Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-2.625, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637409817; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=oaEssedTDsQHb2e3sVotdVXuYJxLGi9XQhkg8nkPxaY=; b=jIh6Ndv7Jc0tKzgQUtxETevcn1Fsi+aP4qIVt0xJvSSm5dOc/151EeWUqp/IBrCUtFnv3h D14+alVhy+1oSIrd6MJON82jVuahtrPDlxBVY3ImebSGUyIeMtWbgMvLQccGhreFzqokX1 JXWIapzs6KDSHQApfwQwYjcYyDz8n0FkMwQDrTSDZEPIFY4Lr0KwviGSeru0+lgds5vv1v 8HDY/PFNuRWJsI37fFR+sP61yDK7xs9Y3i7QS/V+GeYykSqIlTFtlWzwuTsC4XyyH7iVN2 KZEakM1toIAu9FmcNRWYt4gHjE9yuBRS3CEGby7OYedEaKveT33+1lKy+GqUrA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637409817; a=rsa-sha256; cv=none; b=neAgTPWhEE7ZTnuciFChs2w8WrWivsTPSxu7cV4TK1dIpbh7V6RgVVfu26hN39/xXpVnTQ XFYiwvAvggrRKAoi8l3FObQOUFT2WvNmNwbkHX0QdO4cropZJYm3isO2kXO3y765F3FCQp F0EN0x/uBPvndNuZR3i13BK3LngbyyctY1Wb184nYasXoLK1eNquuFN9rHQarSuyCY0wZX GcJ6W7d1UoWA++KDmNj+Xz+Elk6d8wLEMqS+Pce3zU2tgvbroKrNEzja53NNOx0T3jDY5q oZb7d3L1/YBAHa8aYOd18IH408gxKpZ6nLB7DBw46v3JyR4fR7FGEFyz9tI6JA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: -2.27 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 5B07C19B7A X-Spam-Score: -2.27 X-Migadu-Scanner: scn0.migadu.com X-TUID: 9C/pSVeZKuTr This is a multi-part message in MIME format. --------------62B0EC2FAC1B57FB1167EFC3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 16/11/2021 14:43, Ihor Radchenko wrote: > Max Nikulin writes: > >> Better docs and some restriction on defcustom values were discussed earlier: >> https://list.orgmode.org/87k0oyd3pw.fsf@nicolasgoaziou.fr/ >> Nicolas Goaziou. Re: Using backticks for the inline code delimeter? Mon, >> 19 Apr 2021 11:27:07 +0200 >> >> Sorry, I have not prepared a patch. I am not confident with defcustom >> fine tuning and have not experimented with it since that time. > > Maybe something like the attached? My draft version is attached. Ihor, thank you for inspiration. Feel free to improve it. I hope, it makes problem more apparent to user who tries to customize markers. Have I missed some undesired side effects? Unfortunately with "set" type in defcustom "catch inappropriate" item is not hidden for valid configuration. I do not mind if you commit any variant. --------------62B0EC2FAC1B57FB1167EFC3 Content-Type: text/x-patch; charset=UTF-8; name="restrict-org-emphasis-alist.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="restrict-org-emphasis-alist.patch" diff --git a/doc/org-manual.org b/doc/org-manual.org index a38dbec4a..b62c52e61 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -10814,9 +10814,11 @@ and verbatim string is not processed for Org specific syntax; it is exported verbatim. #+vindex: org-fontify-emphasized-text +#+vindex: org-emphasis-alist To turn off fontification for marked up text, you can set -~org-fontify-emphasized-text~ to ~nil~. To narrow down the list of -available markup syntax, you can customize ~org-emphasis-alist~. +~org-fontify-emphasized-text~ to ~nil~. For more fine-tuned +fontification consider themes. It is possible to customize +~org-emphasis-alist~ variable, but it will be deprecated. ** Subscripts and Superscripts :PROPERTIES: diff --git a/lisp/org.el b/lisp/org.el index cb1b58c51..ea62ae0b2 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3771,6 +3771,25 @@ newline The maximum number of newlines allowed in an emphasis exp. You need to reload Org or to restart Emacs after setting this.") +(defun org-set-emphasis-alist (var value) + "Set VAR (`org-emphasis-alist') to VALUE and check it for ignored characters. +Warn user that Org syntax can not be extended with new emphasis markers +if such attempt is detected. The function is intended for :set argument +of `defcustom'." + (set var value) + (let ((unsupported + (delq nil + (mapcar + (lambda (entry) + (let ((marker (car entry))) + (unless (member marker '("*" "/" "_" "=" "~" "+")) marker))) + value)))) + (when unsupported + (message "Warning! Unsupported markup characters '%s' detected in `%s'" + (mapconcat #'identity unsupported " ") + (symbol-name var)))) + value) + (defcustom org-emphasis-alist '(("*" bold) ("/" italic) @@ -3779,23 +3798,41 @@ You need to reload Org or to restart Emacs after setting this.") ("~" org-code verbatim) ("+" (:strike-through t))) "Alist of characters and faces to emphasize text. +Warning! This variable will be deprecated in favor of themes. + Text starting and ending with a special character will be emphasized, for example *bold*, _underlined_ and /italic/. This variable sets the marker characters and the face to be used by font-lock for highlighting in Org buffers. +Do not change the characters and do not add new ones to use custom +markers for existing styles or to introduce new styles. Org syntax is +not meant to be configurable and such modifications will not work with +export. + You need to reload Org or to restart Emacs after customizing this." :group 'org-appearance :set 'org-set-emph-re :version "24.4" :package-version '(Org . "8.0") + :set #'org-set-emphasis-alist :type '(repeat - (list - (string :tag "Marker character") - (choice - (face :tag "Font-lock-face") - (plist :tag "Face property list")) - (option (const verbatim))))) + (group + (choice + :tag "Marker" + (const :tag "*Bold*" "*") + (const :tag "/Italic/" "/") + (const :tag "_Underline_" "_") + (const :tag "+Strike-through+" "+") + (const :tag "=Verbatim=" "=") + (const :tag "~Code~" "~") + ;; To warn users that it does not work. + (string :tag "Unsupported ignored character")) + (choice + :tag "Font" + (face :tag "Face") + (plist :tag "Property list")) + (option (const verbatim))))) (defvar org-protecting-blocks '("src" "example" "export") "Blocks that contain text that is quoted, i.e. not processed as Org syntax. --------------62B0EC2FAC1B57FB1167EFC3--