diff options
| author | Stefan Monnier | 2008-04-01 08:35:58 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-01 08:35:58 +0000 |
| commit | ad0d18af636182f3f93d646af0a7b8ca8489e178 (patch) | |
| tree | aed637cb43fb9d67c1b30189666ed9dd97bdb3d9 | |
| parent | 03b63ba9aa4b6d210d2b3f5d827682b5464ec773 (diff) | |
| download | emacs-ad0d18af636182f3f93d646af0a7b8ca8489e178.tar.gz emacs-ad0d18af636182f3f93d646af0a7b8ca8489e178.zip | |
(mouse-major-mode-menu-prefix): Remove. Remove uses.
(mouse-menu-non-singleton): Rename from mouse-major-mode-menu-1.
Use map-keymap.
(minor-mode-menu-from-indicator): Use it. Simplify.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/mouse.el | 744 |
2 files changed, 361 insertions, 388 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 719f09b0536..ca9da31080e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2008-04-01 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-04-01 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * mouse.el (mouse-major-mode-menu-prefix): Remove. Remove uses. | ||
| 4 | (mouse-menu-non-singleton): Rename from mouse-major-mode-menu-1. | ||
| 5 | Use map-keymap. | ||
| 6 | (minor-mode-menu-from-indicator): Use it. Simplify. | ||
| 7 | |||
| 3 | * bindings.el (mode-line-mode-menu): Move before (new) first use. | 8 | * bindings.el (mode-line-mode-menu): Move before (new) first use. |
| 4 | (mode-line-major-mode-keymap, mode-line-minor-mode-keymap): | 9 | (mode-line-major-mode-keymap, mode-line-minor-mode-keymap): |
| 5 | Bind the key directly to the menu. | 10 | Bind the key directly to the menu. |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 8b3195ac010..9fb04279847 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | ;;; Utility functions. | 36 | ;;; Utility functions. |
| 37 | 37 | ||
| 38 | ;;; Indent track-mouse like progn. | 38 | ;; Indent track-mouse like progn. |
| 39 | (put 'track-mouse 'lisp-indent-function 0) | 39 | (put 'track-mouse 'lisp-indent-function 0) |
| 40 | 40 | ||
| 41 | (defcustom mouse-yank-at-point nil | 41 | (defcustom mouse-yank-at-point nil |
| @@ -164,20 +164,15 @@ items `Turn Off' and `Help'." | |||
| 164 | (unless minor-mode (error "Cannot find minor mode for `%s'" indicator)) | 164 | (unless minor-mode (error "Cannot find minor mode for `%s'" indicator)) |
| 165 | (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist))) | 165 | (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist))) |
| 166 | (menu (and (keymapp map) (lookup-key map [menu-bar])))) | 166 | (menu (and (keymapp map) (lookup-key map [menu-bar])))) |
| 167 | (unless menu | 167 | (setq menu |
| 168 | (setq menu | 168 | (if menu |
| 169 | (mouse-menu-non-singleton menu) | ||
| 169 | `(keymap | 170 | `(keymap |
| 170 | (,(intern indicator) ,indicator | 171 | ,indicator |
| 171 | keymap | 172 | (turn-off menu-item "Turn Off minor mode" ,minor-mode) |
| 172 | (turn-off menu-item "Turn Off minor mode" | 173 | (help menu-item "Help for minor mode" |
| 173 | (lambda () | 174 | (lambda () (interactive) |
| 174 | (interactive) | 175 | (describe-function ',minor-mode)))))) |
| 175 | (,minor-mode -1) | ||
| 176 | (message ,(format "`%S' turned OFF" minor-mode)))) | ||
| 177 | (help menu-item "Help for minor mode" | ||
| 178 | (lambda () (interactive) | ||
| 179 | (describe-function | ||
| 180 | ',minor-mode))))))) | ||
| 181 | (popup-menu menu)))) | 176 | (popup-menu menu)))) |
| 182 | 177 | ||
| 183 | (defun mouse-minor-mode-menu (event) | 178 | (defun mouse-minor-mode-menu (event) |
| @@ -186,8 +181,6 @@ items `Turn Off' and `Help'." | |||
| 186 | (let ((indicator (car (nth 4 (car (cdr event)))))) | 181 | (let ((indicator (car (nth 4 (car (cdr event)))))) |
| 187 | (minor-mode-menu-from-indicator indicator))) | 182 | (minor-mode-menu-from-indicator indicator))) |
| 188 | 183 | ||
| 189 | (defvar mouse-major-mode-menu-prefix) ; dynamically bound | ||
| 190 | |||
| 191 | (defun mouse-major-mode-menu (event &optional prefix) | 184 | (defun mouse-major-mode-menu (event &optional prefix) |
| 192 | "Pop up a mode-specific menu of mouse commands. | 185 | "Pop up a mode-specific menu of mouse commands. |
| 193 | Default to the Edit menu if the major mode doesn't define a menu." | 186 | Default to the Edit menu if the major mode doesn't define a menu." |
| @@ -196,12 +189,8 @@ Default to the Edit menu if the major mode doesn't define a menu." | |||
| 196 | (interactive "@e\nP") | 189 | (interactive "@e\nP") |
| 197 | ;; Let the mode update its menus first. | 190 | ;; Let the mode update its menus first. |
| 198 | (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) | 191 | (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) |
| 199 | (let* (;; This is where mouse-major-mode-menu-prefix | 192 | (let* (;; Keymap from which to inherit; may be null. |
| 200 | ;; returns the prefix we should use (after menu-bar). | 193 | (ancestor (mouse-menu-non-singleton |
| 201 | ;; It is either nil or (SOME-SYMBOL). | ||
| 202 | (mouse-major-mode-menu-prefix nil) | ||
| 203 | ;; Keymap from which to inherit; may be null. | ||
| 204 | (ancestor (mouse-major-mode-menu-1 | ||
| 205 | (and (current-local-map) | 194 | (and (current-local-map) |
| 206 | (local-key-binding [menu-bar])))) | 195 | (local-key-binding [menu-bar])))) |
| 207 | ;; Make a keymap in which our last command leads to a menu or | 196 | ;; Make a keymap in which our last command leads to a menu or |
| @@ -228,39 +217,18 @@ Default to the Edit menu if the major mode doesn't define a menu." | |||
| 228 | (popup-menu newmap event prefix))) | 217 | (popup-menu newmap event prefix))) |
| 229 | 218 | ||
| 230 | 219 | ||
| 231 | ;; Compute and cache the equivalent keys in MENU and all its submenus. | 220 | (defun mouse-menu-non-singleton (menubar) |
| 232 | ;;;(defun mouse-major-mode-menu-compute-equiv-keys (menu) | 221 | "Given menu keymap, |
| 233 | ;;; (and (eq (car menu) 'keymap) | 222 | if it defines exactly one submenu, return just that submenu. |
| 234 | ;;; (x-popup-menu nil menu)) | 223 | Otherwise return the whole menu." |
| 235 | ;;; (while menu | ||
| 236 | ;;; (and (consp (car menu)) | ||
| 237 | ;;; (consp (cdr (car menu))) | ||
| 238 | ;;; (let ((tail (cdr (car menu)))) | ||
| 239 | ;;; (while (and (consp tail) | ||
| 240 | ;;; (not (eq (car tail) 'keymap))) | ||
| 241 | ;;; (setq tail (cdr tail))) | ||
| 242 | ;;; (if (consp tail) | ||
| 243 | ;;; (mouse-major-mode-menu-compute-equiv-keys tail)))) | ||
| 244 | ;;; (setq menu (cdr menu)))) | ||
| 245 | |||
| 246 | ;; Given a mode's menu bar keymap, | ||
| 247 | ;; if it defines exactly one menu bar menu, | ||
| 248 | ;; return just that menu. | ||
| 249 | ;; Otherwise return a menu for all of them. | ||
| 250 | (defun mouse-major-mode-menu-1 (menubar) | ||
| 251 | (if menubar | 224 | (if menubar |
| 252 | (let ((tail menubar) | 225 | (let (submap) |
| 253 | submap) | 226 | (map-keymap |
| 254 | (while tail | 227 | (lambda (k v) (setq submap (if submap t (cons k v)))) |
| 255 | (if (consp (car tail)) | 228 | menubar) |
| 256 | (if submap | 229 | (if (eq submap t) |
| 257 | (setq submap t) | 230 | menubar |
| 258 | (setq submap (car tail)))) | 231 | (lookup-key menubar (vector (car submap))))))) |
| 259 | (setq tail (cdr tail))) | ||
| 260 | (if (eq submap t) | ||
| 261 | menubar | ||
| 262 | (setq mouse-major-mode-menu-prefix (list (car submap))) | ||
| 263 | (lookup-key menubar (vector (car submap))))))) | ||
| 264 | 232 | ||
| 265 | (defun mouse-popup-menubar (event prefix) | 233 | (defun mouse-popup-menubar (event prefix) |
| 266 | "Pop up a menu equivalent to the menu bar for keyboard EVENT with PREFIX. | 234 | "Pop up a menu equivalent to the menu bar for keyboard EVENT with PREFIX. |
| @@ -1409,12 +1377,12 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 1409 | (kill-ring-save (point) (mark t))) | 1377 | (kill-ring-save (point) (mark t))) |
| 1410 | (mouse-show-mark)) | 1378 | (mouse-show-mark)) |
| 1411 | 1379 | ||
| 1412 | ;;; This function used to delete the text between point and the mouse | 1380 | ;; This function used to delete the text between point and the mouse |
| 1413 | ;;; whenever it was equal to the front of the kill ring, but some | 1381 | ;; whenever it was equal to the front of the kill ring, but some |
| 1414 | ;;; people found that confusing. | 1382 | ;; people found that confusing. |
| 1415 | 1383 | ||
| 1416 | ;;; A list (TEXT START END), describing the text and position of the last | 1384 | ;; A list (TEXT START END), describing the text and position of the last |
| 1417 | ;;; invocation of mouse-save-then-kill. | 1385 | ;; invocation of mouse-save-then-kill. |
| 1418 | (defvar mouse-save-then-kill-posn nil) | 1386 | (defvar mouse-save-then-kill-posn nil) |
| 1419 | 1387 | ||
| 1420 | (defun mouse-save-then-kill-delete-region (beg end) | 1388 | (defun mouse-save-then-kill-delete-region (beg end) |
| @@ -2015,331 +1983,331 @@ and selects that window." | |||
| 2015 | ;; Few buffers--put them all in one pane. | 1983 | ;; Few buffers--put them all in one pane. |
| 2016 | (list (cons title alist)))) | 1984 | (list (cons title alist)))) |
| 2017 | 1985 | ||
| 2018 | ;;; These need to be rewritten for the new scroll bar implementation. | 1986 | ;; These need to be rewritten for the new scroll bar implementation. |
| 2019 | 1987 | ||
| 2020 | ;;;!! ;; Commands for the scroll bar. | 1988 | ;;!! ;; Commands for the scroll bar. |
| 2021 | ;;;!! | 1989 | ;;!! |
| 2022 | ;;;!! (defun mouse-scroll-down (click) | 1990 | ;;!! (defun mouse-scroll-down (click) |
| 2023 | ;;;!! (interactive "@e") | 1991 | ;;!! (interactive "@e") |
| 2024 | ;;;!! (scroll-down (1+ (cdr (mouse-coords click))))) | 1992 | ;;!! (scroll-down (1+ (cdr (mouse-coords click))))) |
| 2025 | ;;;!! | 1993 | ;;!! |
| 2026 | ;;;!! (defun mouse-scroll-up (click) | 1994 | ;;!! (defun mouse-scroll-up (click) |
| 2027 | ;;;!! (interactive "@e") | 1995 | ;;!! (interactive "@e") |
| 2028 | ;;;!! (scroll-up (1+ (cdr (mouse-coords click))))) | 1996 | ;;!! (scroll-up (1+ (cdr (mouse-coords click))))) |
| 2029 | ;;;!! | 1997 | ;;!! |
| 2030 | ;;;!! (defun mouse-scroll-down-full () | 1998 | ;;!! (defun mouse-scroll-down-full () |
| 2031 | ;;;!! (interactive "@") | 1999 | ;;!! (interactive "@") |
| 2032 | ;;;!! (scroll-down nil)) | 2000 | ;;!! (scroll-down nil)) |
| 2033 | ;;;!! | 2001 | ;;!! |
| 2034 | ;;;!! (defun mouse-scroll-up-full () | 2002 | ;;!! (defun mouse-scroll-up-full () |
| 2035 | ;;;!! (interactive "@") | 2003 | ;;!! (interactive "@") |
| 2036 | ;;;!! (scroll-up nil)) | 2004 | ;;!! (scroll-up nil)) |
| 2037 | ;;;!! | 2005 | ;;!! |
| 2038 | ;;;!! (defun mouse-scroll-move-cursor (click) | 2006 | ;;!! (defun mouse-scroll-move-cursor (click) |
| 2039 | ;;;!! (interactive "@e") | 2007 | ;;!! (interactive "@e") |
| 2040 | ;;;!! (move-to-window-line (1+ (cdr (mouse-coords click))))) | 2008 | ;;!! (move-to-window-line (1+ (cdr (mouse-coords click))))) |
| 2041 | ;;;!! | 2009 | ;;!! |
| 2042 | ;;;!! (defun mouse-scroll-absolute (event) | 2010 | ;;!! (defun mouse-scroll-absolute (event) |
| 2043 | ;;;!! (interactive "@e") | 2011 | ;;!! (interactive "@e") |
| 2044 | ;;;!! (let* ((pos (car event)) | 2012 | ;;!! (let* ((pos (car event)) |
| 2045 | ;;;!! (position (car pos)) | 2013 | ;;!! (position (car pos)) |
| 2046 | ;;;!! (length (car (cdr pos)))) | 2014 | ;;!! (length (car (cdr pos)))) |
| 2047 | ;;;!! (if (<= length 0) (setq length 1)) | 2015 | ;;!! (if (<= length 0) (setq length 1)) |
| 2048 | ;;;!! (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size))))) | 2016 | ;;!! (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size))))) |
| 2049 | ;;;!! (newpos (* (/ (* (/ (buffer-size) scale-factor) | 2017 | ;;!! (newpos (* (/ (* (/ (buffer-size) scale-factor) |
| 2050 | ;;;!! position) | 2018 | ;;!! position) |
| 2051 | ;;;!! length) | 2019 | ;;!! length) |
| 2052 | ;;;!! scale-factor))) | 2020 | ;;!! scale-factor))) |
| 2053 | ;;;!! (goto-char newpos) | 2021 | ;;!! (goto-char newpos) |
| 2054 | ;;;!! (recenter '(4))))) | 2022 | ;;!! (recenter '(4))))) |
| 2055 | ;;;!! | 2023 | ;;!! |
| 2056 | ;;;!! (defun mouse-scroll-left (click) | 2024 | ;;!! (defun mouse-scroll-left (click) |
| 2057 | ;;;!! (interactive "@e") | 2025 | ;;!! (interactive "@e") |
| 2058 | ;;;!! (scroll-left (1+ (car (mouse-coords click))))) | 2026 | ;;!! (scroll-left (1+ (car (mouse-coords click))))) |
| 2059 | ;;;!! | 2027 | ;;!! |
| 2060 | ;;;!! (defun mouse-scroll-right (click) | 2028 | ;;!! (defun mouse-scroll-right (click) |
| 2061 | ;;;!! (interactive "@e") | 2029 | ;;!! (interactive "@e") |
| 2062 | ;;;!! (scroll-right (1+ (car (mouse-coords click))))) | 2030 | ;;!! (scroll-right (1+ (car (mouse-coords click))))) |
| 2063 | ;;;!! | 2031 | ;;!! |
| 2064 | ;;;!! (defun mouse-scroll-left-full () | 2032 | ;;!! (defun mouse-scroll-left-full () |
| 2065 | ;;;!! (interactive "@") | 2033 | ;;!! (interactive "@") |
| 2066 | ;;;!! (scroll-left nil)) | 2034 | ;;!! (scroll-left nil)) |
| 2067 | ;;;!! | 2035 | ;;!! |
| 2068 | ;;;!! (defun mouse-scroll-right-full () | 2036 | ;;!! (defun mouse-scroll-right-full () |
| 2069 | ;;;!! (interactive "@") | 2037 | ;;!! (interactive "@") |
| 2070 | ;;;!! (scroll-right nil)) | 2038 | ;;!! (scroll-right nil)) |
| 2071 | ;;;!! | 2039 | ;;!! |
| 2072 | ;;;!! (defun mouse-scroll-move-cursor-horizontally (click) | 2040 | ;;!! (defun mouse-scroll-move-cursor-horizontally (click) |
| 2073 | ;;;!! (interactive "@e") | 2041 | ;;!! (interactive "@e") |
| 2074 | ;;;!! (move-to-column (1+ (car (mouse-coords click))))) | 2042 | ;;!! (move-to-column (1+ (car (mouse-coords click))))) |
| 2075 | ;;;!! | 2043 | ;;!! |
| 2076 | ;;;!! (defun mouse-scroll-absolute-horizontally (event) | 2044 | ;;!! (defun mouse-scroll-absolute-horizontally (event) |
| 2077 | ;;;!! (interactive "@e") | 2045 | ;;!! (interactive "@e") |
| 2078 | ;;;!! (let* ((pos (car event)) | 2046 | ;;!! (let* ((pos (car event)) |
| 2079 | ;;;!! (position (car pos)) | 2047 | ;;!! (position (car pos)) |
| 2080 | ;;;!! (length (car (cdr pos)))) | 2048 | ;;!! (length (car (cdr pos)))) |
| 2081 | ;;;!! (set-window-hscroll (selected-window) 33))) | 2049 | ;;!! (set-window-hscroll (selected-window) 33))) |
| 2082 | ;;;!! | 2050 | ;;!! |
| 2083 | ;;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up) | 2051 | ;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up) |
| 2084 | ;;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute) | 2052 | ;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute) |
| 2085 | ;;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down) | 2053 | ;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down) |
| 2086 | ;;;!! | 2054 | ;;!! |
| 2087 | ;;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor) | 2055 | ;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor) |
| 2088 | ;;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor) | 2056 | ;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor) |
| 2089 | ;;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor) | 2057 | ;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor) |
| 2090 | ;;;!! | 2058 | ;;!! |
| 2091 | ;;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full) | 2059 | ;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full) |
| 2092 | ;;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full) | 2060 | ;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full) |
| 2093 | ;;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full) | 2061 | ;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full) |
| 2094 | ;;;!! | 2062 | ;;!! |
| 2095 | ;;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full) | 2063 | ;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full) |
| 2096 | ;;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full) | 2064 | ;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full) |
| 2097 | ;;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full) | 2065 | ;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full) |
| 2098 | ;;;!! | 2066 | ;;!! |
| 2099 | ;;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left) | 2067 | ;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left) |
| 2100 | ;;;!! (global-set-key [horizontal-scroll-bar mouse-2] | 2068 | ;;!! (global-set-key [horizontal-scroll-bar mouse-2] |
| 2101 | ;;;!! 'mouse-scroll-absolute-horizontally) | 2069 | ;;!! 'mouse-scroll-absolute-horizontally) |
| 2102 | ;;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right) | 2070 | ;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right) |
| 2103 | ;;;!! | 2071 | ;;!! |
| 2104 | ;;;!! (global-set-key [horizontal-slider mouse-1] | 2072 | ;;!! (global-set-key [horizontal-slider mouse-1] |
| 2105 | ;;;!! 'mouse-scroll-move-cursor-horizontally) | 2073 | ;;!! 'mouse-scroll-move-cursor-horizontally) |
| 2106 | ;;;!! (global-set-key [horizontal-slider mouse-2] | 2074 | ;;!! (global-set-key [horizontal-slider mouse-2] |
| 2107 | ;;;!! 'mouse-scroll-move-cursor-horizontally) | 2075 | ;;!! 'mouse-scroll-move-cursor-horizontally) |
| 2108 | ;;;!! (global-set-key [horizontal-slider mouse-3] | 2076 | ;;!! (global-set-key [horizontal-slider mouse-3] |
| 2109 | ;;;!! 'mouse-scroll-move-cursor-horizontally) | 2077 | ;;!! 'mouse-scroll-move-cursor-horizontally) |
| 2110 | ;;;!! | 2078 | ;;!! |
| 2111 | ;;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full) | 2079 | ;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full) |
| 2112 | ;;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full) | 2080 | ;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full) |
| 2113 | ;;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full) | 2081 | ;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full) |
| 2114 | ;;;!! | 2082 | ;;!! |
| 2115 | ;;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) | 2083 | ;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) |
| 2116 | ;;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) | 2084 | ;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) |
| 2117 | ;;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) | 2085 | ;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) |
| 2118 | ;;;!! | 2086 | ;;!! |
| 2119 | ;;;!! (global-set-key [horizontal-scroll-bar S-mouse-2] | 2087 | ;;!! (global-set-key [horizontal-scroll-bar S-mouse-2] |
| 2120 | ;;;!! 'mouse-split-window-horizontally) | 2088 | ;;!! 'mouse-split-window-horizontally) |
| 2121 | ;;;!! (global-set-key [mode-line S-mouse-2] | 2089 | ;;!! (global-set-key [mode-line S-mouse-2] |
| 2122 | ;;;!! 'mouse-split-window-horizontally) | 2090 | ;;!! 'mouse-split-window-horizontally) |
| 2123 | ;;;!! (global-set-key [vertical-scroll-bar S-mouse-2] | 2091 | ;;!! (global-set-key [vertical-scroll-bar S-mouse-2] |
| 2124 | ;;;!! 'mouse-split-window) | 2092 | ;;!! 'mouse-split-window) |
| 2125 | 2093 | ||
| 2126 | ;;;!! ;;;; | 2094 | ;;!! ;;;; |
| 2127 | ;;;!! ;;;; Here are experimental things being tested. Mouse events | 2095 | ;;!! ;;;; Here are experimental things being tested. Mouse events |
| 2128 | ;;;!! ;;;; are of the form: | 2096 | ;;!! ;;;; are of the form: |
| 2129 | ;;;!! ;;;; ((x y) window screen-part key-sequence timestamp) | 2097 | ;;!! ;;;; ((x y) window screen-part key-sequence timestamp) |
| 2130 | ;;;!! ;; | 2098 | ;;!! ;; |
| 2131 | ;;;!! ;;;; | 2099 | ;;!! ;;;; |
| 2132 | ;;;!! ;;;; Dynamically track mouse coordinates | 2100 | ;;!! ;;;; Dynamically track mouse coordinates |
| 2133 | ;;;!! ;;;; | 2101 | ;;!! ;;;; |
| 2134 | ;;;!! ;; | 2102 | ;;!! ;; |
| 2135 | ;;;!! ;;(defun track-mouse (event) | 2103 | ;;!! ;;(defun track-mouse (event) |
| 2136 | ;;;!! ;; "Track the coordinates, absolute and relative, of the mouse." | 2104 | ;;!! ;; "Track the coordinates, absolute and relative, of the mouse." |
| 2137 | ;;;!! ;; (interactive "@e") | 2105 | ;;!! ;; (interactive "@e") |
| 2138 | ;;;!! ;; (while mouse-grabbed | 2106 | ;;!! ;; (while mouse-grabbed |
| 2139 | ;;;!! ;; (let* ((pos (read-mouse-position (selected-screen))) | 2107 | ;;!! ;; (let* ((pos (read-mouse-position (selected-screen))) |
| 2140 | ;;;!! ;; (abs-x (car pos)) | 2108 | ;;!! ;; (abs-x (car pos)) |
| 2141 | ;;;!! ;; (abs-y (cdr pos)) | 2109 | ;;!! ;; (abs-y (cdr pos)) |
| 2142 | ;;;!! ;; (relative-coordinate (coordinates-in-window-p | 2110 | ;;!! ;; (relative-coordinate (coordinates-in-window-p |
| 2143 | ;;;!! ;; (list (car pos) (cdr pos)) | 2111 | ;;!! ;; (list (car pos) (cdr pos)) |
| 2144 | ;;;!! ;; (selected-window)))) | 2112 | ;;!! ;; (selected-window)))) |
| 2145 | ;;;!! ;; (if (consp relative-coordinate) | 2113 | ;;!! ;; (if (consp relative-coordinate) |
| 2146 | ;;;!! ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y | 2114 | ;;!! ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y |
| 2147 | ;;;!! ;; (car relative-coordinate) | 2115 | ;;!! ;; (car relative-coordinate) |
| 2148 | ;;;!! ;; (car (cdr relative-coordinate))) | 2116 | ;;!! ;; (car (cdr relative-coordinate))) |
| 2149 | ;;;!! ;; (message "mouse: [%d %d]" abs-x abs-y))))) | 2117 | ;;!! ;; (message "mouse: [%d %d]" abs-x abs-y))))) |
| 2150 | ;;;!! | 2118 | ;;!! |
| 2151 | ;;;!! ;; | 2119 | ;;!! ;; |
| 2152 | ;;;!! ;; Dynamically put a box around the line indicated by point | 2120 | ;;!! ;; Dynamically put a box around the line indicated by point |
| 2153 | ;;;!! ;; | 2121 | ;;!! ;; |
| 2154 | ;;;!! ;; | 2122 | ;;!! ;; |
| 2155 | ;;;!! ;;(require 'backquote) | 2123 | ;;!! ;;(require 'backquote) |
| 2156 | ;;;!! ;; | 2124 | ;;!! ;; |
| 2157 | ;;;!! ;;(defun mouse-select-buffer-line (event) | 2125 | ;;!! ;;(defun mouse-select-buffer-line (event) |
| 2158 | ;;;!! ;; (interactive "@e") | 2126 | ;;!! ;; (interactive "@e") |
| 2159 | ;;;!! ;; (let ((relative-coordinate | 2127 | ;;!! ;; (let ((relative-coordinate |
| 2160 | ;;;!! ;; (coordinates-in-window-p (car event) (selected-window))) | 2128 | ;;!! ;; (coordinates-in-window-p (car event) (selected-window))) |
| 2161 | ;;;!! ;; (abs-y (car (cdr (car event))))) | 2129 | ;;!! ;; (abs-y (car (cdr (car event))))) |
| 2162 | ;;;!! ;; (if (consp relative-coordinate) | 2130 | ;;!! ;; (if (consp relative-coordinate) |
| 2163 | ;;;!! ;; (progn | 2131 | ;;!! ;; (progn |
| 2164 | ;;;!! ;; (save-excursion | 2132 | ;;!! ;; (save-excursion |
| 2165 | ;;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) | 2133 | ;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) |
| 2166 | ;;;!! ;; (x-draw-rectangle | 2134 | ;;!! ;; (x-draw-rectangle |
| 2167 | ;;;!! ;; (selected-screen) | 2135 | ;;!! ;; (selected-screen) |
| 2168 | ;;;!! ;; abs-y 0 | 2136 | ;;!! ;; abs-y 0 |
| 2169 | ;;;!! ;; (save-excursion | 2137 | ;;!! ;; (save-excursion |
| 2170 | ;;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) | 2138 | ;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) |
| 2171 | ;;;!! ;; (end-of-line) | 2139 | ;;!! ;; (end-of-line) |
| 2172 | ;;;!! ;; (push-mark nil t) | 2140 | ;;!! ;; (push-mark nil t) |
| 2173 | ;;;!! ;; (beginning-of-line) | 2141 | ;;!! ;; (beginning-of-line) |
| 2174 | ;;;!! ;; (- (region-end) (region-beginning))) 1)) | 2142 | ;;!! ;; (- (region-end) (region-beginning))) 1)) |
| 2175 | ;;;!! ;; (sit-for 1) | 2143 | ;;!! ;; (sit-for 1) |
| 2176 | ;;;!! ;; (x-erase-rectangle (selected-screen)))))) | 2144 | ;;!! ;; (x-erase-rectangle (selected-screen)))))) |
| 2177 | ;;;!! ;; | 2145 | ;;!! ;; |
| 2178 | ;;;!! ;;(defvar last-line-drawn nil) | 2146 | ;;!! ;;(defvar last-line-drawn nil) |
| 2179 | ;;;!! ;;(defvar begin-delim "[^ \t]") | 2147 | ;;!! ;;(defvar begin-delim "[^ \t]") |
| 2180 | ;;;!! ;;(defvar end-delim "[^ \t]") | 2148 | ;;!! ;;(defvar end-delim "[^ \t]") |
| 2181 | ;;;!! ;; | 2149 | ;;!! ;; |
| 2182 | ;;;!! ;;(defun mouse-boxing (event) | 2150 | ;;!! ;;(defun mouse-boxing (event) |
| 2183 | ;;;!! ;; (interactive "@e") | 2151 | ;;!! ;; (interactive "@e") |
| 2184 | ;;;!! ;; (save-excursion | 2152 | ;;!! ;; (save-excursion |
| 2185 | ;;;!! ;; (let ((screen (selected-screen))) | 2153 | ;;!! ;; (let ((screen (selected-screen))) |
| 2186 | ;;;!! ;; (while (= (x-mouse-events) 0) | 2154 | ;;!! ;; (while (= (x-mouse-events) 0) |
| 2187 | ;;;!! ;; (let* ((pos (read-mouse-position screen)) | 2155 | ;;!! ;; (let* ((pos (read-mouse-position screen)) |
| 2188 | ;;;!! ;; (abs-x (car pos)) | 2156 | ;;!! ;; (abs-x (car pos)) |
| 2189 | ;;;!! ;; (abs-y (cdr pos)) | 2157 | ;;!! ;; (abs-y (cdr pos)) |
| 2190 | ;;;!! ;; (relative-coordinate | 2158 | ;;!! ;; (relative-coordinate |
| 2191 | ;;;!! ;; (coordinates-in-window-p `(,abs-x ,abs-y) | 2159 | ;;!! ;; (coordinates-in-window-p `(,abs-x ,abs-y) |
| 2192 | ;;;!! ;; (selected-window))) | 2160 | ;;!! ;; (selected-window))) |
| 2193 | ;;;!! ;; (begin-reg nil) | 2161 | ;;!! ;; (begin-reg nil) |
| 2194 | ;;;!! ;; (end-reg nil) | 2162 | ;;!! ;; (end-reg nil) |
| 2195 | ;;;!! ;; (end-column nil) | 2163 | ;;!! ;; (end-column nil) |
| 2196 | ;;;!! ;; (begin-column nil)) | 2164 | ;;!! ;; (begin-column nil)) |
| 2197 | ;;;!! ;; (if (and (consp relative-coordinate) | 2165 | ;;!! ;; (if (and (consp relative-coordinate) |
| 2198 | ;;;!! ;; (or (not last-line-drawn) | 2166 | ;;!! ;; (or (not last-line-drawn) |
| 2199 | ;;;!! ;; (not (= last-line-drawn abs-y)))) | 2167 | ;;!! ;; (not (= last-line-drawn abs-y)))) |
| 2200 | ;;;!! ;; (progn | 2168 | ;;!! ;; (progn |
| 2201 | ;;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) | 2169 | ;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) |
| 2202 | ;;;!! ;; (if (= (following-char) 10) | 2170 | ;;!! ;; (if (= (following-char) 10) |
| 2203 | ;;;!! ;; () | 2171 | ;;!! ;; () |
| 2204 | ;;;!! ;; (progn | 2172 | ;;!! ;; (progn |
| 2205 | ;;;!! ;; (setq begin-reg (1- (re-search-forward end-delim))) | 2173 | ;;!! ;; (setq begin-reg (1- (re-search-forward end-delim))) |
| 2206 | ;;;!! ;; (setq begin-column (1- (current-column))) | 2174 | ;;!! ;; (setq begin-column (1- (current-column))) |
| 2207 | ;;;!! ;; (end-of-line) | 2175 | ;;!! ;; (end-of-line) |
| 2208 | ;;;!! ;; (setq end-reg (1+ (re-search-backward begin-delim))) | 2176 | ;;!! ;; (setq end-reg (1+ (re-search-backward begin-delim))) |
| 2209 | ;;;!! ;; (setq end-column (1+ (current-column))) | 2177 | ;;!! ;; (setq end-column (1+ (current-column))) |
| 2210 | ;;;!! ;; (message "%s" (buffer-substring begin-reg end-reg)) | 2178 | ;;!! ;; (message "%s" (buffer-substring begin-reg end-reg)) |
| 2211 | ;;;!! ;; (x-draw-rectangle screen | 2179 | ;;!! ;; (x-draw-rectangle screen |
| 2212 | ;;;!! ;; (setq last-line-drawn abs-y) | 2180 | ;;!! ;; (setq last-line-drawn abs-y) |
| 2213 | ;;;!! ;; begin-column | 2181 | ;;!! ;; begin-column |
| 2214 | ;;;!! ;; (- end-column begin-column) 1)))))))))) | 2182 | ;;!! ;; (- end-column begin-column) 1)))))))))) |
| 2215 | ;;;!! ;; | 2183 | ;;!! ;; |
| 2216 | ;;;!! ;;(defun mouse-erase-box () | 2184 | ;;!! ;;(defun mouse-erase-box () |
| 2217 | ;;;!! ;; (interactive) | 2185 | ;;!! ;; (interactive) |
| 2218 | ;;;!! ;; (if last-line-drawn | 2186 | ;;!! ;; (if last-line-drawn |
| 2219 | ;;;!! ;; (progn | 2187 | ;;!! ;; (progn |
| 2220 | ;;;!! ;; (x-erase-rectangle (selected-screen)) | 2188 | ;;!! ;; (x-erase-rectangle (selected-screen)) |
| 2221 | ;;;!! ;; (setq last-line-drawn nil)))) | 2189 | ;;!! ;; (setq last-line-drawn nil)))) |
| 2222 | ;;;!! | 2190 | ;;!! |
| 2223 | ;;;!! ;;; (defun test-x-rectangle () | 2191 | ;;!! ;;; (defun test-x-rectangle () |
| 2224 | ;;;!! ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) | 2192 | ;;!! ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) |
| 2225 | ;;;!! ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) | 2193 | ;;!! ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) |
| 2226 | ;;;!! ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) | 2194 | ;;!! ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) |
| 2227 | ;;;!! | 2195 | ;;!! |
| 2228 | ;;;!! ;; | 2196 | ;;!! ;; |
| 2229 | ;;;!! ;; Here is how to do double clicking in lisp. About to change. | 2197 | ;;!! ;; Here is how to do double clicking in lisp. About to change. |
| 2230 | ;;;!! ;; | 2198 | ;;!! ;; |
| 2231 | ;;;!! | 2199 | ;;!! |
| 2232 | ;;;!! (defvar double-start nil) | 2200 | ;;!! (defvar double-start nil) |
| 2233 | ;;;!! (defconst double-click-interval 300 | 2201 | ;;!! (defconst double-click-interval 300 |
| 2234 | ;;;!! "Max ticks between clicks") | 2202 | ;;!! "Max ticks between clicks") |
| 2235 | ;;;!! | 2203 | ;;!! |
| 2236 | ;;;!! (defun double-down (event) | 2204 | ;;!! (defun double-down (event) |
| 2237 | ;;;!! (interactive "@e") | 2205 | ;;!! (interactive "@e") |
| 2238 | ;;;!! (if double-start | 2206 | ;;!! (if double-start |
| 2239 | ;;;!! (let ((interval (- (nth 4 event) double-start))) | 2207 | ;;!! (let ((interval (- (nth 4 event) double-start))) |
| 2240 | ;;;!! (if (< interval double-click-interval) | 2208 | ;;!! (if (< interval double-click-interval) |
| 2241 | ;;;!! (progn | 2209 | ;;!! (progn |
| 2242 | ;;;!! (backward-up-list 1) | 2210 | ;;!! (backward-up-list 1) |
| 2243 | ;;;!! ;; (message "Interval %d" interval) | 2211 | ;;!! ;; (message "Interval %d" interval) |
| 2244 | ;;;!! (sleep-for 1))) | 2212 | ;;!! (sleep-for 1))) |
| 2245 | ;;;!! (setq double-start nil)) | 2213 | ;;!! (setq double-start nil)) |
| 2246 | ;;;!! (setq double-start (nth 4 event)))) | 2214 | ;;!! (setq double-start (nth 4 event)))) |
| 2247 | ;;;!! | 2215 | ;;!! |
| 2248 | ;;;!! (defun double-up (event) | 2216 | ;;!! (defun double-up (event) |
| 2249 | ;;;!! (interactive "@e") | 2217 | ;;!! (interactive "@e") |
| 2250 | ;;;!! (and double-start | 2218 | ;;!! (and double-start |
| 2251 | ;;;!! (> (- (nth 4 event ) double-start) double-click-interval) | 2219 | ;;!! (> (- (nth 4 event ) double-start) double-click-interval) |
| 2252 | ;;;!! (setq double-start nil))) | 2220 | ;;!! (setq double-start nil))) |
| 2253 | ;;;!! | 2221 | ;;!! |
| 2254 | ;;;!! ;;; (defun x-test-doubleclick () | 2222 | ;;!! ;;; (defun x-test-doubleclick () |
| 2255 | ;;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) | 2223 | ;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) |
| 2256 | ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) | 2224 | ;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) |
| 2257 | ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) | 2225 | ;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) |
| 2258 | ;;;!! | 2226 | ;;!! |
| 2259 | ;;;!! ;; | 2227 | ;;!! ;; |
| 2260 | ;;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar. | 2228 | ;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar. |
| 2261 | ;;;!! ;; | 2229 | ;;!! ;; |
| 2262 | ;;;!! | 2230 | ;;!! |
| 2263 | ;;;!! (defvar scrolled-lines 0) | 2231 | ;;!! (defvar scrolled-lines 0) |
| 2264 | ;;;!! (defconst scroll-speed 1) | 2232 | ;;!! (defconst scroll-speed 1) |
| 2265 | ;;;!! | 2233 | ;;!! |
| 2266 | ;;;!! (defun incr-scroll-down (event) | 2234 | ;;!! (defun incr-scroll-down (event) |
| 2267 | ;;;!! (interactive "@e") | 2235 | ;;!! (interactive "@e") |
| 2268 | ;;;!! (setq scrolled-lines 0) | 2236 | ;;!! (setq scrolled-lines 0) |
| 2269 | ;;;!! (incremental-scroll scroll-speed)) | 2237 | ;;!! (incremental-scroll scroll-speed)) |
| 2270 | ;;;!! | 2238 | ;;!! |
| 2271 | ;;;!! (defun incr-scroll-up (event) | 2239 | ;;!! (defun incr-scroll-up (event) |
| 2272 | ;;;!! (interactive "@e") | 2240 | ;;!! (interactive "@e") |
| 2273 | ;;;!! (setq scrolled-lines 0) | 2241 | ;;!! (setq scrolled-lines 0) |
| 2274 | ;;;!! (incremental-scroll (- scroll-speed))) | 2242 | ;;!! (incremental-scroll (- scroll-speed))) |
| 2275 | ;;;!! | 2243 | ;;!! |
| 2276 | ;;;!! (defun incremental-scroll (n) | 2244 | ;;!! (defun incremental-scroll (n) |
| 2277 | ;;;!! (while (= (x-mouse-events) 0) | 2245 | ;;!! (while (= (x-mouse-events) 0) |
| 2278 | ;;;!! (setq scrolled-lines (1+ (* scroll-speed scrolled-lines))) | 2246 | ;;!! (setq scrolled-lines (1+ (* scroll-speed scrolled-lines))) |
| 2279 | ;;;!! (scroll-down n) | 2247 | ;;!! (scroll-down n) |
| 2280 | ;;;!! (sit-for 300 t))) | 2248 | ;;!! (sit-for 300 t))) |
| 2281 | ;;;!! | 2249 | ;;!! |
| 2282 | ;;;!! (defun incr-scroll-stop (event) | 2250 | ;;!! (defun incr-scroll-stop (event) |
| 2283 | ;;;!! (interactive "@e") | 2251 | ;;!! (interactive "@e") |
| 2284 | ;;;!! (message "Scrolled %d lines" scrolled-lines) | 2252 | ;;!! (message "Scrolled %d lines" scrolled-lines) |
| 2285 | ;;;!! (setq scrolled-lines 0) | 2253 | ;;!! (setq scrolled-lines 0) |
| 2286 | ;;;!! (sleep-for 1)) | 2254 | ;;!! (sleep-for 1)) |
| 2287 | ;;;!! | 2255 | ;;!! |
| 2288 | ;;;!! ;;; (defun x-testing-scroll () | 2256 | ;;!! ;;; (defun x-testing-scroll () |
| 2289 | ;;;!! ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix))) | 2257 | ;;!! ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix))) |
| 2290 | ;;;!! ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down) | 2258 | ;;!! ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down) |
| 2291 | ;;;!! ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up) | 2259 | ;;!! ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up) |
| 2292 | ;;;!! ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop) | 2260 | ;;!! ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop) |
| 2293 | ;;;!! ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop))) | 2261 | ;;!! ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop))) |
| 2294 | ;;;!! | 2262 | ;;!! |
| 2295 | ;;;!! ;; | 2263 | ;;!! ;; |
| 2296 | ;;;!! ;; Some playthings suitable for picture mode? They need work. | 2264 | ;;!! ;; Some playthings suitable for picture mode? They need work. |
| 2297 | ;;;!! ;; | 2265 | ;;!! ;; |
| 2298 | ;;;!! | 2266 | ;;!! |
| 2299 | ;;;!! (defun mouse-kill-rectangle (event) | 2267 | ;;!! (defun mouse-kill-rectangle (event) |
| 2300 | ;;;!! "Kill the rectangle between point and the mouse cursor." | 2268 | ;;!! "Kill the rectangle between point and the mouse cursor." |
| 2301 | ;;;!! (interactive "@e") | 2269 | ;;!! (interactive "@e") |
| 2302 | ;;;!! (let ((point-save (point))) | 2270 | ;;!! (let ((point-save (point))) |
| 2303 | ;;;!! (save-excursion | 2271 | ;;!! (save-excursion |
| 2304 | ;;;!! (mouse-set-point event) | 2272 | ;;!! (mouse-set-point event) |
| 2305 | ;;;!! (push-mark nil t) | 2273 | ;;!! (push-mark nil t) |
| 2306 | ;;;!! (if (> point-save (point)) | 2274 | ;;!! (if (> point-save (point)) |
| 2307 | ;;;!! (kill-rectangle (point) point-save) | 2275 | ;;!! (kill-rectangle (point) point-save) |
| 2308 | ;;;!! (kill-rectangle point-save (point)))))) | 2276 | ;;!! (kill-rectangle point-save (point)))))) |
| 2309 | ;;;!! | 2277 | ;;!! |
| 2310 | ;;;!! (defun mouse-open-rectangle (event) | 2278 | ;;!! (defun mouse-open-rectangle (event) |
| 2311 | ;;;!! "Kill the rectangle between point and the mouse cursor." | 2279 | ;;!! "Kill the rectangle between point and the mouse cursor." |
| 2312 | ;;;!! (interactive "@e") | 2280 | ;;!! (interactive "@e") |
| 2313 | ;;;!! (let ((point-save (point))) | 2281 | ;;!! (let ((point-save (point))) |
| 2314 | ;;;!! (save-excursion | 2282 | ;;!! (save-excursion |
| 2315 | ;;;!! (mouse-set-point event) | 2283 | ;;!! (mouse-set-point event) |
| 2316 | ;;;!! (push-mark nil t) | 2284 | ;;!! (push-mark nil t) |
| 2317 | ;;;!! (if (> point-save (point)) | 2285 | ;;!! (if (> point-save (point)) |
| 2318 | ;;;!! (open-rectangle (point) point-save) | 2286 | ;;!! (open-rectangle (point) point-save) |
| 2319 | ;;;!! (open-rectangle point-save (point)))))) | 2287 | ;;!! (open-rectangle point-save (point)))))) |
| 2320 | ;;;!! | 2288 | ;;!! |
| 2321 | ;;;!! ;; Must be a better way to do this. | 2289 | ;;!! ;; Must be a better way to do this. |
| 2322 | ;;;!! | 2290 | ;;!! |
| 2323 | ;;;!! (defun mouse-multiple-insert (n char) | 2291 | ;;!! (defun mouse-multiple-insert (n char) |
| 2324 | ;;;!! (while (> n 0) | 2292 | ;;!! (while (> n 0) |
| 2325 | ;;;!! (insert char) | 2293 | ;;!! (insert char) |
| 2326 | ;;;!! (setq n (1- n)))) | 2294 | ;;!! (setq n (1- n)))) |
| 2327 | ;;;!! | 2295 | ;;!! |
| 2328 | ;;;!! ;; What this could do is not finalize until button was released. | 2296 | ;;!! ;; What this could do is not finalize until button was released. |
| 2329 | ;;;!! | 2297 | ;;!! |
| 2330 | ;;;!! (defun mouse-move-text (event) | 2298 | ;;!! (defun mouse-move-text (event) |
| 2331 | ;;;!! "Move text from point to cursor position, inserting spaces." | 2299 | ;;!! "Move text from point to cursor position, inserting spaces." |
| 2332 | ;;;!! (interactive "@e") | 2300 | ;;!! (interactive "@e") |
| 2333 | ;;;!! (let* ((relative-coordinate | 2301 | ;;!! (let* ((relative-coordinate |
| 2334 | ;;;!! (coordinates-in-window-p (car event) (selected-window)))) | 2302 | ;;!! (coordinates-in-window-p (car event) (selected-window)))) |
| 2335 | ;;;!! (if (consp relative-coordinate) | 2303 | ;;!! (if (consp relative-coordinate) |
| 2336 | ;;;!! (cond ((> (current-column) (car relative-coordinate)) | 2304 | ;;!! (cond ((> (current-column) (car relative-coordinate)) |
| 2337 | ;;;!! (delete-char | 2305 | ;;!! (delete-char |
| 2338 | ;;;!! (- (car relative-coordinate) (current-column)))) | 2306 | ;;!! (- (car relative-coordinate) (current-column)))) |
| 2339 | ;;;!! ((< (current-column) (car relative-coordinate)) | 2307 | ;;!! ((< (current-column) (car relative-coordinate)) |
| 2340 | ;;;!! (mouse-multiple-insert | 2308 | ;;!! (mouse-multiple-insert |
| 2341 | ;;;!! (- (car relative-coordinate) (current-column)) " ")) | 2309 | ;;!! (- (car relative-coordinate) (current-column)) " ")) |
| 2342 | ;;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) | 2310 | ;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) |
| 2343 | 2311 | ||
| 2344 | ;; Choose a completion with the mouse. | 2312 | ;; Choose a completion with the mouse. |
| 2345 | 2313 | ||
| @@ -2422,15 +2390,15 @@ and selects that window." | |||
| 2422 | "-schumacher-clean-medium-r-normal--16-*-*-*-c-80-iso8859-1") | 2390 | "-schumacher-clean-medium-r-normal--16-*-*-*-c-80-iso8859-1") |
| 2423 | ("") | 2391 | ("") |
| 2424 | ("sony 8x16" "-sony-fixed-medium-r-normal--16-*-*-*-c-80-iso8859-1") | 2392 | ("sony 8x16" "-sony-fixed-medium-r-normal--16-*-*-*-c-80-iso8859-1") |
| 2425 | ;;; We don't seem to have these; who knows what they are. | 2393 | ;; We don't seem to have these; who knows what they are. |
| 2426 | ;;; ("fg-18" "fg-18") | 2394 | ;; ("fg-18" "fg-18") |
| 2427 | ;;; ("fg-25" "fg-25") | 2395 | ;; ("fg-25" "fg-25") |
| 2428 | ("lucidasanstypewriter-12" "-b&h-lucidatypewriter-medium-r-normal-sans-*-120-*-*-*-*-iso8859-1") | 2396 | ("lucidasanstypewriter-12" "-b&h-lucidatypewriter-medium-r-normal-sans-*-120-*-*-*-*-iso8859-1") |
| 2429 | ("lucidasanstypewriter-bold-14" "-b&h-lucidatypewriter-bold-r-normal-sans-*-140-*-*-*-*-iso8859-1") | 2397 | ("lucidasanstypewriter-bold-14" "-b&h-lucidatypewriter-bold-r-normal-sans-*-140-*-*-*-*-iso8859-1") |
| 2430 | ("lucidasanstypewriter-bold-24" | 2398 | ("lucidasanstypewriter-bold-24" |
| 2431 | "-b&h-lucidatypewriter-bold-r-normal-sans-*-240-*-*-*-*-iso8859-1") | 2399 | "-b&h-lucidatypewriter-bold-r-normal-sans-*-240-*-*-*-*-iso8859-1") |
| 2432 | ;;; ("lucidatypewriter-bold-r-24" "-b&h-lucidatypewriter-bold-r-normal-sans-24-240-75-75-m-140-iso8859-1") | 2400 | ;; ("lucidatypewriter-bold-r-24" "-b&h-lucidatypewriter-bold-r-normal-sans-24-240-75-75-m-140-iso8859-1") |
| 2433 | ;;; ("fixed-medium-20" "-misc-fixed-medium-*-*-*-20-*-*-*-*-*-*-*") | 2401 | ;; ("fixed-medium-20" "-misc-fixed-medium-*-*-*-20-*-*-*-*-*-*-*") |
| 2434 | ) | 2402 | ) |
| 2435 | ("Courier" | 2403 | ("Courier" |
| 2436 | ;; For these, we specify the point height. | 2404 | ;; For these, we specify the point height. |