Add 2012 to FSF copyright years for Emacs files
[bpt/emacs.git] / lisp / emulation / viper-mous.el
index be27397..58d8fb4 100644 (file)
@@ -1,16 +1,16 @@
 ;;; viper-mous.el --- mouse support for Viper
 
-;; Copyright (C) 1994, 1995, 1996, 1997, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +18,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;; in order to spare non-viperized emacs from being viperized
 (if noninteractive
     (eval-when-compile
-      (let ((load-path (cons (expand-file-name ".") load-path)))
-       (or (featurep 'viper-cmd)
-           (load "viper-cmd.el" nil t 'nosuffix))
-       )))
+      (require 'viper-cmd)
+      ))
 ;; end pacifier
 
 (require 'viper-util)
@@ -70,7 +66,7 @@
   "*Function that determines what constitutes a word for clicking events.
 Takes two parameters: a COUNT, indicating how many words to return,
 and CLICK-COUNT, telling whether this is the first click, a double-click,
-or a tripple-click."
+or a triple-click."
   :type 'symbol
   :group 'viper-mouse)
 
@@ -99,7 +95,7 @@ considered related."
 
 ;; remembers prefix argument to pass along to commands invoked by second
 ;; click.
-;; This is needed because in Emacs (not XEmacs), assigning to preix-arg
+;; This is needed because in Emacs (not XEmacs), assigning to prefix-arg
 ;; causes Emacs to count the second click as if it was a single click
 (defvar viper-global-prefix-argument nil)
 
@@ -120,10 +116,8 @@ considered related."
 
 ;; Returns window where click occurs
 (defun viper-mouse-click-window (click)
-  (let ((win (viper-cond-compile-for-xemacs-or-emacs
-             (event-window click) ; xemacs
-             (posn-window (event-start click)) ; emacs
-             )))
+  (let ((win (if (featurep 'xemacs) (event-window click)
+              (posn-window (event-start click)))))
     (if (window-live-p win)
        win
       (error "Click was not over a live window"))))
@@ -142,10 +136,8 @@ considered related."
 
 ;; Returns position of a click
 (defsubst viper-mouse-click-posn (click)
-  (viper-cond-compile-for-xemacs-or-emacs
-   (event-point click) ; xemacs
-   (posn-point (event-start click)) ; emacs
-   ))
+  (if (featurep 'xemacs) (event-point click)
+    (posn-point (event-start click))))
 
 
 (defun viper-surrounding-word (count click-count)
@@ -318,33 +310,30 @@ See `viper-surrounding-word' for the definition of a word in this case."
 ;; XEmacs has no double-click events.  So, we must simulate.
 ;; So, we have to simulate event-click-count.
 (defun viper-event-click-count (click)
-  (viper-cond-compile-for-xemacs-or-emacs
-   (viper-event-click-count-xemacs click) ; xemacs
-   (event-click-count click) ; emacs
-   ))
-
-;; kind of semaphore for updating viper-current-click-count
-(defvar viper-counting-clicks-p nil)
-(viper-cond-compile-for-xemacs-or-emacs
- (defun viper-event-click-count-xemacs (click)
-   (let ((time-delta (- (event-timestamp click)
-                       viper-last-click-event-timestamp))
-        inhibit-quit)
-     (while viper-counting-clicks-p
-       (ignore))
-     (setq viper-counting-clicks-p t)
-     (if (> time-delta viper-multiclick-timeout)
-        (setq viper-current-click-count 0))
-     (discard-input)
-     (setq viper-current-click-count (1+ viper-current-click-count)
-          viper-last-click-event-timestamp (event-timestamp click))
-     (setq viper-counting-clicks-p nil)
-     (if (viper-sit-for-short viper-multiclick-timeout t)
-        viper-current-click-count
-       0)
-     ))
-  nil ; emacs
- )
+  (if (featurep 'xemacs) (viper-event-click-count-xemacs click)
+    (event-click-count click)))
+
+(when (featurep 'xemacs)
+
+  ;; kind of semaphore for updating viper-current-click-count
+  (defvar viper-counting-clicks-p nil)
+
+  (defun viper-event-click-count-xemacs (click)
+    (let ((time-delta (- (event-timestamp click)
+                        viper-last-click-event-timestamp))
+         inhibit-quit)
+      (while viper-counting-clicks-p
+       (ignore))
+      (setq viper-counting-clicks-p t)
+      (if (> time-delta viper-multiclick-timeout)
+         (setq viper-current-click-count 0))
+      (discard-input)
+      (setq viper-current-click-count (1+ viper-current-click-count)
+           viper-last-click-event-timestamp (event-timestamp click))
+      (setq viper-counting-clicks-p nil)
+      (if (viper-sit-for-short viper-multiclick-timeout t)
+         viper-current-click-count
+       0))))
 
 
 (defun viper-mouse-click-search-word (click arg)
@@ -668,10 +657,9 @@ This buffer may be different from the one where the click occurred."
 
 
 
-;;; Local Variables:
-;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
-;;; End:
+;; Local Variables:
+;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
+;; End:
 
 
-;;; arch-tag: e56b2390-06c4-4dd1-96f5-c7876e2d8c2f
 ;;; viper-mous.el ends here