[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scrolling multiple lines [PATCH INCLUDED]
- From: Boruch Baum <boruch_baum@xxxxxxx>
- Date: Thu, 3 Aug 2017 19:05:33 -0400
- X-ml-name: emacs-w3m
- X-mail-count: 12779
I was surprised just now to notice that emacs-w3m does not allow me to
use a prefix argument to scroll more than one line at a time, ie.
C-u M-x w3m-scroll-up
C-u M-x w3m-scroll-down
The docstrings for those functions do indicate that is the intended
behavior:
#+BEGIN_SRC emacs-lisp
(defun w3m-scroll-up (&optional arg mwheel)
"Scroll the current window up ARG lines.
ARG will be fixed into 1 when this function is called interactively.
MWHEEL indicates that this function is called by the mouse wheel.
This function avoids the bug that Emacs 21.x hangs up when scrolling
up for too many number of lines if `scroll-margin' is set as two or
greater."
(defun w3m-scroll-down (&optional arg mwheel)
"Scroll the current window down ARG lines.
ARG will be fixed into 1 when this function is called interactively.
MWHEEL indicates that this function is called by the mouse wheel."
#+END_SRC
In emacs25, when I modified the functions to accept prefix arguments,
I saw no untowards effects when "`scroll-margin' is set as two or
greater.", so if that's the case also with emacs24 (and emacs23 ?),
how about removing that restriction?
You'll note that the attached proposed patch also removes all special
treatment for existence of a mouse-wheel scroll. When I connected a
mouse, I found that scrolling was much choppier and less reliable than
with a keyboard, and was often subject to a delay. Removing the code
per the patch changed nothing, ie. mouse-wheel scrolling still worked,
and with the same limitations as before.
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.1677
diff -u -r1.1677 w3m.el
--- w3m.el 28 Jul 2017 01:42:21 -0000 1.1677
+++ w3m.el 3 Aug 2017 22:52:26 -0000
@@ -8867,9 +8867,9 @@
(setq show-trailing-whitespace nil))
(when (boundp 'mwheel-scroll-up-function)
(eval '(set (make-local-variable (quote mwheel-scroll-up-function))
- (function w3m-mwheel-scroll-up)))
+ (function w3m-scroll-up)))
(eval '(set (make-local-variable (quote mwheel-scroll-down-function))
- (function w3m-mwheel-scroll-down))))
+ (function w3m-scroll-down))))
(w3m-setup-toolbar)
(w3m-setup-menu)
(run-hooks 'w3m-mode-setup-functions)
@@ -8880,49 +8880,10 @@
"2013-01-23")
(wrong-number-of-arguments ;; XEmacs
(define-obsolete-function-alias 'w3m-scroll-up-1 'w3m-scroll-up)))
-(defun w3m-scroll-up (&optional arg mwheel)
- "Scroll the current window up ARG lines.
-ARG will be fixed into 1 when this function is called interactively.
-MWHEEL indicates that this function is called by the mouse wheel.
-This function avoids the bug that Emacs 21.x hangs up when scrolling
-up for too many number of lines if `scroll-margin' is set as two or
-greater."
- (interactive '(1))
- (let ((cur (point))
- end)
- (goto-char (point-max))
- (skip-chars-backward "\t\n\r ")
- (forward-line 1)
- (setq end (point))
- (goto-char cur)
- (if (and (or mwheel (not arg))
- (pos-visible-in-window-p end))
- (run-with-timer 1e-9 nil
- (lambda (win pos)
- (when (window-live-p win)
- (goto-char pos)
- (recenter -1)
- (w3m-message "End of buffer")))
- (selected-window) end)
- (w3m-static-unless (featurep 'xemacs)
- (when (and (numberp arg)
- (> arg 0)
- (numberp scroll-margin)
- (> scroll-margin 0))
- (setq arg (min arg
- (max 0 (- (count-lines (window-start) (point-max))
- scroll-margin))))))
- (scroll-up arg)
- (when (and truncate-lines
- (or mwheel (not arg))
- (pos-visible-in-window-p end))
- (setq cur (point))
- (goto-char end)
- (recenter -1)
- (goto-char cur)))))
-(defun w3m-mwheel-scroll-up (&optional arg)
- (w3m-scroll-up arg t))
+(defun w3m-scroll-up (&optional arg)
+ "Scroll the current window up ARG lines."
+ (interactive "P") (scroll-up (if arg arg 1)))
(defun w3m-scroll-up-or-next-url (arg)
"Scroll the current window up ARG lines, or go to the next page."
@@ -8943,25 +8904,9 @@
(w3m-goto-url w3m-next-url))
(w3m-scroll-up arg))))
-(defun w3m-scroll-down (&optional arg mwheel)
- "Scroll the current window down ARG lines.
-ARG will be fixed into 1 when this function is called interactively.
-MWHEEL indicates that this function is called by the mouse wheel."
- (interactive '(1))
- (if (and (or mwheel (not arg))
- (pos-visible-in-window-p (point-min)))
- (run-with-timer 1e-9 nil
- (lambda (win)
- (when (window-live-p win)
- (select-window win)
- (goto-char (point-min))
- (recenter 0)
- (w3m-message "Beginning of buffer")))
- (selected-window))
- (scroll-down arg)))
-
-(defun w3m-mwheel-scroll-down (&optional arg)
- (w3m-scroll-down arg t))
+(defun w3m-scroll-down (&optional arg)
+ "Scroll the current window down ARG lines."
+ (interactive "P") (scroll-up (if arg arg 1)))
(defun w3m-scroll-down-or-previous-url (arg)
"Scroll the current window down ARG lines, or go to the previous page."
Index: ChangeLog
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3605
diff -u -r1.3605 ChangeLog
--- ChangeLog 2 Aug 2017 07:39:18 -0000 1.3605
+++ ChangeLog 3 Aug 2017 22:53:18 -0000
@@ -1,3 +1,11 @@
+2017-08-03 <Boruch Baum <boruch_baum@xxxxxxx>>
+
+ * w3m.el (w3m-scroll-up, w3m-scroll-down): Removed restriction of using
+ prefix-argument, removed code that fixed bug in emacs v21.
+ (w3m-mwheel-scroll-up, w3m-mwheel-scroll-down): deleted.
+ (w3m-mode): Changed local bindings of `mwheel-scroll-up-function' and
+ `mwheel-scroll-down-function' to `w3m-scroll-up' and `w3m-scroll-down'.
+
2017-08-02 Boruch Baum <boruch_baum@xxxxxxx>
* w3m-search.el (w3m-search-engine-alist): Update URL for debian