mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
2008-04-03 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-macs.el (viper-read-fast-keysequence): use viper-read-event instead of viper-read-key. * viper.el (viper-mode): move the check for fundamental mode. * viper-utils.el (viper-get-saved-cursor-color-in-replace-mode) viper-get-saved-cursor-color-in-insert-mode): get rid of redundant let-statements. * viper*.el: replaced load with require in eval-when-compile.
This commit is contained in:
parent
ece2193705
commit
2ee00512e3
7 changed files with 111 additions and 99 deletions
|
|
@ -1,3 +1,16 @@
|
|||
2008-04-03 Michael Kifer <kifer@cs.stonybrook.edu>
|
||||
|
||||
* viper-macs.el (viper-read-fast-keysequence): use viper-read-event
|
||||
instead of viper-read-key.
|
||||
|
||||
* viper.el (viper-mode): move the check for fundamental mode.
|
||||
|
||||
* viper-utils.el (viper-get-saved-cursor-color-in-replace-mode)
|
||||
viper-get-saved-cursor-color-in-insert-mode): get rid of redundant
|
||||
let-statements.
|
||||
|
||||
* viper*.el: replaced load with require in eval-when-compile.
|
||||
|
||||
2008-04-03 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* files.el (auto-mode-alist): Use archive-mode for Debian packages.
|
||||
|
|
|
|||
|
|
@ -1839,13 +1839,13 @@ invokes the command before that, etc."
|
|||
(concat "`" (viper-array-to-string keys) "'")
|
||||
(viper-abbreviate-string
|
||||
(if (featurep 'xemacs)
|
||||
(replace-in-string ; xemacs
|
||||
(cond ((characterp text) (char-to-string text))
|
||||
((stringp text) text)
|
||||
(t ""))
|
||||
"\n" "^J")
|
||||
text ; emacs
|
||||
)
|
||||
(replace-in-string ; xemacs
|
||||
(cond ((characterp text) (char-to-string text))
|
||||
((stringp text) text)
|
||||
(t ""))
|
||||
"\n" "^J")
|
||||
text ; emacs
|
||||
)
|
||||
max-text-len
|
||||
" inserting `" "'" " ......."))
|
||||
))
|
||||
|
|
@ -2159,9 +2159,9 @@ To turn this feature off, set this variable to nil."
|
|||
(key-binding (setq key (read-key-sequence nil))))
|
||||
(cond ((eq cmd 'self-insert-command)
|
||||
(if (featurep 'xemacs)
|
||||
(insert (events-to-keys key)) ; xemacs
|
||||
(insert key) ; emacs
|
||||
))
|
||||
(insert (events-to-keys key)) ; xemacs
|
||||
(insert key) ; emacs
|
||||
))
|
||||
((memq cmd '(exit-minibuffer viper-exit-minibuffer))
|
||||
nil)
|
||||
(t (command-execute cmd)))
|
||||
|
|
@ -3450,7 +3450,8 @@ controlled by the sign of prefix numeric value."
|
|||
;; (which is called from viper-search-forward/backward/next). If the value of
|
||||
;; viper-search-scroll-threshold is negative - don't scroll.
|
||||
(defun viper-adjust-window ()
|
||||
(let ((win-height (if (featurep 'xemacs) (window-displayed-height)
|
||||
(let ((win-height (if (featurep 'xemacs)
|
||||
(window-displayed-height)
|
||||
(1- (window-height)))) ; adjust for modeline
|
||||
(pt (point))
|
||||
at-top-p at-bottom-p
|
||||
|
|
|
|||
|
|
@ -46,10 +46,8 @@
|
|||
;; in order to spare non-viperized emacs from being viperized
|
||||
(if noninteractive
|
||||
(eval-when-compile
|
||||
(let ((load-path (cons (expand-file-name ".") load-path)))
|
||||
(or (featurep 'viper-cmd)
|
||||
(load "viper-cmd.el" nil t 'nosuffix))
|
||||
)))
|
||||
(require 'viper-cmd)
|
||||
))
|
||||
;; end pacifier
|
||||
|
||||
(require 'viper-util)
|
||||
|
|
@ -2077,7 +2075,8 @@ Please contact your system administrator. "
|
|||
;; create temp buffer for the region
|
||||
(setq temp-buf (get-buffer-create " *ex-write*"))
|
||||
(set-buffer temp-buf)
|
||||
(if (featurep 'xemacs) (set-visited-file-name ex-file)
|
||||
(if (featurep 'xemacs)
|
||||
(set-visited-file-name ex-file)
|
||||
(set-visited-file-name ex-file 'noquery))
|
||||
(erase-buffer)
|
||||
(if (and file-exists ex-append)
|
||||
|
|
|
|||
|
|
@ -38,10 +38,8 @@
|
|||
;; in order to spare non-viperized emacs from being viperized
|
||||
(if noninteractive
|
||||
(eval-when-compile
|
||||
(let ((load-path (cons (expand-file-name ".") load-path)))
|
||||
(or (featurep 'viper-cmd)
|
||||
(load "viper-cmd.el" nil t 'nosuffix))
|
||||
)))
|
||||
(require 'viper-cmd)
|
||||
))
|
||||
;; end pacifier
|
||||
|
||||
(require 'viper-util)
|
||||
|
|
@ -873,9 +871,13 @@ name from there."
|
|||
(let ((lis (vector event))
|
||||
next-event)
|
||||
(while (and (viper-fast-keysequence-p)
|
||||
(viper-keyseq-is-a-possible-macro lis macro-alist))
|
||||
(setq next-event (viper-read-key))
|
||||
;;(setq next-event (viper-read-event))
|
||||
(viper-keyseq-is-a-possible-macro lis macro-alist))
|
||||
;; Seems that viper-read-event is more robust here. We need to be able to
|
||||
;; place these events on unread-command-events list. If we use
|
||||
;; viper-read-key then events will be converted to keys, and sometimes
|
||||
;; (e.g., (control \[)) those keys differ from the corresponding events.
|
||||
;; So, do not use (setq next-event (viper-read-key))
|
||||
(setq next-event (viper-read-event))
|
||||
(or (viper-mouse-event-p next-event)
|
||||
(setq lis (vconcat lis (vector next-event)))))
|
||||
lis))
|
||||
|
|
|
|||
|
|
@ -41,10 +41,8 @@
|
|||
;; in order to spare non-viperized emacs from being viperized
|
||||
(if noninteractive
|
||||
(eval-when-compile
|
||||
(let ((load-path (cons (expand-file-name ".") load-path)))
|
||||
(or (featurep 'viper-cmd)
|
||||
(load "viper-cmd.el" nil t 'nosuffix))
|
||||
)))
|
||||
(require 'viper-cmd)
|
||||
))
|
||||
;; end pacifier
|
||||
|
||||
(require 'viper-util)
|
||||
|
|
|
|||
|
|
@ -209,10 +209,9 @@ Otherwise return the normal value."
|
|||
(if (featurep 'emacs) 'frame-parameter 'frame-property)
|
||||
(selected-frame)
|
||||
'viper-saved-cursor-color-in-replace-mode)
|
||||
(let ((ecolor (viper-frame-value viper-emacs-state-cursor-color)))
|
||||
(or (and (eq viper-current-state 'emacs-mode)
|
||||
ecolor)
|
||||
(viper-frame-value viper-vi-state-cursor-color)))))
|
||||
(or (and (eq viper-current-state 'emacs-mode)
|
||||
(viper-frame-value viper-emacs-state-cursor-color))
|
||||
(viper-frame-value viper-vi-state-cursor-color))))
|
||||
|
||||
(defsubst viper-get-saved-cursor-color-in-insert-mode ()
|
||||
(or
|
||||
|
|
@ -220,10 +219,9 @@ Otherwise return the normal value."
|
|||
(if (featurep 'emacs) 'frame-parameter 'frame-property)
|
||||
(selected-frame)
|
||||
'viper-saved-cursor-color-in-insert-mode)
|
||||
(let ((ecolor (viper-frame-value viper-emacs-state-cursor-color)))
|
||||
(or (and (eq viper-current-state 'emacs-mode)
|
||||
ecolor)
|
||||
(viper-frame-value viper-vi-state-cursor-color)))))
|
||||
(or (and (eq viper-current-state 'emacs-mode)
|
||||
(viper-frame-value viper-emacs-state-cursor-color))
|
||||
(viper-frame-value viper-vi-state-cursor-color))))
|
||||
|
||||
(defsubst viper-get-saved-cursor-color-in-emacs-mode ()
|
||||
(or
|
||||
|
|
@ -996,7 +994,7 @@ Otherwise return the normal value."
|
|||
;; This function lets function-key-map convert key sequences into logical
|
||||
;; keys. This does a better job than viper-read-event when it comes to kbd
|
||||
;; macros, since it enables certain macros to be shared between X and TTY modes
|
||||
;; by correctly mapping key sequences for Left/Right/... (one an ascii
|
||||
;; by correctly mapping key sequences for Left/Right/... (on an ascii
|
||||
;; terminal) into logical keys left, right, etc.
|
||||
(defun viper-read-key ()
|
||||
(let ((overriding-local-map viper-overriding-map)
|
||||
|
|
@ -1206,9 +1204,9 @@ Otherwise return the normal value."
|
|||
|
||||
(defun viper-key-press-events-to-chars (events)
|
||||
(mapconcat (if (featurep 'xemacs)
|
||||
(lambda (elt) (char-to-string (event-to-character elt))) ; xemacs
|
||||
'char-to-string ; emacs
|
||||
)
|
||||
(lambda (elt) (char-to-string (event-to-character elt))) ; xemacs
|
||||
'char-to-string ; emacs
|
||||
)
|
||||
events
|
||||
""))
|
||||
|
||||
|
|
|
|||
|
|
@ -597,13 +597,14 @@ This startup message appears whenever you load Viper, unless you type `y' now."
|
|||
))
|
||||
(viper-set-expert-level 'dont-change-unless)))
|
||||
|
||||
(if (eq major-mode 'viper-mode)
|
||||
(setq major-mode 'fundamental-mode))
|
||||
|
||||
(or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi
|
||||
(memq major-mode viper-insert-state-mode-list) ; don't switch
|
||||
(viper-change-state-to-vi))
|
||||
)))
|
||||
))
|
||||
|
||||
(if (eq major-mode 'viper-mode)
|
||||
(setq major-mode 'fundamental-mode))
|
||||
)
|
||||
|
||||
|
||||
;; Apply a little heuristic to invoke vi state on major-modes
|
||||
|
|
@ -1023,63 +1024,63 @@ It also can't undo some Viper settings."
|
|||
(append '("" viper-mode-string) (cdr global-mode-string))))
|
||||
|
||||
(if (featurep 'xemacs)
|
||||
;; XEmacs
|
||||
(defadvice describe-key (before viper-describe-key-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (list (viper-read-key-sequence "Describe key: "))))
|
||||
;; Emacs
|
||||
(defadvice describe-key (before viper-describe-key-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (let (key)
|
||||
(setq key (viper-read-key-sequence
|
||||
"Describe key (or click or menu item): "))
|
||||
(list key
|
||||
(prefix-numeric-value current-prefix-arg)
|
||||
;; If KEY is a down-event, read also the
|
||||
;; corresponding up-event.
|
||||
(and (vectorp key)
|
||||
(let ((last-idx (1- (length key))))
|
||||
(and (eventp (aref key last-idx))
|
||||
(memq 'down (event-modifiers
|
||||
(aref key last-idx)))))
|
||||
(or (and (eventp (aref key 0))
|
||||
(memq 'down (event-modifiers
|
||||
(aref key 0)))
|
||||
;; For the C-down-mouse-2 popup menu,
|
||||
;; there is no subsequent up-event
|
||||
(= (length key) 1))
|
||||
(and (> (length key) 1)
|
||||
(eventp (aref key 1))
|
||||
(memq 'down (event-modifiers (aref key 1)))))
|
||||
(read-event))))))
|
||||
) ; (if (featurep 'xemacs)
|
||||
|
||||
;; XEmacs
|
||||
(defadvice describe-key (before viper-describe-key-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (list (viper-read-key-sequence "Describe key: "))))
|
||||
;; Emacs
|
||||
(defadvice describe-key (before viper-describe-key-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (let (key)
|
||||
(setq key (viper-read-key-sequence
|
||||
"Describe key (or click or menu item): "))
|
||||
(list key
|
||||
(prefix-numeric-value current-prefix-arg)
|
||||
;; If KEY is a down-event, read also the
|
||||
;; corresponding up-event.
|
||||
(and (vectorp key)
|
||||
(let ((last-idx (1- (length key))))
|
||||
(and (eventp (aref key last-idx))
|
||||
(memq 'down (event-modifiers
|
||||
(aref key last-idx)))))
|
||||
(or (and (eventp (aref key 0))
|
||||
(memq 'down (event-modifiers
|
||||
(aref key 0)))
|
||||
;; For the C-down-mouse-2 popup menu,
|
||||
;; there is no subsequent up-event
|
||||
(= (length key) 1))
|
||||
(and (> (length key) 1)
|
||||
(eventp (aref key 1))
|
||||
(memq 'down (event-modifiers (aref key 1)))))
|
||||
(read-event))))))
|
||||
) ; (if (featurep 'xemacs)
|
||||
|
||||
(if (featurep 'xemacs)
|
||||
;; XEmacs
|
||||
(defadvice describe-key-briefly
|
||||
(before viper-describe-key-briefly-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (list (viper-read-key-sequence "Describe key briefly: "))))
|
||||
;; Emacs
|
||||
(defadvice describe-key-briefly
|
||||
(before viper-describe-key-briefly-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (let (key)
|
||||
(setq key (viper-read-key-sequence
|
||||
"Describe key (or click or menu item): "))
|
||||
;; If KEY is a down-event, read and discard the
|
||||
;; corresponding up-event.
|
||||
(and (vectorp key)
|
||||
(let ((last-idx (1- (length key))))
|
||||
(and (eventp (aref key last-idx))
|
||||
(memq 'down (event-modifiers (aref key last-idx)))))
|
||||
(read-event))
|
||||
(list key
|
||||
(if current-prefix-arg
|
||||
(prefix-numeric-value current-prefix-arg))
|
||||
1))))
|
||||
) ; (if (featurep 'xemacs)
|
||||
|
||||
;; XEmacs
|
||||
(defadvice describe-key-briefly
|
||||
(before viper-describe-key-briefly-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (list (viper-read-key-sequence "Describe key briefly: "))))
|
||||
;; Emacs
|
||||
(defadvice describe-key-briefly
|
||||
(before viper-describe-key-briefly-ad protect activate)
|
||||
"Force to read key via `viper-read-key-sequence'."
|
||||
(interactive (let (key)
|
||||
(setq key (viper-read-key-sequence
|
||||
"Describe key (or click or menu item): "))
|
||||
;; If KEY is a down-event, read and discard the
|
||||
;; corresponding up-event.
|
||||
(and (vectorp key)
|
||||
(let ((last-idx (1- (length key))))
|
||||
(and (eventp (aref key last-idx))
|
||||
(memq 'down (event-modifiers (aref key last-idx)))))
|
||||
(read-event))
|
||||
(list key
|
||||
(if current-prefix-arg
|
||||
(prefix-numeric-value current-prefix-arg))
|
||||
1))))
|
||||
) ; (if (featurep 'xemacs)
|
||||
|
||||
(defadvice find-file (before viper-add-suffix-advice activate)
|
||||
"Use `read-file-name' for reading arguments."
|
||||
(interactive (cons (read-file-name "Find file: " nil default-directory)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue