From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MLEHEikdZmOSOwAAbAwnHQ (envelope-from ) for ; Sat, 05 Nov 2022 09:22:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eBjgESkdZmN7WAEAauVa8A (envelope-from ) for ; Sat, 05 Nov 2022 09:22:01 +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 D02871EFE2 for ; Sat, 5 Nov 2022 09:22:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orEQa-0000Ct-Bj; Sat, 05 Nov 2022 04:21:20 -0400 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 1orEQZ-0000Cg-0B for emacs-orgmode@gnu.org; Sat, 05 Nov 2022 04:21:19 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orEQW-0000S6-NF for emacs-orgmode@gnu.org; Sat, 05 Nov 2022 04:21:18 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 2BE8C240029 for ; Sat, 5 Nov 2022 09:21:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667636474; bh=Npz9fnYKmfv6Qo9hTtlbP9grcrX1hsuAnVMSdvFo3So=; h=From:To:Cc:Subject:Date:From; b=DrWmbbcTyoJQ4HKNWiuZSmNB4xLE9ZvKznE5NMktVQ7iXiGmNkzUlxowDaDvvH+Ec 0/NOTDE6VYT4Pecn5lkW4mu8PF8TzQjrdwhrCVadXqGLbi2u5neuoRZ/I/AJMXKq1I UGMFeCdfNA1jXT6wbgJ1tJF1tzgs9iYmYQLLizSAqvmakOLgJBY6v98SAS/ZDHlthZ aaTEnS6U9yi6J8LIcdoS2RG6d+gZkBeK7V+wgzOIXnhnru1OrHhkixgslBNhl+kyio TtMmhzyID/ZTYyn1c83qQ3laQGHDBWE+JlnmS9/iKK7LlEdU0e0Wfd0wpZKu2bqARv 95Nn7lrIZrSJA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N49S86Jb6z9rxH; Sat, 5 Nov 2022 09:21:12 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] org.el: Warning for unsupported markers in `org-set-emphasis-alist' In-Reply-To: References: <87o86mw86r.fsf@localhost> <87fsrxkahq.fsf@nicolasgoaziou.fr> <87fsrxa1j5.fsf@localhost> <878rxoa6lk.fsf@localhost> <87pmqtj09r.fsf@localhost> <87mt9743di.fsf@localhost> Date: Sat, 05 Nov 2022 08:21:52 +0000 Message-ID: <871qqhlskf.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de 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, 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.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org 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=1667636521; 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=nITDLKIhk15QjVVIzgajV5Gt+ue/ozJstrMWY161qoo=; b=YtVsN0RePuZePv+WJ0a/lR80pvDyZTvNO7U3h6sEW8cTXd4PlnQB8AFGi1YwecR9LssWfv F2U/K7XAfjqmotOKfrtHmMnxL11IV9ZQfw3FXNo6F4vWJls+8fJJjAu7GLn4KrwbXNJHsg gPPX1QHGWjt29eQy7VcLhru7uR9+xfHG07bzm22PKJo7M/4bZEhZyawrekb6FVZVKbMRHQ M8uwbMaP6/tGZ3kevy4fWbRDbYlKiPtTnBtneegQAQqrsRJLTDqQU12K4PqfaK2eIz/F+H y1Oh7WzJKNIh4AHvMcw5te+1UHuroCwpl4frMkP9XEhuNKOCZt8e+6q7Ih0LFw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667636521; a=rsa-sha256; cv=none; b=bwGuhxbs2Swqtt0b2mTp/KtBfg4kGSU2bSVZkpVIdtq2v0QuTYAYcaNroL3gcJLvbES1l8 L2XzdXBs6lRAzsli7Qg5bE1WtmqQvMF9R+y2b8JAtqFO1HFAV5l8cNmFipbWzThqTf6yii G0+oiOf23Ef+QE/OtHHuqp1x1+47tWyw4wduOXw/okd7XUssAwrF1VMN+u9NTwUmZl1yEJ GQMPt6qde4z+zPzLKXm38IKUFPy1lf45wFtOe3d0aWRiBu3A1123gx0eVTBPKmF8/4bX0m gld+PvYpBmNcxaBrEbshZ9+qX5E9PB+ua6c19WX1v1yZzFLpGLAhnVH8M0JBsw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DrWmbbcT; dmarc=pass (policy=none) header.from=posteo.net; 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.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DrWmbbcT; dmarc=pass (policy=none) header.from=posteo.net; 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: D02871EFE2 X-Spam-Score: -2.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: ONndup9dszA1 --=-=-= Content-Type: text/plain Max Nikulin writes: >> 3. Remove verbatim in ("=" org-verbatim verbatim), ("~" org-code >> verbatim), and the :type spec. AFAIU, they are unused. But can you >> please double-check? > > It seems, before the following commit, verbatim was used to suppress > flyspell, but now "~" and "=" are hardcoded. > > 9fb2e047d 2016-12-08 09:44:26 +0100 Nicolas Goaziou: Split `org-emph-re' > and `org-verbatim-re' > > I think, verbatim option should not be removed from `defcustom' :type > just now. For some users it might cause fallback to raw lisp value in > easy customization UI. Perhaps another warning should be added to the > `org-set-emphasis-alist' validator and the option should be labeled as > unused in the :type definition. Makes sense. What about the attached patch? The idea is to tag the constant as deprecated. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v4-0001-org.el-Warn-about-unsupported-markers-in-org-set-.patch >From 19f636e0d76dac3e1ca133adfac8bf97dfd52a68 Mon Sep 17 00:00:00 2001 Message-Id: <19f636e0d76dac3e1ca133adfac8bf97dfd52a68.1667636440.git.yantar92@posteo.net> From: Max Nikulin Date: Mon, 22 Nov 2021 23:56:15 +0700 Subject: [PATCH v4] org.el: Warn about unsupported markers in `org-set-emphasis-alist' * lisp/org.el (org-emphasis-alist, org-set-emphasis-alist): Change custom variable type definition and add :set parameter to warn users that non-standard marker characters are ignored. Remove unused third list entry from the default value. Attempts to introduce new markers have been discussed enough times to add some code that should prevent wasting of time. Unfortunately there is no way to issue warning for e.g. `setq'. Link: https://orgmode.org/list/878rxoa6lk.fsf@localhost --- lisp/org.el | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d8708f8f2..84ed78ef7 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3628,12 +3628,31 @@ (defvar org-emphasis-regexp-components 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. +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-default-toplevel-value var value) + (let ((unsupported + (delq nil + (mapcar + (lambda (entry) + (let ((marker (car entry))) + (unless (member marker '("*" "/" "_" "=" "~" "+")) marker))) + value)))) + (when unsupported + (warn "Unsupported markup characters '%s' detected in `%s'" + (mapconcat #'identity unsupported " ") + (symbol-name var)))) + value) + (defcustom org-emphasis-alist '(("*" bold) ("/" italic) ("_" underline) - ("=" org-verbatim verbatim) - ("~" org-code verbatim) + ("=" org-verbatim) + ("~" org-code) ("+" (:strike-through t))) "Alist of characters and faces to emphasize text. Text starting and ending with a special character will be emphasized, @@ -3641,18 +3660,34 @@ (defcustom org-emphasis-alist 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 :tag "Deprecated ignored constant" verbatim))))) (defvar org-protecting-blocks '("src" "example" "export") "Blocks that contain text that is quoted, i.e. not processed as Org syntax. -- 2.35.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--