From ab4dff3baac9933c55cd22ce57c2a861e71e2781 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Thu, 25 Feb 2021 14:22:47 -0600 Subject: [PATCH] No more mouse --- custom.el | 3 +- .../disable-mouse-autoloads.el | 52 +++++++ elpa/disable-mouse-0.3/disable-mouse-pkg.el | 2 + elpa/disable-mouse-0.3/disable-mouse.el | 129 ++++++++++++++++++ settings.org | 6 + 5 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 elpa/disable-mouse-0.3/disable-mouse-autoloads.el create mode 100644 elpa/disable-mouse-0.3/disable-mouse-pkg.el create mode 100644 elpa/disable-mouse-0.3/disable-mouse.el diff --git a/custom.el b/custom.el index 4eaf292..9821384 100644 --- a/custom.el +++ b/custom.el @@ -120,7 +120,8 @@ ("shell" . sh) ("bash" . sh))) '(package-selected-packages - '(meghanada + '(disable-mouse + meghanada pip-requirements dired-rsync projectile diff --git a/elpa/disable-mouse-0.3/disable-mouse-autoloads.el b/elpa/disable-mouse-0.3/disable-mouse-autoloads.el new file mode 100644 index 0000000..1ea40f9 --- /dev/null +++ b/elpa/disable-mouse-0.3/disable-mouse-autoloads.el @@ -0,0 +1,52 @@ +;;; disable-mouse-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "disable-mouse" "disable-mouse.el" (0 0 0 0)) +;;; Generated autoloads from disable-mouse.el + +(autoload 'disable-mouse-mode "disable-mouse" "\ +Disable the mouse in the current buffer. +You can still use the mouse to click into other buffers or +interact with GUI elements such as divider lines. + +If called interactively, enable Disable-Mouse mode if ARG is +positive, and disable it if ARG is zero or negative. If called +from Lisp, also enable the mode if ARG is omitted or nil, and +toggle it if ARG is `toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +(defvar global-disable-mouse-mode nil "\ +Non-nil if Global Disable-Mouse mode is enabled. +See the `global-disable-mouse-mode' command +for a description of this minor mode.") + +(custom-autoload 'global-disable-mouse-mode "disable-mouse" nil) + +(autoload 'global-disable-mouse-mode "disable-mouse" "\ +Disable the mouse globally. +Interact with GUI elements such as divider lines will also be prevented. + +If called interactively, enable Global Disable-Mouse mode if ARG +is positive, and disable it if ARG is zero or negative. If +called from Lisp, also enable the mode if ARG is omitted or nil, +and toggle it if ARG is `toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "disable-mouse" '("disable-mouse-" "global-disable-mouse-mode-"))) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; disable-mouse-autoloads.el ends here diff --git a/elpa/disable-mouse-0.3/disable-mouse-pkg.el b/elpa/disable-mouse-0.3/disable-mouse-pkg.el new file mode 100644 index 0000000..4d8c007 --- /dev/null +++ b/elpa/disable-mouse-0.3/disable-mouse-pkg.el @@ -0,0 +1,2 @@ +;;; Generated package description from /home/raphael/.emacs.d/elpa/disable-mouse-0.3/disable-mouse.el -*- no-byte-compile: t -*- +(define-package "disable-mouse" "0.3" "Disable mouse commands globally" 'nil :commit "81639930bcaeedadbcc19728e91719afcac84613" :authors '(("Steve Purcell" . "steve@sanityinc.com")) :maintainer '("Steve Purcell" . "steve@sanityinc.com") :keywords '("mouse") :url "https://github.com/purcell/disable-mouse") diff --git a/elpa/disable-mouse-0.3/disable-mouse.el b/elpa/disable-mouse-0.3/disable-mouse.el new file mode 100644 index 0000000..318549e --- /dev/null +++ b/elpa/disable-mouse-0.3/disable-mouse.el @@ -0,0 +1,129 @@ +;;; disable-mouse.el --- Disable mouse commands globally + +;; Copyright (C) 2016 Steve Purcell + +;; Author: Steve Purcell +;; URL: https://github.com/purcell/disable-mouse +;; Package-Commit: 81639930bcaeedadbcc19728e91719afcac84613 +;; Package-Version: 0.3 +;; Package-X-Original-Version: 0 +;; Keywords: mouse + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Provides `disable-mouse-mode' and `global-disable-mouse-mode', pair +;; of minor modes which suppress all mouse events by intercepting them +;; and running a customisable handler command (`ignore' by default). + +;;; Code: + +(defgroup disable-mouse nil + "Disable mouse commands globally." + :prefix "disable-mouse-" + :group 'mouse) + +(defcustom disable-mouse-command 'ignore + "The command to run when a mouse action is attempted." + :group 'disable-mouse + :type 'function) + +(defcustom disable-mouse-mode-lighter " NoMouse" + "Mode-line lighter for `disable-mouse-mode'." + :group 'disable-mouse + :type 'string) + +(defcustom global-disable-mouse-mode-lighter " NoMouse!" + "Mode-line lighter for `global-disable-mouse-mode'." + :group 'disable-mouse + :type 'string) + +(defconst disable-mouse--bindings-modifier-combos + '("C-" "M-" "S-" "C-M-" "C-S-" "M-S-" "M-C-S-")) + +(defconst disable-mouse--bindings-targets '("mode-line" "bottom-divider" "vertical-line")) + +(defconst disable-mouse--multipliers '("double" "triple")) + +(defconst disable-mouse--bindings + '("mouse-1" "mouse-2" "mouse-3" + "up-mouse-1" "up-mouse-2" "up-mouse-3" + "down-mouse-1" "down-mouse-2" "down-mouse-3" + "drag-mouse-1" "drag-mouse-2" "drag-mouse-3" + "mouse-4" "mouse-5" + "up-mouse-4" "up-mouse-5" + "down-mouse-4" "down-mouse-5" + "drag-mouse-4" "drag-mouse-5" + "wheel-up" "wheel-down" "wheel-left" "wheel-right" + )) + +(defun disable-mouse--all-bindings (include-targets) + "Return an extensive list of mouse-related keybindings. +When INCLUDE-TARGETS is non-nil, also return bindings that target +the elements in `disable-mouse--bindings-targets'." + (let ((bindings)) + (dolist (target (append '(nil) + (when include-targets + disable-mouse--bindings-targets))) + (dolist (mod (append '(nil) disable-mouse--bindings-modifier-combos)) + (dolist (mult (append '(nil) disable-mouse--multipliers)) + (dolist (binding disable-mouse--bindings) + (push (read-kbd-macro + (concat (when target (concat "<" target "> ")) + mod + "<" + (when mult (concat mult "-")) + binding + ">")) + bindings))))) + bindings)) + +(defun disable-mouse--handle () + "Handle when a disabled mouse event is fired." + (interactive) + (call-interactively disable-mouse-command)) + +(defvar disable-mouse-mode-map + (let ((map (make-sparse-keymap))) + (dolist (binding (disable-mouse--all-bindings nil)) + (define-key map binding 'disable-mouse--handle)) + map) + "Map containing no-op bindings for all mouse events.") + +(defvar global-disable-mouse-mode-map + (let ((map (make-sparse-keymap))) + (dolist (binding (disable-mouse--all-bindings t)) + (define-key map binding 'disable-mouse--handle)) + map) + "Map containing no-op bindings for all mouse events.") + +;;;###autoload +(define-minor-mode disable-mouse-mode + "Disable the mouse in the current buffer. +You can still use the mouse to click into other buffers or +interact with GUI elements such as divider lines." + nil + :lighter disable-mouse-mode-lighter) + +;;;###autoload +(define-minor-mode global-disable-mouse-mode + "Disable the mouse globally. +Interact with GUI elements such as divider lines will also be prevented." + nil + :lighter global-disable-mouse-mode-lighter + :global t) + +(provide 'disable-mouse) +;;; disable-mouse.el ends here diff --git a/settings.org b/settings.org index 7f88df7..5c0186a 100644 --- a/settings.org +++ b/settings.org @@ -700,6 +700,12 @@ put executables in elpy-rpc-venv in path :config (ido-mode -1)) #+end_src +** Disable mouse +#+begin_src emacs-lisp + (use-package disable-mouse + :config + (global-disable-mouse-mode)) +#+end_src ** Hippie expand #+begin_src emacs-lisp (use-package hippie-exp