From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11983: 24.1; Electric-command-loop broken? Date: Fri, 20 Jul 2012 08:09:41 -0400 Message-ID: References: <87pq7s6b8q.fsf@gnu.org> <20488.31825.986146.195944@gargle.gargle.HOWL> <20489.13911.18062.669102@lukas.physics.niu.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1342786257 1685 80.91.229.3 (20 Jul 2012 12:10:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 Jul 2012 12:10:57 +0000 (UTC) Cc: 11983@debbugs.gnu.org To: "Roland Winkler" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 20 14:10:56 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SsC2n-0001S1-6g for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jul 2012 14:10:53 +0200 Original-Received: from localhost ([::1]:34935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsC2m-0000xj-Ee for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jul 2012 08:10:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsC2j-0000xV-PV for bug-gnu-emacs@gnu.org; Fri, 20 Jul 2012 08:10:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsC2f-00061B-I8 for bug-gnu-emacs@gnu.org; Fri, 20 Jul 2012 08:10:49 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsC2f-00060o-Et for bug-gnu-emacs@gnu.org; Fri, 20 Jul 2012 08:10:45 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SsC8j-0004IU-Ld for bug-gnu-emacs@gnu.org; Fri, 20 Jul 2012 08:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Jul 2012 12:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11983-submit@debbugs.gnu.org id=B11983.134278656416441 (code B ref 11983); Fri, 20 Jul 2012 12:17:01 +0000 Original-Received: (at 11983) by debbugs.gnu.org; 20 Jul 2012 12:16:04 +0000 Original-Received: from localhost ([127.0.0.1]:52016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SsC7n-0004H7-FR for submit@debbugs.gnu.org; Fri, 20 Jul 2012 08:16:03 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:53501) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SsC7l-0004Gj-Be for 11983@debbugs.gnu.org; Fri, 20 Jul 2012 08:16:02 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q6KC9goI021075; Fri, 20 Jul 2012 08:09:43 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id A4806AECB8; Fri, 20 Jul 2012 08:09:41 -0400 (EDT) In-Reply-To: <20489.13911.18062.669102@lukas.physics.niu.edu> (Roland Winkler's message of "Fri, 20 Jul 2012 05:43:35 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4284=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4284> : streams <787671> : uri <1170215> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62185 Archived-At: >> > (unwind-protect >> > (catch 'return-tag >> > (Electric-command-loop 'return-tag)) >> > (cleanup-form)) >> But in which way is this different from `recursive-edit'? > I do not know much about recursive-edit. How would you use it as a > replacement for the above to be sure that after leaving > recursive-edit cleanup-form is always executed? (unwind-protect (recursive-edit) (cleanup-form)) >> It seems that it requires a fair bit of extra surrounding code to >> use it right. E.g. electric-buffer-list is buggy because it lacks >> this extra code: after popping up the electric-buffer-list, you >> can select some other window and work there, but the behavior is >> then all messed up. > The amount of protection provided by an Electric-command-loop > depends on the surrounding code (save-excursion, > save-window-excursion, etc.) The issue is not that the buffer is not reset when you return from electric-buffer-list, but that during electric-buffer-list if you select some other window you do not exit electric-buffer-list and the keys end up behaving weird (e.g. typing "c" in a normal buffer will insert "c" and then move to EOB or something like that). Once you exit from electric-buffer-list, things are back to normal. > I believe that the intended usage pattern of Electric-command-loop > does not include too wild things such as selecting other windows. Or > phrased differently: of course, you can always do whatever you > like. But only cleanup-form is definitely evaluated at the end. What I'm saying is that it's tricky to use Electric-command-loop without introducing bugs because Electric-command-loop presumes that all operations will stay within the current buffer, but it does not (help to) try to enforce it. So it's a poor API. Stefan