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.devel Subject: Re: master 5892b4db8de 2/3: Convert dictionary-mode to define-derived-mode Date: Wed, 16 Aug 2023 18:25:42 +0530 Message-ID: <871qg3404x.fsf@gmail.com> References: <169185199333.11628.2162615922937919004@vcs2.savannah.gnu.org> <20230812145313.C853CC038C2@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30118"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Kangas To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 16 14:56:56 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qWG52-0007ha-JU for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Aug 2023 14:56:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWG3z-0006qM-CR; Wed, 16 Aug 2023 08:55:51 -0400 Original-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 1qWG3x-0006pc-0Z for emacs-devel@gnu.org; Wed, 16 Aug 2023 08:55:49 -0400 Original-Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWG3u-0006kZ-Sp for emacs-devel@gnu.org; Wed, 16 Aug 2023 08:55:48 -0400 Original-Received: by mail-oi1-x241.google.com with SMTP id 5614622812f47-3a7d402fc6fso4778484b6e.2 for ; Wed, 16 Aug 2023 05:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692190545; x=1692795345; h=content-transfer-encoding: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=fqd4r2yvvXPGJHPu3B+5SiTr5P7Joit4WFXVfl286sM=; b=K/+jozm1mMKrUEA/h3o/pCYlz6rKFqi4ZzXLCNyko3YZwfldhSwtZtxMMpkA4V7hct Gds8GfYqxSwRN1VwaWkzeImvkdI2yWZR8Crdg7w3N7cCzHwSUiUwbhiWFyCWSc7L+Tg6 PbQoqCJn1+PkHygDB3ql7XLqT+zH0m4T3Tobqmbs/0/XCv6pAsUpZHFl/eg1nx74TtdM 7sRWem4TflzsNia27j3kSv7jfQhMeC2VMsFpLbcWSExOIkXW9ctSk2z8wd1Z3TqfMhcM EuSWeIhPkkSDVpAiz1wZ1yzSiJhRoyAJguGsLNbrd9d6cdUSCPh23pTr2gNCAuqJcTx2 YzWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692190545; x=1692795345; h=content-transfer-encoding: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=fqd4r2yvvXPGJHPu3B+5SiTr5P7Joit4WFXVfl286sM=; b=S4OLoP1E8mLW8o+Qzs1xuIKJl9SIkK+9ujt4eCOOF6XslxqbH4GfzVSLU7oAUksbw3 A1txtzShtPoQihtJISvLkWuB/dCUx1BRupak4pSsPI3c5XhTQoLyJu0zfmwMPdECtAmv GIOejG4Et47tfaVWmaLpro3cK2In4dwQ27ZXwQga5pmiEmGhP0fe3M2zmGSCt1kMSW8r wFPDfG7WO6GATWXwhjmk99VDIggfFAtEqcxNbujww6wN91Vms5ZEoqJdhnU6wEOJatNT D19H5KaGV8G5GQX6eZkfblk80NS2dEb8MURE6hs3TsP4ZI1Mft/jc1E+hxSzfF0uJbrE lJmA== X-Gm-Message-State: AOJu0YxwSFUvPLR99PPvu6fB68UGwE/yWlGAXX3dl0hX0GBYQi1v6/wL 6OpxDwYX+adysG5AUXB+SttUanFzLalp9A== X-Google-Smtp-Source: AGHT+IHCchsY+tQDg5E+W49HduMZwfcKdsKJs8YIVoaeErInsQ0WKkiqflEsDDJmYUcojya2L008wQ== X-Received: by 2002:a05:6808:3083:b0:3a7:5a6:e0b1 with SMTP id bl3-20020a056808308300b003a705a6e0b1mr2340751oib.10.1692190545209; Wed, 16 Aug 2023 05:55:45 -0700 (PDT) Original-Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id t5-20020a654085000000b0055c090df2fasm10720404pgp.93.2023.08.16.05.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 05:55:44 -0700 (PDT) In-Reply-To: <20230812145313.C853CC038C2@vcs2.savannah.gnu.org> (Stefan Kangas's message of "Sat, 12 Aug 2023 10:53:13 -0400 (EDT)") Received-SPF: pass client-ip=2607:f8b0:4864:20::241; envelope-from=visuweshm@gmail.com; helo=mail-oi1-x241.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-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308819 Archived-At: [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=86=E0=AE=95=E0=AE=B8=E0=AF=8D=E0=AE=9F= =E0=AF=8D 12, 2023] Stefan Kangas wrote: > branch: master > commit 5892b4db8de4694904f631dd86438926fb9d7ff1 > Author: Stefan Kangas > Commit: Stefan Kangas > > Convert dictionary-mode to define-derived-mode >=20=20=20=20=20 > * lisp/net/dictionary.el (dictionary-instances): Delete. > (dictionary-mode): Use define-derived-mode. > (dictionary--count-mode-buffers): New function. > (dictionary-close): Use above new function. =20 > +(defun dictionary--count-mode-buffers () > + "Return the number of buffers that " The docstring is incomplete here. :-( > + (seq-reduce #'+ > + (mapcar > + (lambda (buf) > + (with-current-buffer buf > + (if (derived-mode-p 'dictionary-mode) 1 0))) > + (buffer-list)) > + 0)) > + I believe the following function should be faster (defun dictionary--count-mode-buffers () "Return the number of buffers that " (seq-reduce (lambda (count buf) (if (provided-mode-derived-p (buffer-local-value 'major= -mode buf) 'dictionary-mode) (+ count 1) count)) (buffer-list) 0))