;;; viper-init.el --- some common definitions for Viper
-;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2011 Free Software Foundation, Inc.
;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
;; This file is part of GNU Emacs.
(defvar default-input-method)
(defvar describe-current-input-method-function)
(defvar bar-cursor)
-(defvar default-cursor-type)
(defvar cursor-type)
;; end pacifier
(defun viper-window-display-p ()
(and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc)))))
-(defcustom viper-ms-style-os-p (memq system-type
- '(ms-dos windows-nt windows-95))
- "Tells if Emacs is running under an MS-style OS: ms-dos, windows-nt, W95."
+(defcustom viper-ms-style-os-p
+ (memq system-type (if (featurep 'emacs) '(ms-dos windows-nt)
+ '(ms-dos windows-nt windows-95)))
+ "Non-nil if Emacs is running under an MS-style OS: MS-DOS, or MS-Windows."
:type 'boolean
:tag "Is it Microsoft-made OS?"
:group 'viper-misc)
-(defcustom viper-vms-os-p (memq system-type '(vax-vms axp-vms))
- "Tells if Emacs is running under VMS."
- :type 'boolean
- :tag "Is it VMS?"
- :group 'viper-misc)
(defcustom viper-suppress-input-method-change-message nil
"If t, the message notifying about changes in the input method is not displayed.
(viper-deflocalvar viper-insert-diehard-minor-mode nil
"Minor mode that simulates Vi very closely.
-Not recommened, except for the novice user.")
+Not recommended, except for the novice user.")
(viper-deflocalvar viper-insert-kbd-minor-mode nil
"Minor mode for Ex command macros Insert state.
:type 'integer
:group 'viper-misc)
-(defcustom viper-ESC-keyseq-timeout (if (viper-window-display-p)
- 0 viper-fast-keyseq-timeout)
- "*Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.
-Setting this too high may slow down switching from insert to vi state. Setting
-this value too low will make it impossible to use function keys in insert mode
-on a dumb terminal."
- :type 'integer
- :group 'viper-misc)
-
-(defcustom viper-translate-all-ESC-keysequences (not (viper-window-display-p))
- "Allow translation of all key sequences into commands.
-Normally, Viper lets Emacs translate only those ESC key sequences that are
-defined in the low-level key-translation-map or function-key-map, such as those
-emitted by the arrow and function keys. Other sequences, e.g., \\e/, are
-treated as ESC command followed by a `/'. This is done for people who type fast
-and tend to hit other characters right after they hit ESC. Other people like
-Emacs to translate ESC sequences all the time.
-The default is to translate all sequences only when using a dumb terminal.
-This permits you to use ESC as a meta key in insert mode."
- :type 'boolean
- :group 'viper-misc)
+;; This function determines if ESC key sequences are to be translated into
+;; commands.
+(defun viper-translate-all-ESC-keysequences ()
+ (not (viper-window-display-p)))
;; Modes and related variables
;; The reason this is needed is because dabbrev-expand (and possibly
;; others) may jump to before the insertion point, delete something and
;; then reinsert a bigger piece. For instance: bla^blo
-;; If dabbrev-expand is called after `blo' and ^ undicates viper-insert-point,
+;; If dabbrev-expand is called after `blo' and ^ indicates viper-insert-point,
;; then point jumps to the beginning of `blo'. If expansion is found, `blablo'
;; is deleted, and we have |^, where | denotes point. Next, dabbrev-expand
;; will insert the expansion, and we get: blablo^
:group 'viper-search)
(defcustom viper-search-scroll-threshold 2
- "*If search lands within this threshnold from the window top/bottom,
+ "*If search lands within this threshold from the window top/bottom,
the window will be scrolled up or down appropriately, to reveal context.
If you want Viper search to behave as usual in Vi, set this variable to a
negative number."
;; These two vars control the interaction of jumps performed by ' and `.
;; In this new version, '' doesn't erase the marks set by ``, so one can
-;; use both kinds of jumps interchangeably and without loosing positions
+;; use both kinds of jumps interchangeably and without losing positions
;; inside the lines.
;; Remembers position of the last jump done using ``'.
(condition-case nil
(if (featurep 'xemacs)
(set (make-local-variable 'bar-cursor) nil)
- (setq cursor-type default-cursor-type))
+ (setq cursor-type (default-value 'cursor-type)))
(error nil)))
(defun viper-set-insert-cursor-type ()
(set (make-local-variable 'bar-cursor) 2)
(setq cursor-type '(bar . 2))))
+(defun viper-ESC-keyseq-timeout ()
+ "*Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.
+Setting this too high may slow down switching from insert to vi state. Setting
+this value too low will make it impossible to use function keys in insert mode
+on a dumb terminal."
+ (if (viper-window-display-p)
+ 0 viper-fast-keyseq-timeout))
+
+
(provide 'viper-init)
;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
;; End:
-;; arch-tag: 4efa2416-1fcb-4690-be10-1a2a0248d250
;;; viper-init.el ends here