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
fcfc3c63
Commit
fcfc3c63
authored
May 15, 1993
by
Richard M. Stallman
Browse files
(mouse-drag-region): New command, on down-mouse-1.
parent
6e8d0db7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
5 deletions
+51
-5
lisp/mouse.el
lisp/mouse.el
+51
-5
No files found.
lisp/mouse.el
View file @
fcfc3c63
...
...
@@ -99,18 +99,65 @@ This must be bound to a mouse click."
(
defun
mouse-set-region
(
click
)
"Set the region to the text that the mouse is dragged over.
This must be bound to a mouse
click
."
This must be bound to a mouse
drag event
."
(
interactive
"e"
)
(
let
((
posn
(
event-start
click
))
(
end
(
event-end
click
)))
(
select-window
(
posn-window
posn
))
(
if
(
numberp
(
posn-point
posn
))
(
goto-char
(
posn-point
posn
)))
(
sit-for
1
)
;; If mark is highlighted, no need to bounce the cursor.
(
or
(
and
transient-mark-mode
(
eq
(
framep
(
selected-frame
))
'x
))
(
sit-for
1
))
(
push-mark
)
(
if
(
numberp
(
posn-point
end
))
(
goto-char
(
posn-point
end
)))))
(
defun
mouse-drag-region
(
click
)
"Set the region to the text that the mouse is dragged over.
This must be bound to a button-down mouse event."
(
interactive
"e"
)
(
let
((
posn
(
event-start
click
))
done
event
(
mark-active
nil
))
(
select-window
(
posn-window
posn
))
;; Set point temporarily, so user sees where it is.
(
if
(
numberp
(
posn-point
posn
))
(
goto-char
(
posn-point
posn
)))
;; Turn off the old mark when we set up an empty region.
(
setq
deactivate-mark
t
)))
;;;Nice hack, but too slow.
;;;(defun mouse-drag-region-1 (click)
;;; "Set the region to the text that the mouse is dragged over.
;;;This must be bound to a button-down mouse event."
;;; (interactive "e")
;;; (let (newmark)
;;; (let ((posn (event-start click))
;;; done event omark (mark-active t))
;;; (select-window (posn-window posn))
;;; (setq omark (and mark-active (mark)))
;;; (if (numberp (posn-point posn))
;;; (goto-char (posn-point posn)))
;;; ;; Set mark temporarily, so highlighting does what we want.
;;; (set-marker (mark-marker) (point))
;;; (track-mouse
;;; (while (not done)
;;; (setq event (read-event))
;;; (if (eq (car-safe event) 'mouse-movement)
;;; (goto-char (posn-point (event-start event)))
;;; ;; Exit when we get the drag event; ignore that event.
;;; (setq done t))))
;;; (if (/= (mark) (point))
;;; (setq newmark (mark)))
;;; ;; Restore previous mark status.
;;; (if omark (set-marker (mark-marker) omark)))
;;; ;; Now, if we dragged, set the mark at the proper place.
;;; (if newmark
;;; (push-mark newmark t)
;;; ;; Turn off the old mark when we set up an empty region.
;;; (setq deactivate-mark t))))
(
defun
mouse-set-mark
(
click
)
"Set mark at the position clicked on with the mouse.
Display cursor at that position for a second.
...
...
@@ -603,11 +650,10 @@ and selects that window."
;;; Bindings for mouse commands.
;; This won't be needed once the drag and down events
;; are properly implemented.
(
define-key
global-map
[down-mouse-1]
'mouse-drag-region
)
(
global-set-key
[mouse-1]
'mouse-set-point
)
(
global-set-key
[drag-mouse-1]
'mouse-set-region
)
(
global-set-key
[mouse-2]
'mouse-yank-at-click
)
(
global-set-key
[mouse-3]
'mouse-save-then-kill
)
...
...
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