unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Jen-Chieh Shen <jcs090218@gmail.com>, 42747@debbugs.gnu.org
Subject: bug#42747: 27.0.91; tabulated-list sort column scrolls window.
Date: Sun, 18 Oct 2020 15:12:11 -0700	[thread overview]
Message-ID: <CADwFkmm8AgT=NcUByfLF8dYESkYSTyeN8qJFpXkqethfb+j5bA@mail.gmail.com> (raw)
In-Reply-To: <838sep7dut.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Aug 2020 11:15:22 +0300")

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

tags 42747 + patch
thanks

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Jen-Chieh Shen <jcs090218@gmail.com>
>> Date: Fri, 7 Aug 2020 22:27:28 +0800
>>
>> While using mouse click on tabulated list's column header, the window
>> scroll to the bottom. Is this the normal action?
>
> It looks like it attempts to preserve both the screen position of
> point and the entry on which point is located.  So perhaps this is a
> "feature".  Try clicking on the header when the current entry is not
> the top-most to see what it's trying to do.

Yes, this is a misfeature.

Please test the attached patch and see if it works better.

[-- Attachment #2: 0001-Don-t-preserve-window-line-in-tabulated-list-print.patch --]
[-- Type: text/x-diff, Size: 2333 bytes --]

From def4001cd9b59af9ec604468a15951ea12729da9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Mon, 19 Oct 2020 00:04:58 +0200
Subject: [PATCH] Don't preserve window-line in tabulated-list-print

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print): Don't
try to preserve window-line.  (Bug#42747)
---
 lisp/emacs-lisp/tabulated-list.el | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index b13f609f88..d553a12442 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -404,8 +404,7 @@ tabulated-list-print
 buffer and inserts the entries with `tabulated-list-printer'.
 
 Optional argument REMEMBER-POS, if non-nil, means to move point
-to the entry with the same ID element as the current line and
-recenter window line accordingly.
+to the entry with the same ID element as the current line.
 
 Non-nil UPDATE argument means to use an alternative printing
 method which is faster if most entries haven't changed since the
@@ -418,18 +417,10 @@ tabulated-list-print
 		     (funcall tabulated-list-entries)
 		   tabulated-list-entries))
         (sorter (tabulated-list--get-sorter))
-	entry-id saved-pt saved-col window-line)
+        entry-id saved-pt saved-col)
     (and remember-pos
 	 (setq entry-id (tabulated-list-get-id))
-	 (setq saved-col (current-column))
-         (when (eq (window-buffer) (current-buffer))
-           (setq window-line
-                 (save-excursion
-                   (save-restriction
-                     (widen)
-                     (narrow-to-region (window-start) (point))
-                     (goto-char (point-min))
-                     (vertical-motion (buffer-size)))))))
+	 (setq saved-col (current-column)))
     ;; Sort the entries, if necessary.
     (when sorter
       (setq entries (sort entries sorter)))
@@ -484,9 +475,7 @@ tabulated-list-print
     ;; If REMEMBER-POS was specified, move to the "old" location.
     (if saved-pt
 	(progn (goto-char saved-pt)
-	       (move-to-column saved-col)
-	       (when window-line
-                 (recenter window-line)))
+	       (move-to-column saved-col))
       (goto-char (point-min)))))
 
 (defun tabulated-list-print-entry (id cols)
-- 
2.28.0


  reply	other threads:[~2020-10-18 22:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07 14:27 bug#42747: 27.0.91; tabulated-list sort column scrolls window Jen-Chieh Shen
2020-08-08  8:15 ` Eli Zaretskii
2020-10-18 22:12   ` Stefan Kangas [this message]
2021-04-09 16:26     ` Stefan Kangas

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='CADwFkmm8AgT=NcUByfLF8dYESkYSTyeN8qJFpXkqethfb+j5bA@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=42747@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jcs090218@gmail.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).