1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

new version

This commit is contained in:
Michael Kifer 1997-09-30 01:13:53 +00:00
parent 991667f86e
commit 8e41a31c5d
8 changed files with 208 additions and 97 deletions

View file

@ -1814,7 +1814,7 @@ suffixes, the user is asked to confirm.
To turn this feature off, set this variable to nil."
:type '(repeat string)
:group 'viper)
:group 'viper-misc)
;; Try to add a suitable suffix to files whose name ends with a `.'
@ -3230,7 +3230,8 @@ controlled by the sign of prefix numeric value."
(defun viper-forward-sentence (arg)
"Forward sentence."
(interactive "P")
(push-mark nil t)
(or (eq last-command this-command)
(push-mark nil t))
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
@ -3240,7 +3241,8 @@ controlled by the sign of prefix numeric value."
(defun viper-backward-sentence (arg)
"Backward sentence."
(interactive "P")
(push-mark nil t)
(or (eq last-command this-command)
(push-mark nil t))
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
@ -3250,7 +3252,8 @@ controlled by the sign of prefix numeric value."
(defun viper-forward-paragraph (arg)
"Forward paragraph."
(interactive "P")
(push-mark nil t)
(or (eq last-command this-command)
(push-mark nil t))
(let ((val (viper-p-val arg))
(com (viper-getCom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
@ -3263,7 +3266,8 @@ controlled by the sign of prefix numeric value."
(defun viper-backward-paragraph (arg)
"Backward paragraph."
(interactive "P")
(push-mark nil t)
(or (eq last-command this-command)
(push-mark nil t))
(let ((val (viper-p-val arg))
(com (viper-getCom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
@ -3274,8 +3278,7 @@ controlled by the sign of prefix numeric value."
(viper-execute-com 'viper-backward-paragraph nil com)
(backward-char 1)))))
;; should be mode-specific etc.
;; should be mode-specific
(defun viper-prev-heading (arg)
(interactive "P")
(let ((val (viper-p-val arg))
@ -4288,13 +4291,10 @@ One can use `` and '' to temporarily jump 1 step back."
(view-register (downcase reg)))
((viper-valid-register reg '(digit))
(let ((text (current-kill (- reg ?1) 'do-not-rotate)))
(save-excursion
(set-buffer (get-buffer-create "*Output*"))
(delete-region (point-min) (point-max))
(insert (format "Register %c contains the string:\n" reg))
(insert text)
(goto-char (point-min)))
(display-buffer "*Output*")))
(with-output-to-temp-buffer " *viper-info*"
(princ (format "Register %c contains the string:\n" reg))
(princ text))
))
((= ?\] reg)
(viper-next-heading arg))
(t (error
@ -4310,14 +4310,12 @@ One can use `` and '' to temporarily jump 1 step back."
(viper-heading-end arg))
((viper-valid-register reg '(letter))
(let* ((val (get-register (1+ (- reg ?a))))
(buf (if (not val)
(buf (if (not (markerp val))
(error viper-EmptyTextmarker reg)
(marker-buffer val)))
(pos (marker-position val))
line-no text (s pos) (e pos))
(save-excursion
(set-buffer (get-buffer-create "*Output*"))
(delete-region (point-min) (point-max))
(with-output-to-temp-buffer " *viper-info*"
(if (and buf pos)
(progn
(save-excursion
@ -4339,15 +4337,14 @@ One can use `` and '' to temporarily jump 1 step back."
(setq text (format "%s<%c>%s"
(substring text 0 (- pos s))
reg (substring text (- pos s)))))
(insert
(princ
(format
"Textmarker `%c' is in buffer `%s' at line %d.\n"
reg (buffer-name buf) line-no))
(insert (format "Here is some text around %c:\n\n %s"
(princ (format "Here is some text around %c:\n\n %s"
reg text)))
(insert (format viper-EmptyTextmarker reg)))
(goto-char (point-min)))
(display-buffer "*Output*")))
(princ (format viper-EmptyTextmarker reg))))
))
(t (error viper-InvalidTextmarker reg)))))

View file

@ -107,8 +107,10 @@
;; List of addresses passed to Ex command
(defvar ex-addresses nil)
;; It seems that this flag is used only for `#', `print', and `list', which
;; aren't implemented. Check later.
;; This flag is supposed to be set only by `#', `print', and `list',
;; none of which is implemented. So, it and the pices of the code it
;; controls are dead weight. We keep it just in case this might be
;; needed in the future.
(defvar ex-flag nil)
;; "buffer" where Ex commands keep deleted data.
@ -1134,16 +1136,16 @@ reversed."
(copy-region-as-kill (point) (mark t)))
(if ex-flag
(progn
(with-output-to-temp-buffer "*copy text*"
(with-output-to-temp-buffer " *copy text*"
(princ
(if (or del-flag ex-g-flag ex-g-variant)
(current-kill 0)
(buffer-substring (point) (mark t)))))
(condition-case nil
(progn
(read-string "[Hit return to continue] ")
(save-excursion (kill-buffer "*copy text*")))
(quit (save-excursion (kill-buffer "*copy text*"))
(read-string "[Hit return to confirm] ")
(save-excursion (kill-buffer " *copy text*")))
(quit (save-excursion (kill-buffer " *copy text*"))
(signal 'quit nil))))))
(if (= address 0)
(goto-char (point-min))
@ -1172,7 +1174,7 @@ reversed."
(with-output-to-temp-buffer " *delete text*"
(princ (buffer-substring (point) (mark t))))
(condition-case nil
(read-string "[Hit return to continue] ")
(read-string "[Hit return to confirm] ")
(quit
(save-excursion (kill-buffer " *delete text*"))
(error "")))
@ -1349,14 +1351,14 @@ reversed."
(if ex-flag
;; show text to be joined and ask for confirmation
(progn
(with-output-to-temp-buffer " *text*"
(with-output-to-temp-buffer " *join text*"
(princ (buffer-substring (point) (mark t))))
(condition-case nil
(progn
(read-string "[Hit return to continue] ")
(read-string "[Hit return to confirm] ")
(ex-line-subr com (point) (mark t)))
(quit (ding)))
(save-excursion (kill-buffer " *text*")))
(save-excursion (kill-buffer " *join text*")))
(ex-line-subr com (point) (mark t)))
(setq point (point)))
(goto-char (1- point))
@ -2115,10 +2117,9 @@ Please contact your system administrator. "
(message (concat file " " info))
(save-window-excursion
(with-output-to-temp-buffer " *viper-info*"
(princ (concat "\n"
file "\n\n\t" info
"\n\n\nPress any key to continue...\n\n")))
(viper-read-event)
(princ (concat "\n" file "\n\n\t" info "\n\n")))
(let ((inhibit-quit t))
(viper-set-unread-command-events (viper-read-event)))
(kill-buffer " *viper-info*")))
))

View file

@ -51,16 +51,17 @@
(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))
(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."
:type 'boolean
:tag "Is it Microsoft-made OS?"
:group 'viper)
: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)
:group 'viper-misc)
(defcustom viper-force-faces nil
"If t, Viper will think that it is running on a display that supports faces.
@ -68,7 +69,7 @@ This is provided as a temporary relief for users of graphics-capable terminals
that Viper doesn't know about.
In all likelihood, you don't need to bother with this setting."
:type 'boolean
:group 'viper)
:group 'viper-highlighting)
(defun viper-has-face-support-p ()
(cond ((viper-window-display-p))
@ -470,7 +471,7 @@ color displays. By default, the delimiters are used only on TTYs."
This is a list where Viper keeps the history of previously inserted pieces of
text."
:type 'integer
:group 'viper)
:group 'viper-misc)
;; The insertion ring.
(defvar viper-insertion-ring nil)
;; This is temp insertion ring. Used to do rotation for display purposes.
@ -481,7 +482,7 @@ text."
(defcustom viper-command-ring-size 14
"The size of history of Vi commands repeatable with dot."
:type 'integer
:group 'viper)
:group 'viper-misc)
;; The command ring.
(defvar viper-command-ring nil)
;; This is temp command ring. Used to do rotation for display purposes.
@ -494,7 +495,7 @@ text."
Setting this too high may slow down your typing. Setting this value too low
will make it hard to use Vi-stile timeout macros."
:type 'integer
:group 'viper)
:group 'viper-misc)
(defcustom viper-ESC-keyseq-timeout (if (viper-window-display-p)
0 viper-fast-keyseq-timeout)
@ -503,7 +504,7 @@ 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)
:group 'viper-misc)
;; Modes and related variables
@ -612,6 +613,11 @@ to a new place after repeating previous Vi command."
;;; Variables for Moves and Searches
(defgroup viper-search nil
"Variables that define the search and query-replace behavior of Viper."
:prefix "viper-"
:group 'viper)
;; For use by `;' command.
(defvar viper-f-char nil)
@ -638,13 +644,13 @@ to a new place after repeating previous Vi command."
(defcustom viper-case-fold-search nil
"*If not nil, search ignores cases."
:type 'boolean
:group 'viper)
:group 'viper-search)
(defcustom viper-re-search t
"*If not nil, search is regexp search, otherwise vanilla search."
:type 'boolean
:tag "Regexp Search"
:group 'viper)
:group 'viper-search)
(defcustom viper-search-scroll-threshold 2
"*If search lands within this threshnold from the window top/bottom,
@ -652,19 +658,19 @@ 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."
:type 'boolean
:group 'viper)
:group 'viper-search)
(defcustom viper-re-query-replace t
"*If t then do regexp replace, if nil then do string replace."
:type 'boolean
:tag "Regexp Query Replace"
:group 'viper)
:group 'viper-search)
(defcustom viper-re-replace t
"*If t, do regexp replace. nil means do string replace."
:type 'boolean
:tag "Regexp Replace"
:group 'viper)
:group 'viper-search)
(defcustom viper-parse-sexp-ignore-comments t
"*If t, `%' ignores the parentheses that occur inside comments."
@ -707,20 +713,20 @@ If nil, the cursor will move backwards without deleting anything."
(defcustom viper-buffer-search-char nil
"*Key used for buffer-searching. Must be a character type, e.g., ?g."
:type '(choice (const nil) character)
:group 'viper)
:group 'viper-search)
(defcustom viper-search-wrap-around-t t
"*If t, search wraps around."
:type 'boolean
:tag "Search Wraps Around"
:group 'viper)
:group 'viper-search)
(viper-deflocalvar viper-related-files-and-buffers-ring nil "")
(defcustom viper-related-files-and-buffers-ring nil
"*List of file and buffer names that are considered to be related to the current buffer.
Related buffers can be cycled through via :R and :P commands."
:type 'boolean
:group 'viper)
:group 'viper-misc)
(put 'viper-related-files-and-buffers-ring 'permanent-local t)
;; Used to find out if we are done with searching the current buffer.
@ -826,7 +832,11 @@ Related buffers can be cycled through via :R and :P commands."
"*Face used to flash out the search pattern."
:group 'viper-highlighting)
;; An internal variable. Viper takes the face from here.
(defvar viper-search-face 'viper-search-face)
(defvar viper-search-face 'viper-search-face
"Face used to flash out the search pattern.
DO NOT CHANGE this variable. Instead, use the customization widget
to customize the actual face object `viper-search-face'
this variable represents.")
(viper-hide-face 'viper-search-face)
;;(defvar viper-replace-overlay-face
@ -852,7 +862,11 @@ Related buffers can be cycled through via :R and :P commands."
"*Face for highlighting replace regions on a window display."
:group 'viper-highlighting)
;; An internal variable. Viper takes the face from here.
(defvar viper-replace-overlay-face 'viper-replace-overlay-face)
(defvar viper-replace-overlay-face 'viper-replace-overlay-face
"Face for highlighting replace regions on a window display.
DO NOT CHANGE this variable. Instead, use the customization widget
to customize the actual face object `viper-replace-overlay-face'
this variable represents.")
(viper-hide-face 'viper-replace-overlay-face)
;;(defvar viper-minibuffer-emacs-face
@ -887,7 +901,11 @@ Related buffers can be cycled through via :R and :P commands."
"Face used in the Minibuffer when it is in Emacs state."
:group 'viper-highlighting)
;; An internal variable. Viper takes the face from here.
(defvar viper-minibuffer-emacs-face 'viper-minibuffer-emacs-face)
(defvar viper-minibuffer-emacs-face 'viper-minibuffer-emacs-face
"Face used in the Minibuffer when it is in Emacs state.
DO NOT CHANGE this variable. Instead, use the customization widget
to customize the actual face object `viper-minibuffer-emacs-face'
this variable represents.")
(viper-hide-face 'viper-minibuffer-emacs-face)
;;(defvar viper-minibuffer-insert-face
@ -920,7 +938,11 @@ Related buffers can be cycled through via :R and :P commands."
"Face used in the Minibuffer when it is in Insert state."
:group 'viper-highlighting)
;; An internal variable. Viper takes the face from here.
(defvar viper-minibuffer-insert-face 'viper-minibuffer-insert-face)
(defvar viper-minibuffer-insert-face 'viper-minibuffer-insert-face
"Face used in the Minibuffer when it is in Insert state.
DO NOT CHANGE this variable. Instead, use the customization widget
to customize the actual face object `viper-minibuffer-insert-face'
this variable represents.")
(viper-hide-face 'viper-minibuffer-insert-face)
;;(defvar viper-minibuffer-vi-face
@ -945,11 +967,16 @@ Related buffers can be cycled through via :R and :P commands."
"Face used in the Minibuffer when it is in Vi state."
:group 'viper-highlighting)
;; An internal variable. Viper takes the face from here.
(defvar viper-minibuffer-vi-face 'viper-minibuffer-vi-face)
(defvar viper-minibuffer-vi-face 'viper-minibuffer-vi-face
"Face used in the Minibuffer when it is in Vi state.
DO NOT CHANGE this variable. Instead, use the customization widget
to customize the actual face object `viper-minibuffer-vi-face'
this variable represents.")
(viper-hide-face 'viper-minibuffer-vi-face)
;; the current face to be used in the minibuffer
(viper-deflocalvar viper-minibuffer-current-face viper-minibuffer-emacs-face "")
(viper-deflocalvar
viper-minibuffer-current-face viper-minibuffer-emacs-face "")
;;; Miscellaneous
@ -960,12 +987,12 @@ Related buffers can be cycled through via :R and :P commands."
(defcustom viper-spell-function 'ispell-region
"Spell function used by #s<move> command to spell."
:type 'function
:group 'viper)
:group 'viper-misc)
(defcustom viper-tags-file-name "TAGS"
"The tags file used by Viper."
:type 'string
:group 'viper)
:group 'viper-misc)
;; Minibuffer
@ -995,27 +1022,32 @@ Should be set in `~/.viper' file."
"Mode line tag identifying the Replace mode of Viper.")
(defgroup viper-hooks nil
"Viper hooks."
:prefix "viper-"
:group 'viper)
(defcustom viper-vi-state-hook nil
"*Hooks run just before the switch to Vi mode is completed."
:type 'hook
:group 'viper)
:group 'viper-hooks)
(defcustom viper-insert-state-hook nil
"*Hooks run just before the switch to Insert mode is completed."
:type 'hook
:group 'viper)
:group 'viper-hooks)
(defcustom viper-replace-state-hook nil
"*Hooks run just before the switch to Replace mode is completed."
:type 'hook
:group 'viper)
:group 'viper-hooks)
(defcustom viper-emacs-state-hook nil
"*Hooks run just before the switch to Emacs mode is completed."
:type 'hook
:group 'viper)
:group 'viper-hooks)
(defcustom viper-load-hook nil
"Hooks run just after loading Viper."
:type 'hook
:group 'viper)
:group 'viper-hooks)
;;; Local Variables:

View file

@ -8,7 +8,7 @@
;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
(defconst viper-version "3.00 (Polyglot) of August 18, 1997"
(defconst viper-version "3.001 (Polyglot) of September 23, 1997"
"The current version of Viper")
;; This file is part of GNU Emacs.
@ -334,6 +334,12 @@ defaults to `~/.viper'."
(require 'viper-cmd)
(defgroup viper-misc nil
"Miscellaneous Viper customization."
:prefix "viper-"
:group 'viper)
(defcustom viper-always t
"Non-nil means, arrange for vi-state to be a default when appropriate.
This is different from `viper-mode' variable in that `viper-mode' determines
@ -341,7 +347,7 @@ whether to use Viper in the first place, while `viper-always', if nil, lets
user decide when to invoke Viper in a major mode."
:type 'boolean
:tag "Always Invoke Viper"
:group 'viper)
:group 'viper-misc)
;; Non-viper variables that need to be saved in case the user decides to
;; de-viperize emacs.
@ -357,10 +363,11 @@ If t, viperize emacs. If nil -- don't. If `ask', ask the user.
This variable is used primatily when Viper is being loaded.
Must be set in `~/.emacs' before Viper is loaded.
DO NOT set this variable interactively."
DO NOT set this variable interactively, unless you are using the customization
widget."
:type '(choice (const nil) (const t) (const ask))
:tag "Set Viper Mode on Loading"
:group 'viper)
:group 'viper-misc)
(defcustom viper-non-vi-major-modes
'(custom-mode dired-mode efs-mode internal-ange-ftp-mode tar-mode
@ -371,7 +378,7 @@ Viper automatically augments this list with some obvious modes, such as
`dired-mode', `tar-mode', etc. So, don't put a mode on this list, unless
it comes up in a wrong Viper state."
:type '(repeat symbol)
:group 'viper)
:group 'viper-misc)