From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#15839: 24.3.50; `isearch-allow-scroll': be able to scroll point off screen temporarily Date: Fri, 30 Nov 2018 00:23:38 +0200 Organization: LINKOV.NET Message-ID: <875zwfed5h.fsf@mail.linkov.net> References: <51df60b6-e152-4989-a27e-70dadb9b7474@default> <8736rqgk6f.fsf@mail.linkov.net> <87y39gexdo.fsf@mail.linkov.net> <877egzmmyk.fsf@mail.linkov.net> <8af20443-841d-4211-99ae-269e042a9a33@default> <875zwidonq.fsf@mail.linkov.net> <178ca8ac-fb45-4cef-a48d-d916a60860be@default> <87a7lsu7rn.fsf@mail.linkov.net> <24e8fff5-67d8-49ac-801e-1e5f49d2037f@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1543532085 5602 195.159.176.226 (29 Nov 2018 22:54:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 29 Nov 2018 22:54:45 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 15839@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 29 23:54:40 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gSVCh-0001Hp-Bz for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Nov 2018 23:54:40 +0100 Original-Received: from localhost ([::1]:56991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSVEn-00045w-ST for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Nov 2018 17:56:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSVE6-0003fl-2n for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2018 17:56:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSVE2-0002p7-SG for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2018 17:56:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSVE2-0002ov-M0 for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2018 17:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gSVE2-0008Gp-Iu for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2018 17:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Nov 2018 22:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15839 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15839-submit@debbugs.gnu.org id=B15839.154353212031678 (code B ref 15839); Thu, 29 Nov 2018 22:56:02 +0000 Original-Received: (at 15839) by debbugs.gnu.org; 29 Nov 2018 22:55:20 +0000 Original-Received: from localhost ([127.0.0.1]:55261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gSVDL-0008Es-NG for submit@debbugs.gnu.org; Thu, 29 Nov 2018 17:55:20 -0500 Original-Received: from goldenrod.birch.relay.mailchannels.net ([23.83.209.74]:2881) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gSVDJ-0008Ei-F2 for 15839@debbugs.gnu.org; Thu, 29 Nov 2018 17:55:18 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D2442124666; Thu, 29 Nov 2018 22:55:15 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (unknown [100.96.11.179]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 7D1411219C4; Thu, 29 Nov 2018 22:55:15 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Thu, 29 Nov 2018 22:55:15 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Chemical-Squirrel: 6174a2ba69c4b6f7_1543532115712_3524181244 X-MC-Loop-Signature: 1543532115711:3802910377 X-MC-Ingress-Time: 1543532115711 Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a3.g.dreamhost.com (Postfix) with ESMTP id 419B27F6BB; Thu, 29 Nov 2018 14:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=lI+fjHAFCRKe156R3D8IIFbWzuI=; b= yIdrONK4PP3IMFZ97bno30VWrW9Bfs9lg9kZxZ5x1AUJtCqv/fNBp1QSCadmjRnT As0dy7hh1ddzVuzyjzh+3wHLri2oWPv3u6hnx5JkS4YW6odDG8btJBpf3d6tDLvQ AkcakM2o+g0iI2eqyBUGv+Krj2SmvivkTbWUQr9AEww= Original-Received: from mail.jurta.org (m91-129-107-242.cust.tele2.ee [91.129.107.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a3.g.dreamhost.com (Postfix) with ESMTPSA id 745F57F6CD; Thu, 29 Nov 2018 14:55:12 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a3 In-Reply-To: <24e8fff5-67d8-49ac-801e-1e5f49d2037f@default> (Drew Adams's message of "Wed, 28 Nov 2018 19:36:26 -0800 (PST)") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedruddvgedgtdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdejrddvgedvnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtjedrvdegvddprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegurhgvfidrrggurghmshesohhrrggtlhgvrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:152907 Archived-At: --=-=-= Content-Type: text/plain > 1. I'm still puzzled about this: > > However, the current match will never scroll offscreen. > If `unlimited', the current match can scroll offscreen. > > Those two sentences don't make sense together. > If the current match never scrolls offscreen then > it can't be true that the current match can scroll > offscreen. Something different needs to be said > here. Do you think this is better? "If non-nil, scrolling commands can be used in Isearch mode. However, the current match can't scroll offscreen if the value is t. But if it's `unlimited', the current match can scroll offscreen. You may want to enable `lazy-highlight-buffer' in this case. If nil, scrolling commands will cancel Isearch mode." If you don't agree, please suggest a better wording. > 2. And the term "offscreen" doesn't seem like a > good choice. Don't we mean just off the window, > i.e., out of view? So this too bothers/confuses me: > > "Allow scrolling within screen" > > I don't know what is meant by "screen" here. > What are the limits of the "screen" within > which I can scroll with this option value? I guess a screen is part of the buffer visible in the window. We use the word "screen" in other docstrings as well. > 3. I'm also puzzled by this: > > You may want to enable `lazy-highlight-buffer' > as well. > > Why say that? I think it confuses people, by > suggesting that for some reason you might need > to do that, in order to see such highlighting > if you scroll (e.g. "offscreen"). > > That's not the case, is it? (I hope not.) I > thought that the implementation of `unlimited' > automatically lazy-highlights everything that > you scroll to. Is that not the case? No, this is not the case. This is very difficult to implement, and not worth the effort because this feature is already available by customizing lazy-highlight-buffer. Moreover, even if implemented, it still makes no sense because it can't highlight as quick as you scroll thru the buffer. The problem is that you haven't tried my patch with lazy-highlight-buffer enabled. If you tried you wouldn't want any other implementation. > 4. I think it would be better for the :tag > "Disable scrolling" to say something like this: > "Scrolling exits Isearch". Thanks, fixed. > 5. Doc string of `*-allow-shift-selection': > > Whether motion is allowed to select text during > incremental search. > > That will possibly make users think that this is > about activating the region (selecting text). > > The first doc-string line should kind of stand on > its own, to give an overall idea. I'd say > something more like this: > > Motion keys yank text to the search string. Thanks, fixed. > 6. `*-allow-shift-selection' behavior: > > Why is the value `move'? Is that the best word? > > What happens with `move' if you use a shifted > motion key? If it acts the same as `t' then what > you call "shifted" is really "-only_ when shifted". > What you call just "motion" seems like just both > shifted and unshifted. > > Why do we even have two such choices? Why would > someone who wants to yank chars by moving over > them want to have to use Shift, ever? Is it so > that they can use unshifted to exit Isearch and > move the cursor? I guess so. Maybe that could > be made clearer (dunno). > > 7. OK, no, `move' is apparently more complicated > than that (all the more reason why it shouldn't > be called `move'.) This text is a mouthful: > > by motion commands that have the `isearch-move' > property on their symbols equal to `enabled', > or [for which] the shift-translated command is > not disabled by the value `disabled' of the same > property. > > That sounds a bit like a legal text. You can just > repeat "property `isearch-move'" instead of saying > "the same property" - that would be clearer. But > the sentence probably needs to be split. And it > may be a sign that the behavior is too complicated. > > Why do we have this complicated behavior? Why > not just have a `move' value that lets you yank > text without having to use Shift (i.e. using Shift > or not)? What's the point of having to put such a > property on some command symbols? > > And if there really is a use case for doing that > to certain commands, so that _only they_ manifest > a difference between `t' and `move' behavior, > then why not have only the `move' behavior (no `t' > behavior)? Sorry, I don't understand what do you suggest here. > 8.This option should not be called `*-shift-selection' > if it is not necessarily about Shift selection. > The option is apparently about yanking text you > move the cursor over. So I renamed it to `isearch-allow-yank-on-move', and its options to `no-shift' and `shift'. > 9. Again, I'm not crazy about this :tag, for the > same reason as above: > > Disable shift selection > > A nil option value doesn't disable anything. It > just means that cursor motion ends Isearch, so you > just move over the buffer text. Thanks for the suggestion, I changed it to "Motion keys exits Isearch". --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=isearch-allow-scroll-offscreen.3.patch diff --git a/lisp/isearch.el b/lisp/isearch.el index eb0b25f9b1..b0284a5972 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -72,21 +72,11 @@ search-exit-option If t, random control and meta characters terminate the search and are then executed normally. If `edit', edit the search string instead of exiting. -If `move', extend the search string by motion commands -that have the `isearch-move' property on their symbols -equal to `enabled', or the shift-translated command is -not disabled by the value `disabled' of the same property. -If `shift-move', extend the search string by motion commands -while holding down the shift key. -Both `move' and `shift-move' extend the search string by yanking text -that ends at the new position after moving point in the current buffer. If `append', the characters which you type that are not interpreted by the incremental search are simply appended to the search string. If nil, run the command without exiting Isearch." :type '(choice (const :tag "Terminate incremental search" t) (const :tag "Edit the search string" edit) - (const :tag "Extend the search string by motion commands" move) - (const :tag "Extend the search string by shifted motion keys" shift-move) (const :tag "Append control characters to the search string" append) (const :tag "Don't terminate incremental search" nil)) :version "27.1") @@ -2746,9 +2736,13 @@ isearch-fallback (defcustom isearch-allow-scroll nil "Whether scrolling is allowed during incremental search. If non-nil, scrolling commands can be used in Isearch mode. -However, the current match will never scroll offscreen. -If nil, scrolling commands will first cancel Isearch mode." - :type 'boolean +However, the current match can't scroll offscreen if the value is t. +But if it's `unlimited', the current match can scroll offscreen. +You may want to enable `lazy-highlight-buffer' in this case. +If nil, scrolling commands will cancel Isearch mode." + :type '(choice (const :tag "Scrolling exits Isearch" nil) + (const :tag "Allow scrolling within screen" t) + (const :tag "Allow scrolling offscreen" unlimited)) :group 'isearch) (defcustom isearch-allow-prefix t @@ -2812,6 +2806,21 @@ isearch-back-into-window (defvar isearch-pre-scroll-point nil) (defvar isearch-pre-move-point nil) +(defcustom isearch-allow-yank-on-move nil + "Motion keys yank text to the search string. +If t, extend the search string by motion commands while holding down +the shift key. The search string is extended by yanking text that +ends at the new position after moving point in the current buffer. +If `move', extend the search string without the shift key pressed +by motion commands that have the `isearch-move' property on their +symbols equal to `enabled', or for which the shift-translated command +is not disabled by the value `disabled' of property `isearch-move'." + :type '(choice (const :tag "Motion keys exits Isearch" nil) + (const :tag "Motion keys extend the search string" no-shift) + (const :tag "Shifted motion keys extend the search string" shift)) + :group 'isearch + :version "27.1") + (defun isearch-pre-command-hook () "Decide whether to exit Isearch mode before executing the command. Don't exit Isearch if the key sequence that invoked this command @@ -2845,7 +2854,7 @@ isearch-pre-command-hook (symbolp this-command) (or (eq (get this-command 'isearch-scroll) t) (eq (get this-command 'scroll-command) t)))) - (when isearch-allow-scroll + (when (and isearch-allow-scroll (not (eq isearch-allow-scroll 'unlimited))) (setq isearch-pre-scroll-point (point)))) ;; A mouse click on the isearch message starts editing the search string. ((and (eq (car-safe main-event) 'down-mouse-1) @@ -2854,13 +2863,13 @@ isearch-pre-command-hook (read-event) (setq this-command 'isearch-edit-string)) ;; Don't terminate the search for motion commands. - ((or (and (eq search-exit-option 'move) + ((or (and (eq isearch-allow-yank-on-move 'no-shift) (symbolp this-command) (or (eq (get this-command 'isearch-move) 'enabled) (and (not (eq (get this-command 'isearch-move) 'disabled)) (stringp (nth 1 (interactive-form this-command))) (string-match-p "^^" (nth 1 (interactive-form this-command)))))) - (and (eq search-exit-option 'shift-move) + (and (eq isearch-allow-yank-on-move 'shift) this-command-keys-shift-translated)) (setq this-command-keys-shift-translated nil) (setq isearch-pre-move-point (point))) @@ -2883,7 +2892,7 @@ isearch-post-command-hook (goto-char isearch-pre-scroll-point))) (setq isearch-pre-scroll-point nil) (isearch-update)) - ((memq search-exit-option '(move shift-move)) + (isearch-allow-yank-on-move (when (and isearch-pre-move-point (not (eq isearch-pre-move-point (point)))) (let ((string (buffer-substring-no-properties --=-=-=--