all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 43568@debbugs.gnu.org
Subject: bug#43568: Horizontal mouse wheel scrolling
Date: Tue, 22 Sep 2020 21:40:49 +0300	[thread overview]
Message-ID: <87lfh1ac3y.fsf@mail.linkov.net> (raw)

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

As promised in https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg01598.html
and mentioned in https://debbugs.gnu.org/28182#58
this patch finally provides horizontal scrolling by shifted mouse wheel:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mwheel-hscroll.patch --]
[-- Type: text/patch, Size: 3004 bytes --]

diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 32fde0dd05..421bebc5f5 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -85,7 +85,7 @@ mouse-wheel-inhibit-click-time
   :type 'number)
 
 (defcustom mouse-wheel-scroll-amount
-  '(5 ((shift) . 1) ((meta) . nil) ((control) . text-scale))
+  '(1 ((shift) . hscroll) ((meta) . nil) ((control) . text-scale))
   "Amount to scroll windows by when spinning the mouse wheel.
 This is an alist mapping the modifier key to the amount to scroll when
 the wheel is moved with the modifier key depressed.
@@ -97,6 +97,9 @@ mouse-wheel-scroll-amount
 a full screen to scroll.  A near full screen is `next-screen-context-lines'
 less than a full screen.
 
+If AMOUNT is the symbol 'hscroll', this means that with MODIFIER,
+the mouse wheel will scroll horizontally instead of vertically.
+
 If AMOUNT is the symbol text-scale, this means that with
 MODIFIER, the mouse wheel will change the face height instead of
 scrolling."
@@ -123,6 +126,7 @@ mouse-wheel-scroll-amount
                     (const :tag "Scroll full screen" :value nil)
                     (integer :tag "Scroll specific # of lines")
                     (float :tag "Scroll fraction of window")
+                    (const :tag "Scroll horizontally" :value hscroll)
                     (const :tag "Change face size" :value text-scale)))))
   :set 'mouse-wheel-change-button
   :version "27.1")
@@ -270,7 +274,11 @@ mwheel-scroll
     (condition-case nil
         (unwind-protect
 	    (let ((button (mwheel-event-button event)))
-	      (cond ((eq button mouse-wheel-down-event)
+              (cond ((and (eq amt 'hscroll) (eq button mouse-wheel-down-event))
+                     (funcall (if mouse-wheel-flip-direction
+                                  mwheel-scroll-left-function
+                                mwheel-scroll-right-function) 1))
+                    ((eq button mouse-wheel-down-event)
                      (condition-case nil (funcall mwheel-scroll-down-function amt)
                        ;; Make sure we do indeed scroll to the beginning of
                        ;; the buffer.
@@ -285,7 +293,11 @@ mwheel-scroll
                           ;; for a reason that escapes me.  This problem seems
                           ;; to only affect scroll-down.  --Stef
                           (set-window-start (selected-window) (point-min))))))
-		    ((eq button mouse-wheel-up-event)
+                    ((and (eq amt 'hscroll) (eq button mouse-wheel-up-event))
+                     (funcall (if mouse-wheel-flip-direction
+                                  mwheel-scroll-right-function
+                                mwheel-scroll-left-function) 1))
+                    ((eq button mouse-wheel-up-event)
                      (condition-case nil (funcall mwheel-scroll-up-function amt)
                        ;; Make sure we do indeed scroll to the end of the buffer.
                        (end-of-buffer (while t (funcall mwheel-scroll-up-function)))))

             reply	other threads:[~2020-09-22 18:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 18:40 Juri Linkov [this message]
2020-09-22 18:51 ` bug#43568: Horizontal mouse wheel scrolling Eli Zaretskii
2020-09-22 19:09   ` Juri Linkov
2020-09-24 19:25     ` Juri Linkov
2020-09-22 18:55 ` Juri Linkov
2020-09-23 13:52   ` Lars Ingebrigtsen
2020-09-22 20:02 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-24 19:27   ` Juri Linkov
2020-09-24 20:07     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-10-31 20:30 ` Juri Linkov
2020-11-03 19:06   ` Juri Linkov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfh1ac3y.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=43568@debbugs.gnu.org \
    /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 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.