GNU bug report logs - #12253
Restore window start position

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 21 Aug 2012 22:23:01 UTC

Severity: normal

To reply to this bug, email your comments to 12253 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Tue, 21 Aug 2012 22:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 21 Aug 2012 22:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Restore window start position
Date: Wed, 22 Aug 2012 01:17:05 +0300
This is a request for improvement initiated in bug#12230 and
continued here in a new report.  The request is to restore the original
window start position when returning back to the previous node.

Martin writes in bug#12230:

>> +	  (set-window-start (selected-window) (nth 3 hist))))))
> [...]
>> +    (set-window-start (selected-window) ostart)))
> [...]
>> +    (set-window-start (selected-window) ostart)))
>
> Are you sure you want to force start positions here?

The first change in `Info-find-node-2' is needed to avoid recentering
when the target Info node does not exist and the reader stays in the
same node when the error message is reported in the echo area as
"No such node or anchor".  (What is interesting here is that this
change is needed only when the link leads to another Info file.
But when the link leads to another node of the same Info manual,
this change is not needed, because the window position stays the same.)

The second change in `Info-history-back' and in `Info-history-forward'
is to keep the original window positions while navigating through
the Info history backward and forward.  I think this has the same importance
as keeping the original window positions while navigating buffers
with `next-buffer' and `previous-buffer'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Wed, 22 Aug 2012 07:09:01 GMT) Full text and rfc822 format available.

Message #8 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Wed, 22 Aug 2012 09:08:24 +0200
> Martin writes in bug#12230:
>
>>> +	  (set-window-start (selected-window) (nth 3 hist))))))
>> [...]
>>> +    (set-window-start (selected-window) ostart)))
>> [...]
>>> +    (set-window-start (selected-window) ostart)))
>> Are you sure you want to force start positions here?
[...]
> The second change in `Info-history-back' and in `Info-history-forward'
> is to keep the original window positions while navigating through
> the Info history backward and forward.  I think this has the same importance
> as keeping the original window positions while navigating buffers
> with `next-buffer' and `previous-buffer'.

I fully agree with you.  But I was curious whether setting the window
start position should be allowed to override any (goto-char opoint)
following or preceding it (just in case a window got resized during
navigation).

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Wed, 22 Aug 2012 23:46:02 GMT) Full text and rfc822 format available.

Message #11 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Thu, 23 Aug 2012 02:38:44 +0300
> I fully agree with you.  But I was curious whether setting the window
> start position should be allowed to override any (goto-char opoint)
> following or preceding it (just in case a window got resized during
> navigation).

I see what you mean - the problem handled by
`set-window-buffer-start-and-point'.  Of course,
this function can't be used in Info, but its precautions
of not forcing window-start (the argument NOFORCE
of `set-window-start') and the order of calling
`set-window-start' and `goto-char' afterward
can be applied to Info like in the following patch
(I guess using `set-window-point' instead of `goto-char'
is not applicable to Info):

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-08-21 00:12:42 +0000
+++ lisp/info.el	2012-08-22 23:35:48 +0000
@@ -40,11 +40,11 @@ (defgroup info nil
 
 (defvar Info-history nil
   "Stack of Info nodes user has visited.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
 
 (defvar Info-history-forward nil
   "Stack of Info nodes user has visited with `Info-history-back' command.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
 
 (defvar Info-history-list nil
   "List of all Info nodes user has visited.
@@ -922,7 +925,7 @@ (defun Info-find-node (filename nodename
   ;; Record the node we are leaving, if we were in one.
   (and (not no-going-back)
        Info-current-file
-       (push (list Info-current-file Info-current-node (point))
+       (push (list Info-current-file Info-current-node (point) (window-start))
              Info-history))
   (Info-find-node-2 filename nodename no-going-back))
 
@@ -956,7 +959,7 @@ (defun Info-revert-find-node (filename n
 	(pline        (count-lines (point-min) (line-beginning-position)))
 	(wline        (count-lines (point-min) (window-start)))
 	(new-history  (and Info-current-file
-			   (list Info-current-file Info-current-node (point)))))
+			   (list Info-current-file Info-current-node (point) (window-start)))))
     ;; When `Info-current-file' is nil, `Info-find-node-2' rereads the file.
     (setq Info-current-file nil)
     (Info-find-node filename nodename)
@@ -1226,7 +1229,8 @@ (defun Info-find-node-2 (filename nodena
         (let ((hist (car Info-history)))
           (setq Info-history (cdr Info-history))
           (Info-find-node (nth 0 hist) (nth 1 hist) t)
-          (goto-char (nth 2 hist))))))
+          (set-window-start (selected-window) (nth 3 hist) t)
+          (goto-char (nth 2 hist))))))
 
 ;; Cache the contents of the (virtual) dir file, once we have merged
 ;; it for the first time, so we can save time subsequently.
@@ -2002,7 +2008,7 @@ (defun Info-search (regexp &optional bou
 	       (equal ofile Info-current-file))
           (and isearch-mode isearch-wrapped
 	       (eq opoint (if isearch-forward opoint-min opoint-max)))
-	  (setq Info-history (cons (list ofile onode opoint)
+	  (setq Info-history (cons (list ofile onode opoint ostart)
 				   Info-history))))))
 
 (defun Info-search-case-sensitively ()
@@ -2208,16 +2214,18 @@ (defun Info-history-back ()
   (or Info-history
       (user-error "This is the first Info node you looked at"))
   (let ((history-forward
-	 (cons (list Info-current-file Info-current-node (point))
+	 (cons (list Info-current-file Info-current-node (point) (window-start))
 	       Info-history-forward))
-	filename nodename opoint)
+	filename nodename opoint ostart)
     (setq filename (car (car Info-history)))
     (setq nodename (car (cdr (car Info-history))))
     (setq opoint (car (cdr (cdr (car Info-history)))))
+    (setq ostart (car (cdr (cdr (cdr (car Info-history))))))
     (setq Info-history (cdr Info-history))
     (Info-find-node filename nodename)
     (setq Info-history (cdr Info-history))
     (setq Info-history-forward history-forward)
+    (set-window-start (selected-window) ostart t)
     (goto-char opoint)))
 
 (defalias 'Info-last 'Info-history-back)
@@ -2228,12 +2236,14 @@ (defun Info-history-forward ()
   (or Info-history-forward
       (user-error "This is the last Info node you looked at"))
   (let ((history-forward (cdr Info-history-forward))
-	filename nodename opoint)
+	filename nodename opoint ostart)
     (setq filename (car (car Info-history-forward)))
     (setq nodename (car (cdr (car Info-history-forward))))
     (setq opoint (car (cdr (cdr (car Info-history-forward)))))
+    (setq ostart (car (cdr (cdr (cdr (car Info-history-forward))))))
     (Info-find-node filename nodename)
     (setq Info-history-forward history-forward)
+    (set-window-start (selected-window) ostart t)
     (goto-char opoint)))
 
 (add-to-list 'Info-virtual-files
@@ -4307,7 +4317,7 @@ (defun Info-find-emacs-command-nodes (co
 	      (setq where
 		    (cons (list Info-current-file
 				(match-string-no-properties 2)
-				0)
+				0 0)
 			  where))
 	      (setq line-number (and (match-beginning 3)
 				     (string-to-number (match-string 3)))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Thu, 23 Aug 2012 08:50:03 GMT) Full text and rfc822 format available.

Message #14 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Thu, 23 Aug 2012 10:48:53 +0200
> (I guess using `set-window-point' instead of `goto-char'
> is not applicable to Info):

Why not?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Thu, 23 Aug 2012 22:03:02 GMT) Full text and rfc822 format available.

Message #17 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Fri, 24 Aug 2012 01:00:41 +0300
>> (I guess using `set-window-point' instead of `goto-char'
>> is not applicable to Info):
>
> Why not?

Usually Info widens the Info buffer, moves point using `goto-char' and
finally narrows the buffer to the current node.  There is no way to use
`set-window-point' in this workflow.  Other places (that move point
after narrowing) could use the same function `goto-char' for consistency.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Fri, 24 Aug 2012 09:47:01 GMT) Full text and rfc822 format available.

Message #20 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Fri, 24 Aug 2012 11:45:20 +0200
> Usually Info widens the Info buffer, moves point using `goto-char' and
> finally narrows the buffer to the current node.  There is no way to use
> `set-window-point' in this workflow.  Other places (that move point
> after narrowing) could use the same function `goto-char' for consistency.

Conceptually, `goto-char' and `set-window-point' are idempotent with the
current buffer in the selected window.  Now *info* synchronizes
navigation in all windows showing *info*.  But if I split an *info*
window showing the (narrowed) beginning of *info* and do

(set-window-point (window-in-direction 'below) (point-max))

with the upper window selected, the lower window shows the (narrowed)
end of *info* and

(with-selected-window (window-in-direction 'below)
  (goto-char (point-max)))

does the same.  So I still miss you.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Sat, 25 Aug 2012 00:54:01 GMT) Full text and rfc822 format available.

Message #23 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Sat, 25 Aug 2012 03:29:39 +0300
> (set-window-point (window-in-direction 'below) (point-max))
>
> with the upper window selected, the lower window shows the (narrowed)
> end of *info* and
>
> (with-selected-window (window-in-direction 'below)
>   (goto-char (point-max)))
>
> does the same.  So I still miss you.

These functions might be used non-interactively,
where the *info* buffer is not displayed in any window,
e.g.:

  (with-current-buffer "*info*"
    (Info-history-back))

so in this case `goto-char' should be used instead of `set-window-point'
in `Info-history-back' and other similar functions.

It is true that in the latest patch, `set-window-start'
is not guarded against this use case.  To guarantee that the
function operates on the window that displays the current buffer,
we could add the following condition (this patch is based on the
previous patch that adds `set-window-start'):

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-08-22 23:45:47 +0000
+++ lisp/info.el	2012-08-25 00:28:00 +0000
@@ -2225,7 +2225,8 @@ (defun Info-history-back ()
     (Info-find-node filename nodename)
     (setq Info-history (cdr Info-history))
     (setq Info-history-forward history-forward)
-    (set-window-start (selected-window) ostart t)
+    (when (eq (window-buffer) (current-buffer))
+      (set-window-start (selected-window) ostart t))
     (goto-char opoint)))
 
If you agree that this is the right thing to do
then other places could be changed accordingly as well.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Sat, 25 Aug 2012 13:42:01 GMT) Full text and rfc822 format available.

Message #26 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Sat, 25 Aug 2012 15:40:26 +0200
> These functions might be used non-interactively,
> where the *info* buffer is not displayed in any window,
> e.g.:
>
>   (with-current-buffer "*info*"
>     (Info-history-back))

Aha

> so in this case `goto-char' should be used instead of `set-window-point'
> in `Info-history-back' and other similar functions.
>
> It is true that in the latest patch, `set-window-start'
> is not guarded against this use case.

This must have been the inconsistency that troubled my subconsciousness.

> To guarantee that the
> function operates on the window that displays the current buffer,
> we could add the following condition (this patch is based on the
> previous patch that adds `set-window-start'):
>
> === modified file 'lisp/info.el'
> --- lisp/info.el	2012-08-22 23:45:47 +0000
> +++ lisp/info.el	2012-08-25 00:28:00 +0000
> @@ -2225,7 +2225,8 @@ (defun Info-history-back ()
>      (Info-find-node filename nodename)
>      (setq Info-history (cdr Info-history))
>      (setq Info-history-forward history-forward)
> -    (set-window-start (selected-window) ostart t)
> +    (when (eq (window-buffer) (current-buffer))
> +      (set-window-start (selected-window) ostart t))
>      (goto-char opoint)))
>
> If you agree that this is the right thing to do
> then other places could be changed accordingly as well.

I agree.  How do you handle the case where *info* is not in the selected
window but some other one?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Sat, 25 Aug 2012 19:54:01 GMT) Full text and rfc822 format available.

Message #29 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Sat, 25 Aug 2012 22:29:42 +0300
> I agree.  How do you handle the case where *info* is not in the selected
> window but some other one?

We don't need to care about this case.  When used programmatically,
the caller should handle also the case when *info* is in another window,
e.g.:

  (with-current-buffer "*info*"
    ...
    (Info-history-back)
    (set-window-start (window-in-direction 'below) opoint)
    ...)

or some more specific logic when necessary.

But for the normal case, I think the following patch should be enough:

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-08-21 00:12:42 +0000
+++ lisp/info.el	2012-08-25 19:29:04 +0000
@@ -40,11 +40,11 @@ (defgroup info nil
 
 (defvar Info-history nil
   "Stack of Info nodes user has visited.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
 
 (defvar Info-history-forward nil
   "Stack of Info nodes user has visited with `Info-history-back' command.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
 
 (defvar Info-history-list nil
   "List of all Info nodes user has visited.
@@ -922,7 +925,9 @@ (defun Info-find-node (filename nodename
   ;; Record the node we are leaving, if we were in one.
   (and (not no-going-back)
        Info-current-file
-       (push (list Info-current-file Info-current-node (point))
+       (push (list Info-current-file Info-current-node (point)
+		   (and (eq (window-buffer) (current-buffer))
+			(window-start)))
              Info-history))
   (Info-find-node-2 filename nodename no-going-back))
 
@@ -956,7 +961,9 @@ (defun Info-revert-find-node (filename n
 	(pline        (count-lines (point-min) (line-beginning-position)))
 	(wline        (count-lines (point-min) (window-start)))
 	(new-history  (and Info-current-file
-			   (list Info-current-file Info-current-node (point)))))
+			   (list Info-current-file Info-current-node (point)
+				 (and (eq (window-buffer) (current-buffer))
+				      (window-start))))))
     ;; When `Info-current-file' is nil, `Info-find-node-2' rereads the file.
     (setq Info-current-file nil)
     (Info-find-node filename nodename)
@@ -1226,6 +1233,8 @@ (defun Info-find-node-2 (filename nodena
         (let ((hist (car Info-history)))
           (setq Info-history (cdr Info-history))
           (Info-find-node (nth 0 hist) (nth 1 hist) t)
+          (when (and (nth 3 hist) (eq (window-buffer) (current-buffer)))
+	    (set-window-start (selected-window) (nth 3 hist) t))
           (goto-char (nth 2 hist))))))
 
 ;; Cache the contents of the (virtual) dir file, once we have merged
@@ -2002,7 +2013,7 @@ (defun Info-search (regexp &optional bou
 	       (equal ofile Info-current-file))
           (and isearch-mode isearch-wrapped
 	       (eq opoint (if isearch-forward opoint-min opoint-max)))
-	  (setq Info-history (cons (list ofile onode opoint)
+	  (setq Info-history (cons (list ofile onode opoint ostart)
 				   Info-history))))))
 
 (defun Info-search-case-sensitively ()
@@ -2208,16 +2219,21 @@ (defun Info-history-back ()
   (or Info-history
       (user-error "This is the first Info node you looked at"))
   (let ((history-forward
-	 (cons (list Info-current-file Info-current-node (point))
+	 (cons (list Info-current-file Info-current-node (point)
+		     (and (eq (window-buffer) (current-buffer))
+			  (window-start)))
 	       Info-history-forward))
-	filename nodename opoint)
+	filename nodename opoint ostart)
     (setq filename (car (car Info-history)))
     (setq nodename (car (cdr (car Info-history))))
     (setq opoint (car (cdr (cdr (car Info-history)))))
+    (setq ostart (car (cdr (cdr (cdr (car Info-history))))))
     (setq Info-history (cdr Info-history))
     (Info-find-node filename nodename)
     (setq Info-history (cdr Info-history))
     (setq Info-history-forward history-forward)
+    (when (and ostart (eq (window-buffer) (current-buffer)))
+      (set-window-start (selected-window) ostart t))
     (goto-char opoint)))
 
 (defalias 'Info-last 'Info-history-back)
@@ -2228,12 +2244,15 @@ (defun Info-history-forward ()
   (or Info-history-forward
       (user-error "This is the last Info node you looked at"))
   (let ((history-forward (cdr Info-history-forward))
-	filename nodename opoint)
+	filename nodename opoint ostart)
     (setq filename (car (car Info-history-forward)))
     (setq nodename (car (cdr (car Info-history-forward))))
     (setq opoint (car (cdr (cdr (car Info-history-forward)))))
+    (setq ostart (car (cdr (cdr (cdr (car Info-history-forward))))))
     (Info-find-node filename nodename)
     (setq Info-history-forward history-forward)
+    (when (and ostart (eq (window-buffer) (current-buffer)))
+      (set-window-start (selected-window) ostart t))
     (goto-char opoint)))
 
 (add-to-list 'Info-virtual-files
@@ -4307,7 +4326,7 @@ (defun Info-find-emacs-command-nodes (co
 	      (setq where
 		    (cons (list Info-current-file
 				(match-string-no-properties 2)
-				0)
+				0 0)
 			  where))
 	      (setq line-number (and (match-beginning 3)
 				     (string-to-number (match-string 3)))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Tue, 28 Aug 2012 09:06:02 GMT) Full text and rfc822 format available.

Message #32 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Tue, 28 Aug 2012 11:53:42 +0300
> But for the normal case, I think the following patch should be enough:

Actually this has no effect in Info when isearch returns to the previous node
with DEL ("isearch-delete-char").  So isearch could remember the original
window start position in `isearch-state' and restore it as well.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Wed, 16 Jan 2013 16:58:01 GMT) Full text and rfc822 format available.

Message #35 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>, "'martin rudalics'" <rudalics <at> gmx.at>
Cc: 12253 <at> debbugs.gnu.org
Subject: RE: bug#12253: Restore window start position
Date: Wed, 16 Jan 2013 08:57:18 -0800
[Message part 1 (text/plain, inline)]
The attached patch seems to fix the Isearch problem generally, restoring the
original position of point within the window.
[isearch-2011-05-16.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Fri, 18 Jan 2013 22:44:02 GMT) Full text and rfc822 format available.

Message #38 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>, "'martin rudalics'" <rudalics <at> gmx.at>
Cc: 12253 <at> debbugs.gnu.org
Subject: RE: bug#12253: Restore window start position
Date: Fri, 18 Jan 2013 14:42:22 -0800
[Message part 1 (text/plain, inline)]
> The attached patch seems to fix the Isearch problem 
> generally, restoring the
> original position of point within the window.

Oops.  I sent the wrong patch somehow, as should have been obvious if anyone
looked at it.  Here is the correct patch, which fixes this Isearch problem.
[isearch-2013-01-16.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Sat, 19 Jan 2013 10:19:01 GMT) Full text and rfc822 format available.

Message #41 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'martin rudalics' <rudalics <at> gmx.at>, 12253 <at> debbugs.gnu.org
Subject: Re: bug#12253: Restore window start position
Date: Sat, 19 Jan 2013 12:17:30 +0200
> +         isearch-win-pt-line (- (line-number-at-pos)
> +                                (line-number-at-pos (window-start)))
> ...
> !     (when isearch-win-pt-line (recenter isearch-win-pt-line)))

Why do you use `line-number-at-pos' and `recenter' instead of
`window-start' and `set-window-start'?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Sat, 19 Jan 2013 15:05:02 GMT) Full text and rfc822 format available.

Message #44 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>
Cc: 'martin rudalics' <rudalics <at> gmx.at>, 12253 <at> debbugs.gnu.org
Subject: RE: bug#12253: Restore window start position
Date: Sat, 19 Jan 2013 07:03:40 -0800
> > +         isearch-win-pt-line (- (line-number-at-pos)
> > +                                (line-number-at-pos 
> (window-start)))
> > ...
> > !     (when isearch-win-pt-line (recenter isearch-win-pt-line)))
> 
> Why do you use `line-number-at-pos' and `recenter' instead of
> `window-start' and `set-window-start'?

No special reason.  It's probably just what occurred to me.

Aren't they equivalent in effect, though not necessarily in performance?  Feel
free to use whichever approach you feel is better.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Fri, 29 Mar 2013 17:00:02 GMT) Full text and rfc822 format available.

Message #47 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>
Cc: 12253 <at> debbugs.gnu.org
Subject: RE: bug#12253: Restore window start position
Date: Fri, 29 Mar 2013 09:56:53 -0700
ping.

Any special reason why the patch provided or some other fix has not yet been
applied to fix this bug?  (Or has it been fixed and should thus be closed?)

> Sent: Saturday, January 19, 2013 7:04 AM
> > > +         isearch-win-pt-line (- (line-number-at-pos)
> > > +                                (line-number-at-pos 
> > (window-start)))
> > > ...
> > > !     (when isearch-win-pt-line (recenter isearch-win-pt-line)))
> > 
> > Why do you use `line-number-at-pos' and `recenter' instead of
> > `window-start' and `set-window-start'?
> 
> No special reason.  It's probably just what occurred to me.
> 
> Aren't they equivalent in effect, though not necessarily in 
> performance?  Feel free to use whichever approach you feel is better.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Tue, 11 May 2021 14:34:01 GMT) Full text and rfc822 format available.

Message #50 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Drew Adams <drew.adams <at> oracle.com>, 'Juri Linkov' <juri <at> jurta.org>
Cc: "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>
Subject: RE: bug#12253: Restore window start position
Date: Tue, 11 May 2021 14:33:45 +0000
> Sent: Friday, March 29, 2013 9:57 AM
> 
> ping.
> 
> Any special reason why the patch provided or some other fix has not yet
> been applied to fix this bug?  (Or has it been fixed and should thus be
> closed?)

ping.  Still unaddressed, after 8 more years?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Tue, 11 May 2021 18:32:02 GMT) Full text and rfc822 format available.

Message #53 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>
Subject: Re: bug#12253: Restore window start position
Date: Tue, 11 May 2021 20:53:50 +0300
>> Sent: Friday, March 29, 2013 9:57 AM
>>
>> ping.
>>
>> Any special reason why the patch provided or some other fix has not yet
>> been applied to fix this bug?  (Or has it been fixed and should thus be
>> closed?)
>
> ping.  Still unaddressed, after 8 more years?

Please concretize what is unaddressed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Tue, 11 May 2021 18:47:01 GMT) Full text and rfc822 format available.

Message #56 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>
Subject: RE: [External] : Re: bug#12253: Restore window start position
Date: Tue, 11 May 2021 18:46:25 +0000
> >> ping.
> >>
> >> Any special reason why the patch provided or some other fix has not
> >> yet been applied to fix this bug?  (Or has it been fixed and should
> >> thus be closed?)
> >
> > ping.  Still unaddressed, after 8 more years?
> 
> Please concretize what is unaddressed.

The questions posed are concrete.  What about the patch
I provided?  Or some other fix?  Or has it been fixed
and should be closed?

If you feel that everything has been addressed, then
why not close the bug.  If not, then please "concretize
what is unaddressed".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Tue, 11 May 2021 19:32:02 GMT) Full text and rfc822 format available.

Message #59 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>
Subject: Re: [External] : Re: bug#12253: Restore window start position
Date: Tue, 11 May 2021 22:29:12 +0300
>> >> ping.
>> >>
>> >> Any special reason why the patch provided or some other fix has not
>> >> yet been applied to fix this bug?  (Or has it been fixed and should
>> >> thus be closed?)
>> >
>> > ping.  Still unaddressed, after 8 more years?
>>
>> Please concretize what is unaddressed.
>
> The questions posed are concrete.  What about the patch
> I provided?  Or some other fix?  Or has it been fixed
> and should be closed?
>
> If you feel that everything has been addressed, then
> why not close the bug.  If not, then please "concretize
> what is unaddressed".

This is not helpful.  It was many years ago, and I don't remember the details.
In bug#12253 there is a patch that restores the window position
when navigating back in Info history.  I could try to rebase it
if there is still an interest in such improvement.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Tue, 11 May 2021 20:19:01 GMT) Full text and rfc822 format available.

Message #62 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>
Subject: RE: [External] : Re: bug#12253: Restore window start position
Date: Tue, 11 May 2021 20:18:06 +0000
> >> >> ping.
> >> >>
> >> >> Any special reason why the patch provided or some other fix has
> not
> >> >> yet been applied to fix this bug?  (Or has it been fixed and
> should
> >> >> thus be closed?)
> >> >
> >> > ping.  Still unaddressed, after 8 more years?
> >>
> >> Please concretize what is unaddressed.
> >
> > The questions posed are concrete.  What about the patch
> > I provided?  Or some other fix?  Or has it been fixed
> > and should be closed?
> >
> > If you feel that everything has been addressed, then
> > why not close the bug.  If not, then please "concretize
> > what is unaddressed".
> 
> This is not helpful.  It was many years ago, and I don't remember the
> details.
> In bug#12253 there is a patch that restores the window position
> when navigating back in Info history.  I could try to rebase it
> if there is still an interest in such improvement.

(There are at least 4 patches in-line in the bug
report, and I submitted a 5th one.)

Either you feel the bug has been fixed, in which case
perhaps you'd like to close it.

Or you feel it hasn't been fixed.

In the latter case, how about the patch I sent to fix
it?  If you don't want to use it, maybe say why it
doesn't fix the bug; or why you prefer another solution
(if so, what?); or what part of the bug you feel would
still be unaddressed if it were applied.

(FWIW, I've used essentially the code in the patch I
sent, in isearch+.el, since 2013.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Wed, 12 May 2021 08:48:02 GMT) Full text and rfc822 format available.

Message #65 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>, Drew Adams <drew.adams <at> oracle.com>
Cc: "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>
Subject: Re: bug#12253: [External] : Re: bug#12253: Restore window start
 position
Date: Wed, 12 May 2021 10:47:26 +0200
> This is not helpful.  It was many years ago, and I don't remember the details.
> In bug#12253 there is a patch that restores the window position
> when navigating back in Info history.  I could try to rebase it
> if there is still an interest in such improvement.

I think you should try to do that.  Any sort of navigation should
restore window start and window point positions whenever possible.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Wed, 10 Jan 2024 11:33:02 GMT) Full text and rfc822 format available.

Message #68 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Juri Linkov <juri <at> jurta.org>,
 "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>,
 Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#12253: Restore window start position
Date: Wed, 10 Jan 2024 03:31:57 -0800
martin rudalics <rudalics <at> gmx.at> writes:

>> This is not helpful.  It was many years ago, and I don't remember the details.
>> In bug#12253 there is a patch that restores the window position
>> when navigating back in Info history.  I could try to rebase it
>> if there is still an interest in such improvement.
>
> I think you should try to do that.  Any sort of navigation should
> restore window start and window point positions whenever possible.

Did you make any progress with this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12253; Package emacs. (Wed, 10 Jan 2024 17:22:01 GMT) Full text and rfc822 format available.

Message #71 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: martin rudalics <rudalics <at> gmx.at>,
 "12253 <at> debbugs.gnu.org" <12253 <at> debbugs.gnu.org>,
 Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#12253: Restore window start position
Date: Wed, 10 Jan 2024 19:16:43 +0200
>>> This is not helpful.  It was many years ago, and I don't remember the details.
>>> In bug#12253 there is a patch that restores the window position
>>> when navigating back in Info history.  I could try to rebase it
>>> if there is still an interest in such improvement.
>>
>> I think you should try to do that.  Any sort of navigation should
>> restore window start and window point positions whenever possible.
>
> Did you make any progress with this?

With Info history or with Isearch history?

Here is how to restore the window position
when navigating back in Isearch history:

#+begin_src emacs-lisp
(setq isearch-push-state-function
      (lambda ()
        ;; Recenter new search hits outside of window boundaries
        (when (and isearch-success
                   (not (pos-visible-in-window-p)))
	  (recenter))
        `(lambda (cmd)
           (when isearch-success
             (set-window-start nil ,(window-start))))))
#+end_src




This bug report was last modified 1 year and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.