;;; vi.el --- major mode for emulating "vi" editor under GNU Emacs.
+;; Author: Neal Ziring <nz@rsch.wisc.edu>
+;; Felix S. T. Wu <wu@crys.wisc.edu>
+;; Keywords: emulations
+
+;;; Commentary:
+
; Originally written by : seismo!wucs!nz@rsch.wisc.edu (Neal Ziring)
; Extensively redesigned and rewritten by wu@crys.wisc.edu (Felix S.T. Wu)
; Last revision: 01/07/87 Wed (for GNU Emacs 18.33)
; 2). In operator handling, should allow other point moving Emacs commands
; (such as ESC <, ESC >) to be used as arguments.
;
+;;; Code:
(defun vi-switch-mode (arg mode-char)
"Switch the major mode of current buffer as specified by the following char \\{vi-tilde-map}"
(error "Nothing in register %c" reg)
(if (null reg) (setq reg ?1)) ; the default is the last text killed
(setq put-text
- (if (and (>= reg ?1) (<= reg ?9))
- (let ((ring-length (length kill-ring)))
- (setq this-command 'yank) ; So we may yank-pop !!
- (nth (% (+ (- reg ?0 1) (- ring-length
- (length kill-ring-yank-pointer)))
- ring-length) kill-ring))
- (if (stringp (get-register reg))
- (get-register reg)
- (error "Register %c is not containing text string" reg))))
+ (cond
+ ((and (>= reg ?1) (<= reg ?9))
+ (setq this-command 'yank) ; So we may yank-pop !!
+ (current-kill (- reg ?0 1) 'do-not-rotate))
+ ((stringp (get-register reg)) (get-register reg))
+ (t (error "Register %c is not containing text string" reg))))
(if (vi-string-end-with-nl-p put-text) ; put back text as lines
(if after-p
(progn (next-line 1) (beginning-of-line))