comparison lisp/emulation/vi.el @ 89909:68c22ea6027c

Sync to HEAD
author Kenichi Handa <handa@m17n.org>
date Fri, 16 Apr 2004 12:51:06 +0000
parents 375f2633d815
children 4da4a09e8b1b
comparison
equal deleted inserted replaced
89908:ee1402f7b568 89909:68c22ea6027c
453 (interactive) 453 (interactive)
454 (if (null vi-mode-old-major-mode) ; very first call for current buffer 454 (if (null vi-mode-old-major-mode) ; very first call for current buffer
455 (vi-mode-setup)) 455 (vi-mode-setup))
456 456
457 (if (eq major-mode 'vi-mode) 457 (if (eq major-mode 'vi-mode)
458 (message "Already in vi-mode." (ding)) 458 (progn (ding) (message "Already in vi-mode."))
459 (setq vi-mode-old-local-map (current-local-map)) 459 (setq vi-mode-old-local-map (current-local-map))
460 (setq vi-mode-old-mode-name mode-name) 460 (setq vi-mode-old-mode-name mode-name)
461 (setq vi-mode-old-major-mode major-mode) 461 (setq vi-mode-old-major-mode major-mode)
462 (setq vi-mode-old-case-fold case-fold-search) ; this is needed !! 462 (setq vi-mode-old-case-fold case-fold-search) ; this is needed !!
463 (setq case-fold-search nil) ; exact case match in searching 463 (setq case-fold-search nil) ; exact case match in searching
701 (car (if (memq search-command 701 (car (if (memq search-command
702 '(re-search-forward re-search-backward)) 702 '(re-search-forward re-search-backward))
703 regexp-search-ring 703 regexp-search-ring
704 search-ring)))) 704 search-ring))))
705 (if (null search-command) 705 (if (null search-command)
706 (message "No last search command to repeat." (ding)) 706 (progn (ding) (message "No last search command to repeat."))
707 (funcall search-command search-string nil nil arg))) 707 (funcall search-command search-string nil nil arg)))
708 708
709 (defun vi-reverse-last-search (arg &optional search-command search-string) 709 (defun vi-reverse-last-search (arg &optional search-command search-string)
710 "Redo last search command in reverse direction. 710 "Redo last search command in reverse direction.
711 If the optional search args are given, use those instead of the ones saved." 711 If the optional search args are given, use those instead of the ones saved."
716 (car (if (memq search-command 716 (car (if (memq search-command
717 '(re-search-forward re-search-backward)) 717 '(re-search-forward re-search-backward))
718 regexp-search-ring 718 regexp-search-ring
719 search-ring)))) 719 search-ring))))
720 (if (null search-command) 720 (if (null search-command)
721 (message "No last search command to repeat." (ding)) 721 (progn (ding) (message "No last search command to repeat."))
722 (funcall (cond ((eq search-command 're-search-forward) 're-search-backward) 722 (funcall (cond ((eq search-command 're-search-forward) 're-search-backward)
723 ((eq search-command 're-search-backward) 're-search-forward) 723 ((eq search-command 're-search-backward) 're-search-forward)
724 ((eq search-command 'search-forward) 'search-backward) 724 ((eq search-command 'search-forward) 'search-backward)
725 ((eq search-command 'search-backward) 'search-forward)) 725 ((eq search-command 'search-backward) 'search-forward))
726 search-string nil nil arg))) 726 search-string nil nil arg)))
836 ((char-equal mark-char ?@) ; jump and pop mark 836 ((char-equal mark-char ?@) ; jump and pop mark
837 (set-mark-command t) (if line-flag (back-to-indentation))) 837 (set-mark-command t) (if line-flag (back-to-indentation)))
838 (t 838 (t
839 (let ((mark (vi-get-mark mark-char))) 839 (let ((mark (vi-get-mark mark-char)))
840 (if (null mark) 840 (if (null mark)
841 (message "Mark register undefined." (vi-ding)) 841 (progn (vi-ding) (message "Mark register undefined."))
842 (set-mark-command nil) 842 (set-mark-command nil)
843 (goto-char mark) 843 (goto-char mark)
844 (if line-flag (back-to-indentation))))))) 844 (if line-flag (back-to-indentation)))))))
845 845
846 (defun vi-goto-line-mark (char) 846 (defun vi-goto-line-mark (char)
879 "Reverse last f F t T operation COUNT times. If the optional FIND-ARG 879 "Reverse last f F t T operation COUNT times. If the optional FIND-ARG
880 is given, it is used instead of the saved one." 880 is given, it is used instead of the saved one."
881 (interactive "p") 881 (interactive "p")
882 (if (null find-arg) (setq find-arg vi-last-find-char)) 882 (if (null find-arg) (setq find-arg vi-last-find-char))
883 (if (null find-arg) 883 (if (null find-arg)
884 (message "No last find char to repeat." (ding)) 884 (progn (ding) (message "No last find char to repeat."))
885 (vi-find-char (cons (* (car find-arg) -1) (cdr find-arg)) count))) ;6/13/86 885 (vi-find-char (cons (* (car find-arg) -1) (cdr find-arg)) count))) ;6/13/86
886 886
887 (defun vi-find-char (arg count) 887 (defun vi-find-char (arg count)
888 "Find in DIRECTION (1/-1) for CHAR of COUNT'th times on current line. 888 "Find in DIRECTION (1/-1) for CHAR of COUNT'th times on current line.
889 If UPTO-FLAG is T, stop before the char. ARG = (DIRECTION.CHAR.UPTO-FLAG." 889 If UPTO-FLAG is T, stop before the char. ARG = (DIRECTION.CHAR.UPTO-FLAG."
907 "Repeat last f F t T operation COUNT times. If optional FIND-ARG is given, 907 "Repeat last f F t T operation COUNT times. If optional FIND-ARG is given,
908 it is used instead of the saved one." 908 it is used instead of the saved one."
909 (interactive "p") 909 (interactive "p")
910 (if (null find-arg) (setq find-arg vi-last-find-char)) 910 (if (null find-arg) (setq find-arg vi-last-find-char))
911 (if (null find-arg) 911 (if (null find-arg)
912 (message "No last find char to repeat." (ding)) 912 (progn (ding) (message "No last find char to repeat."))
913 (vi-find-char find-arg count))) 913 (vi-find-char find-arg count)))
914 914
915 (defun vi-backward-find-char (count char) 915 (defun vi-backward-find-char (count char)
916 "Find the COUNT'th CHAR backward on current line." 916 "Find the COUNT'th CHAR backward on current line."
917 (interactive "p\nc") 917 (interactive "p\nc")
1463 (point))))) 1463 (point)))))
1464 (set-mark-command nil) 1464 (set-mark-command nil)
1465 (goto-char (point-min)) 1465 (goto-char (point-min))
1466 (if (re-search-forward (concat "^(def[unvarconst ]*" name) nil t) 1466 (if (re-search-forward (concat "^(def[unvarconst ]*" name) nil t)
1467 nil 1467 nil
1468 (message "No definition for \"%s\" in current file." name (ding)) 1468 (ding)
1469 (message "No definition for \"%s\" in current file." name)
1469 (set-mark-command t)))) 1470 (set-mark-command t))))
1470 1471
1471 (defun vi-split-open-line (arg) 1472 (defun vi-split-open-line (arg)
1472 "Insert a newline and leave point before it. 1473 "Insert a newline and leave point before it.
1473 With ARG, inserts that many newlines." 1474 With ARG, inserts that many newlines."
1484 (if flag (forward-char 1))))) arg) 1485 (if flag (forward-char 1))))) arg)
1485 t)) 1486 t))
1486 1487
1487 (provide 'vi) 1488 (provide 'vi)
1488 1489
1490 ;;; arch-tag: ac9bdac3-8acb-4ddd-bdae-c6dd873153b3
1489 ;;; vi.el ends here 1491 ;;; vi.el ends here