From unknown Sat Jun 14 18:57:09 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#28713 <28713@debbugs.gnu.org> To: bug#28713 <28713@debbugs.gnu.org> Subject: Status: Inconvenient usage of defconst in python-mode Reply-To: bug#28713 <28713@debbugs.gnu.org> Date: Sun, 15 Jun 2025 01:57:09 +0000 retitle 28713 Inconvenient usage of defconst in python-mode reassign 28713 emacs submitter 28713 Lele Gaifax severity 28713 minor tag 28713 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 05 11:35:24 2017 Received: (at submit) by debbugs.gnu.org; 5 Oct 2017 15:35:25 +0000 Received: from localhost ([127.0.0.1]:51707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e08BI-0005Cn-N2 for submit@debbugs.gnu.org; Thu, 05 Oct 2017 11:35:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e08BG-0005CZ-G5 for submit@debbugs.gnu.org; Thu, 05 Oct 2017 11:35:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e08BA-0002VX-4K for submit@debbugs.gnu.org; Thu, 05 Oct 2017 11:35:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53117) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e08BA-0002VT-1B for submit@debbugs.gnu.org; Thu, 05 Oct 2017 11:35:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e08B8-000712-R8 for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2017 11:35:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e08B2-0002NS-Uk for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2017 11:35:14 -0400 Received: from mail.arstecnica.it ([144.76.81.238]:44004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e08B2-0002La-Oj for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2017 11:35:08 -0400 Received: from nautilus (assp.arstecnica.it [192.168.1.102]) by mail.arstecnica.it (Postfix) with ESMTPSA id B79B083EE9D for ; Thu, 5 Oct 2017 15:35:04 +0000 (UTC) Received: from nautilus ([31.44.165.109] helo=nautilus) by assp.arstecnica.it with SMTPS(AES256-GCM-SHA384) (2.3.3); 5 Oct 2017 15:35:04 +0000 From: Lele Gaifax To: bug-gnu-emacs@gnu.org Subject: Inconvenient usage of defconst in python-mode Date: Thu, 05 Oct 2017 17:35:04 +0200 Message-ID: <874lrd38wn.fsf@metapensiero.it> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Assp-Version: 2.3.3(14029) on assp.arstecnica.it X-Assp-ID: assp.arstecnica.it m1-17704-01141 X-Assp-Session: 11D5F7C0 (mail 1) X-Assp-Envelope-From: lele@metapensiero.it X-Assp-Intended-For: bug-gnu-emacs@gnu.org X-Assp-Client-TLS: yes X-Assp-Server-TLS: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) In Emacs 25+, to be exact after commit dadcf33984391a285ef0b161c1122864264e4386, python-mode uses a defconst to define the value of `python--prettify-symbols-alist': (defconst python--prettify-symbols-alist '(("lambda" . ?\u03bb) ("and" . ?\u2227) ("or" . ?\u2228))) that is used just once in the major mode initializer: (set (make-local-variable 'prettify-symbols-alist) python--prettify-symbols-alist) While the replacement for "lambda" is pretty, I find the other two quite unreadable. To get rid of those I cannot simply customize the alist, but I have to do something like the following in one of my python-mode-hooks: ;; Prettify only lambda keyword (setq prettify-symbols-alist '(("lambda" . ?=CE=BB))) ;; Force a refresh (prettify-symbols-mode -1) (prettify-symbols-mode)) This is of course a minor hassle, but I wonder if the major mode could/shou= ld use a normal variable (if not a defcustom) instead. Thanks&bye, lele. --=20 nickname: Lele Gaifax | Quando vivr=C3=B2 di quello che ho pensato ieri real: Emanuele Gaifas | comincer=C3=B2 ad aver paura di chi mi copia. lele@metapensiero.it | -- Fortunato Depero, 1929. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 05 19:43:03 2017 Received: (at 28713) by debbugs.gnu.org; 5 Oct 2017 23:43:03 +0000 Received: from localhost ([127.0.0.1]:51942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0FnD-00036S-Fa for submit@debbugs.gnu.org; Thu, 05 Oct 2017 19:43:03 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:55892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0FnB-00035s-Ly; Thu, 05 Oct 2017 19:43:02 -0400 Received: by mail-io0-f174.google.com with SMTP id z187so14800887ioz.12; Thu, 05 Oct 2017 16:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GyZyhjo+9MzLw9Pjk4nNc0FZZuYgwBVhLdjX7gk/wO0=; b=EKzFg77TTXqkzq28/zdiknKgpCEM9r6ZE1v9NClBXvzendsql3Zomdxr+jYA9RXgY5 BV8sVxumXjFH8GBbWEjbV9w2MnGuc0KsYAw8uYlpLfmcVAH3kzJuis/NrWi6cRoeYzSk TtIW0aFNIxP/nI7bu2zVibkIus0oRo+43cYA3IMKIpDWOY3lkuuQL6gBeAoqn89soOTA POkMr2ud+Wins9znSpUcUBO8TUvE8EcCvAgZVv5gZkNfB6euzUkk0iu0hlgE5VZm5dYK GMmzIZh/XGSvL4S+V2LBbXZAFgRJCGffawUScBLu2WCDuBAXy0JFZ3ratBhju/pLHR2Z XQMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=GyZyhjo+9MzLw9Pjk4nNc0FZZuYgwBVhLdjX7gk/wO0=; b=FPrQJLh1WTJ8aYWf/1/l1Yt+REoO4+if0fEMkZtobTTmkHRaN/Or3EVIXxJpTiR4m2 PESIYO9IFOTU4LcuD3BVQAn/jJePI7UEWSWbjq2HAMVwS8Ul6+IiBRgdO+ylA3a7PlcB w66WMyg2eIoqMgKxzMCNCr4a5AFp7HARETq8C+8HIuCtjZa4nZsBHgh0BCviZgXlt9f8 nzEXLPQtVo2PrDqeMKyQcV+1KaE0skErBelWwdAmRws3ZKP05HXTXXs0FDS4T+dOc1If vtE5MLPy5QZZEymocRGAscw/OyyudB565StWdI2i7iuxccIf00ZH2RK0c5FyYeXnLXth WUcA== X-Gm-Message-State: AMCzsaXizG0Ujv7a+XRaUk/LqYFXKYWguIKEIVCEhVnRBtZO7ZaSv8e0 udtyIlXhlBz66/zHC6Mcqtm5dQ== X-Google-Smtp-Source: AOwi7QA7TCBZLuUMav8JgMTX9TR6s/WSjn5jozKRoOs1I9AxvUl7+30/6pZ/Roqd1vAzuxDv0dWsRA== X-Received: by 10.107.156.134 with SMTP id f128mr415680ioe.226.1507246975600; Thu, 05 Oct 2017 16:42:55 -0700 (PDT) Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id i19sm97063ioi.38.2017.10.05.16.42.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Oct 2017 16:42:54 -0700 (PDT) From: Noam Postavsky To: Lele Gaifax Subject: Re: bug#28713: Inconvenient usage of defconst in python-mode References: <874lrd38wn.fsf@metapensiero.it> Date: Thu, 05 Oct 2017 19:42:52 -0400 In-Reply-To: <874lrd38wn.fsf@metapensiero.it> (Lele Gaifax's message of "Thu, 05 Oct 2017 17:35:04 +0200") Message-ID: <87shexcgar.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 28713 Cc: 28713@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable severity 28713 minor tags 28713 + patch quit Lele Gaifax writes: > have to do something like the following in one of my python-mode-hooks: > > ;; Prettify only lambda keyword > (setq prettify-symbols-alist '(("lambda" . ?=CE=BB))) > > ;; Force a refresh > (prettify-symbols-mode -1) > (prettify-symbols-mode)) Actually you could probably get away with (with-eval-after-load 'python (setq python--prettify-symbols-alist '(("lambda" . ?=CE=BB)))) since defconst doesn't actually make anything const. > This is of course a minor hassle, but I wonder if the major mode could/sh= ould > use a normal variable (if not a defcustom) instead. prettify-symbols-alist is not a defcustom, due to some uncertainty over how to produce a reasonable interface for customizing it, if I recall correctly. So I think the python-mode version should not be a defcustom either, but I see no reason against making it a normal variable: --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=v1-0001-Make-python-prettify-symbols-into-a-defvar-Bug-28.patch Content-Transfer-Encoding: quoted-printable Content-Description: patch >From c430329a2138674c8d67ccb3f4ce92c6b75972b7 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 5 Oct 2017 19:16:46 -0400 Subject: [PATCH v1] Make python prettify symbols into a defvar (Bug#28713) * lisp/progmodes/python.el (python-prettify-symbols-alist): New variable. (python--prettify-symbols-alist): Make into obsolete alias for `python-prettify-symbols-alist'. --- lisp/progmodes/python.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9aa5134ca0..f79d9a47d3 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -640,10 +640,14 @@ python-syntax-propertize-function ((python-rx string-delimiter) (0 (ignore (python-syntax-stringify)))))) =20 -(defconst python--prettify-symbols-alist +(defvar python-prettify-symbols-alist '(("lambda" . ?=CE=BB) ("and" . ?=E2=88=A7) - ("or" . ?=E2=88=A8))) + ("or" . ?=E2=88=A8)) + "Value for `prettify-symbols-alist' in `python-mode'.") + +(define-obsolete-variable-alias 'python--prettify-symbols-alist + 'python-prettify-symbols-alist "26.1") =20 (defsubst python-syntax-count-quotes (quote-char &optional point limit) "Count number of quotes around point (max is 3). --=20 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 06 02:50:17 2017 Received: (at 28713) by debbugs.gnu.org; 6 Oct 2017 06:50:17 +0000 Received: from localhost ([127.0.0.1]:52060 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0MSf-0001Ea-Cg for submit@debbugs.gnu.org; Fri, 06 Oct 2017 02:50:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51631) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0MSd-0001EL-SZ for 28713@debbugs.gnu.org; Fri, 06 Oct 2017 02:50:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0MSV-0003hm-EN for 28713@debbugs.gnu.org; Fri, 06 Oct 2017 02:50:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0MSV-0003hh-Ak; Fri, 06 Oct 2017 02:50:07 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4005 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e0MSU-00045c-Kb; Fri, 06 Oct 2017 02:50:07 -0400 Date: Fri, 06 Oct 2017 09:49:58 +0300 Message-Id: <838tgowz1l.fsf@gnu.org> From: Eli Zaretskii To: Noam Postavsky In-reply-to: <87shexcgar.fsf@users.sourceforge.net> (message from Noam Postavsky on Thu, 05 Oct 2017 19:42:52 -0400) Subject: Re: bug#28713: Inconvenient usage of defconst in python-mode References: <874lrd38wn.fsf@metapensiero.it> <87shexcgar.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 28713 Cc: lele@metapensiero.it, 28713@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Noam Postavsky > Date: Thu, 05 Oct 2017 19:42:52 -0400 > Cc: 28713@debbugs.gnu.org > > > This is of course a minor hassle, but I wonder if the major mode could/should > > use a normal variable (if not a defcustom) instead. > > prettify-symbols-alist is not a defcustom, due to some uncertainty over > how to produce a reasonable interface for customizing it, if I recall > correctly. So I think the python-mode version should not be a defcustom > either, but I see no reason against making it a normal variable: Thanks, LGTM. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 07 20:11:23 2017 Received: (at 28713) by debbugs.gnu.org; 8 Oct 2017 00:11:23 +0000 Received: from localhost ([127.0.0.1]:55222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0zBi-0003Qh-QF for submit@debbugs.gnu.org; Sat, 07 Oct 2017 20:11:22 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:52879) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0zBh-0003QP-6Z; Sat, 07 Oct 2017 20:11:21 -0400 Received: by mail-it0-f43.google.com with SMTP id j140so4718108itj.1; Sat, 07 Oct 2017 17:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=6tnYitcelg4wZVhuqz/MuyGcS7vG4oVBPkDIWXGPis8=; b=V4zz6UpPIfvKy1DnGAJeENBZ3mnm/U8/dwTXpWnvHafutsyRYmBQhGA1P5/3lb6jZu z0x9lc0yHixl7Hgks6feY2dUnDrpq1gn976ByZlsuC84UAUXcYA/eGP3gEkxoZhDCsnR YXDcHFin3B5w5gy6vM9RHYqIdGo+ffsd7mSm2AU2xcBGg1b2ER740+SD0WoGsnBC0i/h quDrciX4e6yh387c3iBl58fxbxpuWo3/vh3cxgInvgzJzCC5294+t0aCEnOQSXkrBJSC v5/yc+iS05phOFJOkM/w4IjnS9NQijNhDXMcj7YOu4ySkr6bM215Aw82k90pgBLZQu3s numA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=6tnYitcelg4wZVhuqz/MuyGcS7vG4oVBPkDIWXGPis8=; b=UHTfeEIFAzwVn2QYO1lcpwz8qCqazA7n/Fdea+4nMPR2XOUSFR88804gMCYzqlcosx S943VeSwpHViVvB2O+BmqgU7GU1R45D3PFBGVPpeAE70j+xeA9f1/O/W/42NClGGNVyb hRi+C39runOs9wgdcYMtY3W7T5QyLEk+bLmgpAenZE2WUttFITJlZ96K7rCYLipHcfr4 pLvy1LjPZwOERkde69efRmrX7UJCXJUulU4zlqpQT8xSBKrOlSOy6UJA/b8P2XS8YD2H VvqrChZ31Ys8hRLnkk7CmHDD8soJtjY5u2THnYrP+KNAvdB8EKxFdAzVz5jy4/FjWict 9IYw== X-Gm-Message-State: AMCzsaX7Oo8mnut8M4kmGVu1AhYamknDtTCpImZLM6wlDncA1Bd4P+EO Vu06SyHymmjejzc0BvrjzRLreg== X-Google-Smtp-Source: AOwi7QCWvfL+UCySyl4zYhnxnA2AeZjnc/X/fl6YZt+s3+xQTSuIsz+MR1/kyQpaa71pDcHQzR49+Q== X-Received: by 10.36.44.200 with SMTP id i191mr8675604iti.136.1507421475414; Sat, 07 Oct 2017 17:11:15 -0700 (PDT) Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id q187sm2259613iof.26.2017.10.07.17.11.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Oct 2017 17:11:13 -0700 (PDT) From: Noam Postavsky To: Eli Zaretskii Subject: Re: bug#28713: Inconvenient usage of defconst in python-mode References: <874lrd38wn.fsf@metapensiero.it> <87shexcgar.fsf@users.sourceforge.net> <838tgowz1l.fsf@gnu.org> Date: Sat, 07 Oct 2017 20:11:12 -0400 In-Reply-To: <838tgowz1l.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 06 Oct 2017 09:49:58 +0300") Message-ID: <87k206cxcv.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 28713 Cc: lele@metapensiero.it, 28713@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) tags 28713 fixed close 28713 26.1 quit Eli Zaretskii writes: >> From: Noam Postavsky >> Date: Thu, 05 Oct 2017 19:42:52 -0400 >> Cc: 28713@debbugs.gnu.org >> >> > This is of course a minor hassle, but I wonder if the major mode could/should >> > use a normal variable (if not a defcustom) instead. >> >> prettify-symbols-alist is not a defcustom, due to some uncertainty over >> how to produce a reasonable interface for customizing it, if I recall >> correctly. So I think the python-mode version should not be a defcustom >> either, but I see no reason against making it a normal variable: > > Thanks, LGTM. Pushed to emacs-26. [1: c194fb61c6]: 2017-10-07 19:19:05 -0400 Make python prettify symbols into a defvar (Bug#28713) http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c194fb61c638490e3510864fe2750814af8c3719 From unknown Sat Jun 14 18:57:09 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 05 Nov 2017 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator