]> git.eshelyaron.com Git - emacs.git/commitdiff
*** empty log message ***
authorMichael Kifer <kifer@cs.stonybrook.edu>
Sat, 20 Jan 1996 03:19:26 +0000 (03:19 +0000)
committerMichael Kifer <kifer@cs.stonybrook.edu>
Sat, 20 Jan 1996 03:19:26 +0000 (03:19 +0000)
lisp/emulation/viper-ex.el
lisp/emulation/viper-keym.el
lisp/emulation/viper-mous.el
lisp/emulation/viper-util.el

index bf8d697d1128b0ac65cbd21b063636d79dd3614f..57a813f6c19dcd5d32f1f82d5882f65f725dd3f6 100644 (file)
 ;; A-list of Ex variables that can be set using the :set command.
 (defconst ex-variable-alist 
   '(("wrapscan") ("ws") ("wrapmargin") ("wm")
-    ("tab-stop-local") ("tsl") ("tabstop") ("ts")
+    ("global-tabstop") ("gts") ("tabstop") ("ts")
     ("showmatch") ("sm") ("shiftwidth") ("sw") ("shell") ("sh")
     ("readonly") ("ro") 
     ("nowrapscan") ("nows") ("noshowmatch") ("nosm")
     ("noreadonly") ("noro") ("nomagic") ("noma")
-    ("noignorecase") ("noic") ("noautoindent") ("noai")
-    ("magic") ("ma") ("ignorecase") ("ic") ("autoindent") ("ai")
+    ("noignorecase") ("noic")
+    ("global-noautoindent") ("gnoai") ("noautoindent") ("noai")
+    ("magic") ("ma") ("ignorecase") ("ic")
+    ("global-autoindent") ("gai") ("autoindent") ("ai")
     ))
 
   
@@ -345,9 +347,11 @@ reversed.")
   (interactive)
   (setq vip-incomplete-ex-cmd t)
   (let ((quit-regex1 (concat
-                     "\\("
-                     "set[ \t]*" "\\|" "edit[ \t]*" "\\|" "[nN]ext[ \t]*"
-                     "\\|" "unm[ \t]*" "\\|" "^[ \t]*rep"
+                     "\\(" "set[ \t]*"
+                     "\\|" "edit[ \t]*"
+                     "\\|" "[nN]ext[ \t]*"
+                     "\\|" "unm[ \t]*"
+                     "\\|" "^[ \t]*rep"
                      "\\)"))
        (quit-regex2 (concat
                      "[a-zA-Z][ \t]*"
@@ -356,13 +360,22 @@ reversed.")
                      "\\)"
                      "*[ \t]*$"))
        (stay-regex (concat
-                    "\\("
-                    "^[ \t]*$" "\\|" "[ktgjmsz][ \t]*$" "\\|" "^[ \t]*ab.*"
-                    "\\|" "tr[ansfer \t]*" "\\|" "sr[ \t]*"
-                    "\\|" "mo.*" "\\|" "^[ \t]*k?ma[^p]*"
-                    "\\|" "^[ \t]*fi.*" "\\|" "v?gl.*" "\\|" "[vg][ \t]*$"
-                    "\\|" "jo.*" "\\|" "^[ \t]*ta.*" "\\|" "^[ \t]*una.*"
-                    "\\|" "^[ \t]*su.*" "\\|['`][a-z][ \t]*"
+                    "\\(" "^[ \t]*$"
+                    "\\|" "[?/].*[?/].*"
+                    "\\|" "[ktgjmsz][ \t]*$"
+                    "\\|" "^[ \t]*ab.*"
+                    "\\|" "tr[ansfer \t]*"
+                    "\\|" "sr[ \t]*"
+                    "\\|" "mo.*"
+                    "\\|" "^[ \t]*k?ma[^p]*"
+                    "\\|" "^[ \t]*fi.*"
+                    "\\|" "v?gl.*"
+                    "\\|" "[vg][ \t]*$"
+                    "\\|" "jo.*"
+                    "\\|" "^[ \t]*ta.*"
+                    "\\|" "^[ \t]*una.*"
+                    "\\|" "^[ \t]*su.*"
+                    "\\|['`][a-z][ \t]*"
                     "\\|" "![ \t]*[a-zA-Z].*"
                     "\\)"
                     "!*")))
@@ -1356,8 +1369,9 @@ reversed.")
     (if (equal buf (current-buffer))
        (or no-recursion
            ;; try again
-           (setq skip-rest t)
-           (ex-next-related-buffer direction 'norecursion)))
+           (progn
+             (setq skip-rest t)
+             (ex-next-related-buffer direction 'norecursion))))
        
     (if skip-rest
        ()
@@ -1497,9 +1511,22 @@ reversed.")
     (setq orig-var var)
     (cond ((member var '("ai" "autoindent"))
           (setq var "vip-auto-indent"
+                set-cmd "setq"
+                ask-if-save nil
+                val "t"))
+         ((member var '("gai" "global-autoindent"))
+          (kill-local-variable 'vip-auto-indent)
+          (setq var "vip-auto-indent"
+                set-cmd "setq-default"
                 val "t"))
          ((member var '("noai" "noautoindent"))
           (setq var "vip-auto-indent"
+                ask-if-save nil
+                val "nil"))
+         ((member var '("gnoai" "global-noautoindent"))
+          (kill-local-variable 'vip-auto-indent)
+          (setq var "vip-auto-indent"
+                set-cmd "setq-default"
                 val "nil"))
          ((member var '("ic" "ignorecase"))
           (setq var "vip-case-fold-search"
@@ -1541,7 +1568,10 @@ reversed.")
          
          ;; check numerical values
          (if (member var
-                     '("sw" "shiftwidth" "ts" "tabstop" "wm" "wrapmargin"))
+                     '("sw" "shiftwidth"
+                       "ts" "tabstop"
+                       "gts" "global-tabstop"
+                       "wm" "wrapmargin")) 
              (condition-case nil
                  (or (numberp (setq val2 (car (read-from-string val))))
                      (error "%s: Invalid value, numberp, %S" var val))
@@ -1553,13 +1583,13 @@ reversed.")
            (setq var "vip-shift-width"))
           ((member var '("ts" "tabstop"))
            ;; make it take effect in curr buff and new bufs
-           (kill-local-variable 'tab-width)
-           (setq var "tab-width"
-                 set-cmd "setq-default"))
-          ((member var '("tsl" "tab-stop-local"))
            (setq var "tab-width"
                  set-cmd "setq"
                  ask-if-save nil))
+          ((member var '("gts" "global-tabstop"))
+           (kill-local-variable 'tab-width)
+           (setq var "tab-width"
+                 set-cmd "setq-default"))
           ((member var '("wm" "wrapmargin"))
            ;; make it take effect in curr buff and new bufs
            (kill-local-variable 'fill-column) 
@@ -1728,7 +1758,7 @@ Please contact your system administrator. "
                          (setq matched-pos (point))
                          (if (not (stringp repl))
                              (error "Can't perform Ex substitution: No previous replacement pattern"))
-                         (replace-match repl t t))))
+                         (replace-match repl t))))
                  (end-of-line)
                  (vip-forward-char-carefully))
              (if (null pat)
@@ -1740,7 +1770,7 @@ Please contact your system administrator. "
                    (setq matched-pos (point))
                    (if (not (stringp repl))
                        (error "Can't perform Ex substitution: No previous replacement pattern"))
-                   (replace-match repl t t)))
+                   (replace-match repl t)))
              (end-of-line)
              (vip-forward-char-carefully))))))
     (if matched-pos (goto-char matched-pos))
@@ -1915,12 +1945,17 @@ Please contact your system administrator. "
 ;; Give information on the file visited by the current buffer
 (defun vip-info-on-file ()
   (interactive)
-  (let (file info)
-    (setq file (if (buffer-file-name)
+  (let ((pos1 (vip-line-pos 'start))
+       (pos2 (vip-line-pos 'end))
+       lines file info)
+    (setq lines (count-lines (point-min) (vip-line-pos 'end))
+         file (if (buffer-file-name)
                   (concat (abbreviate-file-name (buffer-file-name)) ":")
                 (concat (buffer-name) " [Not visiting any file]:"))
          info (format "line=%d/%d pos=%d/%d col=%d %s"
-                      (count-lines (point-min) (vip-line-pos 'end))
+                      (if (= pos1 pos2)
+                          (1+ lines)
+                        lines)
                       (count-lines (point-min) (point-max))
                       (point) (1- (point-max))
                       (1+ (current-column))
@@ -1933,7 +1968,8 @@ Please contact your system administrator. "
          (princ (concat "\n"
                         file "\n\n\t" info
                         "\n\n\nPress any key to continue...\n\n")))
-       (vip-read-event)))
+       (vip-read-event)
+       (kill-buffer " *vip-info*")))
     ))
 
 
index 26f90e8b9082471489218749b1c57d20733803ed..39eb92b228653b5529716dc6fecf44e14b578a05 100644 (file)
@@ -1,4 +1,4 @@
-;;; viper-keym.el --- main Viper keymaps
+;;; viper-keym.el --- Viper keymaps
 
 ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
 
@@ -31,7 +31,8 @@
 (defvar vip-insert-intercept-map (make-sparse-keymap))
 (defvar vip-emacs-intercept-map (make-sparse-keymap))
 
-;; keymap used to zap all keymaps other than function-key-map, etc.
+;; keymap used to zap all keymaps other than function-key-map,
+;; device-function-key-map, etc.
 (defvar vip-overriding-map (make-sparse-keymap))
   
 (vip-deflocalvar vip-vi-local-user-map (make-sparse-keymap)
@@ -403,6 +404,20 @@ Usage:
     (vip-modify-keymap map alist)
     (vip-normalize-minor-mode-map-alist)
     (vip-set-mode-vars-for vip-current-state)))
+
+(defun vip-zap-local-keys ()
+  "Unconditionally reset Viper vip-*-local-user-map's.
+Rarely useful, but if u made a mistake by switching to a mode that adds
+undesirable local keys, e.g., comint-mode, then this function can return
+you to sanity."
+  (interactive)
+  (setq vip-vi-local-user-map (make-sparse-keymap)
+       vip-need-new-vi-local-map nil
+       vip-insert-local-user-map (make-sparse-keymap)
+       vip-need-new-insert-local-map nil
+       vip-emacs-local-user-map (make-sparse-keymap)
+       vip-need-new-emacs-local-map nil)
+  (vip-normalize-minor-mode-map-alist))
     
 
 (defun vip-modify-major-mode (mode state keymap)
index 6372b7e9d6d6eadfe1758004616a3a92660d0699..d9b8d252514e6f61e34920741d5990d5b9b0439d 100644 (file)
@@ -402,13 +402,13 @@ bindings in viper.el and in the Viper manual."
 
 (cond ((vip-window-display-p)
        (let* ((search-key (if vip-xemacs-p
-                             [(meta shift button1up)] [S-mouse-1]))
+                             [(meta shift button1up)] [M-S-mouse-1]))
              (search-key-catch (if vip-xemacs-p
-                                   [(meta shift button1)] [S-down-mouse-1]))
+                                   [(meta shift button1)] [M-S-down-mouse-1]))
              (insert-key (if vip-xemacs-p
-                             [(meta shift button2up)] [S-mouse-2]))
+                             [(meta shift button2up)] [M-S-mouse-2]))
              (insert-key-catch (if vip-xemacs-p
-                                   [(meta shift button2)] [S-down-mouse-2]))
+                                   [(meta shift button2)] [M-S-down-mouse-2]))
              (search-key-unbound (and (not (key-binding search-key))
                                       (not (key-binding search-key-catch))))
              (insert-key-unbound (and (not (key-binding insert-key))
index 5a42f6e2dc0404ff6791a7ab1df4681abc2f0f2e..062ada3f88d1f389f37c5453fc1b24813b059a5c 100644 (file)
       (not (memq nil (mapcar 'vip-color-defined-p colors)))
     ))
 
-;; currently doesn't work for XEmacs
+(defun vip-hide-face (face)
+  (if (and (vip-window-display-p) vip-emacs-p)
+      (add-to-list 'facemenu-unlisted-faces face)))
+
+;; cursor colors
 (defun vip-change-cursor-color (new-color)
   (if (and (vip-window-display-p)  (vip-color-display-p)
           (stringp new-color) (vip-color-defined-p new-color)
   (if (vip-overlay-p vip-replace-overlay)
       (vip-move-replace-overlay beg end)
     (setq vip-replace-overlay (vip-make-overlay beg end (current-buffer)))
-    (vip-overlay-put vip-replace-overlay
-                    'vip-start 
-                    (move-marker (make-marker)
-                                 (vip-overlay-start vip-replace-overlay)))
-    (vip-overlay-put vip-replace-overlay
-                    'vip-end 
-                    (move-marker (make-marker)
-                                 (vip-overlay-end vip-replace-overlay)))
     (vip-overlay-put 
      vip-replace-overlay 'priority vip-replace-overlay-priority)) 
   (if (vip-window-display-p)
   (vip-change-cursor-color vip-replace-overlay-cursor-color)
   )
   
-
   
 (defsubst vip-hide-replace-overlay ()
   (vip-set-replace-overlay-glyphs nil nil)
       
 (defsubst vip-set-replace-overlay-glyphs (before-glyph after-glyph)
   (if (or (not (vip-window-display-p))
-          vip-use-replace-region-delimiters)
+         vip-use-replace-region-delimiters)
       (let ((before-name (if vip-xemacs-p 'begin-glyph 'before-string))
            (after-name (if vip-xemacs-p 'end-glyph 'after-string)))
        (vip-overlay-put vip-replace-overlay before-name before-glyph)
 
     
 (defsubst vip-replace-start ()
-  (vip-overlay-get vip-replace-overlay 'vip-start))
+  (vip-overlay-start vip-replace-overlay))
 (defsubst vip-replace-end ()
-  (vip-overlay-get vip-replace-overlay 'vip-end))
+  (vip-overlay-end vip-replace-overlay))
   
 (defsubst vip-move-replace-overlay (beg end)
   (vip-move-overlay vip-replace-overlay beg end)
-  (move-marker (vip-replace-start) (vip-overlay-start vip-replace-overlay))
-  (move-marker (vip-replace-end) (vip-overlay-end vip-replace-overlay)))
+  )
  
 
 ;; Minibuffer
 
 (defun vip-set-minibuffer-overlay ()
   (vip-check-minibuffer-overlay)
-  ;; We always move the minibuffer overlay, since in XEmacs
-  ;; this overlay may get detached. Moving will reattach it.
-  ;; This overlay is also moved via the vip-post-command-hook,
-  ;; to insure that it covers the whole minibuffer.
-  (vip-move-minibuffer-overlay)
   (if (vip-window-display-p)
       (progn
        (vip-overlay-put
         vip-minibuffer-overlay 'face vip-minibuffer-current-face)
        (vip-overlay-put 
-        vip-minibuffer-overlay 'priority vip-minibuffer-overlay-priority))
-        ))
+        vip-minibuffer-overlay 'priority vip-minibuffer-overlay-priority)
+       ;; prevent detachment and make vip-minibuffer-overlay open-ended
+       ;; In emacs, it is made open ended at creation time
+       (if vip-emacs-p
+           (vip-overlay-put vip-minibuffer-overlay 'evaporate nil)
+         (vip-overlay-put vip-minibuffer-overlay 'detachable nil)
+         (vip-overlay-put vip-minibuffer-overlay 'start-open nil) 
+         (vip-overlay-put vip-minibuffer-overlay 'end-open nil))
+       )))
        
 (defun vip-check-minibuffer-overlay ()
-  (if (vip-overlay-p vip-minibuffer-overlay)
-      ()
-    (setq vip-minibuffer-overlay
-         (vip-make-overlay 1 (1+ (buffer-size)) (current-buffer)))))
-
-;; arguments to this function are dummies. they are needed just because
-;; it is used as a insert-in-front-hook to vip-minibuffer-overlay, and such
-;; hooks require 3 arguments.
-(defun vip-move-minibuffer-overlay (&optional overl beg end)
-  (if (vip-is-in-minibuffer)
-      (progn
-       (vip-check-minibuffer-overlay)
-       (vip-move-overlay vip-minibuffer-overlay 1 (1+ (buffer-size))))))
+  (or (vip-overlay-p vip-minibuffer-overlay)
+      (setq vip-minibuffer-overlay
+           (if vip-xemacs-p
+               (vip-make-overlay 1 (1+ (buffer-size)) (current-buffer))
+             ;; don't move front, move rear
+             (vip-make-overlay 1 (1+ (buffer-size)) (current-buffer) nil t)))
+      ))
+
 
 (defsubst vip-is-in-minibuffer ()
   (string-match "\*Minibuf-" (buffer-name)))
 
 
 ;; Emacs has a bug in eventp, which causes (eventp nil) to return (nil)
-;; instead of nil, if '(nil) was previously inadvertently assigned to
+;; instead of nil, if '(nil) was previously inadvertantly assigned to
 ;; unread-command-events
 (defun vip-event-key (event)
   (or (and event (eventp event))