From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#49700: 27.2; [PATCH] Refactor minibuffer aborting Date: Fri, 23 Jul 2021 10:34:45 +0200 Message-ID: <87eebpfmxm.fsf@miha-pc> References: <87pmvaar0a.fsf@miha-pc> <834kcl37sr.fsf@gnu.org> <87h7glfq3m.fsf@miha-pc> <83wnph1o58.fsf@gnu.org> Reply-To: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4709"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 49700@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 23 10:33:12 2021 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 1m6qcJ-00013x-2S for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Jul 2021 10:33:11 +0200 Original-Received: from localhost ([::1]:58704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6qcI-0000nT-09 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Jul 2021 04:33:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6qcA-0000kk-MW for bug-gnu-emacs@gnu.org; Fri, 23 Jul 2021 04:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m6qcA-0003qW-EU for bug-gnu-emacs@gnu.org; Fri, 23 Jul 2021 04:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m6qcA-0005iW-C1 for bug-gnu-emacs@gnu.org; Fri, 23 Jul 2021 04:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Jul 2021 08:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49700 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 49700-submit@debbugs.gnu.org id=B49700.162702916021946 (code B ref 49700); Fri, 23 Jul 2021 08:33:02 +0000 Original-Received: (at 49700) by debbugs.gnu.org; 23 Jul 2021 08:32:40 +0000 Original-Received: from localhost ([127.0.0.1]:42237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6qbo-0005ht-5f for submit@debbugs.gnu.org; Fri, 23 Jul 2021 04:32:40 -0400 Original-Received: from kamnitnik.top ([209.250.245.214]:55702 helo=mail.kamnitnik.top) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6qbj-0005hi-Ox for 49700@debbugs.gnu.org; Fri, 23 Jul 2021 04:32:38 -0400 Original-Received: from localhost (unknown [IPv6:2a00:ee2:e04:9300:e609:6c46:d026:8c47]) by mail.kamnitnik.top (Postfix) with ESMTPSA id 7B176BBB71; Fri, 23 Jul 2021 08:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1627029153; bh=Zg7r0RWo63ffHxB3Ba96cRBLjNpS0twrYEPPZ0CeLgc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=d9JkWDrcSg3phhuTHqSDArYOXQmKk8YMz4mLa2EOJ/Usm8UTzYttMHRwHHzpOLm/1 XpcXZsT52kixCTV6pM+jP5YHrO8k6Mf0V2chZxMQwISxcPXk7d7No6kmjHkvBAhAem v+dO0MoXKotD54RH9MbsocxvQME1JFms/FyL3D787VxJ8ccb0EMNalKw1g+q+AXuwI fILnHs9DBN6giueO47OolTjlcaSEjqb5HwBY/uT3JM7qJiviWPdnyKStZ50iSVU3n3 AD7KDJ+YymFqH2DCNdld3HctrL84ujYEMdS8M0BnDtOa3dAlasOZUkxkNfaiRaXBCG 3gRJYoaKENcZg== In-Reply-To: <83wnph1o58.fsf@gnu.org> 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:210558 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: >> Cc: acm@muc.de, 49700@debbugs.gnu.org >> Date: Fri, 23 Jul 2021 09:26:21 +0200 >>=20 >> > Thanks, but could you please explain the rationale and the motivation >> > for these changes? >>=20 >> Refactoring to have cleaner code. >>=20 >> Right now, without applying this patch, quitting multiple recursive >> edits (in minibuffer-exit) is achieved by extra special handling in >> internal_catch. In my opinion, it's cleaner to avoid adding such code >> into a core function like internal_catch if possible. This patch moves >> this code into the function minibuffer-exit, and by using closures, it >> achieves the same effect without a global variable >> (minibuffer_quit_level). >>=20 >> In other words, without this patch, Fminibuffer_exit cooperates with >> internal_catch through a global variable. And with this patch, >> Fminibuffer_exit cooperates with command_loop by passing it a closure. >>=20 >> Fminibuffer_exit was moved to lisp because its easier to make closures >> in lisp. >>=20 >> minibuffer-alist was introduced because it's needed by minibuffer-exit. >> I also think that it's nice to expose the list of minibuffers to lisp. > > Thanks. > > I'd prefer not to expose minibuffer-alist to Lisp if it can be > avoided. This is a tricky area of Emacs, and exposing it to Lisp IMO > gives Lisp programmers too much rope to hang themselves. Well, the minibuffer list is already kind of exposed to lisp, try: (seq-filter #'minibufferp (buffer-list)) minibuffer-alist returns a newly constructed list, similar to buffer-list, so modifying the list structure is safe. What could be unsafe is modifying the minibuffers themselves, renaming or killing them. I believe that, since such actions are possible without the use of minibuffer-alist (for example, by evaluating (kill-buffer " *Minibuf-1")), they should not mess up Emacs internals and it should be treated as a bug if they do. > Is it feasible to make these changes without exposing the alist? Yes it is feasible. If the above didn't convince you, please send another e-mail and I will try. Thanks. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmD6fyUTHG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP6DdD/sFLu8Rp5wQMcPqk/FtRaRyO1zFoGQ9 D1LwpcW55eeA67lFq665KUu9AIIvGmVd1wu+v6S130X/8xj16yYR8DYhT3nPkDCr 5ZdKx5408y1GBcTNIIkpu1EGhb5AH+xrOG/s/bG0X4mgIgGxrudnPzMyyVOPXTSJ 4e1kGCM1miJPggYGnQmn7EnpCxWRzQU+yWOMlgLaT1mYvkZu1wTHQVp2vA3AKf7M VPo5TZCcI1OVM9iqCSwPM5jAUcSatju+Hu5K0ciWjZHgq8yR1EcMlW41D0KTlX3W u/NenYe3KpYJ/UGnlEzMlSWePbMD797gjdE5XUldxFd69Cb4baO7F9WspjM4f4O8 5iWwnfmpWpsV3InrK2i5+k+zh35XRHZ0v7ki1q4qFSduVcuDA9wivQTr8V3SPhWv TSMJTrfqH8rGd1pVSbIl34ChV7v4sr92r5gcAi/mKTBgN53/yN/msC5t0CAG+tBH Hif/FCCUoSvdeDeetkOy0ACNI+iNlAuB+mDjSe9VVCLDHjLM07WFb0I4kk+mVw3n keQg1OFurgZIr3vZMShTJNULheuxPKwPi5ehvWeSwUkcGmQWz0LSJtBx1f45Kpg3 EjyAuzVFL9KPQX94OJLWJ9K+oCj34vYNw0gqBcPyqSMx9E/jxAoXdVnfLkSDV44z RY8zlY0m744LRg== =WPoZ -----END PGP SIGNATURE----- --=-=-=--