aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer1996-02-16 04:49:12 +0000
committerMichael Kifer1996-02-16 04:49:12 +0000
commitc992e21143c30f9355a5a8b1fa58cb577f6ae810 (patch)
tree33183a0ca2e3866854446e9fadcb602f9ee8ac2b /lisp/emulation
parent39f002d2de20bcd51bd6b802d8563e9985a33a82 (diff)
downloademacs-c992e21143c30f9355a5a8b1fa58cb577f6ae810.tar.gz
emacs-c992e21143c30f9355a5a8b1fa58cb577f6ae810.zip
*** empty log message ***
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-ex.el58
-rw-r--r--lisp/emulation/viper-macs.el7
-rw-r--r--lisp/emulation/viper.el3
3 files changed, 46 insertions, 22 deletions
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index 32dff786efe..9e396cc5d6e 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -489,7 +489,7 @@ reversed.")
489 )) 489 ))
490 )) 490 ))
491 ((eq ex-token-type 'non-command) 491 ((eq ex-token-type 'non-command)
492 (error "`%s': %s" ex-token vip-BadExCommand)) 492 (error (format "`%s': %s" ex-token vip-BadExCommand)))
493 ((eq ex-token-type 'whole) 493 ((eq ex-token-type 'whole)
494 (setq address nil) 494 (setq address nil)
495 (setq ex-addresses 495 (setq ex-addresses
@@ -839,9 +839,23 @@ reversed.")
839 (setq vip-keep-reading-filename t) 839 (setq vip-keep-reading-filename t)
840 ;; don't exit if directory---ex-commands don't 840 ;; don't exit if directory---ex-commands don't
841 (cond ((ex-cmd-accepts-multiple-files-p ex-token) (exit-minibuffer)) 841 (cond ((ex-cmd-accepts-multiple-files-p ex-token) (exit-minibuffer))
842 (t (minibuffer-complete-word)))) 842 ;; apparently the argument to an Ex command is
843 843 ;; supposed to be a shell command
844 844 ((vip-looking-back "^[ \t]*!.*")
845 (setq ex-cmdfile t)
846 (insert " "))
847 (t
848 (setq ex-cmdfile nil)
849 (minibuffer-complete-word))))
850
851(defun vip-handle-! ()
852 (interactive)
853 (if (and (string=
854 (buffer-string) (vip-abbreviate-file-name default-directory))
855 (member ex-token '("read" "write")))
856 (erase-buffer))
857 (insert "!"))
858
845(defun ex-cmd-accepts-multiple-files-p (token) 859(defun ex-cmd-accepts-multiple-files-p (token)
846 (member token '("edit" "next" "Next"))) 860 (member token '("edit" "next" "Next")))
847 861
@@ -853,7 +867,10 @@ reversed.")
853 (copy-keymap minibuffer-local-completion-map)) 867 (copy-keymap minibuffer-local-completion-map))
854 beg end cont val) 868 beg end cont val)
855 869
856 (vip-add-keymap ex-read-filename-map minibuffer-local-completion-map) 870 (vip-add-keymap ex-read-filename-map
871 (if vip-emacs-p
872 minibuffer-local-completion-map
873 read-file-name-map))
857 874
858 (setq cont (setq vip-keep-reading-filename t)) 875 (setq cont (setq vip-keep-reading-filename t))
859 (while cont 876 (while cont
@@ -944,19 +961,22 @@ reversed.")
944 (string= ex-token "change") 961 (string= ex-token "change")
945 (string= ex-token "insert") 962 (string= ex-token "insert")
946 (string= ex-token "open")) 963 (string= ex-token "open"))
947 (error "`%s': Obsolete command, not supported by Viper" 964 (error
948 ex-token)) 965 (format "`%s': Obsolete command, not supported by Viper"
966 ex-token)))
949 ((or (string= ex-token "abbreviate") 967 ((or (string= ex-token "abbreviate")
950 (string= ex-token "unabbreviate")) 968 (string= ex-token "unabbreviate"))
951 (error 969 (error
970 (format
952 "`%s': Vi-style abbrevs are obsolete. Use the more powerful Emacs abbrevs" 971 "`%s': Vi-style abbrevs are obsolete. Use the more powerful Emacs abbrevs"
953 ex-token)) 972 ex-token)))
954 ((or (string= ex-token "list") 973 ((or (string= ex-token "list")
955 (string= ex-token "print") 974 (string= ex-token "print")
956 (string= ex-token "z") 975 (string= ex-token "z")
957 (string= ex-token "#")) 976 (string= ex-token "#"))
958 (error "`%s': Command not implemented in Viper" ex-token)) 977 (error
959 (t (error "`%s': %s" ex-token vip-BadExCommand)))) 978 (format "`%s': Command not implemented in Viper" ex-token)))
979 (t (error (format "`%s': %s" ex-token vip-BadExCommand)))))
960 980
961(defun vip-undisplayed-files () 981(defun vip-undisplayed-files ()
962 (mapcar 982 (mapcar
@@ -1081,7 +1101,7 @@ reversed.")
1081 (if (not file) 1101 (if (not file)
1082 (vip-get-ex-file)) 1102 (vip-get-ex-file))
1083 (cond ((and (string= ex-file "") buffer-file-name) 1103 (cond ((and (string= ex-file "") buffer-file-name)
1084 (setq ex-file (abbreviate-file-name (buffer-file-name)))) 1104 (setq ex-file (vip-abbreviate-file-name (buffer-file-name))))
1085 ((string= ex-file "") 1105 ((string= ex-file "")
1086 (error vip-NoFileSpecified))) 1106 (error vip-NoFileSpecified)))
1087 1107
@@ -1361,7 +1381,8 @@ reversed.")
1361 (if (not (vip-buffer-live-p buf)) 1381 (if (not (vip-buffer-live-p buf))
1362 (error "Didn't find buffer %S or file %S" 1382 (error "Didn't find buffer %S or file %S"
1363 file-or-buffer-name 1383 file-or-buffer-name
1364 (abbreviate-file-name (expand-file-name file-or-buffer-name)))) 1384 (vip-abbreviate-file-name
1385 (expand-file-name file-or-buffer-name))))
1365 1386
1366 (if (equal buf (current-buffer)) 1387 (if (equal buf (current-buffer))
1367 (or no-recursion 1388 (or no-recursion
@@ -1425,7 +1446,8 @@ reversed.")
1425;; Ex read command 1446;; Ex read command
1426(defun ex-read () 1447(defun ex-read ()
1427 (vip-get-ex-file) 1448 (vip-get-ex-file)
1428 (let ((point (if (null ex-addresses) (point) (car ex-addresses)))) 1449 (let ((point (if (null ex-addresses) (point) (car ex-addresses)))
1450 command)
1429 (goto-char point) 1451 (goto-char point)
1430 (vip-add-newline-at-eob-if-necessary) 1452 (vip-add-newline-at-eob-if-necessary)
1431 (if (not (or (bobp) (eobp))) (forward-line 1)) 1453 (if (not (or (bobp) (eobp))) (forward-line 1))
@@ -1435,7 +1457,9 @@ reversed.")
1435 (error vip-NoFileSpecified)) 1457 (error vip-NoFileSpecified))
1436 (setq ex-file buffer-file-name))) 1458 (setq ex-file buffer-file-name)))
1437 (if ex-cmdfile 1459 (if ex-cmdfile
1438 (shell-command ex-file t) 1460 (progn
1461 (setq command (ex-expand-filsyms ex-file (current-buffer)))
1462 (shell-command command t))
1439 (insert-file-contents ex-file))) 1463 (insert-file-contents ex-file)))
1440 (ex-fixup-history vip-last-ex-prompt ex-file)) 1464 (ex-fixup-history vip-last-ex-prompt ex-file))
1441 1465
@@ -1675,7 +1699,7 @@ reversed.")
1675 (condition-case nil 1699 (condition-case nil
1676 (progn 1700 (progn
1677 (pop-to-buffer (get-buffer-create "*info*")) 1701 (pop-to-buffer (get-buffer-create "*info*"))
1678 (info "viper.info") 1702 (info (if vip-xemacs-p "viper.info" "viper"))
1679 (message "Type `i' to search for a specific topic")) 1703 (message "Type `i' to search for a specific topic"))
1680 (error (beep 1) 1704 (error (beep 1)
1681 (with-output-to-temp-buffer " *vip-info*" 1705 (with-output-to-temp-buffer " *vip-info*"
@@ -1875,7 +1899,7 @@ Please contact your system administrator. "
1875 1899
1876(defun ex-write-info (exists file-name beg end) 1900(defun ex-write-info (exists file-name beg end)
1877 (message "`%s'%s %d lines, %d characters" 1901 (message "`%s'%s %d lines, %d characters"
1878 (abbreviate-file-name file-name) 1902 (vip-abbreviate-file-name file-name)
1879 (if exists "" " [New file]") 1903 (if exists "" " [New file]")
1880 (count-lines beg (min (1+ end) (point-max))) 1904 (count-lines beg (min (1+ end) (point-max)))
1881 (- end beg))) 1905 (- end beg)))
@@ -1947,7 +1971,7 @@ Please contact your system administrator. "
1947 lines file info) 1971 lines file info)
1948 (setq lines (count-lines (point-min) (vip-line-pos 'end)) 1972 (setq lines (count-lines (point-min) (vip-line-pos 'end))
1949 file (if (buffer-file-name) 1973 file (if (buffer-file-name)
1950 (concat (abbreviate-file-name (buffer-file-name)) ":") 1974 (concat (vip-abbreviate-file-name (buffer-file-name)) ":")
1951 (concat (buffer-name) " [Not visiting any file]:")) 1975 (concat (buffer-name) " [Not visiting any file]:"))
1952 info (format "line=%d/%d pos=%d/%d col=%d %s" 1976 info (format "line=%d/%d pos=%d/%d col=%d %s"
1953 (if (= pos1 pos2) 1977 (if (= pos1 pos2)
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index f1a78d39578..1ef27a3389a 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -391,8 +391,9 @@ If SCOPE is nil, the user is asked to specify the scope."
391 (if (stringp macro-body) " ....\"" " ....]")) 391 (if (stringp macro-body) " ....\"" " ....]"))
392 state-name)) 392 state-name))
393 t))) 393 t)))
394 (if (y-or-n-p (format "Save this macro in %s? " 394 (if (y-or-n-p
395 (abbreviate-file-name vip-custom-file-name))) 395 (format "Save this macro in %s? "
396 (vip-abbreviate-file-name vip-custom-file-name)))
396 (vip-save-string-in-file 397 (vip-save-string-in-file
397 (format "\n(vip-record-kbd-macro %S '%S %s '%S)" 398 (format "\n(vip-record-kbd-macro %S '%S %s '%S)"
398 (vip-display-macro macro-name) 399 (vip-display-macro macro-name)
@@ -903,7 +904,7 @@ there."
903 (setq vip-last-macro-reg reg) 904 (setq vip-last-macro-reg reg)
904 (vip-set-register-macro reg)))) 905 (vip-set-register-macro reg))))
905 (t 906 (t
906 (error "`%c': Unknown register" reg))))) 907 (error (format "`%c': Unknown register" reg))))))
907 908
908 909
909(defun vip-global-execute () 910(defun vip-global-execute ()
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 34702cc331f..bc59c077213 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -4839,8 +4839,7 @@ One can use `` and '' to temporarily jump 1 step back."
4839 ((vip-valid-register reg '(letter)) 4839 ((vip-valid-register reg '(letter))
4840 (let* ((val (get-register (1+ (- reg ?a)))) 4840 (let* ((val (get-register (1+ (- reg ?a))))
4841 (buf (if (not val) 4841 (buf (if (not val)
4842 (error 4842 (error vip-EmptyTextmarker reg)
4843 (format vip-EmptyTextmarker reg))
4844 (marker-buffer val))) 4843 (marker-buffer val)))
4845 (pos (marker-position val)) 4844 (pos (marker-position val))
4846 line-no text (s pos) (e pos)) 4845 line-no text (s pos) (e pos))