From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Shahid Newsgroups: gmane.emacs.bugs Subject: bug#31325: 27.0.50; PROPOSAL: introduce a new function to recenter without redisplaying the frame Date: Sun, 01 Jul 2018 18:58:09 +0000 Message-ID: <87po06ye9q.fsf@gmail.com> References: <87po2gkxpi.fsf@gmail.com> <87sh57yrax.fsf@gmail.com> <83lgawmwup.fsf@gnu.org> <878t6wxbzr.fsf@gmail.com> <5B38994B.2010605@gmx.at> <87va9zxfhe.fsf@gmail.com> <83in5zkjsk.fsf@gnu.org> <87tvpiyjz6.fsf@gmail.com> <83fu12lwh2.fsf@gnu.org> <87sh52yiwf.fsf@gmail.com> <83d0w6ltm4.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1530471427 19177 195.159.176.226 (1 Jul 2018 18:57:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 1 Jul 2018 18:57:07 +0000 (UTC) User-Agent: mu4e 1.1.0; emacs 27.0.50 Cc: 31325@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 01 20:57:02 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 1fZhWw-0004tV-2I for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jul 2018 20:57:02 +0200 Original-Received: from localhost ([::1]:55313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZhZ3-0008J2-Gd for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jul 2018 14:59:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZhYw-0008Iw-9C for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2018 14:59:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZhYt-0004Si-04 for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2018 14:59:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34479) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fZhYs-0004Rr-S3 for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2018 14:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fZhYs-0003GA-Ho for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2018 14:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Shahid Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jul 2018 18:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31325 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31325-submit@debbugs.gnu.org id=B31325.153047150312477 (code B ref 31325); Sun, 01 Jul 2018 18:59:02 +0000 Original-Received: (at 31325) by debbugs.gnu.org; 1 Jul 2018 18:58:23 +0000 Original-Received: from localhost ([127.0.0.1]:42376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fZhYE-0003FB-Ld for submit@debbugs.gnu.org; Sun, 01 Jul 2018 14:58:22 -0400 Original-Received: from mail-qt0-f177.google.com ([209.85.216.177]:35097) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fZhYB-0003Ew-W1 for 31325@debbugs.gnu.org; Sun, 01 Jul 2018 14:58:20 -0400 Original-Received: by mail-qt0-f177.google.com with SMTP id z6-v6so12194691qti.2 for <31325@debbugs.gnu.org>; Sun, 01 Jul 2018 11:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=ZJz+seIgyWNH5UwLZP9CooEt27HqsqqKaa/sfH8vsPM=; b=W3MXBBEZRTHq85s9MRt6c4DqnkJiTFxolMPSu/5SSqZnz3KjM4iWDFbdRfN/xtWB3n BCiq/P+Zow0EbORBEaZn6u7s8mgt+i+KCaD5iIjuPgopE+jO93qeZ+yoCzIQD37lKKLb oSechUOGN82ZnRySZDfV66r8s/0eJw3i/ec6od863fr3Gk5tJ1XX/kSZHhUI5EGicsx/ 6NNqlU/INGDst6C7lkBYWzJvi+VBmneEJyX/5rwIsV8bO8uGmnq9bHF2HHPasaQSchnW yrq8oObqQeCam6JxcEI2CT5pZo94OA+qR5IOIjCmOGXQ/TE5IVf/gc6fSl1Ut/UMbMlz mHsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=ZJz+seIgyWNH5UwLZP9CooEt27HqsqqKaa/sfH8vsPM=; b=Krw3MpIIg/US6Ja+cI7CvLOlF801+e4fKMN/Ei3b13QNuhYCaqpQu7ERdeby7RTXLD xnBqPUgYQ1QlSp7VcHsm0EC8jjfnfyp1Of2O4yH29DOzv23deFJTl3mRNcB1KvyhzMKZ qYRVPnohGidALz4EkH2b4QbzWmK624wcQBn+ZtJn9jOTB5gavZm8tX3W3LofJLDwVNts 1Bp5X37+iyQXyiMDwbWgGjTX4n8AtUxMq3EmY6Q0ruihCJotQuujiaXncl0LZwil5v7k /V43YouwDiXIZSFLTkasGpGCYCF94y+7OTOfqxzruowWeaQOH4N1vQUcsxYSaL08pCxT FchQ== X-Gm-Message-State: APt69E1RZGjMP70KpvfOGyW6sk5xuMaZeoPVnRHBL52SG0kCmgOs7GGi U/PXGLgRcb/F5BkmeF029j4= X-Google-Smtp-Source: AAOMgpdGmNy2UAIccLIw9V/pyjYasGKKjSviO4bVz65W/B1Z7ULxg7yEU0dNCdUl7uC35ZLv0Y2D2w== X-Received: by 2002:ac8:1642:: with SMTP id x2-v6mr1288711qtk.107.1530471494134; Sun, 01 Jul 2018 11:58:14 -0700 (PDT) Original-Received: from 9a50e8462956 (cpe-184-152-55-93.nyc.res.rr.com. [184.152.55.93]) by smtp.gmail.com with ESMTPSA id l26-v6sm8598479qtj.11.2018.07.01.11.58.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 11:58:13 -0700 (PDT) In-reply-to: <83d0w6ltm4.fsf@gnu.org> 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:148062 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: John Shahid >> Cc: rudalics@gmx.at, 31325@debbugs.gnu.org, monnier@iro.umontreal.ca >> Date: Sun, 01 Jul 2018 17:18:08 +0000 >> >> >> It just occurred to me that this change will break backward >> >> comparability for those who bind some key to the `recenter' command, >> >> since now the second argument will always be nil and thus won't >> >> redisplay. Should we also change the interactive form of recenter to >> >> use "p" for the second argument? That way the second arg is never nil >> >> when used interactively. >> > >> > I think you are right. >> > >> > Alternatively, we could simply make 'recenter' behave specially in >> > interactive invocations. But in any case, incompatible changes in >> > behavior are bad, and should be avoided. >> >> I am happy to make the change. Should we just revert this patch and >> instead of adding a new argument change the behavior of`recenter' to >> redraw if called interactively ? >> >> How can we determine from C whether the function is called interactively >> ? Is it ok to use `called-interactively-p' ? > > That'd be gross, I think. Going through the interactive spec, as you > suggested originally, should be much simpler. Updated the interactive spec in the attached patch and made the necessary changes to the manual and documentation. I also missed a place where `recenter-top-bottom' was calling `recenter' without passing a non-nil value for REDISPLAY that I also fixed in the attached patch. Let me know what you think. Thanks, --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-Keep-recenter-behavior-backward-compatible-when-call.patch Content-Transfer-Encoding: quoted-printable >From 3ac3d2d5f60593776563e27d4b406b2776de9b96 Mon Sep 17 00:00:00 2001 From: John Shahid Date: Sun, 1 Jul 2018 14:48:24 -0400 Subject: [PATCH] Keep `recenter' behavior backward compatible when called interactively * window.c (recenter): Change the interactive spec to always pass a non-nil value to the REDISPLAY argument when called interactively. * window.el (recenter-top-bottom): Make sure recenter's second argument is non-nil everywhere. * windows.texi (Textual Scrolling): Edit documentation of `recenter'. --- doc/lispref/windows.texi | 3 ++- lisp/window.el | 2 +- src/window.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 9740bbebf2..8903922da5 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -4154,7 +4154,8 @@ Textual Scrolling @code{recenter} puts the line containing point in the middle of the window. If @var{count} is @code{nil} and @var{redisplay} is non-@code{nil}, this function may redraw the frame, according to the -value of @code{recenter-redisplay}. +value of @code{recenter-redisplay}. Interactive calls pass non-=E2=80=98ni= l=E2=80=99 +for @var{redisplay}. =20 When @code{recenter} is called interactively, @var{count} is the raw prefix argument. Thus, typing @kbd{C-u} as the prefix sets the diff --git a/lisp/window.el b/lisp/window.el index 6d9d8bdcd2..d56bed63da 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8767,7 +8767,7 @@ recenter-top-bottom With plain `C-u', move current line to window center." (interactive "P") (cond - (arg (recenter arg)) ; Always respect ARG. + (arg (recenter arg t)) ; Always respect ARG. (t (setq recenter-last-op (if (eq this-command last-command) diff --git a/src/window.c b/src/window.c index a966e99ca8..ffa2236cf8 100644 --- a/src/window.c +++ b/src/window.c @@ -5898,7 +5898,7 @@ displayed_window_lines (struct window *w) } =20 =20 -DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P", +DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P\np", doc: /* Center point in selected window and maybe redisplay frame. With a numeric prefix argument ARG, recenter putting point on screen line = ARG relative to the selected window. If ARG is negative, it counts up from the @@ -5910,7 +5910,7 @@ non-nil, also erase the entire frame and redraw it (w= hen `auto-resize-tool-bars' is set to `grow-only', this resets the tool-bar's height to the minimum height needed); if `recenter-redisplay' has the special value `tty', then only tty frames -are redrawn. +are redrawn. Interactive calls pass non-nil for REDISPLAY. =20 Just C-u as prefix means put point in the center of the window and redisplay normally--don't erase and redraw the frame. */) --=20 2.18.0 --=-=-=--