Commits

michaelk  committed 75c029c

*** empty log message ***

  • Participants
  • Parent commits e7e0758

Comments (0)

Files changed (9)

+2002-05-18  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* all files: eliminated trailing spaces from lines.
+	
 2003-03-09  Ben Wing  <ben@xemacs.org>
 
 	* Makefile:
 	
 	* viper-cmd.el, viper-ex.el, viper.texi: typos.
 	
+2002-04-30  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* emulation/viper.el (viper-emacs-state-mode-list): Add
+	`browse-kill-ring-mode', `recentf-mode', and `occur-mode'
+	to the list of emacs modes (thanks to Colin Walters).
+	
 2002-07-16  Adrian Aichner  <adrian@xemacs.org>
 
 	* .cvsignore: Add generated .info* and .html files.

File viper-cmd.el

 	) ; let
     (error nil)
     ) ; condition-case
-      
+
   (viper-set-input-method nil)
   (viper-set-iso-accents-mode nil)
   (viper-set-mode-vars-for viper-current-state)
 
   (if (atom com)
       ;; `com' is a single char, so we construct the command argument
-      ;; and if `char' is `?', we describe the arg; otherwise 
+      ;; and if `char' is `?', we describe the arg; otherwise
       ;; we prepare the command that will be executed at the end.
       (progn
 	(setq cmd-info (cons value com))
 	  (viper-describe-arg cmd-info)
 	  (setq char (read-char)))
 	;; `char' is a movement cmd, a digit arg cmd, or a register cmd---so we
-	;; execute it at the very end 
+	;; execute it at the very end
 	(or (viper-movement-command-p char)
 	    (viper-digit-command-p char)
 	    (viper-regsuffix-command-p char)
 	    (viper= char ?!) ; bang command
 	    (error ""))
 	(setq cmd-to-exec-at-end
-	      (viper-exec-form-in-vi 
+	      (viper-exec-form-in-vi
 	       `(key-binding (char-to-string ,char)))))
-    
+
     ;; as com is non-nil, this means that we have a command to execute
     (if (viper-memq-char (car com) '(?r ?R))
 	;; execute apropriate region command.
       ;; otherwise, reset prefix arg and call appropriate command
       (setq value (if (null value) 1 value))
       (setq prefix-arg nil)
-      (cond 
+      (cond
        ;; If we change ?C to ?c here, then cc will enter replacement mode
        ;; rather than deleting lines.  However, it will affect 1 less line than
        ;; normal.  We decided to not use replacement mode here and follow Vi,
        ((equal com '(?! . ?!)) (viper-line (cons value ?!)))
        ((equal com '(?= . ?=)) (viper-line (cons value ?=)))
        (t (error "")))))
-  
+
   (if cmd-to-exec-at-end
       (progn
 	(setq last-command-char char)
-	(setq last-command-event 
+	(setq last-command-event
 	      (viper-copy-event
 	       (if viper-xemacs-p (character-to-event char) char)))
 	(condition-case nil
 
 ;; Thie is a temp hook that uses free variables init-message and initial.
 ;; A dirty feature, but it is the simplest way to have it do the right thing.
-;; The INIT-MESSAGE and INITIAL vars come from the scope set by 
+;; The INIT-MESSAGE and INITIAL vars come from the scope set by
 ;; viper-read-string-with-history
 (defun viper-minibuffer-standard-hook ()
   (if (stringp init-message)
     (setq char (if com viper-d-char (viper-char-at-pos 'backward)))
 
     (if com (insert char))
-    
+
     (setq viper-d-char char)
-    
+
     (viper-loop (1- (if (> arg 0) arg (- arg)))
 		(delete-char 1 t)
 		(insert char))
-    
+
     (viper-adjust-undo)
     (backward-char arg)
     ))
 
 ;; Get viper standard value of SYMBOL.  If symbol is customized, get its
 ;; standard value.  Otherwise, get the value saved in the alist STORAGE.  If
-;; STORAGE is nil, use viper-saved-user-settings. 
+;; STORAGE is nil, use viper-saved-user-settings.
 (defun viper-standard-value (symbol &optional storage)
   (or (eval (car (get symbol 'customized-value)))
       (eval (car (get symbol 'saved-value)))
 	  ))
 
 
-  
+
 
 ;;; viper-cmd.el ends here
 	("set"			(ex-set))
 	("shell"		(ex-shell))
 	("source"		(ex-source))
-	("stop"			(suspend-emacs)) 
+	("stop"			(suspend-emacs))
 	("sr"			(ex-substitute t t))
 	("submitReport"	    	(viper-submit-report))
 	("substitute"	    	(ex-substitute) is-mashed)
 	("v"			"vglobal")
 	("version"		(viper-version))
 	("vglobal"		(ex-global t) is-mashed)
-	("visual"		(ex-edit)) 
+	("visual"		(ex-edit))
 	("w"			"write")
 	("wq"			(ex-write t))
 	("write"		(ex-write nil))
 
 
 ;; A-list of Ex variables that can be set using the :set command.
-(defconst ex-variable-alist 
+(defconst ex-variable-alist
   '(("wrapscan") ("ws") ("wrapmargin") ("wm")
     ("tabstop-global") ("ts-g") ("tabstop") ("ts")
     ("showmatch") ("sm") ("shiftwidth") ("sw") ("shell") ("sh")
-    ("readonly") ("ro") 
+    ("readonly") ("ro")
     ("nowrapscan") ("nows") ("noshowmatch") ("nosm")
     ("noreadonly") ("noro") ("nomagic") ("noma")
     ("noignorecase") ("noic")
     ("noautoindent-global") ("noai-g") ("noautoindent") ("noai")
     ("magic") ("ma") ("ignorecase") ("ic")
-    ("autoindent-global") ("ai-g") ("autoindent") ("ai") 
-    ("all") 
+    ("autoindent-global") ("ai-g") ("autoindent") ("ai")
+    ("all")
     ))
 
-  
+
 
 ;; Token recognized during parsing of Ex commands (e.g., "read", "comma")
 (defvar ex-token nil)
 
-;; Type of token. 
+;; Type of token.
 ;; If non-nil, gives type of address; if nil, it is a command.
 (defvar ex-token-type nil)
 
 	      ((string-match "\\(bash$\\|bash.exe$\\)" shell-file-name)
 	       "-noprofile") ; bash: ignore .profile
 	      )))
-  "Options to pass to the Unix-style shell. 
+  "Options to pass to the Unix-style shell.
 Don't put `-c' here, as it is added automatically."
   :type '(choice (const nil) string)
   :group 'viper-ex)
 The default tries to set this variable to work with Unix, Windows,
 OS/2, and VMS.
 
-However, if it doesn't work right for some types of Unix shells or some OS, 
+However, if it doesn't work right for some types of Unix shells or some OS,
 the user should supply the appropriate function and set this variable to the
 corresponding function symbol."
   :type 'symbol
 ;; e.g., :r !date
 (defvar ex-cmdfile nil)
 (defvar ex-cmdfile-args "")
-  
+
 ;; flag used in viper-ex-read-file-name to indicate that we may be reading
 ;; multiple file names.  Used for :edit and :next
 (defvar viper-keep-reading-filename nil)
 
 ;; Last shell command executed with :! command.
 (defvar viper-ex-last-shell-com nil)
-  
+
 ;; Indicates if Minibuffer was exited temporarily in Ex-command.
 (defvar viper-incomplete-ex-cmd nil)
-  
+
 ;; Remembers the last ex-command prompt.
 (defvar viper-last-ex-prompt "")
 
 ;; A token has a type, \(command, address, end-mark\), and a value
 (defun viper-get-ex-token ()
   (save-window-excursion
-    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
     (set-buffer viper-ex-work-buf)
     (skip-chars-forward " \t|")
     (let ((case-fold-search t))
 		     "\\|" "![ \t]*[a-zA-Z].*"
 		     "\\)"
 		     "!*")))
-	
+
     (save-window-excursion ;; put cursor at the end of the Ex working buffer
-      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
       (set-buffer viper-ex-work-buf)
       (goto-char (point-max)))
     (cond ((viper-looking-back quit-regex1) (exit-minibuffer))
 	  ((viper-looking-back stay-regex)  (insert " "))
 	  ((viper-looking-back quit-regex2) (exit-minibuffer))
 	  (t (insert " ")))))
-  
+
 ;; complete Ex command
 (defun ex-cmd-complete ()
   (interactive)
   (let (save-pos dist compl-list string-to-complete completion-result)
-    
+
     (save-excursion
       (setq dist (skip-chars-backward "[a-zA-Z!=>&~]")
 	    save-pos (point)))
-	
+
     (if (or (= dist 0)
 	    (viper-looking-back "\\([ \t]*['`][ \t]*[a-z]*\\)")
 	    (viper-looking-back
 		(viper-looking-back "\\([ \t]*['`][ \t]*[a-z]*\\)")
 		(looking-at "[^ \t\n\C-m]"))
 	    nil
-	  (with-output-to-temp-buffer "*Completions*" 
+	  (with-output-to-temp-buffer "*Completions*"
 	    (display-completion-list
 	     (viper-alist-to-list ex-token-alist))))
       ;; Preceding chars may be part of a command name
       (setq string-to-complete (buffer-substring save-pos (point)))
       (setq completion-result
 	    (try-completion string-to-complete ex-token-alist))
-      
+
       (cond ((eq completion-result t)  ; exact match--do nothing
 	     (viper-tmp-insert-at-eob " (Sole completion)"))
 	    ((eq completion-result nil)
 		     (viper-filter-alist (concat "^" completion-result)
 				       ex-token-alist)))
 	     (if (> (length compl-list) 1)
-		 (with-output-to-temp-buffer "*Completions*" 
+		 (with-output-to-temp-buffer "*Completions*"
 		   (display-completion-list
 		    (viper-alist-to-list (reverse compl-list)))))))
       )))
-    
 
-;; Read Ex commands 
+
+;; Read Ex commands
 ;; ARG is a prefix argument. If given, the ex command runs on the region
 ;;(without the user having to specify the address :a,b
 ;; STRING is the command to execute. If nil, then Viper asks you to enter the
-;; command. 
+;; command.
 (defun viper-ex (arg &optional string)
   (interactive "P")
   (or string
 		  (+ reg-beg-line (count-lines reg-beg reg-end) -1)))))
     (if reg-beg-line
 	(setq initial-str (format "%d,%d" reg-beg-line reg-end-line)))
-    
-    (setq com-str 
+
+    (setq com-str
 	  (or string (viper-read-string-with-history
-		      ":" 
+		      ":"
 		      initial-str
 		      'viper-ex-history
 		      ;; no default when working on region
 			  " [Type command to execute on current region]"))))
     (save-window-excursion
       ;; just a precaution
-      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
       (set-buffer viper-ex-work-buf)
       (delete-region (point-min) (point-max))
       (insert com-str "\n")
 	    (t (let ((ans (viper-get-ex-address-subr address dot)))
 		 (if ans (setq address ans)))))
       (setq prev-token-type ex-token-type))))
-      
+
 
 ;; Get a regular expression and set `ex-variant', if found
 ;; Viper doesn't parse the substitution or search patterns.
 ;; Get an Ex option g or c
 (defun viper-get-ex-opt-gc (c)
   (save-window-excursion
-    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
     (set-buffer viper-ex-work-buf)
     (if (looking-at (format "%c" c)) (forward-char 1))
     (skip-chars-forward " \t")
 	   (save-excursion
 	     (if (null ex-token)
 		 (exchange-point-and-mark)
-	       (goto-char 
+	       (goto-char
 		(viper-register-to-point
 		 (viper-int-to-char (1+ (- ex-token ?a))) 'enforce-buffer)))
 	     (setq address (point-marker)))))
   (setq ex-count nil)
   (setq ex-flag nil)
   (save-window-excursion
-    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
     (set-buffer viper-ex-work-buf)
     (skip-chars-forward " \t")
     (if (looking-at "[a-zA-Z]")
 	ex-count nil
 	ex-flag nil)
   (save-window-excursion
-    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
     (set-buffer viper-ex-work-buf)
     (skip-chars-forward " \t")
     (if (looking-at "!")
 ;; Expand \% and \# in ex command
 (defun ex-expand-filsyms (cmd buf)
   (let (cf pf ret)
-    (save-excursion 
+    (save-excursion
       (set-buffer buf)
       (setq cf buffer-file-name)
       (setq pf (ex-next nil t))) ; this finds alternative file name
       (insert cmd)
       (goto-char (point-min))
       (while (re-search-forward "%\\|#" nil t)
-	(let ((data (match-data)) 
+	(let ((data (match-data))
 	      (char (buffer-substring (match-beginning 0) (match-end 0))))
 	  (if (viper-looking-back (concat "\\\\" char))
 	      (replace-match char)
 	  ex-cmdfile-args "")
     (save-excursion
       (save-window-excursion
-	(setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+	(setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
 	(set-buffer viper-ex-work-buf)
 	(skip-chars-forward " \t")
 	(if (looking-at "!")
 	(skip-chars-backward " \t\n")
 	(setq prompt (buffer-substring (point-min) (point)))
 	))
-    
+
     (setq viper-last-ex-prompt prompt)
-    
+
     ;; If we just finished reading command, redisplay prompt
     (if viper-incomplete-ex-cmd
 	(setq ex-file (viper-ex-read-file-name (format ":%s " prompt)))
 ;; file names, arranges to re-enter the minibuffer.
 (defun viper-complete-filename-or-exit ()
   (interactive)
-  (setq viper-keep-reading-filename t) 
-  ;; don't exit if directory---ex-commands don't 
+  (setq viper-keep-reading-filename t)
+  ;; don't exit if directory---ex-commands don't
   (cond ((ex-cmd-accepts-multiple-files-p ex-token) (exit-minibuffer))
 	;; apparently the argument to an Ex command is
 	;; supposed to be a shell command
 	 (minibuffer-local-completion-map
 	  (copy-keymap minibuffer-local-completion-map))
 	 beg end cont val)
-    
+
     (viper-add-keymap ex-read-filename-map
-		    (if viper-emacs-p 
+		    (if viper-emacs-p
 			minibuffer-local-completion-map
-		      read-file-name-map)) 
-		    
+		      read-file-name-map))
+
     (setq cont (setq viper-keep-reading-filename t))
     (while cont
       (setq viper-keep-reading-filename nil
 	  (setq val (concat "\"" val "\"")))
       (setq str  (concat str (if (equal val "") "" " ")
 			 val (if (equal val "") "" " ")))
-			 
+
       ;; Only edit, next, and Next commands accept multiple files.
       ;; viper-keep-reading-filename is set in the anonymous function that is
       ;; bound to " " in ex-read-filename-map.
       (setq cont (and viper-keep-reading-filename
 		      (ex-cmd-accepts-multiple-files-p ex-token)))
       )
-    
+
     (setq beg (string-match "[^ \t]" str)   ; delete leading blanks
 	  end (string-match "[ \t]*$" str)) ; delete trailing blanks
     (if (member ex-token '("read" "write"))
 
 (defun viper-undisplayed-files ()
   (mapcar
-   (lambda (b) 
+   (lambda (b)
      (if (null (get-buffer-window b))
 	 (let ((f (buffer-file-name b)))
 	   (if f f
-	     (if ex-cycle-through-non-files 
+	     (if ex-cycle-through-non-files
 		 (let ((s (buffer-name b)))
 		   (if (string= " " (substring s 0 1))
 		       nil
 	(args "")
 	(file-count 1))
     (while (not (null l))
-      (if (car l) 
+      (if (car l)
 	  (setq args (format "%s %d) %s\n" args file-count (car l))
 		file-count (1+ file-count)))
       (setq l (cdr l)))
 	 (setq ex-file  (viper-abbreviate-file-name (buffer-file-name))))
 	((string= ex-file "")
 	 (error viper-NoFileSpecified)))
-      
+
      (let (msg do-edit)
        (if buffer-file-name
    	(cond ((buffer-modified-p)
    			     buffer-file-name)
    		     do-edit t))
    	      (t (setq do-edit nil))))
-         
+
        (if do-edit
    	(if (yes-or-no-p msg)
    	    (progn
    	      (kill-buffer (current-buffer)))
    	  (message "Buffer %s was left intact" (buffer-name))))
        ) ; let
-  
+
   (if (null (setq file (get-file-buffer ex-file)))
-      (progn 
+      (progn
 	;; this also does shell-style globbing
 	(ex-find-file
 	 ;; replace # and % with the previous/current file
   (if ex-offset
       (progn
 	(save-window-excursion
-	  (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+	  (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
 	  (set-buffer viper-ex-work-buf)
 	  (delete-region (point-min) (point-max))
 	  (insert ex-offset "\n")
     (viper-get-ex-pat)
     (if (null ex-token)
 	(error "`%s': Missing regular expression" gcommand)))
-  
+
   (if (string= ex-token "")
       (if (null viper-s-string)
 	  (error viper-NoPrevSearch)
 	    (forward-line -1)
 	    (end-of-line)))))
     (save-window-excursion
-      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
       (set-buffer viper-ex-work-buf)
       ;; com-str is the command string, i.e., g/pattern/ or v/pattern'
       (setq com-str (buffer-substring (1+ (point)) (1- (point-max)))))
 	  (error "`%s': Spurious text \"%s\" after mark name"
 		 name (substring name 1) viper-SpuriousText))
     (save-window-excursion
-      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
       (set-buffer viper-ex-work-buf)
       (skip-chars-forward " \t")
       (if (looking-at "[a-z]")
       (goto-char (car ex-addresses))
       (point-to-register (viper-int-to-char (1+ (- char ?a)))))))
 
-    
-      
+
+
 ;; Alternate file is the file next to the first one in the buffer ring
 (defun ex-next (cycle-other-window &optional find-alt-file)
   (catch 'ex-edit
     (let (count l)
-      (if (not find-alt-file) 
+      (if (not find-alt-file)
 	  (progn
 	    (viper-get-ex-file)
 	    (if (or (char-or-string-p ex-offset)
-		    (and (not (string= "" ex-file)) 
+		    (and (not (string= "" ex-file))
 		         (not (string-match "^[0-9]+$" ex-file))))
 		(progn
 		  (ex-edit t)
 
 
 (defun ex-next-related-buffer (direction &optional no-recursion)
-  
+
   (viper-ring-rotate1 viper-related-files-and-buffers-ring direction)
-  
-  (let ((file-or-buffer-name 
+
+  (let ((file-or-buffer-name
 	 (viper-current-ring-item viper-related-files-and-buffers-ring))
 	(old-ring viper-related-files-and-buffers-ring)
 	(old-win (selected-window))
 	skip-rest buf wind)
-    
+
     (or (and (ring-p viper-related-files-and-buffers-ring)
 	     (> (ring-length viper-related-files-and-buffers-ring) 0))
 	(error "This buffer has no related files or buffers"))
-	
+
     (or (stringp file-or-buffer-name)
 	(error
 	 "File and buffer names must be strings, %S" file-or-buffer-name))
-    
+
     (setq buf (cond ((get-buffer file-or-buffer-name))
 		    ((file-exists-p file-or-buffer-name)
 		     (find-file-noselect file-or-buffer-name))
 		    ))
-    
+
     (if (not (viper-buffer-live-p buf))
 	(error "Didn't find buffer %S or file %S"
 	       file-or-buffer-name
 	       (viper-abbreviate-file-name
 		(expand-file-name file-or-buffer-name))))
-	  
+
     (if (equal buf (current-buffer))
 	(or no-recursion
 	    ;; try again
 	    (progn
 	      (setq skip-rest t)
 	      (ex-next-related-buffer direction 'norecursion))))
-	
+
     (if skip-rest
 	()
       ;; setup buffer
 	  ()
 	(setq wind (get-lru-window (if viper-xemacs-p nil 'visible)))
 	(set-window-buffer wind buf))
-	    
+
       (if (viper-window-display-p)
 	  (progn
 	    (raise-frame (window-frame wind))
 		(save-window-excursion (select-window wind) (sit-for 1))
 	      (select-window wind)))
 	(save-window-excursion (select-window wind) (sit-for 1)))
-	
+
       (save-excursion
 	(set-buffer buf)
 	(setq viper-related-files-and-buffers-ring old-ring))
-      
+
       (setq viper-local-search-start-marker (point-marker))
       )))
-  
-    
+
+
 ;; Force auto save
 (defun ex-preserve ()
   (message "Autosaving all buffers that need to be saved...")
 (defun ex-quit ()
   ;; skip "!", if it is q!.  In Viper q!, w!, etc., behave as q, w, etc.
   (save-excursion
-    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
     (set-buffer viper-ex-work-buf)
     (if (looking-at "!") (forward-char 1)))
   (if (< viper-expert-level 3)
 	  (setq ex-file buffer-file-name)))
     (if ex-cmdfile
 	(progn
-	  (setq command 
+	  (setq command
 		;; replace # and % with the previous/current file
 		(ex-expand-filsyms (concat ex-file ex-cmdfile-args)
 				   (current-buffer)))
 	  (shell-command command t))
       (insert-file-contents ex-file)))
   (ex-fixup-history viper-last-ex-prompt ex-file ex-cmdfile-args))
-  
+
 ;; this function fixes ex-history for some commands like ex-read, ex-edit
-(defun ex-fixup-history (&rest args)  
+(defun ex-fixup-history (&rest args)
   (setq viper-ex-history
 	(cons (mapconcat 'identity args " ") (cdr viper-ex-history))))
-  
+
 
 ;; Ex recover from emacs \#file\#
 (defun ex-recover ()
 	  (viper-set-unread-command-events ?\C-m)))
     (message ":set  <Variable> [= <Value>]")
     (or batch (sit-for 2))
-    
+
     (while (string-match "^[ \\t\\n]*$"
 			 (setq str
 			       (completing-read ":set " ex-variable-alist)))
 	  (or (viper-set-unread-command-events "") (sit-for 2))
 	  (setq val (read-string (format ":set %s = " var)))
 	  (ex-fixup-history "set" orig-var val)
-	  
+
 	  ;; check numerical values
 	  (if (member var
 		      '("sw" "shiftwidth"
 			"ts" "tabstop"
 			"ts-g" "tabstop-global"
-			"wm" "wrapmargin")) 
+			"wm" "wrapmargin"))
 	      (condition-case nil
 		  (or (numberp (setq val2 (car (read-from-string val))))
 		      (error "%s: Invalid value, numberp, %S" var val))
 		(error
 		 (error "%s: Invalid value, numberp, %S" var val))))
-		  
+
 	  (cond
 	   ((member var '("sw" "shiftwidth"))
 	    (setq var "viper-shift-width"))
 		  set-cmd "setq-default"))
 	   ((member var '("wm" "wrapmargin"))
 	    ;; make it take effect in curr buff and new bufs
-	    (kill-local-variable 'fill-column) 
-	    (setq var "fill-column" 
+	    (kill-local-variable 'fill-column)
+	    (setq var "fill-column"
 		  val (format "(- (window-width) %s)" val)
 		  set-cmd "setq-default"))
 	   ((member var '("sh" "shell"))
 	    (setq var "explicit-shell-file-name"
 		  val (format "\"%s\"" val)))))
       (ex-fixup-history "set" orig-var))
-    
+
     (if set-cmd
 	(setq actual-lisp-cmd
 	      (format "\n(%s %s %s) %s" set-cmd var val auto-cmd-label)
 	      lisp-cmd-del-pattern
 	      (format "^\n?[ \t]*([ \t]*%s[ \t]+%s[ \t].*)[ \t]*%s"
 		      set-cmd var auto-cmd-label)))
-    
+
     (if (and ask-if-save
 	     (y-or-n-p (format "Do you want to save this setting in %s "
 			       viper-custom-file-name)))
 	(progn
-	  (viper-save-string-in-file 
+	  (viper-save-string-in-file
 	   actual-lisp-cmd viper-custom-file-name
 	   ;; del pattern
 	   lisp-cmd-del-pattern)
 		 lisp-cmd-del-pattern)
 		))
 	  ))
-    
+
     (if set-cmd
 	(message "%s %s %s"
 		 set-cmd var
 ;; special meaning
 (defun ex-get-inline-cmd-args (regex-forw &optional chars-back replace-str)
   (save-excursion
-    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+    (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
     (set-buffer viper-ex-work-buf)
     (goto-char (point-min))
     (re-search-forward regex-forw nil t)
 ;; Ex shell command
 (defun ex-shell ()
   (shell))
-  
+
 ;; Viper help.  Invokes Info
 (defun ex-help ()
   (condition-case nil
 
 ;; Ex substitute command
 ;; If REPEAT use previous regexp which is ex-reg-exp or viper-s-string
-(defun ex-substitute (&optional repeat r-flag) 
+(defun ex-substitute (&optional repeat r-flag)
   (let ((opt-g nil)
 	(opt-c nil)
 	(matched-pos nil)
 (defun ex-tag ()
   (let (tag)
     (save-window-excursion
-      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
       (set-buffer viper-ex-work-buf)
       (skip-chars-forward " \t")
       (set-mark (point))
 
 ;; Ex write command
 ;; ex-write doesn't support wildcards, because file completion is a better
-;; mechanism. We also don't support # and % 
+;; mechanism. We also don't support # and %
 ;; because file history is a better mechanism.
 (defun ex-write (q-flag)
   (viper-default-ex-addresses t)
   (viper-get-ex-file)
   (let ((end (car ex-addresses))
-	(beg (car (cdr ex-addresses))) 
+	(beg (car (cdr ex-addresses)))
 	(orig-buf (current-buffer))
 	;;(orig-buf-file-name (buffer-file-name))
 	;;(orig-buf-name (buffer-name))
     (if ex-cmdfile
 	(progn
 	  (viper-enlarge-region beg end)
-	  (shell-command-on-region (point) (mark t) 
+	  (shell-command-on-region (point) (mark t)
 				   (concat ex-file ex-cmdfile-args)))
       (if (and (string= ex-file "") (not (buffer-file-name)))
 	  (setq ex-file
 		(read-file-name
 		 (format "Buffer %s isn't visiting any file.  File to save in: "
 			 (buffer-name)))))
-      
+
       (setq writing-whole-file (and (= (point-min) beg) (= (point-max) end))
 	    ex-file (if (string= ex-file "")
 			(buffer-file-name)
 	  (setq ex-file
 		(concat (file-name-as-directory ex-file)
 			(file-name-nondirectory buffer-file-name))))
-      
+
       (setq file-exists (file-exists-p ex-file)
 	    writing-same-file (string= ex-file (buffer-file-name)))
 
 		       (format "File %s exists.  Overwrite? " ex-file))))
 	    (error "Quit"))
 	;; writing a region or whole buffer to non-visited file
-	(unwind-protect 
+	(unwind-protect
 	    (save-excursion
 	      (viper-enlarge-region beg end)
 	      (setq region (buffer-substring (point) (mark t)))
       (if (and (buffer-file-name) writing-same-file)
 	  (set-visited-file-modtime))
       ;; prevent loss of data if saving part of the buffer in visited file
-      (or writing-whole-file 
+      (or writing-whole-file
 	  (not writing-same-file)
 	  (progn
 	    (sit-for 2)
 	      (save-buffers-kill-emacs)
 	    (kill-buffer (current-buffer))))
       )))
-	  
+
 
 (defun ex-write-info (exists file-name beg end)
   (message "`%s'%s %d lines, %d characters"
 (defun ex-command ()
   (let (command)
     (save-window-excursion
-      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
       (set-buffer viper-ex-work-buf)
       (skip-chars-forward " \t")
       (setq command (buffer-substring (point) (point-max)))
   (with-output-to-temp-buffer " *viper-info*"
     (princ (if viper-auto-indent
 	       "autoindent (local)\n" "noautoindent (local)\n"))
-    (princ (if (default-value 'viper-auto-indent) 
+    (princ (if (default-value 'viper-auto-indent)
 	       "autoindent (global) \n" "noautoindent (global) \n"))
     (princ (if viper-case-fold-search "ignorecase\n" "noignorecase\n"))
     (princ (if viper-re-search "magic\n" "nomagic\n"))

File viper-init.el

 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. 
+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

File viper-keym.el

 
 (defvar viper-toggle-key "\C-z"
   "The key used to change states from emacs to Vi and back.
-In insert mode, this key also functions as Meta. 
+In insert mode, this key also functions as Meta.
 Must be set in .viper file or prior to loading Viper.
 This setting cannot be changed interactively.")
 
-(defvar viper-ESC-key "\e" 
-  "Key used to ESC. 
+(defvar viper-ESC-key "\e"
+  "Key used to ESC.
 Must be set in .viper file or prior to loading Viper.
 This setting cannot be changed interactively.")
-  
-;;; Emacs keys in other states.  
+
+;;; Emacs keys in other states.
 
 (defcustom viper-want-emacs-keys-in-insert t
   "*Set to nil if you want complete Vi compatibility in insert mode.
 Setting viper-no-multiple-ESC to nil will allow as many multiple ESC,
 as is allowed by the major mode in effect."
   :type 'boolean
-  :group 'viper) 
+  :group 'viper)
 
 (defcustom viper-want-ctl-h-help nil
   "*If non-nil, C-h gets bound to help-command; otherwise, C-h gets the usual Vi bindings."
 ;; keymap used to zap all keymaps other than function-key-map,
 ;; device-function-key-map, etc.
 (defvar viper-overriding-map (make-sparse-keymap))
-  
+
 (viper-deflocalvar viper-vi-local-user-map (make-sparse-keymap)
   "Keymap for user-defined local bindings.
 Useful for changing bindings such as ZZ in certain major modes.
 For instance, in letter-mode, one may want to bind ZZ to
 mh-send-letter.  In a newsreader such as gnus, tin, or rn, ZZ could be bound
 to save-buffers-kill-emacs then post article, etc.")
-(put 'viper-vi-local-user-map 'permanent-local t)	
+(put 'viper-vi-local-user-map 'permanent-local t)
 
 (defvar viper-vi-global-user-map (make-sparse-keymap)
   "Keymap for user-defined global bindings.
 (defvar viper-vi-diehard-map (make-sparse-keymap)
   "This keymap is in use when the user asks Viper to simulate Vi very closely.
 This happens when viper-expert-level is 1 or 2.  See viper-set-expert-level.")
-  
+
 
 (viper-deflocalvar viper-insert-local-user-map (make-sparse-keymap)
   "Auxiliary map for per-buffer user-defined keybindings in Insert state.")
-(put 'viper-insert-local-user-map 'permanent-local t)	
+(put 'viper-insert-local-user-map 'permanent-local t)
 
 (defvar viper-insert-global-user-map (make-sparse-keymap)
   "Auxiliary map for global user-defined bindings in Insert state.")
 
 (defvar viper-replace-map (make-sparse-keymap)
   "Map used in Viper's replace state.")
-  
+
 (defvar viper-emacs-global-user-map (make-sparse-keymap)
   "Auxiliary map for global user-defined bindings in Emacs state.")
 
 (defvar  viper-emacs-kbd-map  (make-sparse-keymap)
   "This keymap keeps Vi-style kbd macros for emacs mode.")
-  
+
 (viper-deflocalvar viper-emacs-local-user-map  (make-sparse-keymap)
   "Auxiliary map for local user-defined bindings in Emacs state.")
-(put 'viper-emacs-local-user-map 'permanent-local t)  
+(put 'viper-emacs-local-user-map 'permanent-local t)
 
 ;; This keymap should stay empty
 (defvar viper-empty-keymap (make-sparse-keymap))
 
 ;;; Variables used by minor modes
 
-;; Association list of the form 
+;; Association list of the form
 ;; ((major-mode . keymap) (major-mode . keymap) ...)
 ;; Viper uses these keymaps to make user-requested adjustments
 ;; to its Vi state in various major modes.")
 (defvar viper-vi-state-modifier-alist nil)
 
-;; Association list of the form 
+;; Association list of the form
 ;; ((major-mode . keymap) (major-mode . keymap) ...)
 ;; Viper uses these keymaps to make user-requested adjustments
 ;; to its Insert state in various major modes.")
 (defvar viper-insert-state-modifier-alist nil)
 
-;; Association list of the form 
+;; Association list of the form
 ;; ((major-mode . keymap) (major-mode . keymap) ...)
 ;; Viper uses these keymaps to make user-requested adjustments
 ;; to its Emacs state in various major modes.
 (define-key viper-insert-basic-map "\C-d" 'viper-backward-indent)
 (define-key viper-insert-basic-map "\C-w" 'viper-delete-backward-word)
 (define-key viper-insert-basic-map "\C-t" 'viper-forward-indent)
-(define-key viper-insert-basic-map 
+(define-key viper-insert-basic-map
   (if viper-xemacs-p [(shift tab)] [S-tab]) 'viper-insert-tab)
 (define-key viper-insert-basic-map "\C-v" 'quoted-insert)
 (define-key viper-insert-basic-map "\C-?" 'viper-del-backward-char-in-insert)
 
 
 ;;; Minibuffer keymap
-  
+
 
 (defvar viper-minibuffer-map (make-sparse-keymap)
   "Keymap used to modify keys when Minibuffer is in Insert state.")
-  
+
 (define-key viper-minibuffer-map "\C-m" 'viper-exit-minibuffer)
 (define-key viper-minibuffer-map "\C-j" 'viper-exit-minibuffer)
 
 on a per buffer basis.
 Usage:
       (viper-add-local-keys state '((key-str . func) (key-str . func)...))   "
-      
+
   (let (map)
     (cond ((eq state 'vi-state)
 	   (if viper-need-new-vi-local-map
 	       (setq viper-emacs-local-user-map (make-sparse-keymap)))
 	   (setq viper-need-new-emacs-local-map nil
 		 map viper-emacs-local-user-map))
-	  (t 
+	  (t
 	   (error
 	    "Invalid state in viper-add-local-keys: %S.  Valid states: vi-state, insert-state or emacs-state" state)))
 
 	viper-emacs-local-user-map (make-sparse-keymap)
 	viper-need-new-emacs-local-map nil)
   (viper-normalize-minor-mode-map-alist))
-    
+
 
 (defun viper-modify-major-mode (mode state keymap)
   "Modify key bindings in a major-mode in a Viper state using a keymap.
     (if (setq elt (assoc mode (eval alist)))
 	(set alist (delq elt (eval alist))))
     (set alist (cons (cons mode keymap) (eval alist)))
-    
+
     ;; Normalization usually doesn't help here, since one needs to
     ;; normalize in the actual buffer where changes to the keymap are
     ;; to take place.  However, it doesn't hurt, and it helps whenever this
     ;; function is actually called from within the affected buffer.
     (viper-normalize-minor-mode-map-alist)
-    
+
     (viper-set-mode-vars-for viper-current-state)))
 
-    
+
 ;; Displays variables that control Viper's keymaps
 (defun viper-debug-keymaps ()
   (interactive)
     (princ (format "viper-insert-global-user-minor-mode:  %S\n"
 		   viper-insert-global-user-minor-mode))
     (princ (format "viper-insert-kbd-minor-mode:  %S\n"
-		   viper-insert-kbd-minor-mode)) 
+		   viper-insert-kbd-minor-mode))
     (princ (format "viper-insert-state-modifier-minor-mode:  %S\n"
 		   viper-insert-state-modifier-minor-mode))
     (princ (format "viper-insert-diehard-minor-mode:  %S\n"
 		   viper-emacs-global-user-minor-mode))
     (princ (format "viper-emacs-state-modifier-minor-mode:  %S\n"
 		   viper-emacs-state-modifier-minor-mode))
-    
+
     (princ (format "\nviper-expert-level  %S\n" viper-expert-level))
     (princ (format "viper-no-multiple-ESC  %S\n" viper-no-multiple-ESC))
     (princ (format "viper-always  %S\n" viper-always))
     (princ (format "viper-ex-style-editing  %S\n"
 		   viper-ex-style-editing))
     (princ (format "viper-want-emacs-keys-in-vi  %S\n"
-		   viper-want-emacs-keys-in-vi)) 
+		   viper-want-emacs-keys-in-vi))
     (princ (format "viper-want-emacs-keys-in-insert  %S\n"
-		   viper-want-emacs-keys-in-insert)) 
+		   viper-want-emacs-keys-in-insert))
     (princ (format "viper-want-ctl-h-help  %S\n" viper-want-ctl-h-help))
-    
+
     (princ "\n\n\n")
     (princ (format "Default value for minor-mode-map-alist:  \n%S\n\n"
 		   (default-value 'minor-mode-map-alist)))
     (princ (format "Actual value for minor-mode-map-alist:  \n%S\n"
 		   minor-mode-map-alist))
     ))
-   
+
 
 ;;; Keymap utils
-	     
-(defun viper-add-keymap (mapsrc mapdst) 
+
+(defun viper-add-keymap (mapsrc mapdst)
   "Add contents of mapsrc to mapdst.  It is assumed that mapsrc is sparse."
   (viper-cond-compile-for-xemacs-or-emacs
    ;; xemacs
    (mapcar (lambda (p) (define-key mapdst (vector (car p)) (cdr p)))
 	   (cdr mapsrc))
    ))
-  
+
 (defun viper-modify-keymap (map alist)
    "Modifies MAP with bindings specified in the ALIST.  The alist has the
 form ((key . function) (key . function) ... )."
-   (mapcar (lambda (p) (define-key map (eval (car p)) (cdr p))) 
+   (mapcar (lambda (p) (define-key map (eval (car p)) (cdr p)))
 	   alist))
 
 

File viper-macs.el

 ;; Register holding last macro.
 (defvar viper-last-macro-reg nil)
 
-;; format of the elements of kbd alists: 
+;; format of the elements of kbd alists:
 ;; (name ((buf . macr)...(buf . macr)) ((maj-mode . macr)...) (t . macr))
 ;; kbd macro alist for Vi state
 (defvar viper-vi-kbd-macro-alist nil)
 	       (viper-display-macro macro-name)
 	       (if ins "Insert" "Vi")))
     ))
-    
+
 
 ;; Ex unmap
 (defun ex-unmap ()
 			      (viper-display-macro temp)))
     (viper-unrecord-kbd-macro macro-name (if ins 'insert-state 'vi-state))
     ))
-    
+
 
 ;; read arguments for ex-map
 (defun ex-map-read-args (variant)
 	(key-seq [])
 	temp key event message
 	macro-name macro-body args)
-	
+
     (condition-case nil
 	(setq args (concat (ex-get-inline-cmd-args ".*map[!]*[ \t]?" "\n\C-m")
 			   " nil nil ")
 	      macro-body (car (read-from-string args (cdr temp))))
       (error
        (signal
-	'error 
+	'error
 	'("map: Macro name and body must be a quoted string or a vector"))))
-    
+
     ;; We expect macro-name to be a vector, a string, or a quoted string.
     ;; In the second case, it will emerge as a symbol when read from
     ;; the above read-from-string.  So we need to convert it into a string
     (if macro-name
         (cond ((vectorp macro-name) nil)
-	      ((stringp macro-name) 
+	      ((stringp macro-name)
 	       (setq macro-name (vconcat macro-name)))
 	      (t (setq macro-name (vconcat (prin1-to-string macro-name)))))
       (message ":map%s <Name>" variant)(sit-for 2)
 		(viper-event-key event)))
 	)
       (setq macro-name key-seq))
-    
+
     (if (= (length macro-name) 0)
 	(error "Can't map an empty macro name"))
     (setq macro-name (viper-fixup-macro macro-name))
     (if (viper-char-array-p macro-name)
 	(setq macro-name (viper-char-array-to-macro macro-name)))
-    
+
     (if macro-body
 	(cond ((viper-char-array-p macro-body)
 	       (setq macro-body (viper-char-array-to-macro macro-body)))
 	      (t (error "map: Invalid syntax in macro definition"))))
     (setq cursor-in-echo-area nil)(sit-for 0) ; this overcomes xemacs tty bug
     (cons macro-name macro-body)))
-    
+
 
 
 ;; read arguments for ex-unmap
 	event message
 	key key-seq macro-name)
     (setq macro-name (ex-get-inline-cmd-args ".*unma?p?[!]*[ \t]*"))
-	  
+
     (if (> (length macro-name) 0)
 	()
       (message ":unmap%s <Name>" variant) (sit-for 2)
 	       (setq key-seq (subseq key-seq 0 (- (length key-seq) 2))))
 	      ((member key '(tab (control i) ?\t))
 	       (setq key-seq (subseq key-seq 0 (1- (length key-seq))))
-	       (setq message 
+	       (setq message
 		     (format
 		      ":unmap%s %s"
 		      variant (if (> (length key-seq) 0)
 	       (setq key-seq
 		     (viper-do-sequence-completion key-seq macro-alist message))
 	       ))
-	(setq message 
+	(setq message
 	      (format
 	       ":unmap%s %s"
 	       variant (if (> (length key-seq) 0)
 
     (if (= (length macro-name) 0)
 	(error "Can't unmap an empty macro name"))
-				  
+
     ;; convert macro names into vector, if starts with a `['
     (if (memq (elt macro-name 0) '(?\[ ?\"))
 	(car (read-from-string macro-name))
       (vconcat macro-name))
     ))
-    
-    
+
+
 ;; Terminate a Vi kbd macro.
 ;; optional argument IGNORE, if t, indicates that we are dealing with an
 ;; existing macro that needs to be registered, but there is no need to
 	  ;; always go back to Vi, since this is where we started
 	  ;; defining macro
 	  (viper-change-state-to-vi)))
-    
+
     (viper-record-kbd-macro macro-name
 			  (if ins 'insert-state 'vi-state)
 			  (viper-display-macro macro-body))
-    
+
     (ex-fixup-history (format "map%s %S %S" mod-char
 			      (viper-display-macro macro-name)
 			      (viper-display-macro macro-body)))
 Optional SCOPE says whether the macro should be global \(t\), mode-specific
 \(a major-mode symbol\), or buffer-specific \(buffer name, a string\).
 If SCOPE is nil, the user is asked to specify the scope."
-  (let* (state-name keymap 
+  (let* (state-name keymap
 	 (macro-alist-var
 	  (cond ((eq state 'vi-state)
 		 (setq state-name "Vi state"
 		 ))
 	 new-elt old-elt old-sub-elt msg
 	 temp lis lis2)
-	 
+
     (if (= (length macro-name) 0)
 	(error "Can't map an empty macro name"))
-	
+
     ;; Macro-name is usually a vector.  However, command history or macros
     ;; recorded in ~/.viper may be recorded as strings.  So, convert to
-    ;; vectors. 
+    ;; vectors.
     (setq macro-name (viper-fixup-macro macro-name))
     (if (viper-char-array-p macro-name)
 	(setq macro-name (viper-char-array-to-macro macro-name)))
     (setq macro-body (viper-fixup-macro macro-body))
     (if (viper-char-array-p macro-body)
 	(setq macro-body (viper-char-array-to-macro macro-body)))
-	
+
     ;; don't ask if scope is given and is of the right type
     (or (eq scope t)
 	(stringp scope)
 	  (if (y-or-n-p
 	       (format "Save this macro in %s? "
 		       (viper-abbreviate-file-name viper-custom-file-name)))
-	      (viper-save-string-in-file 
+	      (viper-save-string-in-file
 	       (format "\n(viper-record-kbd-macro %S '%S %s '%S)"
 		       (viper-display-macro macro-name)
 		       state
 		       (if (vectorp macro-body)
 			   (format "%S" macro-body)
 			 macro-body)
-		       scope) 
+		       scope)
 	       viper-custom-file-name))
-	  
+
 	  (message msg)
 	  ))
-	
+
     (setq new-elt
 	  (cons macro-name
 		(cond ((eq scope t) (list nil nil (cons t nil)))
 				     (viper-array-to-string macro-name)))
 	      (setq lis2 (cons (car lis) lis2))
 	      (setq lis (cdr lis)))
-	    
+
 	    (setq lis2 (reverse lis2))
 	    (set macro-alist-var (append lis2 (cons new-elt lis)))
 	    (setq old-elt new-elt)))
 	  (cond ((eq scope t) (viper-kbd-global-pair old-elt))
 		((symbolp scope) (assoc scope (viper-kbd-mode-alist old-elt)))
 		((stringp scope) (assoc scope (viper-kbd-buf-alist old-elt)))))
-    (if old-sub-elt 
+    (if old-sub-elt
 	(setcdr old-sub-elt macro-body)
       (cond ((symbolp scope) (setcar (cdr (cdr old-elt))
 				     (cons (cons scope macro-body)
 				     (cons (cons scope macro-body)
 					   (viper-kbd-buf-alist old-elt))))))
     ))
-  
 
-    
+
+
 ;; macro name must be a vector of viper-style keys
 (defun viper-unrecord-kbd-macro (macro-name state)
   "Delete macro MACRO-NAME from Viper STATE.
 macros supplied with Viper.  The best way to avoid mistakes in macro names to
 be passed to this function is to use viper-describe-kbd-macros and copy the
 name from there."
-  (let* (state-name keymap 
+  (let* (state-name keymap
 	 (macro-alist-var
 	  (cond ((eq state 'vi-state)
 		 (setq state-name "Vi state"
 		))
 	 buf-mapping mode-mapping global-mapping
 	 macro-pair macro-entry)
-	 	
+
     ;; Macro-name is usually a vector.  However, command history or macros
     ;; recorded in ~/.viper may appear as strings.  So, convert to vectors.
     (setq macro-name (viper-fixup-macro macro-name))
 	(error "%S is not mapped to a macro for %s in `%s'"
 	       (viper-display-macro macro-name)
 	       state-name (buffer-name)))
-	
+
     (setq buf-mapping (viper-kbd-buf-pair macro-entry)
 	  mode-mapping (viper-kbd-mode-pair macro-entry)
 	  global-mapping (viper-kbd-global-pair macro-entry))
-	
+
     (cond ((and (cdr buf-mapping)
 		(or (and (not (cdr mode-mapping)) (not (cdr global-mapping)))
 		    (y-or-n-p
 			     (viper-display-macro macro-name)
 			     (buffer-name)))))
 	   (setq macro-pair buf-mapping)
-	   (message "%S is unmapped for %s in `%s'" 
+	   (message "%S is unmapped for %s in `%s'"
 		    (viper-display-macro macro-name)
 		    state-name (buffer-name)))
 	  ((and (cdr mode-mapping)
 	(cdr global-mapping)
 	(progn
 	  (set macro-alist-var (delq macro-entry (eval macro-alist-var)))
-	  (if (viper-can-release-key (aref macro-name 0) 
+	  (if (viper-can-release-key (aref macro-name 0)
 				   (eval macro-alist-var))
 	      (define-key
 		keymap
 		nil))
 	  ))
     ))
-    
+
 ;; Check if MACRO-ALIST has an entry for a macro name starting with
 ;; CHAR.  If not, this indicates that the binding for this char
 ;; in viper-vi/insert-kbd-map can be released.
   (let ((lis macro-alist)
 	(can-release t)
 	macro-name)
-    
+
     (while (and lis can-release)
       (setq macro-name (car (car lis)))
       (if (eq char (aref macro-name 0))
 	next-best-match keyseq event-seq
 	macro-first-char macro-alist-elt macro-body
 	command)
-    
+
     (setq macro-first-char last-command-event
 	  event-seq (viper-read-fast-keysequence macro-first-char macro-alist)
 	  keyseq (viper-events-to-macro event-seq)
 	  macro-alist-elt (assoc keyseq macro-alist)
 	  next-best-match (viper-find-best-matching-macro macro-alist keyseq))
-	  
+
     (if (null macro-alist-elt)
 	(setq macro-alist-elt (car next-best-match)
 	      unmatched-suffix (subseq event-seq (cdr next-best-match))))
 	  ((setq macro-body (viper-kbd-buf-definition macro-alist-elt)))
 	  ((setq macro-body (viper-kbd-mode-definition macro-alist-elt)))
 	  ((setq macro-body (viper-kbd-global-definition macro-alist-elt))))
-				 
+
     ;; when defining keyboard macro, don't use the macro mappings
     (if (and macro-body (not defining-kbd-macro))
 	;; block cmd executed as part of a macro from entering command history
       ;; some other command (setting prefix arg can happen if we do, say,
       ;; 2dw and there is a macro starting with 2.  Then control will go to
       ;; this routine
-      (or prefix-arg (setq  prefix-arg count)) 
+      (or prefix-arg (setq  prefix-arg count))
       (setq command (key-binding (read-key-sequence nil)))
       (if (commandp command)
 	  (command-execute command)
 
 
 ;;; Displaying and completing macros
-    
+
 (defun viper-describe-kbd-macros ()
   "Show currently defined keyboard macros."
   (interactive)
     (princ "\n\nMacros in Emacs state:\n======================\n")
     (mapcar 'viper-describe-one-macro viper-emacs-kbd-macro-alist)
     ))
-    
+
 (defun viper-describe-one-macro (macro)
   (princ (format "\n  *** Mappings for %S:\n      ------------\n"
 		 (viper-display-macro (car macro))))
       (princ (format "\n           %S" (cdr (viper-kbd-global-pair macro))))
     (princ "  none"))
   (princ "\n"))
-  
+
 (defun viper-describe-one-macro-elt (elt)
   (let ((name (car elt))
 	(defn (cdr elt)))
     (princ (format "\n       * %S:\n           %S\n" name defn))))
-    
-    
-    
+
+
+
 ;; check if SEQ is a prefix of some car of an element in ALIST
 (defun viper-keyseq-is-a-possible-macro (seq alist)
   (let ((converted-seq (viper-events-to-macro seq)))
-    (eval (cons 'or 
+    (eval (cons 'or
 		(mapcar
 		 (lambda (elt) (viper-prefix-subseq-p converted-seq elt))
 		 (viper-this-buffer-macros alist))))))
-		 
+
 ;; whether SEQ1 is a prefix of SEQ2
 (defun viper-prefix-subseq-p (seq1 seq2)
   (let ((len1 (length seq1))
 	(len2 (length seq2)))
     (if (<= len1 len2)
 	(equal seq1 (subseq seq2 0 len1)))))
-	
+
 ;; find the longest common prefix
 (defun viper-common-seq-prefix (&rest seqs)
   (let* ((first (car seqs))
 	(setq len 0)
       (setq len (apply 'min (mapcar 'length seqs))))
     (while (< idx len)
-      (if (eval (cons 'and 
+      (if (eval (cons 'and
 		      (mapcar (lambda (s) (equal (elt first idx) (elt s idx)))
 			      rest)))
 	  (setq pref (vconcat pref (vector (elt first idx)))))
       (setq idx (1+ idx)))
     pref))
-    
+
 ;; get all sequences that match PREFIX from a given A-LIST
 (defun viper-extract-matching-alist-members (pref alist)
   (delq nil (mapcar (lambda (elt) (if (viper-prefix-subseq-p pref elt) elt))
 		    (viper-this-buffer-macros alist))))
-		    
+
 (defun viper-do-sequence-completion (seq alist compl-message)
   (let* ((matches (viper-extract-matching-alist-members seq alist))
 	 (new-seq (apply 'viper-common-seq-prefix matches))
     (cond ((and (equal seq new-seq) (= (length matches) 1))
 	   (message "%s (Sole completion)" compl-message)
 	   (sit-for 2))
-	  ((null matches) 
+	  ((null matches)
 	   (message "%s (No match)" compl-message)
 	   (sit-for 2)
 	   (setq new-seq seq))
-	  ((member seq matches) 
+	  ((member seq matches)
 	   (message "%s (Complete, but not unique)" compl-message)
 	   (sit-for 2)
 	   (viper-display-vector-completions matches))
 	  ((equal seq new-seq)
 	   (viper-display-vector-completions matches)))
     new-seq))
-	
-	 
+
+
 (defun viper-display-vector-completions (list)
   (with-output-to-temp-buffer "*Completions*"
-    (display-completion-list 
+    (display-completion-list
      (mapcar 'prin1-to-string
 	     (mapcar 'viper-display-macro list)))))
-  
-				  
-    
+
+
+
 ;; alist is the alist of macros
 ;; str is the fast key sequence entered
 ;; returns: (matching-macro-def . unmatched-suffix-start-index)
 	      (setq found t))
 	)
       (setq lis (cdr lis)))
-    
+
     (if found
 	(setq match macro-def
 	      unmatched-start-idx def-len)
       (setq match nil
 	    unmatched-start-idx 0))
-    
+
     (cons match unmatched-start-idx)))
-  
-    
-    
+
+
+
 ;; returns a list of names of macros defined for the current buffer
 (defun viper-this-buffer-macros (macro-alist)
   (let (candidates)
 			(car elt)))
 		  macro-alist))
     (setq candidates (delq nil candidates))))
-    
-  
+
+
 ;; if seq of Viper key symbols (representing a macro) can be converted to a
 ;; string--do so.  Otherwise, do nothing.
 (defun viper-display-macro (macro-name-or-body)
 	((viper-char-array-p macro-name-or-body)
 	 (mapconcat 'char-to-string macro-name-or-body ""))
 	(t macro-name-or-body)))
-    
+
 ;; convert sequence of events (that came presumably from emacs kbd macro) into
 ;; Viper's macro, which is a vector of the form
 ;; [ desc desc ... ]
 					       nil
 					     (viper-event-key elt)))
 			     event-seq))))
-  
+
 ;; convert strings or arrays of characters to Viper macro form
 (defun viper-char-array-to-macro (array)
   (let ((vec (vconcat array))
 	(setq macro (mapcar 'character-to-event vec))
       (setq macro vec))
     (vconcat (mapcar 'viper-event-key macro))))
-    
+
 ;; For macros bodies and names, goes over MACRO and checks if all members are
 ;; names of keys (actually, it only checks if they are symbols or lists
 ;; if a digit is found, it is converted into a symbol (e.g., 0 -> \0, etc).
 		((symbolp elt) nil)
 		(t (setq break t)))
 	  (setq idx (1+ idx))))
-      
+
       (if break
 	  (error "Wrong type macro component, symbol-or-listp, %S" elt)
 	macro)))
-  
+
 (defun viper-macro-to-events (macro-body)
   (vconcat (mapcar 'viper-key-to-emacs-key macro-body)))
-	    
-	       
+
+
 
 ;;; Reading fast key sequences
-    
+
 ;; Assuming that CHAR was the first character in a fast succession of key
 ;; strokes, read the rest.  Return the vector of keys that was entered in
 ;; this fast succession of key strokes.
 		 (viper-set-register-macro reg))
 	     (execute-kbd-macro (get-register reg) count)))
 	  ((or (= ?@ reg) (= ?\^j reg) (= ?\^m reg))
-	   (if viper-last-macro-reg 
+	   (if viper-last-macro-reg
 	       nil
 	       (error "No previous kbd macro"))
 	   (execute-kbd-macro (get-register viper-last-macro-reg) count))
 	       (viper-set-register-macro reg))))
 	  (t
 	   (error "`%c': Unknown register" reg)))))
-	   
+
 
 (defun viper-global-execute ()
   "Call last keyboad macro for each line in the region."

File viper-mous.el

 
 
 ;;; Variables
-  
+
 ;; Variable used for catching the switch-frame event.
 ;; If non-nil, indicates that previous-frame should be the selected
 ;; one.  Used by viper-mouse-click-get-word.  Not a user option.
 (defvar viper-frame-of-focus nil)
-    
+
 ;; Frame that was selected before the switch-frame event.
 (defconst viper-current-frame-saved (selected-frame))
-  
+
 (defcustom viper-surrounding-word-function 'viper-surrounding-word
   "*Function that determines what constitutes a word for clicking events.
-Takes two parameters: a COUNT, indicating how many words to return, 
+Takes two parameters: a COUNT, indicating how many words to return,
 and CLICK-COUNT, telling whether this is the first click, a double-click,
 or a tripple-click."
   :type 'symbol
   :group 'viper-mouse)
-       
+
 ;; time interval in millisecond within which successive clicks are
 ;; considered related
 (defcustom viper-multiclick-timeout (if (viper-window-display-p)
 
 ;; Local variable used to toggle wraparound search on click.
 (viper-deflocalvar  viper-mouse-click-search-noerror t)
-	
+
 ;; Local variable used to delimit search after wraparound.
 (viper-deflocalvar  viper-mouse-click-search-limit nil)
-	
+
 ;; remembers prefix argument to pass along to commands invoked by second
 ;; click.
 ;; This is needed because in Emacs (not XEmacs), assigning to preix-arg
    (event-point click) ; xemacs
    (posn-point (event-start click)) ; emacs
    ))
-	     
+
 
 (defun viper-surrounding-word (count click-count)
    "Returns word surrounding point according to a heuristic.
 	   (setq beg (point))
 	   (end-of-line)
 	   (setq result (buffer-substring beg (point))))
-       
+
        (if (and (not (viper-looking-at-alphasep))
 		(or (save-excursion (viper-backward-char-carefully)
 				    (viper-looking-at-alpha))
 			       (t (char-to-string (following-char))))
 			 )
 		 ))
-       
+
        ;; Add `-' to alphanum, if it wasn't added and if we are in Lisp
        (or (looking-at "-")
 	   (not (string-match "lisp" (symbol-name major-mode)))
 	   (setq modifiers (concat modifiers "C-C-")))
-       
-       
+
+
        (save-excursion
 	 (cond ((> click-count 1) (viper-skip-nonseparators 'backward))
 	       ((viper-looking-at-alpha modifiers)
 		    (viper-skip-alpha-backward modifiers))))
 
 	 (setq word-beg (point))
-	 
+
 	 (setq skip-flag nil) ; don't move 1 char forw the first time
 	 (while (> count 0)
 	   (if skip-flag (viper-forward-char-carefully 1))
 Click may be in another window.  Current window and buffer isn't changed.
 On single or double click, returns the word as determined by
 `viper-surrounding-word-function'."
-     
+
   (let ((click-word "")
 	(click-pos (viper-mouse-click-posn click))
 	(click-buf (viper-mouse-click-window-buffer click)))
     (or (natnump count) (setq count 1))
     (or (natnump click-count) (setq click-count 1))
-     
+
     (save-excursion
       (save-window-excursion
 	(if click-pos
 	    (progn
 	      (set-buffer click-buf)
-	
+
 	      (goto-char click-pos)
 	      (setq click-word
 		    (funcall viper-surrounding-word-function count click-count)))
 	  ((and (listp arg) (integerp (car arg)))
 	   (setq arg (car arg)))
 	  (t (setq arg 1)))
-    
+
     (if (not (eq (key-binding viper-mouse-down-insert-key-parsed)
 		 'viper-mouse-catch-frame-switch))
 	() ; do nothing
 		   (not (viper-mouse-event-p interrupting-event)))
 	      (viper-set-unread-command-events interrupting-event))
 	  )))))
-  
+
 ;; Arg is an event.  Accepts symbols and numbers, too
 (defun viper-mouse-event-p (event)
   (if (eventp event)
       (string-match "\\(mouse-\\|frame\\|screen\\|track\\)"
 		    (prin1-to-string (viper-event-key event)))))
-  
+
 ;; XEmacs has no double-click events.  So, we must simulate.
 ;; So, we have to simulate event-click-count.
 (defun viper-event-click-count (click)
    (viper-event-click-count-xemacs click) ; xemacs
    (event-click-count click) ; emacs
    ))
-    
+
 ;; kind of semaphore for updating viper-current-click-count
 (defvar viper-counting-clicks-p nil)
 (viper-cond-compile-for-xemacs-or-emacs
      ))
   nil ; emacs
  )
-    
+
 
 (defun viper-mouse-click-search-word (click arg)
    "Find the word clicked or double-clicked on.  Word may be in another window.
       () ; do nothing, if binding isn't right or not over text
     (let ((previous-search-string viper-s-string)
 	  click-word click-count)
-    
+
       (if (and
 	   (viper-multiclick-p)
 	   ;; This trick checks if there is a pending mouse event if so, we use
 	;; uninterrupted wait
 	(setq click-count (viper-event-click-count click))
 	(setq click-word (viper-mouse-click-get-word click nil click-count))
-	
+
 	(if (> click-count 1)
 	    (setq arg viper-global-prefix-argument
 		  viper-global-prefix-argument nil))
 	(setq arg (or arg 1))
-	
+
 	(viper-deactivate-mark)
 	(if (or (not (string= click-word viper-s-string))
 		(not (markerp viper-search-start-marker))
 		     viper-local-search-start-marker viper-search-start-marker
 		     viper-mouse-click-search-noerror t
 		     viper-mouse-click-search-limit nil)
-	      
+
 	      ;; make search string known to Viper
 	      (setq viper-s-string (if viper-re-search
 				       (regexp-quote click-word)
 		  (setq viper-search-history
 			(cons viper-s-string viper-search-history)))
 	      ))
-	
+
 	(push-mark nil t)
 	(while (> arg 0)
 	  (viper-forward-word 1)
 				   (marker-buffer viper-local-search-start-marker))
 				  (goto-char viper-local-search-start-marker))
 			      (viper-line-pos 'end)))
-		      
+
 		      (goto-char (point-min))
 		      (search-forward click-word
 				      viper-mouse-click-search-limit nil)))
 		      click-word (buffer-name (current-buffer)))
 		     (setq arg 1) ;; to terminate the loop
 		     (sit-for 2))
-		   (setq  viper-mouse-click-search-noerror t) 
+		   (setq  viper-mouse-click-search-noerror t)
 		   (setq  viper-mouse-click-search-limit nil)
 		   (if (and (markerp viper-local-search-start-marker)
 			    (marker-buffer viper-local-search-start-marker))
 		       (goto-char viper-local-search-start-marker))))
 	  (setq arg (1- arg)))
 	))))
-  
+
 (defun viper-mouse-catch-frame-switch (event arg)
   "Catch the event of switching frame.
 Usually is bound to a `down-mouse' event to work properly.  See sample
       (setq viper-frame-of-focus viper-current-frame-saved))
   ;; make Emacs forget that it executed viper-mouse-catch-frame-switch
   (setq this-command last-command))
-      
+
 ;; Called just before switching frames.  Saves the old selected frame.
 ;; Sets last-command to handle-switch-frame (this is done automatically in
-;; Emacs. 
+;; Emacs.
 ;; The semantics of switching frames is different in Emacs and XEmacs.
 ;; In Emacs, if you select-frame A while mouse is over frame B and then
 ;; start typing, input goes to frame B, which becomes selected.
   (cond ((or (null viper-mouse-up-search-key-parsed)
 	     (null viper-mouse-down-search-key-parsed))
 	 nil) ; just quit
-	((and (null force) 
+	((and (null force)
 	      (key-binding viper-mouse-up-search-key-parsed)
 	      (not (eq (key-binding viper-mouse-up-search-key-parsed)
 		       'viper-mouse-click-search-word)))
-	 (message 
+	 (message
 	  "%S already bound to a mouse event.  Viper mouse-search feature disabled"
 	  viper-mouse-up-search-key-parsed))
-	((and (null force) 
+	((and (null force)
 	      (key-binding viper-mouse-down-search-key-parsed)
 	      (not (eq (key-binding viper-mouse-down-search-key-parsed)
 		       'viper-mouse-catch-frame-switch)))
 	 (message
 	  "%S already bound to a mouse event.  Viper mouse-search feature disabled"
 	  viper-mouse-down-search-key-parsed))
-	(t 
+	(t
 	 (global-set-key viper-mouse-up-search-key-parsed
 			 'viper-mouse-click-search-word)
 	 (global-set-key viper-mouse-down-search-key-parsed
 	      (key-binding viper-mouse-up-insert-key-parsed)
 	      (not (eq (key-binding viper-mouse-up-insert-key-parsed)
 		       'viper-mouse-click-insert-word)))
-	 (message 
+	 (message
 	  "%S already bound to a mouse event.  Viper mouse-insert feature disabled"
 	  viper-mouse-up-insert-key-parsed))
 	((and (null force)
 	 (message
 	  "%S already bound to a mouse event.  Viper mouse-insert feature disabled"
 	  viper-mouse-down-insert-key-parsed))
-	(t 
+	(t
 	 (global-set-key viper-mouse-up-insert-key-parsed
 			 'viper-mouse-click-insert-word)
 	 (global-set-key viper-mouse-down-insert-key-parsed
 	       (integer :tag "Button"))
   :set 'viper-reset-mouse-insert-key
   :group 'viper-mouse)
-	   
+
 
 
 ;;; Local Variables:

File viper-util.el

    (eq (device-class (selected-device)) 'color) ; xemacs
    (x-display-color-p)  ; emacs
    ))
-   
+
 (defsubst viper-get-cursor-color ()
   (viper-cond-compile-for-xemacs-or-emacs
    ;; xemacs
    (color-instance-name (frame-property (selected-frame) 'cursor-color))
    (cdr (assoc 'cursor-color (frame-parameters))) ; emacs
    ))
-  
+
 
 ;; OS/2
 (cond ((eq (viper-device-type) 'pm)
        (fset 'viper-color-defined-p
 	     (lambda (color) (assoc color pm-color-alist)))))
-    
+
 
 ;; cursor colors
 (defun viper-change-cursor-color (new-color)
 	(selected-frame) (list (cons 'cursor-color new-color)))
        )
     ))
-	 
+
 ;; By default, saves current frame cursor color in the
 ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay
 (defun viper-save-cursor-color (before-which-mode)
 		 'viper-saved-cursor-color-in-insert-mode)
 	       color)))
 	  ))))
-	
+
 
 (defsubst viper-get-saved-cursor-color-in-replace-mode ()
   (or
     (selected-frame)
     'viper-saved-cursor-color-in-insert-mode)
    viper-vi-state-cursor-color))
-	 
+
 ;; restore cursor color from replace overlay
 (defun viper-restore-cursor-color(after-which-mode)
   (if (viper-overlay-p viper-replace-overlay)
 	   (viper-get-saved-cursor-color-in-replace-mode)
 	 (viper-get-saved-cursor-color-in-insert-mode))
        )))
-   
+
 
 ;; Check the current version against the major and minor version numbers
 ;; using op: cur-vers op major.minor If emacs-major-version or
 		  (error "%S: Invalid op in viper-check-version" op))))
     (cond ((memq op '(= > >=)) nil)
 	  ((memq op '(< <=)) t))))
-	  
+
 
 (defun viper-get-visible-buffer-window (wind)
   (if viper-xemacs-p
       (get-buffer-window wind t)
     (get-buffer-window wind 'visible)))
-    
-    
+
+
 ;; Return line position.
 ;; If pos is 'start then returns position of line start.
 ;; If pos is 'end, returns line end.  If pos is 'mid, returns line center.
 ;; Like move-marker but creates a virgin marker if arg isn't already a marker.
 ;; The first argument must eval to a variable name.
 ;; Arguments: (var-name position &optional buffer).
-;; 
+;;
 ;; This is useful for moving markers that are supposed to be local.
 ;; For this, VAR-NAME should be made buffer-local with nil as a default.
 ;; Then, each time this var is used in `viper-move-marker-locally' in a new
 
 
 ;;; List/alist utilities
-	
+
 ;; Convert LIST to an alist
 (defun viper-list-to-alist (lst)
   (let ((alist))
     (while lst
       (setq alist (cons (list (car lst)) alist))
       (setq lst (cdr lst)))
-    alist))	
+    alist))
 
 ;; Convert ALIST to a list.
 (defun viper-alist-to-list (alst)
       (if (string-match regexp (car (car inalst)))
 	  (setq outalst (cons (car inalst) outalst)))
       (setq inalst (cdr inalst)))
-    outalst))    
-       
+    outalst))
+
 ;; Filter LIST using REGEXP.  Return list whose elements match the regexp.
 (defun viper-filter-list (regexp lst)
   (interactive "s x")
       (if (string-match regexp (car inlst))
 	  (setq outlst (cons (car inlst) outlst)))
       (setq inlst (cdr inlst)))
-    outlst))    
+    outlst))
 
-   
+
 ;; Append LIS2 to LIS1, both alists, by side-effect and returns LIS1
 ;; LIS2 is modified by filtering it: deleting its members of the form
 ;; \(car elt\) such that (car elt') is in LIS1.
       (while (setq elt (assoc (car (car temp)) lis2))
 	(setq lis2 (delq elt lis2)))
       (setq temp (cdr temp)))
-    
+
     (nconc lis1 lis2)))
 
 
 	(command (cond (viper-ms-style-os-p (format "\"ls -1 -d %s\"" filespec))
 		       (t (format "ls -1 -d %s" filespec))))
 	status)
-    (save-excursion 
+    (save-excursion
       (set-buffer (get-buffer-create viper-ex-tmp-buf-name))
       (erase-buffer)
       (setq status
 		((looking-at "'")
 		 (setq delim ?')
 		 (re-search-forward "[^']+" nil t)) ; noerror
-		(t 
+		(t
 		 (re-search-forward
 		  (concat "[^" skip-chars "]+") nil t))) ;noerror
 	  (setq fname
 (defun viper-glob-mswindows-files (filespec)
   (let ((case-fold-search t)
 	tmp tmp2)
-    (save-excursion 
+    (save-excursion
       (set-buffer (get-buffer-create viper-ex-tmp-buf-name))
       (erase-buffer)
       (insert filespec)
       (goto-char (point-min))
       (setq tmp (viper-get-filenames-from-buffer))
       (while tmp
-	(setq tmp2 (cons (directory-files 
+	(setq tmp2 (cons (directory-files
 			  ;; the directory part
 			  (or (file-name-directory (car tmp))
 			      "")
 			   (t (car ring))))
 	(viper-current-ring-item ring)
 	)))
-	
+
 (defun viper-special-ring-rotate1 (ring dir)
   (if (memq viper-intermediate-command
 	    '(repeating-display-destructive-command
       (viper-ring-rotate1 ring dir)
     ;; don't rotate otherwise
     (viper-ring-rotate1 ring 0)))
-    
+
 ;; current ring item; if N is given, then so many items back from the
 ;; current
 (defun viper-current-ring-item (ring &optional n)
   (setq n (or n 0))
   (if (and (ring-p ring) (> (ring-length ring) 0))
       (aref (cdr (cdr ring)) (mod (- (car ring) 1 n) (ring-length ring)))))
-    
+
 ;; Push item onto ring.  The second argument is a ring-variable, not value.
 (defun viper-push-onto-ring (item ring-var)
   (or (ring-p (eval ring-var))
 			 (viper-array-to-string (this-command-keys))))
       (viper-ring-insert (eval ring-var) item))
   )
-  
+
 
 ;; removing elts from ring seems to break it
 (defun viper-cleanup-ring (ring)
       (if (equal (viper-current-ring-item ring)
 		 (viper-current-ring-item ring 1))
 	  (viper-ring-pop ring))))
-	  
+
 ;; ring-remove seems to be buggy, so we concocted this for our purposes.
 (defun viper-ring-pop (ring)
   (let* ((ln (ring-length ring))
 	 (hd (car ring))
 	 (idx (max 0 (ring-minus1 hd ln)))
 	 (top-elt (aref vec idx)))
-	
+
 	;; shift elements
 	(while (< (1+ idx) veclen)
 	  (aset vec idx (aref vec (1+ idx)))
 	  (setq idx (1+ idx)))
 	(aset vec idx nil)
-	
+
 	(setq hd (max 0 (ring-minus1 hd ln)))
 	(if (= hd (1- ln)) (setq hd 0))
 	(setcar ring hd) ; move head
 	(setcar (cdr ring) (max 0 (1- ln))) ; adjust length
 	top-elt
 	))
-	
+
 (defun viper-ring-insert (ring item)
   (let* ((ln (ring-length ring))
 	 (vec (cdr (cdr ring)))
 	 (hd (car ring))
 	 (vecpos-after-hd (if (= hd 0) ln hd))
 	 (idx ln))
-	 
+
     (if (= ln veclen)
 	(progn
 	  (aset vec hd item) ; hd is always 1+ the actual head index in vec
 	(setq idx (1- idx)))
       (aset vec vecpos-after-hd item))