From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Simple isearch concerns Date: Sun, 11 Apr 2021 10:07:31 +0300 Message-ID: <83wnt947v0.fsf@gnu.org> References: <20210403001539.x4rb55dvh46rmhb3.ref@Ergus> <9ff81b52fad2911cc740@heytings.org> <87im4w1tgw.fsf@mail.linkov.net> <9ff81b52fa878cb35a86@heytings.org> <87pmz4zgn5.fsf@mail.linkov.net> <83eefk802u.fsf@gnu.org> <871rbjdea4.fsf@mail.linkov.net> <8335vz91en.fsf@gnu.org> <940751cee594ef1cf8a4@heytings.org> <83zgy77hep.fsf@gnu.org> <940751cee566285b8519@heytings.org> <83wntb7eli.fsf@gnu.org> <940751cee50d69f2231d@heytings.org> <83r1jj7bhg.fsf@gnu.org> <940751cee5acf0f913df@heytings.org> <83eefj705i.fsf@gnu.org> <940751cee53181aedd72@heytings.org> <83a6q67gme.fsf@gnu.org> <5cf18ab57c8becad2999@heytings.org> <83pmz25sdr.fsf@gnu.org> <5cf18ab57ca5d2cc99ad@heytings.org> <8735vxbwju.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17398"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gregory@heytings.org, spacibba@aol.com, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 11 09:08:53 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 1lVUDF-0004S5-1q for ged-emacs-devel@m.gmane-mx.org; Sun, 11 Apr 2021 09:08:53 +0200 Original-Received: from localhost ([::1]:39990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVUDE-0002xY-3I for ged-emacs-devel@m.gmane-mx.org; Sun, 11 Apr 2021 03:08:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVUCI-0002WY-Ih for emacs-devel@gnu.org; Sun, 11 Apr 2021 03:07:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58098) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVUCH-0006kZ-Sp; Sun, 11 Apr 2021 03:07:53 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1850 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lVUCE-00011s-3d; Sun, 11 Apr 2021 03:07:53 -0400 In-Reply-To: <8735vxbwju.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 11 Apr 2021 01:12:28 +0300) 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:267855 Archived-At: > From: Juri Linkov > Cc: Eli Zaretskii , spacibba@aol.com, emacs-devel@gnu.org > Date: Sun, 11 Apr 2021 01:12:28 +0300 > > > +(put 'scroll-up-command 'isearch-motion > > + '((lambda () (goto-char (window-end))) . forward)) > > +(put 'scroll-down-command 'isearch-motion > > + '((lambda () (goto-char (window-start)) (recenter nil t)) . backward)) > > These definitions have such a problem that after going to the next screen, > it's recentered, so the upper half of the screen displays old matches > already seen on the previous screen. > > I get much better scrolling experience with these properties: > > (put 'scroll-up-command 'isearch-motion > '((lambda () (goto-char (window-end)) (recenter 1 t)) . forward)) > (put 'scroll-down-command 'isearch-motion > '((lambda () (goto-char (window-start)) (recenter -1 t)) . backward)) > > so only new unseen matches are highlighted. That's your personal preference wrt how much of the context should be left on the screen; it is well known that there are other preferences regarding this aspect. Gregory's code provides the default Emacs experience of recentering, so it is the right default. If we want to cater to other preferences, we need to make the 1st argument to recenter depend on scroll-related options, or maybe introduce a new user option.