))
))
((eq ex-token-type 'non-command)
- (error (format "`%s': %s" ex-token vip-BadExCommand)))
+ (error "`%s': %s" ex-token vip-BadExCommand))
((eq ex-token-type 'whole)
(setq address nil)
(setq ex-addresses
(string= ex-token "change")
(string= ex-token "insert")
(string= ex-token "open"))
- (error
- (format "`%s': Obsolete command, not supported by Viper"
- ex-token)))
+ (error "`%s': Obsolete command, not supported by Viper" ex-token))
((or (string= ex-token "abbreviate")
(string= ex-token "unabbreviate"))
(error
- (format
- "`%s': Vi-style abbrevs are obsolete. Use the more powerful Emacs abbrevs"
- ex-token)))
+ "`%s': Vi abbrevs are obsolete. Use the more powerful Emacs abbrevs"
+ ex-token))
((or (string= ex-token "list")
(string= ex-token "print")
(string= ex-token "z")
(string= ex-token "#"))
- (error
- (format "`%s': Command not implemented in Viper" ex-token)))
- (t (error (format "`%s': %s" ex-token vip-BadExCommand)))))
+ (error "`%s': Command not implemented in Viper" ex-token))
+ (t (error "`%s': %s" ex-token vip-BadExCommand))))
(defun vip-undisplayed-files ()
(mapcar
val "nil")))
(if (eq val 0) ; value must be set by the user
(let ((cursor-in-echo-area t))
- (message (format ":set %s = <Value>" var))
+ (message ":set %s = <Value>" var)
;; if there are unread events, don't wait
(or (vip-set-unread-command-events "") (sit-for 2))
(setq val (read-string (format ":set %s = " var)))
))
))
- (message (format "%s %s %s" set-cmd var (if (string-match "^[ \t]*$" val)
- (format "%S" val)
- val)))
+ (message "%s %s %s" set-cmd var (if (string-match "^[ \t]*$" val)
+ (format "%S" val)
+ val))
(eval (car (read-from-string actual-lisp-cmd)))
(if (string= var "fill-column")
(if (> val2 0)
(provide 'viper-ex)
-;;; viper-ex.el ends here
+;;; viper-ex.el ends here
\ No newline at end of file
;; Keymap for reading file names in Ex-style commands.
(defvar ex-read-filename-map (make-sparse-keymap))
(define-key ex-read-filename-map " " 'vip-complete-filename-or-exit)
+(define-key ex-read-filename-map "!" 'vip-handle-!)
'(?\b ?\d '^? '^H (control h) (control \?) backspace delete))
(setq key-seq (subseq key-seq 0 (- (length key-seq) 2))))
(setq message
- (format ":map%s %s"
- variant (if (> (length key-seq) 0)
- (prin1-to-string (vip-display-macro key-seq))
- "")))
+ ":map%s %s"
+ variant (if (> (length key-seq) 0)
+ (prin1-to-string (vip-display-macro key-seq))
+ ""))
(message message)
(setq event (vip-read-key))
;;(setq event (vip-read-event))
((member key '(tab (control i) ?\t))
(setq key-seq (subseq key-seq 0 (1- (length key-seq))))
(setq message
- (format ":unmap%s %s"
- variant (if (> (length key-seq) 0)
- (prin1-to-string
- (vip-display-macro key-seq))
- "")))
+ ":unmap%s %s"
+ variant (if (> (length key-seq) 0)
+ (prin1-to-string
+ (vip-display-macro key-seq))
+ ""))
(setq key-seq
(vip-do-sequence-completion key-seq macro-alist message))
))
(setq message
- (format ":unmap%s %s"
- variant (if (> (length key-seq) 0)
- (prin1-to-string
- (vip-display-macro key-seq))
- "")))
+ ":unmap%s %s"
+ variant (if (> (length key-seq) 0)
+ (prin1-to-string
+ (vip-display-macro key-seq))
+ ""))
(message message)
(setq event (vip-read-key))
;;(setq event (vip-read-event))
(princ " none\n"))
(princ "\n ** Global:")
(if (vip-kbd-global-definition macro)
- (princ
- (format "\n %S"
- (cdr (vip-kbd-global-pair macro))))
+ (princ (format "\n %S" (cdr (vip-kbd-global-pair macro))))
(princ " none"))
(princ "\n"))
(setq vip-last-macro-reg reg)
(vip-set-register-macro reg))))
(t
- (error (format "`%c': Unknown register" reg))))))
+ (error "`%c': Unknown register" reg)))))
(defun vip-global-execute ()
window-system
(device-type (selected-device))))
;; in XEmacs: device-type is tty on tty and stream in batch.
-(defsubst vip-window-display-p ()
+(defun vip-window-display-p ()
(and (vip-device-type) (not (memq (vip-device-type) '(tty stream)))))
+(defvar vip-force-faces nil
+ "If t, Viper will think that it is running on a display that supports faces.
+This is provided as a temporary relief for users of face-capable displays
+that Viper doesn't know about.")
+
+(defun vip-has-face-support-p ()
+ (cond ((vip-window-display-p))
+ (vip-force-faces)
+ (vip-emacs-p (memq (vip-device-type) '(pc)))
+ (vip-xemacs-p (memq (vip-device-type) '(tty pc)))))
+
\f
;;; Macros
(fset 'vip-move-overlay (symbol-function 'set-extent-endpoints))
(if (vip-window-display-p)
(fset 'vip-iconify (symbol-function 'iconify-frame)))
- (cond ((vip-window-display-p)
+ (cond ((vip-has-face-support-p)
(fset 'vip-get-face (symbol-function 'get-face))
(fset 'vip-color-defined-p
(symbol-function 'valid-color-name-p))
(fset 'vip-move-overlay (symbol-function 'move-overlay))
(if (vip-window-display-p)
(fset 'vip-iconify (symbol-function 'iconify-or-deiconify-frame)))
- (cond ((vip-window-display-p)
+ (cond ((vip-has-face-support-p)
(fset 'vip-get-face (symbol-function 'internal-get-face))
(fset 'vip-color-defined-p (symbol-function 'x-color-defined-p))
)))
))
(defun vip-hide-face (face)
- (if (and (vip-window-display-p) vip-emacs-p)
+ (if (and (vip-has-face-support-p) vip-emacs-p)
(add-to-list 'facemenu-unlisted-faces face)))
;; cursor colors
(match-beginning 0) (match-end 0) (current-buffer))))
(vip-overlay-put vip-search-overlay 'priority vip-search-overlay-priority)
- (if (vip-window-display-p)
+ (if (vip-has-face-support-p)
(progn
(vip-overlay-put vip-search-overlay 'face vip-search-face)
(sit-for 2)
(setq vip-replace-overlay (vip-make-overlay beg end (current-buffer)))
(vip-overlay-put
vip-replace-overlay 'priority vip-replace-overlay-priority))
- (if (vip-window-display-p)
+ (if (vip-has-face-support-p)
(vip-overlay-put vip-replace-overlay 'face vip-replace-overlay-face))
(vip-save-cursor-color)
(vip-change-cursor-color vip-replace-overlay-cursor-color)
(defsubst vip-hide-replace-overlay ()
(vip-set-replace-overlay-glyphs nil nil)
(vip-restore-cursor-color)
- (if (vip-window-display-p)
+ (if (vip-has-face-support-p)
(vip-overlay-put vip-replace-overlay 'face nil)))
(defsubst vip-set-replace-overlay-glyphs (before-glyph after-glyph)
- (if (or (not (vip-window-display-p))
+ (if (or (not (vip-has-face-support-p))
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)))
(defun vip-set-minibuffer-overlay ()
(vip-check-minibuffer-overlay)
- (if (vip-window-display-p)
+ (if (vip-has-face-support-p)
(progn
(vip-overlay-put
vip-minibuffer-overlay 'face vip-minibuffer-current-face)
\f
;;; XEmacs compatibility
+
+(defun vip-abbreviate-file-name (file)
+ (if vip-emacs-p
+ (abbreviate-file-name file)
+ ;; XEmacs requires addl argument
+ (abbreviate-file-name file t)))
;; Sit for VAL milliseconds. XEmacs doesn't support the millisecond arg
;; in sit-for, so this function smoothes out the differences.
(text-marker (get-register reg)))
(if com (vip-move-marker-locally 'vip-com-point (point)))
(if (not (vip-valid-marker text-marker))
- (error (format vip-EmptyTextmarker char)))
+ (error vip-EmptyTextmarker char))
(if (and (vip-same-line (point) vip-last-jump)
(= (point) vip-last-jump-ignore))
(push-mark vip-last-jump t)