]> code.delx.au - gnu-emacs/blobdiff - lisp/term/sun-mouse.el
Delete the autoloads for functions defined with ibuffer-specific commands.
[gnu-emacs] / lisp / term / sun-mouse.el
index bed2b416c1f026c6bbb249cfe86dd5ea3ac05f0c..6e5113093f590603a76d4638e2d9a831864c288f 100644 (file)
@@ -1,11 +1,16 @@
-;; Mouse handling for Sun windows
+;;; sun-mouse.el --- mouse handling for Sun windows
+
 ;; Copyright (C) 1987 Free Software Foundation, Inc.
 
+;; Author: Jeff Peck
+;; Maintainer: FSF
+;; Keywords: hardware
+
 ;; This file is part of GNU Emacs.
 
 ;; 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 1, or (at your option)
+;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; 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, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
-;;; Jeff Peck, Sun Microsystems, Jan 1987.
-;;; Original idea by Stan Jefferson
+;;; Commentary:
 
-(provide 'sun-mouse)
+;; Jeff Peck, Sun Microsystems, Jan 1987.
+;; Original idea by Stan Jefferson
 
-;;;
-;;;     Modelled after the GNUEMACS keymap interface.
-;;;
-;;; User Functions:
-;;;   make-mousemap, copy-mousemap, 
-;;;   define-mouse, global-set-mouse, local-set-mouse,
-;;;   use-global-mousemap, use-local-mousemap,
-;;;   mouse-lookup, describe-mouse-bindings
-;;;
-;;; Options:
-;;;   extra-click-wait, scrollbar-width
-;;;
+;;     Modeled after the GNUEMACS keymap interface.
+;;
+;; User Functions:
+;;   make-mousemap, copy-mousemap, 
+;;   define-mouse, global-set-mouse, local-set-mouse,
+;;   use-global-mousemap, use-local-mousemap,
+;;   mouse-lookup, describe-mouse-bindings
+;;
+;; Options:
+;;   extra-click-wait, scrollbar-width
+
+;;; Code:
 
 (defvar extra-click-wait 150
   "*Number of milliseconds to wait for an extra click.
@@ -58,7 +64,7 @@ Setting to nil limits the scrollbar to the edge or vertical dividing bar.")
 
 (defun define-mouse (mousemap mouse-list def)
   "Args MOUSEMAP, MOUSE-LIST, DEF.  Define MOUSE-LIST in MOUSEMAP as DEF.
-MOUSE-LIST is a list of atoms specifing a mouse hit according to these rules:
+MOUSE-LIST is a list of atoms specifying a mouse hit according to these rules:
   * One of these atoms specifies the active region of the definition.
        text, scrollbar, modeline, minibuffer
   * One or two or these atoms specify the button or button combination.
@@ -127,28 +133,28 @@ 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))
 ;;; Screen y position.
 (defmacro sm::hit-y (hit) (list 'nth 2 hit))
-;;; Millisconds since last hit.
+;;; Milliseconds since last hit.
 (defmacro sm::hit-delta (hit) (list 'nth 3 hit))
 
-(defmacro sm::hit-up-p (hit)           ; A predicate.
-  (` (not (zerop (sm::hit-up (, hit))))))
+(defmacro sm::hit-up-p (hit)    ; A predicate.
+  `(not (zerop (sm::hit-up ,hit))))
 
 ;;;
 ;;; Loc accessors.  for sm::window-xy
@@ -160,12 +166,12 @@ Just like the Common Lisp function of the same name."
 (defmacro eval-in-buffer (buffer &rest forms)
   "Macro to switches to BUFFER, evaluates FORMS, returns to original buffer."
   ;; When you don't need the complete window context of eval-in-window
-  (` (let ((StartBuffer (current-buffer)))
+  `(let ((StartBuffer (current-buffer)))
     (unwind-protect
-       (progn
-         (set-buffer (, buffer))
-         (,@ forms))
-    (set-buffer StartBuffer)))))
+         (progn
+           (set-buffer ,buffer)
+           ,@forms)
+      (set-buffer StartBuffer))))
 
 (put 'eval-in-buffer 'lisp-indent-function 1)
 
@@ -173,12 +179,12 @@ Just like the Common Lisp function of the same name."
 ;;;
 (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)
 
 ;;;
@@ -190,14 +196,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)
@@ -219,7 +225,7 @@ Handles wrapped and horizontally scrolled lines correctly."
 
 (defun minibuffer-window-p (window)
   "True iff this WINDOW is minibuffer."
-  (= (screen-height)
+  (= (frame-height)
      (nth 3 (window-edges window))     ; The bottom edge.
      ))
 
@@ -266,7 +272,7 @@ Returns nil."
 (defun sm::combined-hits ()
   "Read and return next mouse-hit, include possible double click"
   (let ((hit1 (mouse-hit-read)))
-    (if (not (sm::hit-up-p hit1))      ; Up hits dont start doubles or chords.
+    (if (not (sm::hit-up-p hit1))      ; Up hits don't start doubles or chords.
        (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) ...))
@@ -311,12 +317,14 @@ but that uses minibuffer, and mucks up last-command."
     (let ((pc1 (read-char)))
       (if (or (not (equal pc1 mouse-prefix1))
              (sit-for-millisecs 3))    ; a mouse prefix will have second char
-         (progn (setq unread-command-char pc1) ; Can get away with one unread.
+         ;; Can get away with one unread.
+         (progn (setq unread-command-events (list pc1))
                 nil)                   ; Next input not mouse event.
        (let ((pc2 (read-char)))
          (if (not (equal pc2 mouse-prefix2))
-             (progn (setq unread-command-char pc1) ; put back the ^X
-;;; Too bad can't do two: (setq unread-command-char (list pc1 pc2))
+             (progn (setq unread-command-events (list pc1)) ; put back the ^X
+;;; Too bad can't do two: (setq unread-command-event (list pc1 pc2))
+;;; Well, now we can, but I don't understand this code well enough to fix it...
                (ding)                  ; user will have to retype that pc2.
                nil)                    ; This input is not a mouse event.
            ;; Next input has mouse prefix and is within time limit.
@@ -337,12 +345,12 @@ Returns list (window x y) where x and y are relative to window."
              (te (nth 1 we))
              (re (nth 2 we))
              (be (nth 3 we)))
-         (if (= re (screen-width))
+         (if (= re (frame-width))
              ;; include the continuation column with this window
              (setq re (1+ re)))
-         (if (= be (screen-height))
-             ;; include partial line at bottom of screen with this window
-             ;; id est, if window is not multple of char size.
+         (if (= be (frame-height))
+             ;; include partial line at bottom of frame with this window
+             ;; id est, if window is not multiple of char size.
              (setq be (1+ be)))
 
          (if (and (>= x le) (< x re)
@@ -365,7 +373,7 @@ Returns one of (text scrollbar modeline minibuffer)"
       (cond ((minibuffer-window-p w) 'minibuffer)
            ((>= y bottom) 'modeline)
            ((>= x right) 'scrollbar)
-           ;; far right column (window seperator) is always a scrollbar
+           ;; far right column (window separator) is always a scrollbar
            ((and scrollbar-width
                  ;; mouse within scrollbar-width of edge.
                  (>= x (- right scrollbar-width))
@@ -376,7 +384,7 @@ Returns one of (text scrollbar modeline minibuffer)"
 
 (defun window-line-end (w x y)
   "Return WINDOW column (ignore X) containing end of line Y"
-  (eval-in-window w (save-excursion (move-to-loc (screen-width) y))))
+  (eval-in-window w (save-excursion (move-to-loc (frame-width) y))))
 \f
 ;;;
 ;;; The encoding of mouse events into a mousemap.
@@ -453,7 +461,7 @@ where L-UNIQUE is considered to be union'ized already."
       (setq l (cdr l)))
     result))
 
-(defun mouse-union-first-prefered (l1 l2)
+(defun mouse-union-first-preferred (l1 l2)
   "Return the union of lists of mouse (code . form) pairs L1 and L2,
 based on the code's, with preference going to elements in L1."
   (mouse-union l2 (mouse-union l1 nil)))
@@ -462,7 +470,7 @@ based on the code's, with preference going to elements in L1."
   "Return a list of (code . function) pairs, where each code is
 currently set in the REGION."
   (let ((mask (mouse-region-to-code region)))
-    (mouse-union-first-prefered
+    (mouse-union-first-preferred
      (mouse-mask-lookup mask (cdr current-local-mousemap))
      (mouse-mask-lookup mask (cdr current-global-mousemap))
      )))
@@ -538,7 +546,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)
@@ -586,8 +594,8 @@ 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, 
 then it is displayed and evaluated as a pullright menu item.
-  If the 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 selectible."
+  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."
 
   (if (symbolp menu) (setq menu (symbol-value menu)))
   (eval (sun-menu-internal *menu-window* *menu-x* *menu-y* 4 menu)))
@@ -632,14 +640,14 @@ CODE values: 13 = Tool-Position, 14 = Size-in-Pixels, 18 = Size-in-Chars."
 \f
 ;;;
 ;;;  Function interface to selection/region
-;;;  primative functions are defined in sunfns.c
+;;;  primitive functions are defined in sunfns.c
 ;;;
 (defun sun-yank-selection ()
-  "Set mark and yank the contents of the current sunwindows selection
-into the current buffer at point."
+  "Set mark and yank the contents of the current sunwindows selection.
+Insert contents into the current buffer at point."
   (interactive "*")
   (set-mark-command nil)
-  (insert-string (sun-get-selection)))
+  (insert (sun-get-selection)))
 
 (defun sun-select-region (beg end)
   "Set the sunwindows selection to the region in the current buffer."
@@ -651,7 +659,8 @@ into the current buffer at point."
 ;;; This closes the window instead of stopping emacs.
 ;;;
 (defun suspend-emacstool (&optional stuffstring)
-  "If running under as a detached process emacstool,
+  "Suspend emacstool.
+If running under as a detached process emacstool,
 you don't want to suspend  (there is no way to resume), 
 just close the window, and wait for reopening."
   (interactive)
@@ -666,3 +675,8 @@ just close the window, and wait for reopening."
 (make-variable-buffer-local 'current-local-mousemap)
 (setq-default current-local-mousemap nil)
 (defvar current-global-mousemap (make-mousemap))
+
+(provide 'sun-mouse)
+(provide 'term/sun-mouse)              ; have to (require 'term/sun-mouse)
+
+;;; sun-mouse.el ends here