Mercurial > emacs
comparison lisp/mouse.el @ 758:f8688580137c
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Fri, 10 Jul 1992 22:19:56 +0000 |
parents | c7d478752305 |
children | 203c23c9f22c |
comparison
equal
deleted
inserted
replaced
757:745b7fc3a3d3 | 758:f8688580137c |
---|---|
75 | 75 |
76 (defun mouse-kill (click) | 76 (defun mouse-kill (click) |
77 "Kill the region between point and the mouse click. | 77 "Kill the region between point and the mouse click. |
78 The text is saved in the kill ring, as with \\[kill-region]." | 78 The text is saved in the kill ring, as with \\[kill-region]." |
79 (interactive "K") | 79 (interactive "K") |
80 (mouse-set-mark click) | 80 (let ((click-posn (event-point click))) |
81 (kill-region)) | 81 (kill-region (min (point) click-posn) |
82 (max (point) click-posn)))) | |
82 | 83 |
83 (defun mouse-yank-at-click (click arg) | 84 (defun mouse-yank-at-click (click arg) |
84 "Insert the last stretch of killed text at the position clicked on. | 85 "Insert the last stretch of killed text at the position clicked on. |
85 Prefix arguments are interpreted as with \\[yank]." | 86 Prefix arguments are interpreted as with \\[yank]." |
86 (interactive "K\nP") | 87 (interactive "K\nP") |
260 ;; (message "mouse: [%d %d]" abs-x abs-y))))) | 261 ;; (message "mouse: [%d %d]" abs-x abs-y))))) |
261 | 262 |
262 ;; | 263 ;; |
263 ;; Dynamically put a box around the line indicated by point | 264 ;; Dynamically put a box around the line indicated by point |
264 ;; | 265 ;; |
265 | 266 ;; |
266 (require 'backquote) | 267 ;;(require 'backquote) |
267 | 268 ;; |
268 (defun mouse-select-buffer-line (event) | 269 ;;(defun mouse-select-buffer-line (event) |
269 (interactive "@e") | 270 ;; (interactive "@e") |
270 (let ((relative-coordinate | 271 ;; (let ((relative-coordinate |
271 (coordinates-in-window-p (car event) (selected-window))) | 272 ;; (coordinates-in-window-p (car event) (selected-window))) |
272 (abs-y (car (cdr (car event))))) | 273 ;; (abs-y (car (cdr (car event))))) |
273 (if (consp relative-coordinate) | 274 ;; (if (consp relative-coordinate) |
274 (progn | 275 ;; (progn |
275 (save-excursion | 276 ;; (save-excursion |
276 (move-to-window-line (car (cdr relative-coordinate))) | 277 ;; (move-to-window-line (car (cdr relative-coordinate))) |
277 (x-draw-rectangle | 278 ;; (x-draw-rectangle |
278 (selected-screen) | 279 ;; (selected-screen) |
279 abs-y 0 | 280 ;; abs-y 0 |
280 (save-excursion | 281 ;; (save-excursion |
281 (move-to-window-line (car (cdr relative-coordinate))) | 282 ;; (move-to-window-line (car (cdr relative-coordinate))) |
282 (end-of-line) | 283 ;; (end-of-line) |
283 (push-mark nil t) | 284 ;; (push-mark nil t) |
284 (beginning-of-line) | 285 ;; (beginning-of-line) |
285 (- (region-end) (region-beginning))) 1) | 286 ;; (- (region-end) (region-beginning))) 1)) |
286 (setq the-buffer (Buffer-menu-buffer t))) | 287 ;; (sit-for 1) |
287 (sit-for 1) | 288 ;; (x-erase-rectangle (selected-screen)))))) |
288 (x-erase-rectangle (selected-screen)))))) | 289 ;; |
289 | 290 ;;(defvar last-line-drawn nil) |
290 (defvar last-line-drawn nil) | 291 ;;(defvar begin-delim "[^ \t]") |
291 (defvar begin-delim "[^ \t]") | 292 ;;(defvar end-delim "[^ \t]") |
292 (defvar end-delim "[^ \t]") | 293 ;; |
293 | 294 ;;(defun mouse-boxing (event) |
294 (defun mouse-boxing (event) | 295 ;; (interactive "@e") |
295 (interactive "@e") | 296 ;; (save-excursion |
296 (save-excursion | 297 ;; (let ((screen (selected-screen))) |
297 (let ((screen (selected-screen))) | 298 ;; (while (= (x-mouse-events) 0) |
298 (while (= (x-mouse-events) 0) | 299 ;; (let* ((pos (read-mouse-position screen)) |
299 (let* ((pos (read-mouse-position screen)) | 300 ;; (abs-x (car pos)) |
300 (abs-x (car pos)) | 301 ;; (abs-y (cdr pos)) |
301 (abs-y (cdr pos)) | 302 ;; (relative-coordinate |
302 (relative-coordinate | 303 ;; (coordinates-in-window-p (` ((, abs-x) (, abs-y))) |
303 (coordinates-in-window-p (` ((, abs-x) (, abs-y))) | 304 ;; (selected-window))) |
304 (selected-window))) | 305 ;; (begin-reg nil) |
305 (begin-reg nil) | 306 ;; (end-reg nil) |
306 (end-reg nil) | 307 ;; (end-column nil) |
307 (end-column nil) | 308 ;; (begin-column nil)) |
308 (begin-column nil)) | 309 ;; (if (and (consp relative-coordinate) |
309 (if (and (consp relative-coordinate) | 310 ;; (or (not last-line-drawn) |
310 (or (not last-line-drawn) | 311 ;; (not (= last-line-drawn abs-y)))) |
311 (not (= last-line-drawn abs-y)))) | 312 ;; (progn |
312 (progn | 313 ;; (move-to-window-line (car (cdr relative-coordinate))) |
313 (move-to-window-line (car (cdr relative-coordinate))) | 314 ;; (if (= (following-char) 10) |
314 (if (= (following-char) 10) | 315 ;; () |
315 () | 316 ;; (progn |
316 (progn | 317 ;; (setq begin-reg (1- (re-search-forward end-delim))) |
317 (setq begin-reg (1- (re-search-forward end-delim))) | 318 ;; (setq begin-column (1- (current-column))) |
318 (setq begin-column (1- (current-column))) | 319 ;; (end-of-line) |
319 (end-of-line) | 320 ;; (setq end-reg (1+ (re-search-backward begin-delim))) |
320 (setq end-reg (1+ (re-search-backward begin-delim))) | 321 ;; (setq end-column (1+ (current-column))) |
321 (setq end-column (1+ (current-column))) | 322 ;; (message "%s" (buffer-substring begin-reg end-reg)) |
322 (message "%s" (buffer-substring begin-reg end-reg)) | 323 ;; (x-draw-rectangle screen |
323 (x-draw-rectangle screen | 324 ;; (setq last-line-drawn abs-y) |
324 (setq last-line-drawn abs-y) | 325 ;; begin-column |
325 begin-column | 326 ;; (- end-column begin-column) 1)))))))))) |
326 (- end-column begin-column) 1)))))))))) | 327 ;; |
327 | 328 ;;(defun mouse-erase-box () |
328 (defun mouse-erase-box () | 329 ;; (interactive) |
329 (interactive) | 330 ;; (if last-line-drawn |
330 (if last-line-drawn | 331 ;; (progn |
331 (progn | 332 ;; (x-erase-rectangle (selected-screen)) |
332 (x-erase-rectangle (selected-screen)) | 333 ;; (setq last-line-drawn nil)))) |
333 (setq last-line-drawn nil)))) | |
334 | 334 |
335 ;;; (defun test-x-rectangle () | 335 ;;; (defun test-x-rectangle () |
336 ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) | 336 ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) |
337 ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) | 337 ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) |
338 ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) | 338 ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) |