comparison lisp/viper/viper-init.el @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 43dd3413c7c7
children 2d532a89d707
comparison
equal deleted inserted replaced
162:4de2936b4e77 163:0132846995bd
23 23
24 (provide 'viper-init) 24 (provide 'viper-init)
25 25
26 ;; compiler pacifier 26 ;; compiler pacifier
27 (defvar mark-even-if-inactive) 27 (defvar mark-even-if-inactive)
28 (defvar viper-version)
28 ;; end pacifier 29 ;; end pacifier
30
31
32 ;; Viper version
33 (defun viper-version ()
34 (interactive)
35 (message "Viper version is %s" viper-version))
36 (defalias 'vip-version 'viper-version)
29 37
30 ;; Is it XEmacs? 38 ;; Is it XEmacs?
31 (defconst vip-xemacs-p (string-match "\\(Lucid\\|XEmacs\\)" emacs-version)) 39 (defconst vip-xemacs-p (string-match "\\(Lucid\\|XEmacs\\)" emacs-version))
32 ;; Is it Emacs? 40 ;; Is it Emacs?
33 (defconst vip-emacs-p (not vip-xemacs-p)) 41 (defconst vip-emacs-p (not vip-xemacs-p))
119 (defvar vip-replace-overlay-priority 400) 127 (defvar vip-replace-overlay-priority 400)
120 (defvar vip-search-overlay-priority 500) 128 (defvar vip-search-overlay-priority 500)
121 129
122 130
123 ;;; Viper minor modes 131 ;;; Viper minor modes
124
125 ;; This is not local in Emacs, so we make it local.
126 ;; This must be local because although the stack of minor modes can be the same
127 ;; for all buffers, the associated *keymaps* can be different. In Viper,
128 ;; vip-vi-local-user-map, vip-insert-local-user-map, and others can have
129 ;; different keymaps for different buffers.
130 ;; Also, the keymaps associated with vip-vi/insert-state-modifier-minor-mode
131 ;; can be different.
132 (make-variable-buffer-local 'minor-mode-map-alist)
133 132
134 ;; Mode for vital things like \e, C-z. 133 ;; Mode for vital things like \e, C-z.
135 (vip-deflocalvar vip-vi-intercept-minor-mode nil) 134 (vip-deflocalvar vip-vi-intercept-minor-mode nil)
136 135
137 (vip-deflocalvar vip-vi-basic-minor-mode nil 136 (vip-deflocalvar vip-vi-basic-minor-mode nil
595 594
596 595
597 596
598 ;;; Miscellaneous 597 ;;; Miscellaneous
599 598
600 ;; don't bark when mark is inactive
601 (setq mark-even-if-inactive t)
602
603 (defvar vip-inhibit-startup-message nil 599 (defvar vip-inhibit-startup-message nil
604 "Whether Viper startup message should be inhibited.") 600 "Whether Viper startup message should be inhibited.")
605 601
606 (defvar vip-always t 602 (defvar vip-custom-file-name (vip-convert-standard-file-name "~/.viper")
607 "t means, arrange that vi-state will be a default.")
608
609 (defvar vip-custom-file-name (vip-convert-standard-file-name "~/.vip")
610 "Viper customisation file. 603 "Viper customisation file.
611 This variable must be set _before_ loading Viper.") 604 This variable must be set _before_ loading Viper.")
612 605
613 606
614 (defvar vip-spell-function 'ispell-region 607 (defvar vip-spell-function 'ispell-region
632 625
633 ;; Hook, specific to Viper, which is run just *before* exiting the minibuffer. 626 ;; Hook, specific to Viper, which is run just *before* exiting the minibuffer.
634 ;; Beginning with Emacs 19.26, the standard `minibuffer-exit-hook' is run 627 ;; Beginning with Emacs 19.26, the standard `minibuffer-exit-hook' is run
635 ;; *after* exiting the minibuffer 628 ;; *after* exiting the minibuffer
636 (defvar vip-minibuffer-exit-hook nil) 629 (defvar vip-minibuffer-exit-hook nil)
637
638 ;; setup emacs-supported vi-style feel
639 (setq next-line-add-newlines nil
640 require-final-newline t)
641
642 (make-variable-buffer-local 'require-final-newline)
643 630
644 631
645 ;; Mode line 632 ;; Mode line
646 (defconst vip-vi-state-id "<V> " 633 (defconst vip-vi-state-id "<V> "
647 "Mode line tag identifying the Vi mode of Viper.") 634 "Mode line tag identifying the Vi mode of Viper.")
650 (defconst vip-insert-state-id "<I> " 637 (defconst vip-insert-state-id "<I> "
651 "Mode line tag identifying the Insert mode of Viper.") 638 "Mode line tag identifying the Insert mode of Viper.")
652 (defconst vip-replace-state-id "<R> " 639 (defconst vip-replace-state-id "<R> "
653 "Mode line tag identifying the Replace mode of Viper.") 640 "Mode line tag identifying the Replace mode of Viper.")
654 641
655 ;; Viper changes the default mode-line-buffer-identification
656 (setq-default mode-line-buffer-identification '(" %b"))
657
658 ;; Variable displaying the current Viper state in the mode line.
659 (vip-deflocalvar vip-mode-string vip-emacs-state-id)
660 (or (memq 'vip-mode-string global-mode-string)
661 (setq global-mode-string
662 (append '("" vip-mode-string) (cdr global-mode-string))))
663
664 642
665 (defvar vip-vi-state-hook nil 643 (defvar vip-vi-state-hook nil
666 "*Hooks run just before the switch to Vi mode is completed.") 644 "*Hooks run just before the switch to Vi mode is completed.")
667 (defvar vip-insert-state-hook nil 645 (defvar vip-insert-state-hook nil
668 "*Hooks run just before the switch to Insert mode is completed.") 646 "*Hooks run just before the switch to Insert mode is completed.")