comparison lisp/emulation/viper-mous.el @ 42602:633233bf2bbf

2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Tue, 08 Jan 2002 04:36:01 +0000
parents 8dccf2552307
children 0d8b17d428b5
comparison
equal deleted inserted replaced
42601:ddd4802ff361 42602:633233bf2bbf
1 ;;; viper-mous.el --- mouse support for Viper 1 ;;; viper-mous.el --- mouse support for Viper
2 2
3 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1994, 95, 96, 97, 2001, 02 Free Software Foundation, Inc.
4 4
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
6 6
7 ;; This file is part of GNU Emacs. 7 ;; This file is part of GNU Emacs.
8 8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify 9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by 10 ;; it under the terms of the GNU General Public License as published by
119 (defsubst viper-multiclick-p () 119 (defsubst viper-multiclick-p ()
120 (not (viper-sit-for-short viper-multiclick-timeout t))) 120 (not (viper-sit-for-short viper-multiclick-timeout t)))
121 121
122 ;; Returns window where click occurs 122 ;; Returns window where click occurs
123 (defun viper-mouse-click-window (click) 123 (defun viper-mouse-click-window (click)
124 (let ((win (if viper-xemacs-p 124 (let ((win (viper-cond-compile-for-xemacs-or-emacs
125 (event-window click) 125 (event-window click) ; xemacs
126 (posn-window (event-start click))))) 126 (posn-window (event-start click)) ; emacs
127 )))
127 (if (window-live-p win) 128 (if (window-live-p win)
128 win 129 win
129 (error "Click was not over a live window")))) 130 (error "Click was not over a live window"))))
130 131
131 ;; Returns window where click occurs 132 ;; Returns window where click occurs
140 (defsubst viper-mouse-click-window-buffer-name (click) 141 (defsubst viper-mouse-click-window-buffer-name (click)
141 (buffer-name (viper-mouse-click-window-buffer click))) 142 (buffer-name (viper-mouse-click-window-buffer click)))
142 143
143 ;; Returns position of a click 144 ;; Returns position of a click
144 (defsubst viper-mouse-click-posn (click) 145 (defsubst viper-mouse-click-posn (click)
145 (if viper-xemacs-p 146 (viper-cond-compile-for-xemacs-or-emacs
146 (event-point click) 147 (event-point click) ; xemacs
147 (posn-point (event-start click)))) 148 (posn-point (event-start click)) ; emacs
149 ))
148 150
149 151
150 (defun viper-surrounding-word (count click-count) 152 (defun viper-surrounding-word (count click-count)
151 "Returns word surrounding point according to a heuristic. 153 "Returns word surrounding point according to a heuristic.
152 COUNT indicates how many regions to return. 154 COUNT indicates how many regions to return.
315 (prin1-to-string (viper-event-key event))))) 317 (prin1-to-string (viper-event-key event)))))
316 318
317 ;; XEmacs has no double-click events. So, we must simulate. 319 ;; XEmacs has no double-click events. So, we must simulate.
318 ;; So, we have to simulate event-click-count. 320 ;; So, we have to simulate event-click-count.
319 (defun viper-event-click-count (click) 321 (defun viper-event-click-count (click)
320 (if viper-xemacs-p 322 (viper-cond-compile-for-xemacs-or-emacs
321 (viper-event-click-count-xemacs click) 323 (viper-event-click-count-xemacs click) ; xemacs
322 (event-click-count click))) 324 (event-click-count click) ; emacs
325 ))
323 326
324 ;; kind of semaphore for updating viper-current-click-count 327 ;; kind of semaphore for updating viper-current-click-count
325 (defvar viper-counting-clicks-p nil) 328 (defvar viper-counting-clicks-p nil)
326 (defun viper-event-click-count-xemacs (click) 329 (viper-cond-compile-for-xemacs-or-emacs
327 (let ((time-delta (- (event-timestamp click) 330 (defun viper-event-click-count-xemacs (click)
328 viper-last-click-event-timestamp)) 331 (let ((time-delta (- (event-timestamp click)
329 inhibit-quit) 332 viper-last-click-event-timestamp))
330 (while viper-counting-clicks-p 333 inhibit-quit)
331 (ignore)) 334 (while viper-counting-clicks-p
332 (setq viper-counting-clicks-p t) 335 (ignore))
333 (if (> time-delta viper-multiclick-timeout) 336 (setq viper-counting-clicks-p t)
334 (setq viper-current-click-count 0)) 337 (if (> time-delta viper-multiclick-timeout)
335 (discard-input) 338 (setq viper-current-click-count 0))
336 (setq viper-current-click-count (1+ viper-current-click-count) 339 (discard-input)
337 viper-last-click-event-timestamp (event-timestamp click)) 340 (setq viper-current-click-count (1+ viper-current-click-count)
338 (setq viper-counting-clicks-p nil) 341 viper-last-click-event-timestamp (event-timestamp click))
339 (if (viper-sit-for-short viper-multiclick-timeout t) 342 (setq viper-counting-clicks-p nil)
340 viper-current-click-count 343 (if (viper-sit-for-short viper-multiclick-timeout t)
341 0) 344 viper-current-click-count
342 )) 345 0)
346 ))
347 nil ; emacs
348 )
343 349
344 350
345 (defun viper-mouse-click-search-word (click arg) 351 (defun viper-mouse-click-search-word (click arg)
346 "Find the word clicked or double-clicked on. Word may be in another window. 352 "Find the word clicked or double-clicked on. Word may be in another window.
347 With prefix argument, N, search for N-th occurrence. 353 With prefix argument, N, search for N-th occurrence.