[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/visual-fill-column 48a3690b01 091/137: Add more bindings f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/visual-fill-column 48a3690b01 091/137: Add more bindings for mouse events in the margins. |
Date: |
Sun, 2 Jan 2022 22:59:14 -0500 (EST) |
branch: elpa/visual-fill-column
commit 48a3690b01c6dc414dc3a9a27b5d9046edf7b233
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>
Add more bindings for mouse events in the margins.
Suggested in Github issue #44.
---
README.md | 1 +
visual-fill-column.el | 42 +++++++++++++++++++++++++++++++++---------
2 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index e03f52286a..a4b44bf58a 100644
--- a/README.md
+++ b/README.md
@@ -65,3 +65,4 @@ The customisation group `visual-fill-column` has three
options (beside `global-v
All three options are buffer-local, so the values you set in your init file
are default values. They can also be set in mode hooks or directory or file
local variables in order to customise particular files or file types.
+`visual-fill-column-mode` also binds several mouse events for the left and
right margins, so that scrolling or clicking on the margins does what you'd
expect (rather than cause an "event not bound" error). If you wish to adjust
these bindings, you should do so in `visual-fill-column-mode-map`.
diff --git a/visual-fill-column.el b/visual-fill-column.el
index 1aa27a1fa5..d7bb77846b 100644
--- a/visual-fill-column.el
+++ b/visual-fill-column.el
@@ -66,19 +66,43 @@ this option is set to a value, it is used instead."
(make-variable-buffer-local 'visual-fill-column-center-text)
(put 'visual-fill-column-center-text 'safe-local-variable 'symbolp)
+(defvar visual-fill-column-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [right-margin mouse-1] (global-key-binding [mouse-1])) ;
#'mouse-set-point
+ (define-key map [right-margin mouse-2] (global-key-binding [mouse-2])) ;
#'mouse-yank-primary
+ (define-key map [right-margin mouse-3] (global-key-binding [mouse-3])) ;
#'mouse-save-then-kill
+ (define-key map [right-margin drag-mouse-1] #'ignore)
+ (define-key map [right-margin drag-mouse-2] #'ignore)
+ (define-key map [right-margin drag-mouse-3] #'ignore)
+ (define-key map [right-margin double-mouse-1] #'ignore)
+ (define-key map [right-margin double-mouse-2] #'ignore)
+ (define-key map [right-margin double-mouse-3] #'ignore)
+ (define-key map [right-margin triple-mouse-1] #'ignore)
+ (define-key map [right-margin triple-mouse-2] #'ignore)
+ (define-key map [right-margin triple-mouse-3] #'ignore)
+ (define-key map [left-margin mouse-1] (global-key-binding [mouse-1])) ;
#'mouse-set-point
+ (define-key map [left-margin mouse-2] (global-key-binding [mouse-2])) ;
#'mouse-yank-primary
+ (define-key map [left-margin mouse-3] (global-key-binding [mouse-3])) ;
#'mouse-save-then-kill
+ (define-key map [left-margin drag-mouse-1] #'ignore)
+ (define-key map [left-margin drag-mouse-2] #'ignore)
+ (define-key map [left-margin drag-mouse-3] #'ignore)
+ (define-key map [left-margin double-mouse-1] #'ignore)
+ (define-key map [left-margin double-mouse-2] #'ignore)
+ (define-key map [left-margin double-mouse-3] #'ignore)
+ (define-key map [left-margin triple-mouse-1] #'ignore)
+ (define-key map [left-margin triple-mouse-2] #'ignore)
+ (define-key map [left-margin triple-mouse-3] #'ignore)
+ (when (bound-and-true-p mouse-wheel-mode)
+ (define-key map [right-margin mouse-wheel-down-event] #'mwheel-scroll)
+ (define-key map [right-margin mouse-wheel-up-event] #'mwheel-scroll)
+ (define-key map [left-margin mouse-wheel-down-event] #'mwheel-scroll)
+ (define-key map [left-margin mouse-wheel-up-event] #'mwheel-scroll))
+ map))
+
;;;###autoload
(define-minor-mode visual-fill-column-mode
"Wrap lines according to `fill-column' in `visual-line-mode'."
:init-value nil :lighter nil :global nil
- :keymap
- (let ((map (make-sparse-keymap)))
- (when (bound-and-true-p mouse-wheel-mode)
- (progn
- (define-key map (vector 'left-margin mouse-wheel-down-event)
'mwheel-scroll)
- (define-key map (vector 'left-margin mouse-wheel-up-event)
'mwheel-scroll)
- (define-key map (vector 'right-margin mouse-wheel-down-event)
'mwheel-scroll)
- (define-key map (vector 'right-margin mouse-wheel-up-event)
'mwheel-scroll))
- map))
(if visual-fill-column-mode
(visual-fill-column-mode--enable)
(visual-fill-column-mode--disable)))
- [nongnu] elpa/visual-fill-column 8aee572de5 062/137: Merge branch 'master' of https://github.com/joostkremers/visual-fill-column, (continued)
- [nongnu] elpa/visual-fill-column 8aee572de5 062/137: Merge branch 'master' of https://github.com/joostkremers/visual-fill-column, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column a19fbe8bcf 076/137: Update version number., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column d6b09e5533 078/137: Add screenshots before and after., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column fac6a4ce67 044/137: Take text scaling into account when computing margins, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column db89c32b4d 059/137: Update copyright statement to 2018., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column d3f64e7206 050/137: Update README, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column c0e5ec8f88 052/137: Fix potentially serious typos in license, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 606d86e38c 060/137: Update doc string of `turn-on-visual-fill-column-mode'., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column dd6f1e0cf2 084/137: Resize screenshots., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 14e841218d 083/137: Add text introducing screenshots to the README., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 48a3690b01 091/137: Add more bindings for mouse events in the margins.,
ELPA Syncer <=
- [nongnu] elpa/visual-fill-column 2048a0ce91 089/137: turn-on-visual-fill-column-mode: Do not depend on `visual-line-mode`., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 7ca18f37af 092/137: Rewrap comment., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 598bc992f0 093/137: Update Emacs dependency to 25.1., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 7c479f1a1c 098/137: Use `(selected-window)' instead of `(get-buffer-window (current-buffer))'., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column e73f99e09f 104/137: Fix the values of `visual-fill-column-inhibit-sensible-window-split`., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 0c410828e0 101/137: Use `window-configuration-change-hook' in Emacs 27 as well., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column f833fb94ff 095/137: Use the window's previous margins as minimum margins., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column ff329c5ffd 105/137: Merge branch 'devel', ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 1da41f73a4 096/137: Use `window-size-change-functions`., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 9258eaf705 100/137: Resurrect `visual-fill-column-split-window'., ELPA Syncer, 2022/01/02