From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#58376: [PATCH] Set the PARENTS argument for language environments Date: Mon, 10 Oct 2022 20:02:58 +0530 Message-ID: <87ilkrwxyd.fsf@gmail.com> References: <83wn9ajrud.fsf@gnu.org> <83tu4eji4l.fsf@gnu.org> <83edvhjt76.fsf@gnu.org> <838rlpjfmr.fsf@gnu.org> <87wn99oxtv.fsf@gmail.com> <87sfjxox3r.fsf@gmail.com> <87o7ulovzj.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29668"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 58376@debbugs.gnu.org To: =?UTF-8?Q?=E0=A4=B8=E0=A4=AE=E0=A5=80=E0=A4=B0_?= =?UTF-8?Q?=E0=A4=B8=E0=A4=BF=E0=A4=82=E0=A4=B9?= Sameer Singh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 10 17:08:56 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohuOl-0007P9-0z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Oct 2022 17:08:55 +0200 Original-Received: from localhost ([::1]:53356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohuOj-0001CP-Tv for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Oct 2022 11:08:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohtr0-0006eX-Q3 for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 10:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50446) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohtr0-0006Rw-Gk for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 10:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ohtr0-0006m7-CQ for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 10:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Oct 2022 14:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58376 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58376-submit@debbugs.gnu.org id=B58376.166541239125980 (code B ref 58376); Mon, 10 Oct 2022 14:34:02 +0000 Original-Received: (at 58376) by debbugs.gnu.org; 10 Oct 2022 14:33:11 +0000 Original-Received: from localhost ([127.0.0.1]:49524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohtqA-0006kx-Bw for submit@debbugs.gnu.org; Mon, 10 Oct 2022 10:33:10 -0400 Original-Received: from mail-pg1-f196.google.com ([209.85.215.196]:36804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohtq8-0006kk-Vz for 58376@debbugs.gnu.org; Mon, 10 Oct 2022 10:33:09 -0400 Original-Received: by mail-pg1-f196.google.com with SMTP id s206so10449029pgs.3 for <58376@debbugs.gnu.org>; Mon, 10 Oct 2022 07:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=azdC6o9jqVZpevRtUm2ms87DPF8rbEDKk3ILqal1jYY=; b=WitqNkAxE/lMoF+0q1IB3U01i7MaBvuujizBaDz2kcN76egBdnmfbkUmBl7XFZmQNx ozva1fpWJTBJDfPJu+H05k8H3UIPdn/+YFhD+YXWkFdG+NixcNLB82AZh/RksLDuiRC2 w+4vVgwolmDXZpOou5HSltVZzqZJ/S9yOZCnF7t7+i+HjMT9N6WLWhFAyEuSaoreNZb2 IpVR/ft3ZPmN7BjpGw5AuzOWDEYnpz/IIPnL0MAos5lhCVIGJnk7oEH3/NMYHeZnaQoc U5Bo5Z9zQbBVATXI/U/VDH+MRc05K1MEh+hsuhKTCEidObHGTpwdAOqYnK4Nn+UyXK6O FXAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=azdC6o9jqVZpevRtUm2ms87DPF8rbEDKk3ILqal1jYY=; b=jnbrk7hxRHciGr83QiUIm7OAPN/NAeEMYISATBhryVBX9CJ0zyOjk5pgTtIw4xtK7e Gx7DHHsfM68RfGggET2yyM9AMJ/4bLoaivvJVkTYFIBfIA90+oc42uqjN1I91RsjeOOZ /xY1Leslh8QfSePpx17U9L+yprzY2RMtSVNnMvaKD4mmXSkbPppFQkWN4V5j9r2QbbAY Pzrs6Sro/6QValgsoD3Z7Yw5qWAJFSVivDdQicLH0Ao9pqljRGFBRnkYm6IhZyZ84uYL yLeCeERXk6mjUX+F/BCokq08Yke5bZ3scbTUuKuGKdKBEcdqnUpR2IwqGRwGaOA0Nd3s RWEQ== X-Gm-Message-State: ACrzQf0+fHNH18jhT/XJZ1BrVmJaUvxUa2iOJw1nNO0JYk2uGvRAD2oj a6QBdgHMG8jLuEdIs3WgWNY= X-Google-Smtp-Source: AMsMyM7mF4fBXmwMqi0Qo2OJVchr8w+DBdO+7RV6XyGevNqco+8E9jhYX+7rhzXjCQPalAx/ALkvBw== X-Received: by 2002:a05:6a00:24cb:b0:563:5499:b73 with SMTP id d11-20020a056a0024cb00b0056354990b73mr6644989pfv.44.1665412382913; Mon, 10 Oct 2022 07:33:02 -0700 (PDT) Original-Received: from localhost ([14.139.216.98]) by smtp.gmail.com with ESMTPSA id a11-20020a170902900b00b00179c99eb815sm6741086plp.33.2022.10.10.07.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 07:33:01 -0700 (PDT) In-Reply-To: ("=?UTF-8?Q?=E0=A4=B8=E0=A4=AE=E0=A5=80=E0=A4=B0_?= =?UTF-8?Q?=E0=A4=B8=E0=A4=BF=E0=A4=82=E0=A4=B9?= Sameer Singh"'s message of "Mon, 10 Oct 2022 19:36:59 +0530") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245027 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=A4=E0=AE=BF=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D =E0=AE=85= =E0=AE=95=E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 10, 2022] = =E0=A4=B8=E0=A4=AE=E0=A5=80=E0=A4=B0 =E0=A4=B8=E0=A4=BF=E0=A4=82=E0=A4=B9 S= ameer Singh wrote: > On Sun, Oct 9, 2022 at 9:00 PM Visuwesh wrote: > > [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=85=E0=AE= =95=E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 09, 2022] Visuwes= h wrote: > > >> Attached patch puts the "Kharosthi" item in both Indian and Misc > >> submenus without overwriting. > >> > >> > >> > >> The problem is that when looping, the variables setup-map and > >> describe-map gets outdated and causes the overwrite. The solution I > >> came up with was to update them both to their default after each > >> iteration. This involved moving the keymap-setting forms to a > >> separate > >> function. > > > > Hmm, I seethat the function can be cleaned up further. I will do it > > after my dinner. > > Please find attached. > > > Can you resend the patch? > This one fails to apply. Hmm weird, the patch applies cleanly for me if I download a fresh copy of mule-cmds.el from https://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/in= ternational/mule-cmds.el. How about the attached? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=pp diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 48e5c9a..4ad0d10 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1208,6 +1208,16 @@ Arguments are the same as `set-language-info'." (list 'const lang)) (sort (mapcar 'car language-info-alist) 'string<)))))) +(defun set-language-info-setup-keymap (lang-env alist describe-map setup-map) + "Setup menu items for LANG-ENV. +See `set-language-info-alist' for details of other arguments." + (let ((doc (assq 'documentation alist))) + (when doc + (define-key-after describe-map (vector (intern lang-env)) + (cons lang-env 'describe-specified-language-support)))) + (define-key-after setup-map (vector (intern lang-env)) + (cons lang-env 'setup-specified-language-environment))) + (defun set-language-info-alist (lang-env alist &optional parents) "Store ALIST as the definition of language environment LANG-ENV. ALIST is an alist of KEY and INFO values. See the documentation of @@ -1222,51 +1232,37 @@ in the European submenu in each of those two menus." (setq lang-env (symbol-name lang-env))) ((stringp lang-env) (setq lang-env (purecopy lang-env)))) - (let ((describe-map describe-language-environment-map) - (setup-map setup-language-environment-map)) - (if parents - (let ((l parents) - map parent-symbol parent prompt) - (while l - (if (symbolp (setq parent-symbol (car l))) - (setq parent (symbol-name parent)) - (setq parent parent-symbol parent-symbol (intern parent))) - (setq map (lookup-key describe-map (vector parent-symbol))) - ;; This prompt string is for define-prefix-command, so - ;; that the map it creates will be suitable for a menu. - (or map (setq prompt (format "%s Environment" parent))) - (if (not map) - (progn - (setq map (intern (format "describe-%s-environment-map" - (downcase parent)))) - (define-prefix-command map nil prompt) - (define-key-after describe-map (vector parent-symbol) - (cons parent map)))) - (setq describe-map (symbol-value map)) - (setq map (lookup-key setup-map (vector parent-symbol))) - (if (not map) - (progn - (setq map (intern (format "setup-%s-environment-map" + (if parents + (while parents + (let (describe-map setup-map parent-symbol parent prompt) + (if (symbolp (setq parent-symbol (car parents))) + (setq parent (symbol-name parent)) + (setq parent parent-symbol parent-symbol (intern parent))) + (setq describe-map (lookup-key describe-language-environment-map (vector parent-symbol))) + ;; This prompt string is for define-prefix-command, so + ;; that the map it creates will be suitable for a menu. + (or describe-map (setq prompt (format "%s Environment" parent))) + (unless describe-map + (setq describe-map (intern (format "describe-%s-environment-map" + (downcase parent)))) + (define-prefix-command describe-map nil prompt) + (define-key-after describe-language-environment-map (vector parent-symbol) + (cons parent describe-map))) + (setq setup-map (lookup-key setup-language-environment-map (vector parent-symbol))) + (unless setup-map + (setq setup-map (intern (format "setup-%s-environment-map" (downcase parent)))) - (define-prefix-command map nil prompt) - (define-key-after setup-map (vector parent-symbol) - (cons parent map)))) - (setq setup-map (symbol-value map)) - (setq l (cdr l))))) - - ;; Set up menu items for this language env. - (let ((doc (assq 'documentation alist))) - (when doc - (define-key-after describe-map (vector (intern lang-env)) - (cons lang-env 'describe-specified-language-support)))) - (define-key-after setup-map (vector (intern lang-env)) - (cons lang-env 'setup-specified-language-environment)) - - (dolist (elt alist) - (set-language-info-internal lang-env (car elt) (cdr elt))) - - (if (equal lang-env current-language-environment) - (set-language-environment lang-env)))) + (define-prefix-command setup-map nil prompt) + (define-key-after setup-language-environment-map (vector parent-symbol) + (cons parent setup-map))) + (setq parents (cdr parents)) + (set-language-info-setup-keymap lang-env alist (symbol-value describe-map) (symbol-value setup-map)))) + (set-language-info-setup-keymap lang-env alist + describe-language-environment-map setup-language-environment-map)) + (dolist (elt alist) + (set-language-info-internal lang-env (car elt) (cdr elt))) + (if (equal lang-env current-language-environment) + (set-language-environment lang-env))) (defun read-language-name (key prompt &optional default) "Read a language environment name which has information for KEY. --=-=-=--