unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Drew Adams <drew.adams@oracle.com>
Cc: 15839@debbugs.gnu.org
Subject: bug#15839: 24.3.50; `isearch-allow-scroll': be able to scroll point off screen temporarily
Date: Thu, 29 Nov 2018 01:01:00 +0200	[thread overview]
Message-ID: <87a7lsu7rn.fsf@mail.linkov.net> (raw)
In-Reply-To: <178ca8ac-fb45-4cef-a48d-d916a60860be@default> (Drew Adams's message of "Wed, 28 Nov 2018 07:15:11 -0800 (PST)")

[-- Attachment #1: Type: text/plain, Size: 1173 bytes --]

> But users should preferably not need to worry
> about variable interactions.  The doc for a given
> variable should make clear just what it does, and
> each variable should preferably have one behavior
> (per value chosen).

I agree that it's better to make it clear in the docstring.
Fixed in a new patch below.

> I'm guessing that nil `search-exit-option' does
> not just have "the same effect".  But (see above)
> even if it does, that doesn't mean that option
> `search-exit-option' has the same effect, because
> setting it to non-nil, ONLY to NOT have the
> effect of `unlimited' `isearch-allow-scroll',
> would presumably also have some other effect
> unrelated to allowing scrolling.

I agree that `search-exit-option' is too confusing variable
for such features.  So we have to offload it from all
unrelated features.

As the first step, I moved the recently added shift-select
feature from `search-exit-option' to its own clearly named
customizable variable `isearch-allow-shift-select'.

For the same reason, unlimited scrolling was moved to the new option
`unlimited' of `isearch-allow-scroll'.

Now finally everything looks right.  Please try a new patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: isearch-allow-scroll-offscreen.2.patch --]
[-- Type: text/x-diff, Size: 5033 bytes --]

diff --git a/lisp/isearch.el b/lisp/isearch.el
index eb0b25f9b1..8c54ab92db 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")
@@ -2747,8 +2737,12 @@ isearch-allow-scroll
   "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 `unlimited', the current match can scroll offscreen.
+You may want to enable `lazy-highlight-buffer' as well.
 If nil, scrolling commands will first cancel Isearch mode."
-  :type 'boolean
+  :type '(choice (const :tag "Disable scrolling" 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-shift-select nil
+  "Whether motion is allowed to select text during incremental search.
+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 the shift-translated command is
+not disabled by the value `disabled' of the same property."
+  :type '(choice (const :tag "Disable shift selection" nil)
+                 (const :tag "Shifted motion keys extend the search string" t)
+                 (const :tag "Motion keys extend the search string" move))
+  :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-shift-select 'move)
                (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 isearch-allow-shift-select (not (eq isearch-allow-shift-select 'move))
                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-shift-select
     (when (and isearch-pre-move-point
                (not (eq isearch-pre-move-point (point))))
       (let ((string (buffer-substring-no-properties

  reply	other threads:[~2018-11-28 23:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 23:02 bug#15839: 24.3.50; `isearch-allow-scroll': be able to scroll point off screen temporarily Drew Adams
2013-11-09  0:57 ` Juri Linkov
2013-11-09  3:09   ` Drew Adams
2013-11-10 13:46 ` Stefan Monnier
2013-11-10 16:52   ` Drew Adams
2013-11-11 19:08     ` Drew Adams
2018-11-24 22:45 ` Juri Linkov
2018-11-25  3:14   ` Drew Adams
2018-11-25 20:15     ` Juri Linkov
2018-11-26  0:16       ` Drew Adams
2018-11-26 23:35         ` Juri Linkov
2018-11-27  0:49           ` Drew Adams
2018-11-28  0:35             ` Juri Linkov
2018-11-28 15:15               ` Drew Adams
2018-11-28 23:01                 ` Juri Linkov [this message]
2018-11-29  3:36                   ` Drew Adams
2018-11-29 22:23                     ` Juri Linkov
2018-11-30  0:27                       ` Drew Adams
2018-11-30  7:28                         ` Eli Zaretskii
     [not found]                         ` <<83lg5bc9d6.fsf@gnu.org>
2018-11-30 15:33                           ` Drew Adams
2018-12-04  0:29                         ` Juri Linkov
2018-12-04 14:46                           ` Drew Adams
2018-12-04 20:46                             ` Drew Adams
2018-12-04 21:38                               ` Juri Linkov
2018-12-05  0:32                                 ` Drew Adams
2018-12-05 23:44                                   ` Juri Linkov
2018-12-06  1:20                                     ` Drew Adams
2018-12-05 12:59                           ` Michael Heerdegen
2018-12-05 23:49                             ` Juri Linkov
2018-12-06 12:15                               ` Michael Heerdegen
2018-12-06 23:03                                 ` Juri Linkov
2018-12-07 12:42                                   ` Michael Heerdegen
2018-12-08 23:38                                     ` Juri Linkov
2018-12-09  1:13                                       ` Michael Heerdegen
2018-12-10  0:21                                         ` Juri Linkov
2018-12-10  0:58                                           ` Michael Heerdegen
2018-12-11  0:37                                             ` Juri Linkov
2018-12-11 18:22                                               ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7lsu7rn.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=15839@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).