* bug#12253: Restore window start position
@ 2012-08-21 22:17 Juri Linkov
2012-08-22 7:08 ` martin rudalics
0 siblings, 1 reply; 23+ messages in thread
From: Juri Linkov @ 2012-08-21 22:17 UTC (permalink / raw)
To: 12253
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'.
^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-21 22:17 bug#12253: Restore window start position Juri Linkov @ 2012-08-22 7:08 ` martin rudalics 2012-08-22 23:38 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: martin rudalics @ 2012-08-22 7:08 UTC (permalink / raw) To: Juri Linkov; +Cc: 12253 > 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 ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-22 7:08 ` martin rudalics @ 2012-08-22 23:38 ` Juri Linkov 2012-08-23 8:48 ` martin rudalics 0 siblings, 1 reply; 23+ messages in thread From: Juri Linkov @ 2012-08-22 23:38 UTC (permalink / raw) To: martin rudalics; +Cc: 12253 > 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))) \f (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))))) ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-22 23:38 ` Juri Linkov @ 2012-08-23 8:48 ` martin rudalics 2012-08-23 22:00 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: martin rudalics @ 2012-08-23 8:48 UTC (permalink / raw) To: Juri Linkov; +Cc: 12253 > (I guess using `set-window-point' instead of `goto-char' > is not applicable to Info): Why not? martin ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-23 8:48 ` martin rudalics @ 2012-08-23 22:00 ` Juri Linkov 2012-08-24 9:45 ` martin rudalics 0 siblings, 1 reply; 23+ messages in thread From: Juri Linkov @ 2012-08-23 22:00 UTC (permalink / raw) To: martin rudalics; +Cc: 12253 >> (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. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-23 22:00 ` Juri Linkov @ 2012-08-24 9:45 ` martin rudalics 2012-08-25 0:29 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: martin rudalics @ 2012-08-24 9:45 UTC (permalink / raw) To: Juri Linkov; +Cc: 12253 > 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 ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-24 9:45 ` martin rudalics @ 2012-08-25 0:29 ` Juri Linkov 2012-08-25 13:40 ` martin rudalics 0 siblings, 1 reply; 23+ messages in thread From: Juri Linkov @ 2012-08-25 0:29 UTC (permalink / raw) To: martin rudalics; +Cc: 12253 > (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. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-25 0:29 ` Juri Linkov @ 2012-08-25 13:40 ` martin rudalics 2012-08-25 19:29 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: martin rudalics @ 2012-08-25 13:40 UTC (permalink / raw) To: Juri Linkov; +Cc: 12253 > 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 ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-25 13:40 ` martin rudalics @ 2012-08-25 19:29 ` Juri Linkov 2012-08-28 8:53 ` Juri Linkov 2013-01-16 16:57 ` Drew Adams 0 siblings, 2 replies; 23+ messages in thread From: Juri Linkov @ 2012-08-25 19:29 UTC (permalink / raw) To: martin rudalics; +Cc: 12253 > 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))) \f (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))))) ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-25 19:29 ` Juri Linkov @ 2012-08-28 8:53 ` Juri Linkov 2013-01-16 16:57 ` Drew Adams 1 sibling, 0 replies; 23+ messages in thread From: Juri Linkov @ 2012-08-28 8:53 UTC (permalink / raw) To: martin rudalics; +Cc: 12253 > 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. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2012-08-25 19:29 ` Juri Linkov 2012-08-28 8:53 ` Juri Linkov @ 2013-01-16 16:57 ` Drew Adams 2013-01-18 22:42 ` Drew Adams 1 sibling, 1 reply; 23+ messages in thread From: Drew Adams @ 2013-01-16 16:57 UTC (permalink / raw) To: 'Juri Linkov', 'martin rudalics'; +Cc: 12253 [-- Attachment #1: Type: text/plain, Size: 123 bytes --] The attached patch seems to fix the Isearch problem generally, restoring the original position of point within the window. [-- Attachment #2: isearch-2011-05-16.patch --] [-- Type: application/octet-stream, Size: 1968 bytes --] diff -cw isearch.el isearch-patched-2011-05-16.el *** isearch.el Mon May 16 11:38:22 2011 --- isearch-patched-2011-05-16.el Mon May 16 14:21:04 2011 *************** *** 1060,1065 **** --- 1060,1080 ---- (defvar minibuffer-history-symbol) ;; from external package gmhist.el + (defun isearch-fail-pos () + "Position of first mismatch in search string, or its length if none." + (let ((cmds isearch-cmds) + succ-msg) + (if (and isearch-success (not isearch-error)) + (length isearch-message) + (while (or (not (isearch-success-state (car cmds))) + (isearch-error-state (car cmds))) + (pop cmds)) + (setq succ-msg (and cmds (isearch-message-state (car cmds)))) + (if (and (stringp succ-msg) (< (length succ-msg) (length isearch-message)) + (equal succ-msg (substring isearch-message 0 (length succ-msg)))) + (length succ-msg) + 0)))) + (defun isearch-edit-string () "Edit the search string in the minibuffer. The following additional command keys are active while editing. *************** *** 1139,1145 **** (setq isearch-new-string (read-from-minibuffer (isearch-message-prefix nil nil isearch-nonincremental) ! isearch-string minibuffer-local-isearch-map nil (if isearch-regexp (cons 'regexp-search-ring --- 1154,1160 ---- (setq isearch-new-string (read-from-minibuffer (isearch-message-prefix nil nil isearch-nonincremental) ! (cons isearch-string (1+ (isearch-fail-pos))) minibuffer-local-isearch-map nil (if isearch-regexp (cons 'regexp-search-ring Diff finished. Mon May 16 14:23:06 2011 ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2013-01-16 16:57 ` Drew Adams @ 2013-01-18 22:42 ` Drew Adams 2013-01-19 10:17 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: Drew Adams @ 2013-01-18 22:42 UTC (permalink / raw) To: 'Juri Linkov', 'martin rudalics'; +Cc: 12253 [-- Attachment #1: Type: text/plain, Size: 284 bytes --] > 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. [-- Attachment #2: isearch-2013-01-16.patch --] [-- Type: application/octet-stream, Size: 2061 bytes --] diff -c isearch.el isearch-patched-2013-01-16.el *** isearch.el Wed Jan 16 08:49:58 2013 --- isearch-patched-2013-01-16.el Wed Jan 16 08:51:10 2013 *************** *** 605,610 **** --- 605,612 ---- (defvar isearch-opoint 0) ;; The window configuration active at the beginning of the search. (defvar isearch-window-configuration nil) + ;; The line number of point before searching, relative to the line number of `window-start'. + (defvar isearch-win-pt-line nil) ;; Flag to indicate a yank occurred, so don't move the cursor. (defvar isearch-yank-flag nil) *************** *** 827,832 **** --- 829,836 ---- isearch-start-hscroll (window-hscroll) isearch-opoint (point) + isearch-win-pt-line (- (line-number-at-pos) + (line-number-at-pos (window-start))) search-ring-yank-pointer nil isearch-opened-overlays nil isearch-input-method-function input-method-function *************** *** 1307,1314 **** ;; For defined push-state function, restore the first state. ;; This calls pop-state function and restores original point. (let ((isearch-cmds (last isearch-cmds))) ! (isearch--set-state (car isearch-cmds))) ! (goto-char isearch-opoint)) (isearch-done t) ; Exit isearch.. (isearch-clean-overlays) (signal 'quit nil)) ; ..and pass on quit signal. --- 1311,1320 ---- ;; For defined push-state function, restore the first state. ;; This calls pop-state function and restores original point. (let ((isearch-cmds (last isearch-cmds))) ! (isearch--set-state (car isearch-cmds)) ! (when isearch-win-pt-line (recenter isearch-win-pt-line))) ! (goto-char isearch-opoint) ! (when isearch-win-pt-line (recenter isearch-win-pt-line))) (isearch-done t) ; Exit isearch.. (isearch-clean-overlays) (signal 'quit nil)) ; ..and pass on quit signal. Diff finished. Wed Jan 16 15:52:01 2013 ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2013-01-18 22:42 ` Drew Adams @ 2013-01-19 10:17 ` Juri Linkov 2013-01-19 15:03 ` Drew Adams 0 siblings, 1 reply; 23+ messages in thread From: Juri Linkov @ 2013-01-19 10:17 UTC (permalink / raw) To: Drew Adams; +Cc: 12253 > + 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'? ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2013-01-19 10:17 ` Juri Linkov @ 2013-01-19 15:03 ` Drew Adams 2013-03-29 16:56 ` Drew Adams 0 siblings, 1 reply; 23+ messages in thread From: Drew Adams @ 2013-01-19 15:03 UTC (permalink / raw) To: 'Juri Linkov'; +Cc: 12253 > > + 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. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2013-01-19 15:03 ` Drew Adams @ 2013-03-29 16:56 ` Drew Adams 2021-05-11 14:33 ` Drew Adams 0 siblings, 1 reply; 23+ messages in thread From: Drew Adams @ 2013-03-29 16:56 UTC (permalink / raw) To: 'Juri Linkov'; +Cc: 12253 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. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2013-03-29 16:56 ` Drew Adams @ 2021-05-11 14:33 ` Drew Adams 2021-05-11 17:53 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: Drew Adams @ 2021-05-11 14:33 UTC (permalink / raw) To: Drew Adams, 'Juri Linkov'; +Cc: 12253@debbugs.gnu.org > 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? ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2021-05-11 14:33 ` Drew Adams @ 2021-05-11 17:53 ` Juri Linkov 2021-05-11 18:46 ` bug#12253: [External] : " Drew Adams 0 siblings, 1 reply; 23+ messages in thread From: Juri Linkov @ 2021-05-11 17:53 UTC (permalink / raw) To: Drew Adams; +Cc: 12253@debbugs.gnu.org >> 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. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: [External] : Re: bug#12253: Restore window start position 2021-05-11 17:53 ` Juri Linkov @ 2021-05-11 18:46 ` Drew Adams 2021-05-11 19:29 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: Drew Adams @ 2021-05-11 18:46 UTC (permalink / raw) To: Juri Linkov; +Cc: 12253@debbugs.gnu.org > >> 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". ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: [External] : Re: bug#12253: Restore window start position 2021-05-11 18:46 ` bug#12253: [External] : " Drew Adams @ 2021-05-11 19:29 ` Juri Linkov 2021-05-11 20:18 ` Drew Adams 2021-05-12 8:47 ` martin rudalics 0 siblings, 2 replies; 23+ messages in thread From: Juri Linkov @ 2021-05-11 19:29 UTC (permalink / raw) To: Drew Adams; +Cc: 12253@debbugs.gnu.org >> >> 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. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: [External] : Re: bug#12253: Restore window start position 2021-05-11 19:29 ` Juri Linkov @ 2021-05-11 20:18 ` Drew Adams 2021-05-12 8:47 ` martin rudalics 1 sibling, 0 replies; 23+ messages in thread From: Drew Adams @ 2021-05-11 20:18 UTC (permalink / raw) To: Juri Linkov; +Cc: 12253@debbugs.gnu.org > >> >> 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.) ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: [External] : Re: bug#12253: Restore window start position 2021-05-11 19:29 ` Juri Linkov 2021-05-11 20:18 ` Drew Adams @ 2021-05-12 8:47 ` martin rudalics 2024-01-10 11:31 ` Stefan Kangas 1 sibling, 1 reply; 23+ messages in thread From: martin rudalics @ 2021-05-12 8:47 UTC (permalink / raw) To: Juri Linkov, Drew Adams; +Cc: 12253@debbugs.gnu.org > 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 ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2021-05-12 8:47 ` martin rudalics @ 2024-01-10 11:31 ` Stefan Kangas 2024-01-10 17:16 ` Juri Linkov 0 siblings, 1 reply; 23+ messages in thread From: Stefan Kangas @ 2024-01-10 11:31 UTC (permalink / raw) To: martin rudalics; +Cc: Juri Linkov, 12253@debbugs.gnu.org, Drew Adams martin rudalics <rudalics@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? ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#12253: Restore window start position 2024-01-10 11:31 ` Stefan Kangas @ 2024-01-10 17:16 ` Juri Linkov 0 siblings, 0 replies; 23+ messages in thread From: Juri Linkov @ 2024-01-10 17:16 UTC (permalink / raw) To: Stefan Kangas; +Cc: martin rudalics, 12253@debbugs.gnu.org, Drew Adams >>> 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 ^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2024-01-10 17:16 UTC | newest] Thread overview: 23+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-08-21 22:17 bug#12253: Restore window start position Juri Linkov 2012-08-22 7:08 ` martin rudalics 2012-08-22 23:38 ` Juri Linkov 2012-08-23 8:48 ` martin rudalics 2012-08-23 22:00 ` Juri Linkov 2012-08-24 9:45 ` martin rudalics 2012-08-25 0:29 ` Juri Linkov 2012-08-25 13:40 ` martin rudalics 2012-08-25 19:29 ` Juri Linkov 2012-08-28 8:53 ` Juri Linkov 2013-01-16 16:57 ` Drew Adams 2013-01-18 22:42 ` Drew Adams 2013-01-19 10:17 ` Juri Linkov 2013-01-19 15:03 ` Drew Adams 2013-03-29 16:56 ` Drew Adams 2021-05-11 14:33 ` Drew Adams 2021-05-11 17:53 ` Juri Linkov 2021-05-11 18:46 ` bug#12253: [External] : " Drew Adams 2021-05-11 19:29 ` Juri Linkov 2021-05-11 20:18 ` Drew Adams 2021-05-12 8:47 ` martin rudalics 2024-01-10 11:31 ` Stefan Kangas 2024-01-10 17:16 ` Juri Linkov
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.