Mercurial > emacs
comparison lisp/emulation/vip.el @ 3591:507f64624555
Apply typo patches from Paul Eggert.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 09 Jun 1993 11:59:12 +0000 |
parents | 093c4dc7e884 |
children | f14639c69ed3 |
comparison
equal
deleted
inserted
replaced
3590:d5f22061277d | 3591:507f64624555 |
---|---|
65 (defvar vip-use-register nil | 65 (defvar vip-use-register nil |
66 "name of register to store deleted or yanked strings.") | 66 "name of register to store deleted or yanked strings.") |
67 | 67 |
68 (defvar vip-d-com nil | 68 (defvar vip-d-com nil |
69 "If non-nil, it's value is a list (M-COM VAL COM), and is used to | 69 "If non-nil, it's value is a list (M-COM VAL COM), and is used to |
70 re-execute last destrcutive command") | 70 re-execute last destructive command") |
71 | 71 |
72 (defconst vip-shift-width 8 | 72 (defconst vip-shift-width 8 |
73 "*The number of colums shifted by > and < command.") | 73 "*The number of colums shifted by > and < command.") |
74 | 74 |
75 (defconst vip-re-replace nil | 75 (defconst vip-re-replace nil |
76 "*If t then do regexp replace, if nil then do string replace.") | 76 "*If t then do regexp replace, if nil then do string replace.") |
77 | 77 |
78 (defvar vip-d-char nil | 78 (defvar vip-d-char nil |
79 "The character remenbered by the vi \"r\" command") | 79 "The character remembered by the vi \"r\" command") |
80 | 80 |
81 (defvar vip-f-char nil | 81 (defvar vip-f-char nil |
82 "for use by \";\" command") | 82 "for use by \";\" command") |
83 | 83 |
84 (defvar vip-F-char nil | 84 (defvar vip-F-char nil |
320 "Emulate C-h key in Emacs mode." | 320 "Emulate C-h key in Emacs mode." |
321 (interactive "P") | 321 (interactive "P") |
322 (vip-escape-to-emacs arg '(?\C-h))) | 322 (vip-escape-to-emacs arg '(?\C-h))) |
323 | 323 |
324 | 324 |
325 ;; prefix argmument for vi mode | 325 ;; prefix argument for vi mode |
326 | 326 |
327 ;; In vi mode, prefix argument is a dotted pair (NUM . COM) where NUM | 327 ;; In vi mode, prefix argument is a dotted pair (NUM . COM) where NUM |
328 ;; represents the numeric value of the prefix argument and COM represents | 328 ;; represents the numeric value of the prefix argument and COM represents |
329 ;; command prefix such as "c", "d", "m" and "y". | 329 ;; command prefix such as "c", "d", "m" and "y". |
330 | 330 |
357 (if (or (= char ?#) (= char ?\")) (error "")) | 357 (if (or (= char ?#) (= char ?\")) (error "")) |
358 (setq com (cons char com)) | 358 (setq com (cons char com)) |
359 (setq cont nil)) | 359 (setq cont nil)) |
360 ;; if com is nil we set com as char, and read more. again, if char | 360 ;; if com is nil we set com as char, and read more. again, if char |
361 ;; is ", we read the name of register and store it in vip-use-register. | 361 ;; is ", we read the name of register and store it in vip-use-register. |
362 ;; if char is !, =, or #, a copmlete com is formed so we exit while. | 362 ;; if char is !, =, or #, a complete com is formed so we exit while. |
363 (cond ((or (= char ?!) (= char ?=)) | 363 (cond ((or (= char ?!) (= char ?=)) |
364 (setq com char) | 364 (setq com char) |
365 (setq char (read-char)) | 365 (setq char (read-char)) |
366 (setq cont nil)) | 366 (setq cont nil)) |
367 ((= char ?#) | 367 ((= char ?#) |
420 (let (val com) | 420 (let (val com) |
421 (setq val (vip-P-val arg) | 421 (setq val (vip-P-val arg) |
422 com (vip-getcom arg)) | 422 com (vip-getcom arg)) |
423 (if (null val) | 423 (if (null val) |
424 (if (null com) | 424 (if (null com) |
425 (message "Value is nil, and commmand is nil.") | 425 (message "Value is nil, and command is nil.") |
426 (message "Value is nil, and command is %c." com)) | 426 (message "Value is nil, and command is %c." com)) |
427 (if (null com) | 427 (if (null com) |
428 (message "Value is %d, and command is nil." val) | 428 (message "Value is %d, and command is nil." val) |
429 (message "Value is %d, and command is %c." val com))))) | 429 (message "Value is %d, and command is %c." val com))))) |
430 | 430 |
624 (setq vip-d-com (list m-com val (if (or (= com ?c) (= com ?C) (= com ?!)) | 624 (setq vip-d-com (list m-com val (if (or (= com ?c) (= com ?C) (= com ?!)) |
625 (- com) com) | 625 (- com) com) |
626 reg)))) | 626 reg)))) |
627 | 627 |
628 (defun vip-repeat (arg) | 628 (defun vip-repeat (arg) |
629 "(ARG) Re-excute last destructive command. vip-d-com has the form | 629 "(ARG) Re-execute last destructive command. vip-d-com has the form |
630 (COM ARG CH REG), where COM is the command to be re-executed, ARG is the | 630 (COM ARG CH REG), where COM is the command to be re-executed, ARG is the |
631 argument for COM, CH is a flag for repeat, and REG is optional and if exists | 631 argument for COM, CH is a flag for repeat, and REG is optional and if exists |
632 is the name of the register for COM." | 632 is the name of the register for COM." |
633 (interactive "P") | 633 (interactive "P") |
634 (if (eq last-command 'vip-undo) | 634 (if (eq last-command 'vip-undo) |
1126 (forward-line (1- val))) | 1126 (forward-line (1- val))) |
1127 (back-to-indentation) | 1127 (back-to-indentation) |
1128 (if com (vip-execute-com 'vip-goto-line val com)))) | 1128 (if com (vip-execute-com 'vip-goto-line val com)))) |
1129 | 1129 |
1130 (defun vip-find-char (arg char forward offset) | 1130 (defun vip-find-char (arg char forward offset) |
1131 "Find ARG's occurence of CHAR on the current line. If FORWARD then | 1131 "Find ARG's occurrence of CHAR on the current line. If FORWARD then |
1132 search is forward, otherwise backward. OFFSET is used to adjust point | 1132 search is forward, otherwise backward. OFFSET is used to adjust point |
1133 after search." | 1133 after search." |
1134 (let ((arg (if forward arg (- arg))) point) | 1134 (let ((arg (if forward arg (- arg))) point) |
1135 (save-excursion | 1135 (save-excursion |
1136 (save-restriction | 1136 (save-restriction |
1427 | 1427 |
1428 | 1428 |
1429 ;; searching | 1429 ;; searching |
1430 | 1430 |
1431 (defun vip-search-forward (arg) | 1431 (defun vip-search-forward (arg) |
1432 "Search a string forward. ARG is used to find the ARG's occurence | 1432 "Search a string forward. ARG is used to find the ARG's occurrence |
1433 of the string. Default is vanilla search. Search mode can be toggled by | 1433 of the string. Default is vanilla search. Search mode can be toggled by |
1434 giving null search string." | 1434 giving null search string." |
1435 (interactive "P") | 1435 (interactive "P") |
1436 (let ((val (vip-P-val arg)) (com (vip-getcom arg))) | 1436 (let ((val (vip-P-val arg)) (com (vip-getcom arg))) |
1437 (setq vip-s-forward t | 1437 (setq vip-s-forward t |
1447 (progn | 1447 (progn |
1448 (move-marker vip-com-point (mark)) | 1448 (move-marker vip-com-point (mark)) |
1449 (vip-execute-com 'vip-search-next val com)))))) | 1449 (vip-execute-com 'vip-search-next val com)))))) |
1450 | 1450 |
1451 (defun vip-search-backward (arg) | 1451 (defun vip-search-backward (arg) |
1452 "Search a string backward. ARG is used to find the ARG's occurence | 1452 "Search a string backward. ARG is used to find the ARG's occurrence |
1453 of the string. Default is vanilla search. Search mode can be toggled by | 1453 of the string. Default is vanilla search. Search mode can be toggled by |
1454 giving null search string." | 1454 giving null search string." |
1455 (interactive "P") | 1455 (interactive "P") |
1456 (let ((val (vip-P-val arg)) (com (vip-getcom arg))) | 1456 (let ((val (vip-P-val arg)) (com (vip-getcom arg))) |
1457 (setq vip-s-forward nil | 1457 (setq vip-s-forward nil |
2010 | 2010 |
2011 (defvar ex-g-pat nil | 2011 (defvar ex-g-pat nil |
2012 "pattern for global command") | 2012 "pattern for global command") |
2013 | 2013 |
2014 (defvar ex-map (make-sparse-keymap) | 2014 (defvar ex-map (make-sparse-keymap) |
2015 "save commnads for mapped keys") | 2015 "save commands for mapped keys") |
2016 | 2016 |
2017 (defvar ex-tag nil | 2017 (defvar ex-tag nil |
2018 "save ex tag") | 2018 "save ex tag") |
2019 | 2019 |
2020 (defvar ex-file nil) | 2020 (defvar ex-file nil) |
2986 (progn | 2986 (progn |
2987 (set-mark (point)) | 2987 (set-mark (point)) |
2988 (forward-line (1- ex-count))) | 2988 (forward-line (1- ex-count))) |
2989 (set-mark end)) | 2989 (set-mark end)) |
2990 (vip-enlarge-region (point) (mark)) | 2990 (vip-enlarge-region (point) (mark)) |
2991 (if ex-flag (error "Extra chacters at end of command")) | 2991 (if ex-flag (error "Extra characters at end of command")) |
2992 (if ex-buffer | 2992 (if ex-buffer |
2993 (copy-to-register ex-buffer (point) (mark) nil)) | 2993 (copy-to-register ex-buffer (point) (mark) nil)) |
2994 (copy-region-as-kill (point) (mark))))) | 2994 (copy-region-as-kill (point) (mark))))) |
2995 | 2995 |
2996 (defun ex-command () | 2996 (defun ex-command () |