[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: maintain column position in selection pop-up buffer

In [emacs-w3m:13446]
On Thu, 06 Jun 2019 23:13:23 -0400, Boruch Baum wrote:
> See for example what happens when point is somewhere in the middle of
> the final line and you attempt to advance another line. For me, it jumps
> to the end of the line.

Ok, here is the second try.  Is it ok?
--- w3m.el~	2019-05-28 05:01:41.982806500 +0000
+++ w3m.el	2019-06-07 03:46:40.615836500 +0000
@@ -11400,7 +11400,6 @@
 (defun w3m-select-buffer-show-this-line (&optional interactive-p)
   "Show the buffer on the current menu line or scroll it up."
   (interactive (list t))
-  (forward-line 0)
   (let ((obuffer (and (window-live-p w3m-select-buffer-window)
 		      (window-buffer w3m-select-buffer-window)))
 	(buffer (w3m-select-buffer-current-buffer)))
@@ -11441,13 +11440,16 @@
 (defun w3m-select-buffer-next-line (&optional n)
   "Move cursor vertically down N lines and show the buffer on the menu."
   (interactive "p")
-  (forward-line n)
+  (when (if (or (not n) (> n 0))
+	    (< (line-end-position) (point-max))
+	  (> (line-beginning-position) (point-min)))
+    (next-line n)
     (w3m-static-when (featurep 'xemacs)
 	;; Update gutter tabs.
-	(select-window w3m-select-buffer-window)))))
+	(select-window w3m-select-buffer-window))))))
 (defun w3m-select-buffer-previous-line (&optional n)
   "Move cursor vertically up N lines and show the buffer on the menu."