From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrii Kolomoiets Newsgroups: gmane.emacs.devel Subject: Re: master f450798: Don't move point in vc-dir on vc-register/vc-checkin (bug#43188) Date: Sat, 05 Sep 2020 22:34:00 +0300 Message-ID: References: <20200904211737.15548.63989@vcs0.savannah.gnu.org> <20200904211738.DA94720667@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26194"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 05 21:34:42 2020 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 1kEdxR-0006ia-So for ged-emacs-devel@m.gmane-mx.org; Sat, 05 Sep 2020 21:34:41 +0200 Original-Received: from localhost ([::1]:35690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEdxQ-0006Ww-VL for ged-emacs-devel@m.gmane-mx.org; Sat, 05 Sep 2020 15:34:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEdws-00063j-Vz for emacs-devel@gnu.org; Sat, 05 Sep 2020 15:34:07 -0400 Original-Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]:40028) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEdwr-0004dA-8c for emacs-devel@gnu.org; Sat, 05 Sep 2020 15:34:06 -0400 Original-Received: by mail-lj1-x243.google.com with SMTP id s205so11708547lja.7 for ; Sat, 05 Sep 2020 12:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=5NEmi2rnK7YSh1rEtgxVE1qRkHizlUFsG6p7szKAJUw=; b=fIxUVCYE7T1nFgHNs4GoyXenkPrNcRFuT0UG6Pim4hyTAeIt6sW09cQuEU3A2jYwwJ EFsOeK/g5MjU0miVpYfmSZ031wz3xQWWqLGFekQjfcJhvEH+6WwLQ+Aog5MErt5vfEme jJHjJC0bDIJO/NZqS1b/HaPWci4PN2olVTxyeCZr+DZs+//WgvMYqNsxg3iXGjsxfzes 8oB3mhjq5samu6m9DU+22luuDHYAe4bhxodpgl/BkmGRCu4h2axV8n8X51B9/BkOsc4o EaYU6ELASQKfCDQH7Bybk9R7i1cqKHfZqIUP770DaPXLcbri9hzWa7s2mX2yx4qsum5A HdNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=5NEmi2rnK7YSh1rEtgxVE1qRkHizlUFsG6p7szKAJUw=; b=qAeyMq4cTf17ov7AzcHIKW2bBP50Ihcl40Fcl6toHmb+9knnrgxJIm9RVhwZcEEfjf rL+w7zRoVIZdUWT5CxJoP83Mre0UXANWhbIQN+5zX6rm4zT1Dv9Sq0arW7ol8+OVjmCR 4B8hJClB4hLXFFBwDHS11k6ZOnMeCzHnfM8mhwSFTnYKwUyC/fOT6RfdmF3SbJke3zuv 81WVf4H+n7K5WnHbPmNCS3mj7/uH5vivqqJaSy9bz2XW1ycBRH+BplTWB+CV/s3dJ4rG Kc+YE18imzMW/cgPdckiCzBVB3TlKQpfu6S+9P1XYT9Sg3K2FwcOlR+CCsncTtjKOcDu PQZQ== X-Gm-Message-State: AOAM531x6PpEjImejznfzIuxKF0l8pKfEvPxP0j8qn1plKtq1kTKixmo j2+FXslWRYsnoixfAuyYbMkIZeL8Kto= X-Google-Smtp-Source: ABdhPJyCE7PIG/PkrGJ1qEAnu9LO+IHcU390BfbmvA7RbGqjtp7Cjuss2lgYrX8jmH6vK0nKlx0JwA== X-Received: by 2002:a2e:3019:: with SMTP id w25mr6158374ljw.291.1599334442775; Sat, 05 Sep 2020 12:34:02 -0700 (PDT) Original-Received: from muffinmac ([91.206.110.147]) by smtp.gmail.com with ESMTPSA id f23sm2590478ljn.8.2020.09.05.12.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Sep 2020 12:34:01 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Fri, 04 Sep 2020 17:44:44 -0400") Received-SPF: pass client-ip=2a00:1450:4864:20::243; envelope-from=andreyk.mad@gmail.com; helo=mail-lj1-x243.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:254548 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: >> - (ewoc-invalidate vc-ewoc node)) >> + ;; `ewoc-invalidate' will kill line and insert new text, >> + ;; let's keep point column. >> + (let ((p (point))) >> + (ewoc-invalidate vc-ewoc node) >> + (goto-char p))) > > Shouldn't this be done in `ewoc-invalidate` instead? Good point! According 'ewoc-invalidate' docstring, refreshing is done by deleting the text and inserting the new one thus the 'save-excursion' is not really helpful. Please see attached patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Save-and-restore-point-in-ewoc-invalidate.patch >From 6f07dca7bff37c6ca7e98f38e8613445d3e8ea32 Mon Sep 17 00:00:00 2001 From: Andrii Kolomoiets Date: Sat, 5 Sep 2020 22:18:59 +0300 Subject: [PATCH] Save and restore point in ewoc-invalidate * lisp/emacs-lisp/ewoc.el (ewoc-invalidate): Use 'goto-char' instead of 'save-excursion'. * lisp/vc/vc-dir.el (vc-dir-update): Don't save/restore point on calling 'ewoc-invalidate'. --- lisp/emacs-lisp/ewoc.el | 5 +++-- lisp/vc/vc-dir.el | 6 +----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el index 78ada3e076..7244fd9359 100644 --- a/lisp/emacs-lisp/ewoc.el +++ b/lisp/emacs-lisp/ewoc.el @@ -461,9 +461,10 @@ ewoc-invalidate Delete current text first, thus effecting a \"refresh\"." (ewoc--set-buffer-bind-dll-let* ewoc ((pp (ewoc--pretty-printer ewoc))) - (save-excursion + (let ((p (point))) (dolist (node nodes) - (ewoc--refresh-node pp node dll))))) + (ewoc--refresh-node pp node dll)) + (goto-char p)))) (defun ewoc-goto-prev (ewoc arg) "Move point to the ARGth previous element in EWOC. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 6c219005ce..cdf8ab984e 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -451,11 +451,7 @@ vc-dir-update (setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry)) (setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry)) (setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil) - ;; `ewoc-invalidate' will kill line and insert new text, - ;; let's keep point column. - (let ((p (point))) - (ewoc-invalidate vc-ewoc node) - (goto-char p))) + (ewoc-invalidate vc-ewoc node)) ;; If the state is nil, the file does not exist ;; anymore, so remember the entry so we can remove ;; it after we are done inserting all ENTRIES. -- 2.15.1 --=-=-=--