update.
[chise/xemacs-chise.git.1] / lisp / term / sun-mouse.el
index ba577bd..2879126 100644 (file)
@@ -34,7 +34,7 @@
 ;;     Modelled after the GNUEMACS keymap interface.
 ;;
 ;; User Functions:
-;;   make-mousemap, copy-mousemap, 
+;;   make-mousemap, copy-mousemap,
 ;;   define-mouse, global-set-mouse, local-set-mouse,
 ;;   use-global-mousemap, use-local-mousemap,
 ;;   mouse-lookup, describe-mouse-bindings
@@ -137,46 +137,46 @@ Just like the Common Lisp function of the same name."
 
 ;;; All the useful code bits
 (defmacro sm::hit-code (hit)
-  (` (nth 0 (, hit))))
+  `(nth 0 ,hit))
 ;;; The button, or buttons if a chord.
 (defmacro sm::hit-button (hit)
-  (` (logand sm::ButtonBits (nth 0 (, hit)))))
+  `(logand sm::ButtonBits (nth 0 ,hit)))
 ;;; The shift, control, and meta flags.
 (defmacro sm::hit-shiftmask (hit)
-  (` (logand sm::ShiftmaskBits (nth 0 (, hit)))))
+  `(logand sm::ShiftmaskBits (nth 0 ,hit)))
 ;;; Set if a double click (but not a chord).
 (defmacro sm::hit-double (hit)
-  (` (logand sm::DoubleBits (nth 0 (, hit)))))
+  `(logand sm::DoubleBits (nth 0 ,hit)))
 ;;; Set on button release (as opposed to button press).
 (defmacro sm::hit-up (hit)
-  (` (logand sm::UpBits (nth 0 (, hit)))))
+  `(logand sm::UpBits (nth 0 ,hit)))
 ;;; Screen x position.
-(defmacro sm::hit-x (hit) (list 'nth 1 hit))
+(defmacro sm::hit-x (hit) `(nth 1 ,hit))
 ;;; Screen y position.
-(defmacro sm::hit-y (hit) (list 'nth 2 hit))
+(defmacro sm::hit-y (hit) `(nth 2 ,hit))
 ;;; Milliseconds since last hit.
-(defmacro sm::hit-delta (hit) (list 'nth 3 hit))
+(defmacro sm::hit-delta (hit) `(nth 3 ,hit))
 
 (defmacro sm::hit-up-p (hit)           ; A predicate.
-  (` (not (zerop (sm::hit-up (, hit))))))
+  `(not (zerop (sm::hit-up ,hit))))
 
 ;;;
 ;;; Loc accessors.  for sm::window-xy
 ;;;
-(defmacro sm::loc-w (loc) (list 'nth 0 loc))
-(defmacro sm::loc-x (loc) (list 'nth 1 loc))
-(defmacro sm::loc-y (loc) (list 'nth 2 loc))
+(defmacro sm::loc-w (loc) `(nth 0 ,loc))
+(defmacro sm::loc-x (loc) `(nth 1 ,loc))
+(defmacro sm::loc-y (loc) `(nth 2 ,loc))
 
 ;;; this is used extensively by sun-fns.el
 ;;;
 (defmacro eval-in-window (window &rest forms)
   "Switch to WINDOW, evaluate FORMS, return to original window."
-  (` (let ((OriginallySelectedWindow (selected-window)))
-       (unwind-protect
-          (progn
-            (select-window (, window))
-            (,@ forms))
-        (select-window OriginallySelectedWindow)))))
+  `(let ((OriginallySelectedWindow (selected-window)))
+     (unwind-protect
+        (progn
+          (select-window ,window)
+          ,@forms)
+       (select-window OriginallySelectedWindow))))
 (put 'eval-in-window 'lisp-indent-function 1)
 
 ;;;
@@ -188,14 +188,14 @@ Just like the Common Lisp function of the same name."
   "Switches to each window and evaluates FORM.  Optional argument
 YESMINI says to include the minibuffer as a window.
 This is a macro, and does not evaluate its arguments."
-  (` (let ((OriginallySelectedWindow (selected-window)))
-       (unwind-protect 
-          (while (progn
-                   (, form)
-                   (not (eq OriginallySelectedWindow
-                            (select-window
-                             (next-window nil (, yesmini)))))))
-        (select-window OriginallySelectedWindow)))))
+  `(let ((OriginallySelectedWindow (selected-window)))
+     (unwind-protect
+        (while (progn
+                 ,form
+                 (not (eq OriginallySelectedWindow
+                          (select-window
+                           (next-window nil ,yesmini))))))
+       (select-window OriginallySelectedWindow))))
 (put 'eval-in-window 'lisp-indent-function 0)
 
 (defun move-to-loc (x y)
@@ -216,7 +216,7 @@ Handles wrapped and horizontally scrolled lines correctly."
 
 
 (defun minibuffer-window-p (window)
-  "True iff this WINDOW is minibuffer."
+  "Return t if this WINDOW is a minibuffer."
   (= (frame-height)
      (nth 3 (window-edges window))     ; The bottom edge.
      ))
@@ -224,9 +224,9 @@ Handles wrapped and horizontally scrolled lines correctly."
 \f
 (defun sun-mouse-handler (&optional hit)
   "Evaluates the function or list associated with a mouse hit.
-Expecting to read a hit, which is a list: (button x y delta).  
-A form bound to button by define-mouse is found by mouse-lookup. 
-The variables: *mouse-window*, *mouse-x*, *mouse-y* are bound.  
+Expecting to read a hit, which is a list: (button x y delta).
+A form bound to button by define-mouse is found by mouse-lookup.
+The variables: *mouse-window*, *mouse-x*, *mouse-y* are bound.
 If the form is a symbol (symbolp), it is funcall'ed with *mouse-window*,
 *mouse-x*, and *mouse-y* as arguments; if the form is a list (listp),
 the form is eval'ed; if the form is neither of these, it is an error.
@@ -242,8 +242,8 @@ Returns nil."
                    (mouse-lookup mouse-code))))
        (cond ((null form)
               (if (not (sm::hit-up-p hit))     ; undefined up hits are ok.
-                  (error "Undefined mouse event: %s" 
-                         (prin1-to-string 
+                  (error "Undefined mouse event: %s"
+                         (prin1-to-string
                           (mouse-code-to-mouse-list mouse-code)))))
              ((symbolp form)
               (setq this-command form)
@@ -268,9 +268,9 @@ Returns nil."
        (let ((hit2 (mouse-second-hit extra-click-wait)))
          (if hit2      ; we cons'd it, we can smash it.
              ; (setf (sm::hit-code hit1) (logior (sm::hit-code hit1) ...))
-             (setcar hit1 (logior (sm::hit-code hit1) 
+             (setcar hit1 (logior (sm::hit-code hit1)
                                   (sm::hit-code hit2)
-                                  (if (= (sm::hit-button hit1) 
+                                  (if (= (sm::hit-button hit1)
                                          (sm::hit-button hit2))
                                       sm::DoubleBits 0))))))
     hit1))
@@ -280,7 +280,7 @@ Returns nil."
 but that uses minibuffer, and mucks up last-command."
   (let ((char-list nil) (char nil))
     (while (not (equal 13              ; Carriage return.
-                      (prog1 (setq char (read-char)) 
+                      (prog1 (setq char (read-char))
                         (setq char-list (cons char char-list))))))
     (read (mapconcat 'char-to-string (nreverse char-list) ""))
     ))
@@ -331,7 +331,7 @@ but that uses minibuffer, and mucks up last-command."
 Returns list (window x y) where x and y are relative to window."
   (or
    (catch 'found
-     (eval-in-windows 
+     (eval-in-windows
       (let ((we (window-edges (selected-window))))
        (let ((le (nth 0 we))
              (te (nth 1 we))
@@ -347,7 +347,7 @@ Returns list (window x y) where x and y are relative to window."
 
          (if (and (>= x le) (< x re)
                   (>= y te) (< y be))
-             (throw 'found 
+             (throw 'found
                     (list (selected-window) (- x le) (- y te))))))
       t))                              ; include minibuffer in eval-in-windows
    ;;If x,y from a real mouse click, we shouldn't get here.
@@ -375,14 +375,14 @@ Returns one of (text scrollbar modeline minibuffer)"
            (t 'text)))))
 
 (defun window-line-end (w x y)
-  "Return WINDOW column (ignore X) containing end of line Y"
+  "Return WINDOW column (ignore X) containing end of line Y."
   (eval-in-window w (save-excursion (move-to-loc (frame-width) y))))
 \f
 ;;;
 ;;; The encoding of mouse events into a mousemap.
 ;;; These values must agree with coding in emacstool:
 ;;;
-(defconst sm::keyword-alist 
+(defconst sm::keyword-alist
   '((left . 1) (middle . 2) (right . 4)
     (shift . 8) (control . 16) (meta . 32) (double . 64) (up . 128)
     (text . 256) (scrollbar . 512) (modeline . 1024) (minibuffer . 2048)
@@ -538,7 +538,7 @@ where each mouse-list is bound to the function in REGION."
 
 (defun describe-mouse-briefly (mouse-list)
   "Print a short description of the function bound to MOUSE-LIST."
-  (interactive "xDescibe mouse list briefly: ")
+  (interactive "xDescribe mouse list briefly: ")
   (let ((function (mouse-lookup (mouse-list-to-mouse-code mouse-list))))
     (if function
        (message "%s runs the command %s" mouse-list function)
@@ -584,7 +584,7 @@ of MENU.  MENU (or its symbol-value) should be a menu defined by defmenu.
 the FORM associated with the selected STRING is evaluated,
 and the resulting value is returned.  Generally these FORMs are
 evaluated for their side-effects rather than their values.
-  If the selected form is a menu or a symbol whose value is a menu, 
+  If the selected form is a menu or a symbol whose value is a menu,
 then it is displayed and evaluated as a pullright menu item.
   If the FORM of the first ITEM is nil, the STRING of the item
 is used as a label for the menu, i.e. it's inverted and not selectable."
@@ -595,7 +595,7 @@ is used as a label for the menu, i.e. it's inverted and not selectable."
 (defun sun-get-frame-data (code)
   "Sends the tty-sub-window escape sequence CODE to terminal,
 and returns a cons of the two numbers in returned escape sequence.
-That is it returns (cons <car> <cdr>) from \"\\E[n;<car>;<cdr>t\". 
+That is it returns (cons <car> <cdr>) from \"\\E[n;<car>;<cdr>t\".
 CODE values: 13 = Tool-Position, 14 = Size-in-Pixels, 18 = Size-in-Chars."
   (send-string-to-terminal (concat "\033[" (int-to-string code) "t"))
   (let (char str x y)
@@ -615,9 +615,9 @@ CODE values: 13 = Tool-Position, 14 = Size-in-Pixels, 18 = Size-in-Chars."
        (chr (sun-get-frame-data 18)))  ; returns size in chars
     (cons (/ (car pix) (car chr)) (/ (cdr pix) (cdr chr)))))
 
-(defvar sm::menu-kludge-x nil 
+(defvar sm::menu-kludge-x nil
   "Cached frame-to-window X-Offset for sm::menu-kludge")
-(defvar sm::menu-kludge-y nil 
+(defvar sm::menu-kludge-y nil
   "Cached frame-to-window Y-Offset for sm::menu-kludge")
 
 (defun sm::menu-kludge ()
@@ -641,10 +641,10 @@ Insert contents into the current buffer at point."
   (set-mark-command nil)
   (insert-string (sun-get-selection)))
 
-(defun sun-select-region (beg end)
+(defun sun-select-region (start end)
   "Set the sunwindows selection to the region in the current buffer."
   (interactive "r")
-  (sun-set-selection (buffer-substring beg end)))
+  (sun-set-selection (buffer-substring start end)))
 
 ;;;
 ;;; Support for emacstool
@@ -653,7 +653,7 @@ Insert contents into the current buffer at point."
 (defun suspend-emacstool (&optional stuffstring)
   "Suspend emacstool.
 If running under as a detached process emacstool,
-you don't want to suspend  (there is no way to resume), 
+you don't want to suspend  (there is no way to resume),
 just close the window, and wait for reopening."
   (interactive)
   (run-hooks 'suspend-hook)