From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [WIP PATCH] Controlling Isearch from the minibuffer Date: Sun, 9 May 2021 13:36:56 +0000 Message-ID: References: <87zgx5cz33.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13513"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Augusto Stoffel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 09 15:37:58 2021 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 1lfjd8-0003MQ-I0 for ged-emacs-devel@m.gmane-mx.org; Sun, 09 May 2021 15:37:58 +0200 Original-Received: from localhost ([::1]:35352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfjd7-0006rR-Km for ged-emacs-devel@m.gmane-mx.org; Sun, 09 May 2021 09:37:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfjcI-00064e-53 for emacs-devel@gnu.org; Sun, 09 May 2021 09:37:06 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:19129 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1lfjcD-0004bj-AY for emacs-devel@gnu.org; Sun, 09 May 2021 09:37:05 -0400 Original-Received: (qmail 62066 invoked by uid 3782); 9 May 2021 13:36:57 -0000 Original-Received: from acm.muc.de (p2e5d56ec.dip0.t-ipconnect.de [46.93.86.236]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 09 May 2021 15:36:57 +0200 Original-Received: (qmail 6421 invoked by uid 1000); 9 May 2021 13:36:56 -0000 Content-Disposition: inline In-Reply-To: <87zgx5cz33.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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.23 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" Xref: news.gmane.io gmane.emacs.devel:269078 Archived-At: Hello, Augusto. On Sat, May 08, 2021 at 12:13:52 +0200, Augusto Stoffel wrote: > I've attached a draft implementation of a minibuffer-controlled mode for > Isearch, as described for instance in > https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00447.html > To enable the feature, set `isearch-from-minibuffer' to t. > The basic trade-off is that this makes it easier to edit the search > string, and harder to quit the search. You mean, the patch makes incompatible changes to isearch, yes? > It also drops some of the eccentricities of regular Isearch. For > instance, DEL deletes and C-g quits. What to you are eccentricities, are features to other people. I'm very satisfied with the current workings of C-g, and would protest vehemently were they to be changed. I'm not sure what you mean by "DEL deletes" - what does it delete, and in which circumstances? > I'm sharing this preliminary version because two important questions can > already be answered: > - Does the approach taken here seem sufficiently robust? Note in > particular the `with-isearch-window' macro, which is now needed around > several functions, as well as the somewhat hacky `run-with-idle-timer' > call inside the `isearch-mode' function. > - Are the slightly backwards incompatible keybinding changes in > `isearch-edit-string' acceptable? It depends what you mean by "slightly". I suspect the answer to the question is no. Any changes here which aren't simply additions are going to disturb somebody's workflow. > If any of these answers is no, then I would provide a package for the > same feature. But I think the feature is interesting enough to be built > in isearch.el. Moreover, it would benefit from being official because > many third-party extensions to Isearch will need to take into account > the possibility that the search is being controlled remotely from a > minibuffer. Skimming through your patch (it is too large for me to take in every detail at the moment), it seems it could make isearch.el even more difficult to maintain than it currently is. For example, the two defmacros `with-...' are the sort that force somebody debugging (or trying to read a patch) to look somewhere else to find out what they mean. This is irksome and tedious. There are already macros like this in isearch.el, and it would seem wise to minimise any further proliferation. Each of these macros expands the ,@body twice for every invocation. Would it not be possible to rearrange things, just to expand them once? In one hunk in the patch, I see a condition-case containing a funcall, containing a catch, containing a minibuffer-with-setup-hook, which in its turn contains a lambda function and an unwind-protect. The lambda function sets functions onto both after-change-functions and post-command-hook. Whew! Each one of these constructs on its own causes difficulty in debugging, but they have their justification. Must they really all appear together in this fashion? The biggest question, which may have been answered somewhere in the thread already, is why? What is wrong with isearch at the moment that the patch will fix, or enable to be fixed? The emacs-devel post you cite above (from 2020) doesn't seem to motivate this change. Could you possibly answer this question, or cite a post which answers it, please? > Some further remarks: > - The minibuffer-controlled mode is supposed to depend on the proposed > `isearch-buffer-local' feature. This will make the hack used to > deactivate the `overriding-terminal-local-map' unnecessary. > - It seems necessary to let-bind `inhibit-redisplay' to nil in > `with-isearch-window' in order to avoid flicker in the cursor. This > seems related to the recent thread "Temporarily select-window, without > updating mode-line face and cursor fill?" in this list. Any better > solutions? > - I don't like the `with-isearch-window-quitting-edit' macro, but I > don't see a different way of achieving the necessary effect. > - I don't use/know of all Isearch features, so let me know if you spot > some incompatibility. > What do you think? The patch is ~500 lines long. This makes me worried. I'm afraid I can only react negatively and defensively at the moment. [ patch snipped ]. -- Alan Mackenzie (Nuremberg, Germany).