Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
c6005bf3
Commit
c6005bf3
authored
Apr 12, 2002
by
Stefan Monnier
Browse files
(xterm-mouse-mode): Use define-minor-mode.
parent
efcc2791
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
24 deletions
+12
-24
lisp/xt-mouse.el
lisp/xt-mouse.el
+12
-24
No files found.
lisp/xt-mouse.el
View file @
c6005bf3
...
@@ -106,7 +106,6 @@
...
@@ -106,7 +106,6 @@
"Position of last xterm mouse event relative to the frame."
)
"Position of last xterm mouse event relative to the frame."
)
;; Indicator for the xterm-mouse mode.
;; Indicator for the xterm-mouse mode.
(
defvar
xterm-mouse-mode
nil
)
(
defun
xterm-mouse-position-function
(
pos
)
(
defun
xterm-mouse-position-function
(
pos
)
"Bound to `mouse-position-function' in XTerm mouse mode."
"Bound to `mouse-position-function' in XTerm mouse mode."
...
@@ -159,41 +158,30 @@
...
@@ -159,41 +158,30 @@
(
list
window
pos
point
(
list
window
pos
point
(
/
(
nth
2
(
current-time
))
1000
)))))
(
/
(
nth
2
(
current-time
))
1000
)))))
(
or
(
assq
'xterm-mouse-mode
minor-mode-alist
)
(
setq
minor-mode-alist
(
cons
'
(
xterm-mouse-mode
(
" Mouse"
))
minor-mode-alist
)))
;;;###autoload
;;;###autoload
(
def
un
xterm-mouse-mode
(
arg
)
(
def
ine-minor-mode
xterm-mouse-mode
"Toggle XTerm mouse mode.
"Toggle XTerm mouse mode.
With prefix arg, turn XTerm mouse mode on iff arg is positive.
With prefix arg, turn XTerm mouse mode on iff arg is positive.
Turn it on to use emacs mouse commands, and off to use xterm mouse commands."
Turn it on to use emacs mouse commands, and off to use xterm mouse commands."
(
interactive
"P"
)
nil
" Mouse"
nil
(
if
(
or
(
and
(
null
arg
)
xterm-mouse-mode
)
(
if
xterm-mouse-mode
(
<=
(
prefix-numeric-value
arg
)
0
))
;; Turn it on
;; Turn it off
(
unless
window-system
(
if
xterm-mouse-mode
(
setq
mouse-position-function
#'
xterm-mouse-position-function
)
(
progn
(
turn-on-xterm-mouse-tracking
))
(
turn-off-xterm-mouse-tracking
)
;; Turn it off
(
setq
xterm-mouse-mode
nil
(
turn-off-xterm-mouse-tracking
'force
)
mouse-position-function
nil
)
(
setq
mouse-position-function
nil
)))
(
set-buffer-modified-p
(
buffer-modified-p
))))
;;Turn it on
(
unless
(
or
window-system
xterm-mouse-mode
)
(
setq
xterm-mouse-mode
t
mouse-position-function
#'
xterm-mouse-position-function
)
(
turn-on-xterm-mouse-tracking
)
(
set-buffer-modified-p
(
buffer-modified-p
)))))
(
defun
turn-on-xterm-mouse-tracking
()
(
defun
turn-on-xterm-mouse-tracking
()
"Enable Emacs mouse tracking in xterm."
"Enable Emacs mouse tracking in xterm."
(
if
xterm-mouse-mode
(
if
xterm-mouse-mode
(
send-string-to-terminal
"\e[?1000h"
)))
(
send-string-to-terminal
"\e[?1000h"
)))
(
defun
turn-off-xterm-mouse-tracking
()
(
defun
turn-off-xterm-mouse-tracking
(
&optional
force
)
"Disable Emacs mouse tracking in xterm."
"Disable Emacs mouse tracking in xterm."
(
if
xterm-mouse-mode
(
if
(
or
force
xterm-mouse-mode
)
(
send-string-to-terminal
"\e[?1000l"
)))
(
send-string-to-terminal
"\e[?1000l"
)))
;; Restore normal mouse behaviour outside Emacs.
;; Restore normal mouse behaviour outside Emacs.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment