1997-06-02 22:50:31 +00:00
|
|
|
|
;;; viper-cmd.el --- Vi command support for Viper
|
2001-09-09 22:33:38 +00:00
|
|
|
|
|
2014-01-01 07:43:34 +00:00
|
|
|
|
;; Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
|
2010-08-29 16:17:13 +00:00
|
|
|
|
;; Package: viper
|
2001-09-09 22:33:38 +00:00
|
|
|
|
|
1997-09-13 06:11:09 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 03:28:01 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1997-09-13 06:11:09 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:28:01 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1997-09-13 06:11:09 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 03:28:01 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2001-07-15 19:53:53 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
(provide 'viper-cmd)
|
|
|
|
|
|
|
|
|
|
;; Compiler pacifier
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defvar viper-minibuffer-current-face)
|
|
|
|
|
(defvar viper-minibuffer-insert-face)
|
|
|
|
|
(defvar viper-minibuffer-vi-face)
|
|
|
|
|
(defvar viper-minibuffer-emacs-face)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(defvar viper-always)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defvar viper-mode-string)
|
|
|
|
|
(defvar viper-custom-file-name)
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(defvar viper--key-maps)
|
|
|
|
|
(defvar viper--intercept-key-maps)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(defvar iso-accents-mode)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(defvar quail-mode)
|
|
|
|
|
(defvar quail-current-str)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(defvar mark-even-if-inactive)
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
(defvar init-message)
|
2010-11-06 19:44:11 +00:00
|
|
|
|
(defvar viper-initial)
|
2006-08-25 16:06:57 +00:00
|
|
|
|
(defvar undo-beg-posn)
|
|
|
|
|
(defvar undo-end-posn)
|
2008-01-10 06:54:12 +00:00
|
|
|
|
|
|
|
|
|
(eval-and-compile
|
|
|
|
|
(unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; end pacifier
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(require 'viper-util)
|
|
|
|
|
(require 'viper-keym)
|
|
|
|
|
(require 'viper-mous)
|
|
|
|
|
(require 'viper-macs)
|
|
|
|
|
(require 'viper-ex)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Generic predicates
|
|
|
|
|
|
|
|
|
|
;; These test functions are shamelessly lifted from vip 4.4.2 by Aamod Sane
|
|
|
|
|
|
|
|
|
|
;; generate test functions
|
|
|
|
|
;; given symbol foo, foo-p is the test function, foos is the set of
|
|
|
|
|
;; Viper command keys
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; (macroexpand '(viper-test-com-defun foo))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
;; (defun foo-p (com) (consp (memq com foos)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defmacro viper-test-com-defun (name)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let* ((snm (symbol-name name))
|
|
|
|
|
(nm-p (intern (concat snm "-p")))
|
|
|
|
|
(nms (intern (concat snm "s"))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
`(defun ,nm-p (com)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(consp (viper-memq-char com ,nms)
|
|
|
|
|
))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Variables for defining VI commands
|
|
|
|
|
|
|
|
|
|
;; Modifying commands that can be prefixes to movement commands
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(defvar viper-prefix-commands '(?c ?d ?y ?! ?= ?# ?< ?> ?\"))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; define viper-prefix-command-p
|
|
|
|
|
(viper-test-com-defun viper-prefix-command)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Commands that are pairs eg. dd. r and R here are a hack
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defconst viper-charpair-commands '(?c ?d ?y ?! ?= ?< ?> ?r ?R))
|
|
|
|
|
;; define viper-charpair-command-p
|
|
|
|
|
(viper-test-com-defun viper-charpair-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2007-06-12 19:20:25 +00:00
|
|
|
|
(defconst viper-movement-commands '(?b ?B ?e ?E ?f ?F ?G ?h ?j ?k ?l
|
1997-06-02 22:50:31 +00:00
|
|
|
|
?H ?M ?L ?n ?t ?T ?w ?W ?$ ?%
|
|
|
|
|
?^ ?( ?) ?- ?+ ?| ?{ ?} ?[ ?] ?' ?`
|
1999-11-01 07:16:15 +00:00
|
|
|
|
?\; ?, ?0 ?? ?/ ?\ ?\C-m
|
1997-08-02 06:56:24 +00:00
|
|
|
|
space return
|
|
|
|
|
delete backspace
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
"Movement commands")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; define viper-movement-command-p
|
|
|
|
|
(viper-test-com-defun viper-movement-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; Vi digit commands
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defconst viper-digit-commands '(?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; define viper-digit-command-p
|
|
|
|
|
(viper-test-com-defun viper-digit-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Commands that can be repeated by . (dotted)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defconst viper-dotable-commands '(?c ?d ?C ?s ?S ?D ?> ?<))
|
|
|
|
|
;; define viper-dotable-command-p
|
|
|
|
|
(viper-test-com-defun viper-dotable-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Commands that can follow a #
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defconst viper-hash-commands '(?c ?C ?g ?q ?s))
|
|
|
|
|
;; define viper-hash-command-p
|
|
|
|
|
(viper-test-com-defun viper-hash-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Commands that may have registers as prefix
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defconst viper-regsuffix-commands '(?d ?y ?Y ?D ?p ?P ?x ?X))
|
|
|
|
|
;; define viper-regsuffix-command-p
|
|
|
|
|
(viper-test-com-defun viper-regsuffix-command)
|
|
|
|
|
|
|
|
|
|
(defconst viper-vi-commands (append viper-movement-commands
|
|
|
|
|
viper-digit-commands
|
|
|
|
|
viper-dotable-commands
|
|
|
|
|
viper-charpair-commands
|
|
|
|
|
viper-hash-commands
|
|
|
|
|
viper-prefix-commands
|
|
|
|
|
viper-regsuffix-commands)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"The list of all commands in Vi-state.")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; define viper-vi-command-p
|
|
|
|
|
(viper-test-com-defun viper-vi-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Where viper saves mark. This mark is resurrected by m^
|
|
|
|
|
(defvar viper-saved-mark nil)
|
|
|
|
|
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
;; Contains user settings for vars affected by viper-set-expert-level function.
|
|
|
|
|
;; Not a user option.
|
|
|
|
|
(defvar viper-saved-user-settings nil)
|
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;;; CODE
|
|
|
|
|
|
|
|
|
|
;; sentinels
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; Runs viper-after-change-functions inside after-change-functions
|
|
|
|
|
(defun viper-after-change-sentinel (beg end len)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(run-hook-with-args 'viper-after-change-functions beg end len))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; Runs viper-before-change-functions inside before-change-functions
|
|
|
|
|
(defun viper-before-change-sentinel (beg end)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(run-hook-with-args 'viper-before-change-functions beg end))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-post-command-sentinel ()
|
2006-12-23 21:33:50 +00:00
|
|
|
|
(condition-case conds
|
|
|
|
|
(run-hooks 'viper-post-command-hooks)
|
|
|
|
|
(error (viper-message-conditions conds)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(if (eq viper-current-state 'vi-state)
|
|
|
|
|
(viper-restore-cursor-color 'after-insert-mode)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-pre-command-sentinel ()
|
|
|
|
|
(run-hooks 'viper-pre-command-hooks))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Needed so that Viper will be able to figure the last inserted
|
|
|
|
|
;; chunk of text with reasonable accuracy.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-insert-state-post-command-sentinel ()
|
|
|
|
|
(if (and (memq viper-current-state '(insert-state replace-state))
|
|
|
|
|
viper-insert-point
|
|
|
|
|
(>= (point) viper-insert-point))
|
|
|
|
|
(setq viper-last-posn-while-in-insert-state (point-marker)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(or (viper-overlay-p viper-replace-overlay)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-set-replace-overlay (point-min) (point-min))
|
|
|
|
|
(viper-hide-replace-overlay)))
|
|
|
|
|
(if (eq viper-current-state 'insert-state)
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(let ((icolor (viper-frame-value viper-insert-state-cursor-color)))
|
|
|
|
|
(or (stringp (viper-get-saved-cursor-color-in-insert-mode))
|
|
|
|
|
(string= (viper-get-cursor-color) icolor)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; save current color, if not already saved
|
|
|
|
|
(viper-save-cursor-color 'before-insert-mode))
|
|
|
|
|
;; set insert mode cursor color
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(viper-change-cursor-color icolor)))
|
|
|
|
|
(let ((ecolor (viper-frame-value viper-emacs-state-cursor-color)))
|
|
|
|
|
(when (and ecolor (eq viper-current-state 'emacs-state))
|
|
|
|
|
(or (stringp (viper-get-saved-cursor-color-in-emacs-mode))
|
|
|
|
|
(string= (viper-get-cursor-color) ecolor)
|
|
|
|
|
;; save current color, if not already saved
|
|
|
|
|
(viper-save-cursor-color 'before-emacs-mode))
|
|
|
|
|
;; set emacs mode cursor color
|
|
|
|
|
(viper-change-cursor-color ecolor)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
|
|
|
|
|
(if (and (memq this-command '(dabbrev-expand hippie-expand))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(integerp viper-pre-command-point)
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(markerp viper-insert-point)
|
|
|
|
|
(marker-position viper-insert-point)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(> viper-insert-point viper-pre-command-point))
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(viper-move-marker-locally viper-insert-point viper-pre-command-point)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(defsubst viper-preserve-cursor-color ()
|
|
|
|
|
(or (memq this-command '(self-insert-command
|
|
|
|
|
viper-del-backward-char-in-insert
|
|
|
|
|
viper-del-backward-char-in-replace
|
|
|
|
|
viper-delete-backward-char
|
|
|
|
|
viper-join-lines
|
|
|
|
|
viper-delete-char))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(memq (viper-event-key last-command-event)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'(up down left right (meta f) (meta b)
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(control n) (control p) (control f) (control b)))))
|
|
|
|
|
|
|
|
|
|
(defsubst viper-insert-state-pre-command-sentinel ()
|
|
|
|
|
(or (viper-preserve-cursor-color)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-restore-cursor-color 'after-insert-mode))
|
|
|
|
|
(if (and (memq this-command '(dabbrev-expand hippie-expand))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(markerp viper-insert-point)
|
|
|
|
|
(marker-position viper-insert-point))
|
|
|
|
|
(setq viper-pre-command-point (marker-position viper-insert-point))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2008-11-16 04:55:45 +00:00
|
|
|
|
(defun viper-R-state-post-command-sentinel ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Restoring cursor color is needed despite
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; viper-replace-state-pre-command-sentinel: When you jump to another buffer
|
|
|
|
|
;; in another frame, the pre-command hook won't change cursor color to
|
|
|
|
|
;; default in that other frame. So, if the second frame cursor was red and
|
|
|
|
|
;; we set the point outside the replacement region, then the cursor color
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; will remain red. Restoring the default, below, prevents this.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (and (<= (viper-replace-start) (point))
|
|
|
|
|
(<= (point) (viper-replace-end)))
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(viper-change-cursor-color
|
|
|
|
|
(viper-frame-value viper-replace-overlay-cursor-color))
|
|
|
|
|
(viper-restore-cursor-color 'after-replace-mode)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; to speed up, don't change cursor color before self-insert
|
|
|
|
|
;; and common move commands
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-replace-state-pre-command-sentinel ()
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(or (viper-preserve-cursor-color)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-restore-cursor-color 'after-replace-mode)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-12-04 06:19:05 +00:00
|
|
|
|
|
|
|
|
|
;; Make sure we don't delete more than needed.
|
|
|
|
|
;; This is executed at viper-last-posn-in-replace-region
|
|
|
|
|
(defsubst viper-trim-replace-chars-to-delete-if-necessary ()
|
|
|
|
|
(setq viper-replace-chars-to-delete
|
|
|
|
|
(max 0
|
|
|
|
|
(min viper-replace-chars-to-delete
|
|
|
|
|
;; Don't delete more than to the end of repl overlay
|
|
|
|
|
(viper-chars-in-region
|
|
|
|
|
(viper-replace-end) viper-last-posn-in-replace-region)
|
|
|
|
|
;; point is viper-last-posn-in-replace-region now
|
|
|
|
|
;; So, this limits deletion to the end of line
|
|
|
|
|
(viper-chars-in-region (point) (viper-line-pos 'end))
|
|
|
|
|
))))
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-replace-state-post-command-sentinel ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Restoring cursor color is needed despite
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; viper-replace-state-pre-command-sentinel: When one jumps to another buffer
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; in another frame, the pre-command hook won't change cursor color to
|
|
|
|
|
;; default in that other frame. So, if the second frame cursor was red and
|
|
|
|
|
;; we set the point outside the replacement region, then the cursor color
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; will remain red. Restoring the default, below, fixes this problem.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;;
|
2000-10-29 04:56:45 +00:00
|
|
|
|
;; We optimize for some commands, like self-insert-command,
|
|
|
|
|
;; viper-delete-backward-char, etc., since they either don't change
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; cursor color or, if they terminate replace mode, the color will be changed
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; in viper-finish-change
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(or (viper-preserve-cursor-color)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-restore-cursor-color 'after-replace-mode))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(cond
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((eq viper-current-state 'replace-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; delete characters to compensate for inserted chars.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((replace-boundary (viper-replace-end)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(goto-char viper-last-posn-in-replace-region)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-trim-replace-chars-to-delete-if-necessary)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(delete-char viper-replace-chars-to-delete)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(setq viper-replace-chars-to-delete 0)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; terminate replace mode if reached replace limit
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (= viper-last-posn-in-replace-region (viper-replace-end))
|
|
|
|
|
(viper-finish-change)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(when (viper-pos-within-region
|
|
|
|
|
(point) (viper-replace-start) replace-boundary)
|
|
|
|
|
;; the state may have changed in viper-finish-change above
|
|
|
|
|
(if (eq viper-current-state 'replace-state)
|
|
|
|
|
(viper-change-cursor-color
|
|
|
|
|
(viper-frame-value viper-replace-overlay-cursor-color)))
|
|
|
|
|
(setq viper-last-posn-in-replace-region (point-marker)))))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; terminate replace mode if changed Viper states.
|
|
|
|
|
(t (viper-finish-change))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; changing mode
|
|
|
|
|
|
|
|
|
|
;; Change state to NEW-STATE---either emacs-state, vi-state, or insert-state.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change-state (new-state)
|
|
|
|
|
;; Keep viper-post/pre-command-hooks fresh.
|
|
|
|
|
;; We remove then add viper-post/pre-command-sentinel since it is very
|
|
|
|
|
;; desirable that viper-pre-command-sentinel is the last hook and
|
|
|
|
|
;; viper-post-command-sentinel is the first hook.
|
1998-05-04 22:42:59 +00:00
|
|
|
|
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(when (featurep 'xemacs)
|
|
|
|
|
(make-local-hook 'viper-after-change-functions)
|
|
|
|
|
(make-local-hook 'viper-before-change-functions)
|
|
|
|
|
(make-local-hook 'viper-post-command-hooks)
|
|
|
|
|
(make-local-hook 'viper-pre-command-hooks))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(remove-hook 'post-command-hook 'viper-post-command-sentinel)
|
|
|
|
|
(add-hook 'post-command-hook 'viper-post-command-sentinel)
|
|
|
|
|
(remove-hook 'pre-command-hook 'viper-pre-command-sentinel)
|
|
|
|
|
(add-hook 'pre-command-hook 'viper-pre-command-sentinel t)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; These hooks will be added back if switching to insert/replace mode
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(remove-hook 'viper-post-command-hooks
|
|
|
|
|
'viper-insert-state-post-command-sentinel 'local)
|
|
|
|
|
(remove-hook 'viper-pre-command-hooks
|
|
|
|
|
'viper-insert-state-pre-command-sentinel 'local)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-intermediate-command nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cond ((eq new-state 'vi-state)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((member viper-current-state '(insert-state replace-state))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; move viper-last-posn-while-in-insert-state
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; This is a normal hook that is executed in insert/replace
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; states after each command. In Vi/Emacs state, it does
|
|
|
|
|
;; nothing. We need to execute it here to make sure that
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; the last posn was recorded when we hit ESC.
|
|
|
|
|
;; It may be left unrecorded if the last thing done in
|
|
|
|
|
;; insert/repl state was dabbrev-expansion or abbrev
|
|
|
|
|
;; expansion caused by hitting ESC
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-insert-state-post-command-sentinel)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case conds
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-save-last-insertion
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-insert-point
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-last-posn-while-in-insert-state)
|
|
|
|
|
(if viper-began-as-replace
|
|
|
|
|
(setq viper-began-as-replace nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; repeat insert commands if numerical arg > 1
|
|
|
|
|
(save-excursion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-repeat-insert-command))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-message-conditions conds)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (> (length viper-last-insertion) 0)
|
|
|
|
|
(viper-push-onto-ring viper-last-insertion
|
|
|
|
|
'viper-insertion-ring))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-12-04 06:19:05 +00:00
|
|
|
|
(if viper-ESC-moves-cursor-back
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(or (bolp) (viper-beginning-of-field) (backward-char 1))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; insert or replace
|
|
|
|
|
((memq new-state '(insert-state replace-state))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (memq viper-current-state '(emacs-state vi-state))
|
|
|
|
|
(viper-move-marker-locally 'viper-insert-point (point)))
|
|
|
|
|
(viper-move-marker-locally
|
|
|
|
|
'viper-last-posn-while-in-insert-state (point))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(add-hook 'viper-post-command-hooks
|
|
|
|
|
'viper-insert-state-post-command-sentinel t 'local)
|
|
|
|
|
(add-hook 'viper-pre-command-hooks
|
|
|
|
|
'viper-insert-state-pre-command-sentinel t 'local))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
) ; outermost cond
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Nothing needs to be done to switch to emacs mode! Just set some
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; variables, which is already done in viper-change-state-to-emacs!
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; ISO accents
|
|
|
|
|
;; always turn off iso-accents-mode in vi-state, or else we won't be able to
|
|
|
|
|
;; use the keys `,',^ , as they will do accents instead of Vi actions.
|
|
|
|
|
(cond ((eq new-state 'vi-state) (viper-set-iso-accents-mode nil));accents off
|
|
|
|
|
(viper-automatic-iso-accents (viper-set-iso-accents-mode t));accents on
|
|
|
|
|
(t (viper-set-iso-accents-mode nil)))
|
|
|
|
|
;; Always turn off quail mode in vi state
|
|
|
|
|
(cond ((eq new-state 'vi-state) (viper-set-input-method nil)) ;intl input off
|
|
|
|
|
(viper-special-input-method (viper-set-input-method t)) ;intl input on
|
|
|
|
|
(t (viper-set-input-method nil)))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-current-state new-state)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
|
|
|
|
|
(viper-update-syntax-classes)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-normalize-minor-mode-map-alist)
|
|
|
|
|
(viper-adjust-keys-for new-state)
|
|
|
|
|
(viper-set-mode-vars-for new-state)
|
|
|
|
|
(viper-refresh-mode-line)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-adjust-keys-for (state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Make necessary adjustments to keymaps before entering STATE."
|
|
|
|
|
(cond ((memq state '(insert-state replace-state))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-auto-indent
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(define-key viper-insert-basic-map "\C-m" 'viper-autoindent)
|
|
|
|
|
(if viper-want-emacs-keys-in-insert
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; expert
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(define-key viper-insert-basic-map "\C-j" nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; novice
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(define-key viper-insert-basic-map "\C-j" 'viper-autoindent)))
|
|
|
|
|
(define-key viper-insert-basic-map "\C-m" nil)
|
|
|
|
|
(define-key viper-insert-basic-map "\C-j" nil))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-insert-diehard-minor-mode
|
|
|
|
|
(not viper-want-emacs-keys-in-insert))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-want-ctl-h-help
|
1997-09-12 21:09:03 +00:00
|
|
|
|
(progn
|
|
|
|
|
(define-key viper-insert-basic-map "\C-h" 'help-command)
|
|
|
|
|
(define-key viper-replace-map "\C-h" 'help-command))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(define-key viper-insert-basic-map
|
1997-09-12 21:09:03 +00:00
|
|
|
|
"\C-h" 'viper-del-backward-char-in-insert)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(define-key viper-replace-map
|
1997-09-12 21:09:03 +00:00
|
|
|
|
"\C-h" 'viper-del-backward-char-in-replace))
|
|
|
|
|
;; In XEmacs, C-h overrides backspace, so we make sure it doesn't.
|
|
|
|
|
(define-key viper-insert-basic-map
|
|
|
|
|
[backspace] 'viper-del-backward-char-in-insert)
|
|
|
|
|
(define-key viper-replace-map
|
|
|
|
|
[backspace] 'viper-del-backward-char-in-replace)
|
|
|
|
|
) ; end insert/replace case
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(t ; Vi state
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-vi-diehard-minor-mode (not viper-want-emacs-keys-in-vi))
|
|
|
|
|
(if viper-want-ctl-h-help
|
1997-09-12 21:09:03 +00:00
|
|
|
|
(define-key viper-vi-basic-map "\C-h" 'help-command)
|
|
|
|
|
(define-key viper-vi-basic-map "\C-h" 'viper-backward-char))
|
|
|
|
|
;; In XEmacs, C-h overrides backspace, so we make sure it doesn't.
|
|
|
|
|
(define-key viper-vi-basic-map [backspace] 'viper-backward-char))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Normalizes minor-mode-map-alist by putting Viper keymaps first.
|
|
|
|
|
;; This ensures that Viper bindings are in effect, regardless of which minor
|
|
|
|
|
;; modes were turned on by the user or by other packages.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-normalize-minor-mode-map-alist ()
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(setq viper--intercept-key-maps
|
|
|
|
|
(list
|
|
|
|
|
(cons 'viper-vi-intercept-minor-mode viper-vi-intercept-map)
|
|
|
|
|
(cons 'viper-insert-intercept-minor-mode viper-insert-intercept-map)
|
|
|
|
|
(cons 'viper-emacs-intercept-minor-mode viper-emacs-intercept-map)
|
|
|
|
|
))
|
|
|
|
|
(setq viper--key-maps
|
|
|
|
|
(list (cons 'viper-vi-minibuffer-minor-mode viper-minibuffer-map)
|
|
|
|
|
(cons 'viper-vi-local-user-minor-mode viper-vi-local-user-map)
|
|
|
|
|
(cons 'viper-vi-kbd-minor-mode viper-vi-kbd-map)
|
|
|
|
|
(cons 'viper-vi-global-user-minor-mode viper-vi-global-user-map)
|
|
|
|
|
(cons 'viper-vi-state-modifier-minor-mode
|
|
|
|
|
(if (keymapp
|
|
|
|
|
(cdr (assoc major-mode viper-vi-state-modifier-alist)))
|
|
|
|
|
(cdr (assoc major-mode viper-vi-state-modifier-alist))
|
|
|
|
|
viper-empty-keymap))
|
|
|
|
|
(cons 'viper-vi-diehard-minor-mode viper-vi-diehard-map)
|
|
|
|
|
(cons 'viper-vi-basic-minor-mode viper-vi-basic-map)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cons 'viper-replace-minor-mode viper-replace-map)
|
|
|
|
|
;; viper-insert-minibuffer-minor-mode must come after
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; viper-replace-minor-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cons 'viper-insert-minibuffer-minor-mode
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-minibuffer-map)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cons 'viper-insert-local-user-minor-mode
|
|
|
|
|
viper-insert-local-user-map)
|
|
|
|
|
(cons 'viper-insert-kbd-minor-mode viper-insert-kbd-map)
|
|
|
|
|
(cons 'viper-insert-global-user-minor-mode
|
|
|
|
|
viper-insert-global-user-map)
|
|
|
|
|
(cons 'viper-insert-state-modifier-minor-mode
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (keymapp
|
1997-08-07 04:48:48 +00:00
|
|
|
|
(cdr (assoc major-mode
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-insert-state-modifier-alist)))
|
1997-08-07 04:48:48 +00:00
|
|
|
|
(cdr (assoc major-mode
|
|
|
|
|
viper-insert-state-modifier-alist))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-empty-keymap))
|
|
|
|
|
(cons 'viper-insert-diehard-minor-mode viper-insert-diehard-map)
|
|
|
|
|
(cons 'viper-insert-basic-minor-mode viper-insert-basic-map)
|
|
|
|
|
(cons 'viper-emacs-local-user-minor-mode
|
|
|
|
|
viper-emacs-local-user-map)
|
|
|
|
|
(cons 'viper-emacs-kbd-minor-mode viper-emacs-kbd-map)
|
|
|
|
|
(cons 'viper-emacs-global-user-minor-mode
|
|
|
|
|
viper-emacs-global-user-map)
|
|
|
|
|
(cons 'viper-emacs-state-modifier-minor-mode
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (keymapp
|
|
|
|
|
(cdr
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(assoc major-mode viper-emacs-state-modifier-alist)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cdr
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(assoc major-mode viper-emacs-state-modifier-alist))
|
|
|
|
|
viper-empty-keymap))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
))
|
2010-01-18 04:39:40 +00:00
|
|
|
|
|
2005-10-06 00:09:49 +00:00
|
|
|
|
;; This var is not local in Emacs, so we make it local. It must be local
|
|
|
|
|
;; because although the stack of minor modes can be the same for all buffers,
|
|
|
|
|
;; the associated *keymaps* can be different. In Viper,
|
|
|
|
|
;; viper-vi-local-user-map, viper-insert-local-user-map, and others can have
|
|
|
|
|
;; different keymaps for different buffers. Also, the keymaps associated
|
|
|
|
|
;; with viper-vi/insert-state-modifier-minor-mode can be different.
|
|
|
|
|
;; ***This is needed only in case emulation-mode-map-alists is not defined.
|
|
|
|
|
;; In emacs with emulation-mode-map-alists, nothing needs to be done
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(unless
|
|
|
|
|
(and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
|
2005-10-06 00:09:49 +00:00
|
|
|
|
(set (make-local-variable 'minor-mode-map-alist)
|
|
|
|
|
(viper-append-filter-alist
|
|
|
|
|
(append viper--intercept-key-maps viper--key-maps)
|
|
|
|
|
minor-mode-map-alist)))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Viper mode-changing commands and utilities
|
|
|
|
|
|
|
|
|
|
;; Modifies mode-line-buffer-identification.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-refresh-mode-line ()
|
2005-10-06 00:09:49 +00:00
|
|
|
|
(set (make-local-variable 'viper-mode-string)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((eq viper-current-state 'emacs-state) viper-emacs-state-id)
|
|
|
|
|
((eq viper-current-state 'vi-state) viper-vi-state-id)
|
|
|
|
|
((eq viper-current-state 'replace-state) viper-replace-state-id)
|
|
|
|
|
((eq viper-current-state 'insert-state) viper-insert-state-id)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Sets Viper mode string in global-mode-string
|
|
|
|
|
(force-mode-line-update))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Switch from Insert state to Vi state.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exit-insert-state ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-state-to-vi))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-set-mode-vars-for (state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Sets Viper minor mode variables to put Viper's state STATE in effect."
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Emacs state
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-vi-minibuffer-minor-mode nil
|
|
|
|
|
viper-insert-minibuffer-minor-mode nil
|
|
|
|
|
viper-vi-intercept-minor-mode nil
|
|
|
|
|
viper-insert-intercept-minor-mode nil
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-vi-local-user-minor-mode nil
|
|
|
|
|
viper-vi-kbd-minor-mode nil
|
|
|
|
|
viper-vi-global-user-minor-mode nil
|
|
|
|
|
viper-vi-state-modifier-minor-mode nil
|
|
|
|
|
viper-vi-diehard-minor-mode nil
|
|
|
|
|
viper-vi-basic-minor-mode nil
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-replace-minor-mode nil
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-insert-local-user-minor-mode nil
|
|
|
|
|
viper-insert-kbd-minor-mode nil
|
|
|
|
|
viper-insert-global-user-minor-mode nil
|
|
|
|
|
viper-insert-state-modifier-minor-mode nil
|
|
|
|
|
viper-insert-diehard-minor-mode nil
|
|
|
|
|
viper-insert-basic-minor-mode nil
|
|
|
|
|
viper-emacs-intercept-minor-mode t
|
|
|
|
|
viper-emacs-local-user-minor-mode t
|
|
|
|
|
viper-emacs-kbd-minor-mode (not (viper-is-in-minibuffer))
|
|
|
|
|
viper-emacs-global-user-minor-mode t
|
|
|
|
|
viper-emacs-state-modifier-minor-mode t
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Vi state
|
|
|
|
|
(if (eq state 'vi-state) ; adjust for vi-state
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq
|
|
|
|
|
viper-vi-intercept-minor-mode t
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-vi-minibuffer-minor-mode (viper-is-in-minibuffer)
|
|
|
|
|
viper-vi-local-user-minor-mode t
|
|
|
|
|
viper-vi-kbd-minor-mode (not (viper-is-in-minibuffer))
|
|
|
|
|
viper-vi-global-user-minor-mode t
|
|
|
|
|
viper-vi-state-modifier-minor-mode t
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; don't let the diehard keymap block command completion
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; and other things in the minibuffer
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-vi-diehard-minor-mode (not
|
|
|
|
|
(or viper-want-emacs-keys-in-vi
|
|
|
|
|
(viper-is-in-minibuffer)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-vi-basic-minor-mode t
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-emacs-intercept-minor-mode nil
|
|
|
|
|
viper-emacs-local-user-minor-mode nil
|
|
|
|
|
viper-emacs-kbd-minor-mode nil
|
|
|
|
|
viper-emacs-global-user-minor-mode nil
|
|
|
|
|
viper-emacs-state-modifier-minor-mode nil
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Insert and Replace states
|
|
|
|
|
(if (member state '(insert-state replace-state))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq
|
|
|
|
|
viper-insert-intercept-minor-mode t
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-replace-minor-mode (eq state 'replace-state)
|
|
|
|
|
viper-insert-minibuffer-minor-mode (viper-is-in-minibuffer)
|
|
|
|
|
viper-insert-local-user-minor-mode t
|
|
|
|
|
viper-insert-kbd-minor-mode (not (viper-is-in-minibuffer))
|
|
|
|
|
viper-insert-global-user-minor-mode t
|
|
|
|
|
viper-insert-state-modifier-minor-mode t
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; don't let the diehard keymap block command completion
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; and other things in the minibuffer
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-insert-diehard-minor-mode (not
|
|
|
|
|
(or
|
|
|
|
|
viper-want-emacs-keys-in-insert
|
|
|
|
|
(viper-is-in-minibuffer)))
|
|
|
|
|
viper-insert-basic-minor-mode t
|
|
|
|
|
viper-emacs-intercept-minor-mode nil
|
|
|
|
|
viper-emacs-local-user-minor-mode nil
|
|
|
|
|
viper-emacs-kbd-minor-mode nil
|
|
|
|
|
viper-emacs-global-user-minor-mode nil
|
|
|
|
|
viper-emacs-state-modifier-minor-mode nil
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; minibuffer faces
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (viper-has-face-support-p)
|
|
|
|
|
(setq viper-minibuffer-current-face
|
|
|
|
|
(cond ((eq state 'emacs-state) viper-minibuffer-emacs-face)
|
|
|
|
|
((eq state 'vi-state) viper-minibuffer-vi-face)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
((memq state '(insert-state replace-state))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-minibuffer-insert-face))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (viper-is-in-minibuffer)
|
|
|
|
|
(viper-set-minibuffer-overlay))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; This also takes care of the annoying incomplete lines in files.
|
|
|
|
|
;; Also, this fixes `undo' to work vi-style for complex commands.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change-state-to-vi ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Change Viper state to Vi."
|
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (and viper-first-time (not (viper-is-in-minibuffer)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(viper-mode)
|
2000-11-24 08:15:11 +00:00
|
|
|
|
(if overwrite-mode (overwrite-mode -1))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(or (viper-overlay-p viper-replace-overlay)
|
|
|
|
|
(viper-set-replace-overlay (point-min) (point-min)))
|
|
|
|
|
(viper-hide-replace-overlay)
|
2011-07-09 19:32:42 +00:00
|
|
|
|
;; Expand abbrevs iff the previous character has word syntax.
|
|
|
|
|
(and abbrev-mode
|
|
|
|
|
(eq (char-syntax (preceding-char)) ?w)
|
|
|
|
|
(expand-abbrev))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and auto-fill-function (> (current-column) fill-column))
|
|
|
|
|
(funcall auto-fill-function))
|
|
|
|
|
;; don't leave whitespace lines around
|
|
|
|
|
(if (and (memq last-command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'(viper-autoindent
|
|
|
|
|
viper-open-line viper-Open-line
|
|
|
|
|
viper-replace-state-exit-cmd))
|
|
|
|
|
(viper-over-whitespace-line))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(indent-to-left-margin))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-add-newline-at-eob-if-necessary)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-adjust-undo)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
(if (eq viper-current-state 'emacs-state)
|
|
|
|
|
(viper-restore-cursor-color 'after-emacs-mode)
|
|
|
|
|
(viper-restore-cursor-color 'after-insert-mode))
|
|
|
|
|
|
|
|
|
|
(viper-change-state 'vi-state)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; Protect against user errors in hooks
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case conds
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(run-hooks 'viper-vi-state-hook)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-message-conditions conds)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change-state-to-insert ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Change Viper state to Insert."
|
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-state 'insert-state)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(or (viper-overlay-p viper-replace-overlay)
|
|
|
|
|
(viper-set-replace-overlay (point-min) (point-min)))
|
|
|
|
|
(viper-hide-replace-overlay)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(let ((icolor (viper-frame-value viper-insert-state-cursor-color)))
|
|
|
|
|
(or (stringp (viper-get-saved-cursor-color-in-insert-mode))
|
|
|
|
|
(string= (viper-get-cursor-color) icolor)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-save-cursor-color 'before-insert-mode))
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(viper-change-cursor-color icolor))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; Protect against user errors in hooks
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case conds
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(run-hooks 'viper-insert-state-hook)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-message-conditions conds))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-downgrade-to-insert ()
|
2000-11-24 08:15:11 +00:00
|
|
|
|
;; Protect against user errors in hooks
|
|
|
|
|
(condition-case conds
|
|
|
|
|
(run-hooks 'viper-insert-state-hook)
|
|
|
|
|
(error
|
|
|
|
|
(viper-message-conditions conds)))
|
|
|
|
|
(setq viper-current-state 'insert-state
|
|
|
|
|
viper-replace-minor-mode nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Change to replace state. When the end of replacement region is reached,
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; replace state changes to insert state.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change-state-to-replace (&optional non-R-cmd)
|
|
|
|
|
(viper-change-state 'replace-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Run insert-state-hook
|
|
|
|
|
(condition-case conds
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(run-hooks 'viper-insert-state-hook 'viper-replace-state-hook)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-message-conditions conds)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if non-R-cmd
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-start-replace)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; 'R' is implemented using Emacs's overwrite-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-start-R-mode))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change-state-to-emacs ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Change Viper state to Emacs."
|
|
|
|
|
(interactive)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(or (viper-overlay-p viper-replace-overlay)
|
|
|
|
|
(viper-set-replace-overlay (point-min) (point-min)))
|
|
|
|
|
(viper-hide-replace-overlay)
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(let ((ecolor (viper-frame-value viper-emacs-state-cursor-color)))
|
|
|
|
|
(when ecolor
|
|
|
|
|
(or (stringp (viper-get-saved-cursor-color-in-emacs-mode))
|
|
|
|
|
(string= (viper-get-cursor-color) ecolor)
|
|
|
|
|
(viper-save-cursor-color 'before-emacs-mode))
|
|
|
|
|
(viper-change-cursor-color ecolor)))
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-state 'emacs-state)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
;; Protect against user errors in hooks
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case conds
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(run-hooks 'viper-emacs-state-hook)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-message-conditions conds))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; escape to emacs mode temporarily
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-escape-to-emacs (arg &optional events)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Escape to Emacs state from Vi state for one Emacs command.
|
|
|
|
|
ARG is used as the prefix value for the executed command. If
|
|
|
|
|
EVENTS is a list of events, which become the beginning of the command."
|
|
|
|
|
(interactive "P")
|
2009-11-22 03:14:14 +00:00
|
|
|
|
(if (viper= (viper-last-command-char) ?\\)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(message "Switched to EMACS state for the next command..."))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-escape-to-state arg events 'emacs-state))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; escape to Vi mode temporarily
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-escape-to-vi (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Escape from Emacs state to Vi state for one Vi 1-character command.
|
|
|
|
|
If the Vi command that the user types has a prefix argument, e.g., `d2w', then
|
1999-11-01 07:16:15 +00:00
|
|
|
|
Vi's prefix argument will be used. Otherwise, the prefix argument passed to
|
1997-08-02 06:56:24 +00:00
|
|
|
|
`viper-escape-to-vi' is used."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(message "Switched to VI state for the next command...")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-escape-to-state arg nil 'vi-state))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Escape to STATE mode for one Emacs command.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-escape-to-state (arg events state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;;(let (com key prefix-arg)
|
|
|
|
|
(let (com key)
|
|
|
|
|
;; this temporarily turns off Viper's minor mode keymaps
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for state)
|
|
|
|
|
(viper-normalize-minor-mode-map-alist)
|
|
|
|
|
(if events (viper-set-unread-command-events events))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; protect against keyboard quit and other errors
|
|
|
|
|
(condition-case nil
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(let (viper-vi-kbd-minor-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-insert-kbd-minor-mode
|
|
|
|
|
viper-emacs-kbd-minor-mode)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(setq com
|
|
|
|
|
(key-binding (setq key (viper-read-key-sequence nil))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; In case of binding indirection--chase definitions.
|
|
|
|
|
;; Have to do it here because we execute this command under
|
|
|
|
|
;; different keymaps, so command-execute may not do the
|
|
|
|
|
;; right thing there
|
|
|
|
|
(while (vectorp com) (setq com (key-binding com))))
|
|
|
|
|
nil)
|
|
|
|
|
;; Execute command com in the original Viper state, not in state
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; `state'. Otherwise, if we switch buffers while executing the
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; escaped to command, Viper's mode vars will remain those of
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; `state'. When we return to the orig buffer, the bindings will be
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; screwed up.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for viper-current-state)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; this-command, last-command-char, last-command-event
|
|
|
|
|
(setq this-command com)
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
|
;; XEmacs represents key sequences as vectors
|
|
|
|
|
(setq last-command-event
|
|
|
|
|
(viper-copy-event (viper-seq-last-elt key))
|
|
|
|
|
last-command-char (event-to-character last-command-event))
|
|
|
|
|
;; Emacs represents them as sequences (str or vec)
|
|
|
|
|
(setq last-command-event
|
2009-01-09 04:36:00 +00:00
|
|
|
|
(viper-copy-event (viper-seq-last-elt key))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (commandp com)
|
2011-03-06 02:43:19 +00:00
|
|
|
|
;; pretend that current state is the state we escaped to
|
2005-07-19 05:01:20 +00:00
|
|
|
|
(let ((viper-current-state state))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq prefix-arg (or prefix-arg arg))
|
|
|
|
|
(command-execute com)))
|
|
|
|
|
)
|
|
|
|
|
(quit (ding))
|
|
|
|
|
(error (beep 1))))
|
|
|
|
|
;; set state in the new buffer
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for viper-current-state))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;; This is used in order to allow reading characters according to the input
|
|
|
|
|
;; method. The character is read in emacs and inserted into the buffer.
|
|
|
|
|
;; If an input method is in effect, this might
|
|
|
|
|
;; cause several characters to be combined into one.
|
|
|
|
|
;; Also takes care of the iso-accents mode
|
|
|
|
|
(defun viper-special-read-and-insert-char ()
|
|
|
|
|
(viper-set-mode-vars-for 'emacs-state)
|
|
|
|
|
(viper-normalize-minor-mode-map-alist)
|
|
|
|
|
(if viper-special-input-method
|
|
|
|
|
(viper-set-input-method t))
|
|
|
|
|
(if viper-automatic-iso-accents
|
|
|
|
|
(viper-set-iso-accents-mode t))
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(let (viper-vi-kbd-minor-mode
|
|
|
|
|
viper-insert-kbd-minor-mode
|
|
|
|
|
viper-emacs-kbd-minor-mode
|
|
|
|
|
ch)
|
|
|
|
|
(cond ((and viper-special-input-method
|
* ediff-init.el (ediff-xemacs-p, ediff-emacs-p): Remove.
(ediff-has-face-support-p, ediff-BAD-INFO, ediff-check-version)
(ediff-current-diff-A, ediff-current-diff-B)
(ediff-current-diff-C, ediff-fine-diff-C, ediff-fine-diff-A)
(ediff-fine-diff-B, ediff-fine-diff-Ancestor, ediff-even-diff-A)
(ediff-even-diff-B, ediff-even-diff-C, ediff-even-diff-Ancestor)
(ediff-odd-diff-A, ediff-odd-diff-B, ediff-odd-diff-C)
(ediff-odd-diff-Ancestor, ediff-reset-mouse):
* ediff-wind.el (ediff-narrow-control-frame-leftward-shift)
(ediff-setup-windows-plain-merge)
(ediff-setup-windows-plain-compare, ediff-setup-control-frame)
(ediff-refresh-control-frame, ediff-get-visible-buffer-window):
* ediff-util.el (ediff-setup-keymap, )
(ediff-toggle-wide-display, ediff-toggle-multiframe)
(ediff-toggle-use-toolbar, ediff-really-quit)
(ediff-good-frame-under-mouse)
(ediff-highlight-diff-in-one-buffer)
(ediff-remove-flags-from-buffer, ediff-place-flags-in-buffer1)
(ediff-make-bullet-proof-overlay):
* ediff-mult.el (ediff-setup-meta-map, ediff-emacs-p)
(ediff-set-meta-overlay):
* ediff-help.el (ediff-help-region-map, ediff-set-help-overlays):
* ediff.el (ediff-documentation): Replace ediff-xemacs-p and
ediff-emacs-p with their former definitions.
* emulation/viper-init.el (viper-xemacs-p, viper-emacs-p): Remove.
(viper-has-face-support-p, viper-inactivate-input-method)
(viper-activate-input-method)
(viper-use-replace-region-delimiters, viper-restore-cursor-type):
* emulation/viper-mous.el (viper-multiclick-timeout)
(viper-surrounding-word, viper-mouse-click-insert-word)
(viper-mouse-click-search-word, viper-parse-mouse-key):
* emulation/viper-macs.el (viper-char-array-to-macro):
* emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings):
* emulation/viper-util.el (viper-get-saved-cursor-color-in-replace-mode)
(viper-get-saved-cursor-color-in-insert-mode)
(viper-get-saved-cursor-color-in-emacs-mode)
(viper-check-version, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-set-minibuffer-overlay)
(viper-check-minibuffer-overlay, viper-read-key-sequence)
(viper-key-to-emacs-key): Replace viper-xemacs-p and viper-emacs-p
with their former definitions.
(viper-eventify-list-xemacs): Only do work for XEmacs.
(viper-set-unread-command-events): Only do work for Emacs.
(viper-overlay-p, viper-make-overlay, viper-overlay-live-p)
(viper-move-overlay, viper-overlay-start, viper-overlay-end)
(viper-overlay-get, viper-overlay-put, viper-read-event)
(viper-characterp, viper-int-to-char, viper-get-face)
(viper-color-defined-p, viper-iconify): New defaliases replacing
the old fsets.
* progmodes/fortran.el (comment-region-function)
(uncomment-region-function): Pacify byte compiler.
* vc.el (vc-diff-internal): Remove code for an old version of
gnus.
2007-11-09 05:20:57 +00:00
|
|
|
|
(featurep 'emacs)
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(fboundp 'quail-input-method))
|
|
|
|
|
;; (let ...) is used to restore unread-command-events to the
|
|
|
|
|
;; original state. We don't want anything left in there after
|
|
|
|
|
;; key translation. (Such left-overs are possible if the user
|
|
|
|
|
;; types a regular key.)
|
|
|
|
|
(let (unread-command-events)
|
2001-12-24 05:50:31 +00:00
|
|
|
|
;; The next cmd and viper-set-unread-command-events
|
|
|
|
|
;; are intended to prevent the input method
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;; from swallowing ^M, ^Q and other special characters
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
(setq ch (read-char-exclusive))
|
2001-12-24 05:50:31 +00:00
|
|
|
|
;; replace ^M with the newline
|
|
|
|
|
(if (eq ch ?\C-m) (setq ch ?\n))
|
|
|
|
|
;; Make sure ^V and ^Q work as quotation chars
|
|
|
|
|
(if (memq ch '(?\C-v ?\C-q))
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
(setq ch (read-char-exclusive)))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(viper-set-unread-command-events ch)
|
|
|
|
|
(quail-input-method nil)
|
|
|
|
|
|
|
|
|
|
(if (and ch (string= quail-current-str ""))
|
|
|
|
|
(insert ch)
|
|
|
|
|
(insert quail-current-str))
|
|
|
|
|
(setq ch (or ch
|
|
|
|
|
(aref quail-current-str
|
|
|
|
|
(1- (length quail-current-str)))))
|
|
|
|
|
))
|
|
|
|
|
((and viper-special-input-method
|
* ediff-init.el (ediff-xemacs-p, ediff-emacs-p): Remove.
(ediff-has-face-support-p, ediff-BAD-INFO, ediff-check-version)
(ediff-current-diff-A, ediff-current-diff-B)
(ediff-current-diff-C, ediff-fine-diff-C, ediff-fine-diff-A)
(ediff-fine-diff-B, ediff-fine-diff-Ancestor, ediff-even-diff-A)
(ediff-even-diff-B, ediff-even-diff-C, ediff-even-diff-Ancestor)
(ediff-odd-diff-A, ediff-odd-diff-B, ediff-odd-diff-C)
(ediff-odd-diff-Ancestor, ediff-reset-mouse):
* ediff-wind.el (ediff-narrow-control-frame-leftward-shift)
(ediff-setup-windows-plain-merge)
(ediff-setup-windows-plain-compare, ediff-setup-control-frame)
(ediff-refresh-control-frame, ediff-get-visible-buffer-window):
* ediff-util.el (ediff-setup-keymap, )
(ediff-toggle-wide-display, ediff-toggle-multiframe)
(ediff-toggle-use-toolbar, ediff-really-quit)
(ediff-good-frame-under-mouse)
(ediff-highlight-diff-in-one-buffer)
(ediff-remove-flags-from-buffer, ediff-place-flags-in-buffer1)
(ediff-make-bullet-proof-overlay):
* ediff-mult.el (ediff-setup-meta-map, ediff-emacs-p)
(ediff-set-meta-overlay):
* ediff-help.el (ediff-help-region-map, ediff-set-help-overlays):
* ediff.el (ediff-documentation): Replace ediff-xemacs-p and
ediff-emacs-p with their former definitions.
* emulation/viper-init.el (viper-xemacs-p, viper-emacs-p): Remove.
(viper-has-face-support-p, viper-inactivate-input-method)
(viper-activate-input-method)
(viper-use-replace-region-delimiters, viper-restore-cursor-type):
* emulation/viper-mous.el (viper-multiclick-timeout)
(viper-surrounding-word, viper-mouse-click-insert-word)
(viper-mouse-click-search-word, viper-parse-mouse-key):
* emulation/viper-macs.el (viper-char-array-to-macro):
* emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings):
* emulation/viper-util.el (viper-get-saved-cursor-color-in-replace-mode)
(viper-get-saved-cursor-color-in-insert-mode)
(viper-get-saved-cursor-color-in-emacs-mode)
(viper-check-version, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-set-minibuffer-overlay)
(viper-check-minibuffer-overlay, viper-read-key-sequence)
(viper-key-to-emacs-key): Replace viper-xemacs-p and viper-emacs-p
with their former definitions.
(viper-eventify-list-xemacs): Only do work for XEmacs.
(viper-set-unread-command-events): Only do work for Emacs.
(viper-overlay-p, viper-make-overlay, viper-overlay-live-p)
(viper-move-overlay, viper-overlay-start, viper-overlay-end)
(viper-overlay-get, viper-overlay-put, viper-read-event)
(viper-characterp, viper-int-to-char, viper-get-face)
(viper-color-defined-p, viper-iconify): New defaliases replacing
the old fsets.
* progmodes/fortran.el (comment-region-function)
(uncomment-region-function): Pacify byte compiler.
* vc.el (vc-diff-internal): Remove code for an old version of
gnus.
2007-11-09 05:20:57 +00:00
|
|
|
|
(featurep 'xemacs)
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(fboundp 'quail-start-translation))
|
|
|
|
|
;; same as above but for XEmacs, which doesn't have
|
|
|
|
|
;; quail-input-method
|
|
|
|
|
(let (unread-command-events)
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
(setq ch (read-char-exclusive))
|
2001-12-24 05:50:31 +00:00
|
|
|
|
;; replace ^M with the newline
|
|
|
|
|
(if (eq ch ?\C-m) (setq ch ?\n))
|
|
|
|
|
;; Make sure ^V and ^Q work as quotation chars
|
|
|
|
|
(if (memq ch '(?\C-v ?\C-q))
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
(setq ch (read-char-exclusive)))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(viper-set-unread-command-events ch)
|
|
|
|
|
(quail-start-translation nil)
|
|
|
|
|
|
|
|
|
|
(if (and ch (string= quail-current-str ""))
|
|
|
|
|
(insert ch)
|
|
|
|
|
(insert quail-current-str))
|
|
|
|
|
(setq ch (or ch
|
|
|
|
|
(aref quail-current-str
|
|
|
|
|
(1- (length quail-current-str)))))
|
|
|
|
|
))
|
|
|
|
|
((and (boundp 'iso-accents-mode) iso-accents-mode)
|
|
|
|
|
(setq ch (aref (read-key-sequence nil) 0))
|
2001-12-24 05:50:31 +00:00
|
|
|
|
;; replace ^M with the newline
|
|
|
|
|
(if (eq ch ?\C-m) (setq ch ?\n))
|
|
|
|
|
;; Make sure ^V and ^Q work as quotation chars
|
|
|
|
|
(if (memq ch '(?\C-v ?\C-q))
|
|
|
|
|
(setq ch (aref (read-key-sequence nil) 0)))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(insert ch))
|
|
|
|
|
(t
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
;;(setq ch (read-char-exclusive))
|
|
|
|
|
(setq ch (aref (read-key-sequence nil) 0))
|
* ediff-init.el (ediff-xemacs-p, ediff-emacs-p): Remove.
(ediff-has-face-support-p, ediff-BAD-INFO, ediff-check-version)
(ediff-current-diff-A, ediff-current-diff-B)
(ediff-current-diff-C, ediff-fine-diff-C, ediff-fine-diff-A)
(ediff-fine-diff-B, ediff-fine-diff-Ancestor, ediff-even-diff-A)
(ediff-even-diff-B, ediff-even-diff-C, ediff-even-diff-Ancestor)
(ediff-odd-diff-A, ediff-odd-diff-B, ediff-odd-diff-C)
(ediff-odd-diff-Ancestor, ediff-reset-mouse):
* ediff-wind.el (ediff-narrow-control-frame-leftward-shift)
(ediff-setup-windows-plain-merge)
(ediff-setup-windows-plain-compare, ediff-setup-control-frame)
(ediff-refresh-control-frame, ediff-get-visible-buffer-window):
* ediff-util.el (ediff-setup-keymap, )
(ediff-toggle-wide-display, ediff-toggle-multiframe)
(ediff-toggle-use-toolbar, ediff-really-quit)
(ediff-good-frame-under-mouse)
(ediff-highlight-diff-in-one-buffer)
(ediff-remove-flags-from-buffer, ediff-place-flags-in-buffer1)
(ediff-make-bullet-proof-overlay):
* ediff-mult.el (ediff-setup-meta-map, ediff-emacs-p)
(ediff-set-meta-overlay):
* ediff-help.el (ediff-help-region-map, ediff-set-help-overlays):
* ediff.el (ediff-documentation): Replace ediff-xemacs-p and
ediff-emacs-p with their former definitions.
* emulation/viper-init.el (viper-xemacs-p, viper-emacs-p): Remove.
(viper-has-face-support-p, viper-inactivate-input-method)
(viper-activate-input-method)
(viper-use-replace-region-delimiters, viper-restore-cursor-type):
* emulation/viper-mous.el (viper-multiclick-timeout)
(viper-surrounding-word, viper-mouse-click-insert-word)
(viper-mouse-click-search-word, viper-parse-mouse-key):
* emulation/viper-macs.el (viper-char-array-to-macro):
* emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings):
* emulation/viper-util.el (viper-get-saved-cursor-color-in-replace-mode)
(viper-get-saved-cursor-color-in-insert-mode)
(viper-get-saved-cursor-color-in-emacs-mode)
(viper-check-version, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-set-minibuffer-overlay)
(viper-check-minibuffer-overlay, viper-read-key-sequence)
(viper-key-to-emacs-key): Replace viper-xemacs-p and viper-emacs-p
with their former definitions.
(viper-eventify-list-xemacs): Only do work for XEmacs.
(viper-set-unread-command-events): Only do work for Emacs.
(viper-overlay-p, viper-make-overlay, viper-overlay-live-p)
(viper-move-overlay, viper-overlay-start, viper-overlay-end)
(viper-overlay-get, viper-overlay-put, viper-read-event)
(viper-characterp, viper-int-to-char, viper-get-face)
(viper-color-defined-p, viper-iconify): New defaliases replacing
the old fsets.
* progmodes/fortran.el (comment-region-function)
(uncomment-region-function): Pacify byte compiler.
* vc.el (vc-diff-internal): Remove code for an old version of
gnus.
2007-11-09 05:20:57 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
2006-08-31 03:39:42 +00:00
|
|
|
|
(setq ch (event-to-character ch)))
|
2001-12-24 05:50:31 +00:00
|
|
|
|
;; replace ^M with the newline
|
|
|
|
|
(if (eq ch ?\C-m) (setq ch ?\n))
|
|
|
|
|
;; Make sure ^V and ^Q work as quotation chars
|
|
|
|
|
(if (memq ch '(?\C-v ?\C-q))
|
2006-08-31 03:39:42 +00:00
|
|
|
|
(progn
|
|
|
|
|
;;(setq ch (read-char-exclusive))
|
|
|
|
|
(setq ch (aref (read-key-sequence nil) 0))
|
* ediff-init.el (ediff-xemacs-p, ediff-emacs-p): Remove.
(ediff-has-face-support-p, ediff-BAD-INFO, ediff-check-version)
(ediff-current-diff-A, ediff-current-diff-B)
(ediff-current-diff-C, ediff-fine-diff-C, ediff-fine-diff-A)
(ediff-fine-diff-B, ediff-fine-diff-Ancestor, ediff-even-diff-A)
(ediff-even-diff-B, ediff-even-diff-C, ediff-even-diff-Ancestor)
(ediff-odd-diff-A, ediff-odd-diff-B, ediff-odd-diff-C)
(ediff-odd-diff-Ancestor, ediff-reset-mouse):
* ediff-wind.el (ediff-narrow-control-frame-leftward-shift)
(ediff-setup-windows-plain-merge)
(ediff-setup-windows-plain-compare, ediff-setup-control-frame)
(ediff-refresh-control-frame, ediff-get-visible-buffer-window):
* ediff-util.el (ediff-setup-keymap, )
(ediff-toggle-wide-display, ediff-toggle-multiframe)
(ediff-toggle-use-toolbar, ediff-really-quit)
(ediff-good-frame-under-mouse)
(ediff-highlight-diff-in-one-buffer)
(ediff-remove-flags-from-buffer, ediff-place-flags-in-buffer1)
(ediff-make-bullet-proof-overlay):
* ediff-mult.el (ediff-setup-meta-map, ediff-emacs-p)
(ediff-set-meta-overlay):
* ediff-help.el (ediff-help-region-map, ediff-set-help-overlays):
* ediff.el (ediff-documentation): Replace ediff-xemacs-p and
ediff-emacs-p with their former definitions.
* emulation/viper-init.el (viper-xemacs-p, viper-emacs-p): Remove.
(viper-has-face-support-p, viper-inactivate-input-method)
(viper-activate-input-method)
(viper-use-replace-region-delimiters, viper-restore-cursor-type):
* emulation/viper-mous.el (viper-multiclick-timeout)
(viper-surrounding-word, viper-mouse-click-insert-word)
(viper-mouse-click-search-word, viper-parse-mouse-key):
* emulation/viper-macs.el (viper-char-array-to-macro):
* emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings):
* emulation/viper-util.el (viper-get-saved-cursor-color-in-replace-mode)
(viper-get-saved-cursor-color-in-insert-mode)
(viper-get-saved-cursor-color-in-emacs-mode)
(viper-check-version, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-set-minibuffer-overlay)
(viper-check-minibuffer-overlay, viper-read-key-sequence)
(viper-key-to-emacs-key): Replace viper-xemacs-p and viper-emacs-p
with their former definitions.
(viper-eventify-list-xemacs): Only do work for XEmacs.
(viper-set-unread-command-events): Only do work for Emacs.
(viper-overlay-p, viper-make-overlay, viper-overlay-live-p)
(viper-move-overlay, viper-overlay-start, viper-overlay-end)
(viper-overlay-get, viper-overlay-put, viper-read-event)
(viper-characterp, viper-int-to-char, viper-get-face)
(viper-color-defined-p, viper-iconify): New defaliases replacing
the old fsets.
* progmodes/fortran.el (comment-region-function)
(uncomment-region-function): Pacify byte compiler.
* vc.el (vc-diff-internal): Remove code for an old version of
gnus.
2007-11-09 05:20:57 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
2006-08-31 03:39:42 +00:00
|
|
|
|
(setq ch (event-to-character ch))))
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
)
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(insert ch))
|
|
|
|
|
)
|
|
|
|
|
(setq last-command-event
|
* ediff-init.el (ediff-xemacs-p, ediff-emacs-p): Remove.
(ediff-has-face-support-p, ediff-BAD-INFO, ediff-check-version)
(ediff-current-diff-A, ediff-current-diff-B)
(ediff-current-diff-C, ediff-fine-diff-C, ediff-fine-diff-A)
(ediff-fine-diff-B, ediff-fine-diff-Ancestor, ediff-even-diff-A)
(ediff-even-diff-B, ediff-even-diff-C, ediff-even-diff-Ancestor)
(ediff-odd-diff-A, ediff-odd-diff-B, ediff-odd-diff-C)
(ediff-odd-diff-Ancestor, ediff-reset-mouse):
* ediff-wind.el (ediff-narrow-control-frame-leftward-shift)
(ediff-setup-windows-plain-merge)
(ediff-setup-windows-plain-compare, ediff-setup-control-frame)
(ediff-refresh-control-frame, ediff-get-visible-buffer-window):
* ediff-util.el (ediff-setup-keymap, )
(ediff-toggle-wide-display, ediff-toggle-multiframe)
(ediff-toggle-use-toolbar, ediff-really-quit)
(ediff-good-frame-under-mouse)
(ediff-highlight-diff-in-one-buffer)
(ediff-remove-flags-from-buffer, ediff-place-flags-in-buffer1)
(ediff-make-bullet-proof-overlay):
* ediff-mult.el (ediff-setup-meta-map, ediff-emacs-p)
(ediff-set-meta-overlay):
* ediff-help.el (ediff-help-region-map, ediff-set-help-overlays):
* ediff.el (ediff-documentation): Replace ediff-xemacs-p and
ediff-emacs-p with their former definitions.
* emulation/viper-init.el (viper-xemacs-p, viper-emacs-p): Remove.
(viper-has-face-support-p, viper-inactivate-input-method)
(viper-activate-input-method)
(viper-use-replace-region-delimiters, viper-restore-cursor-type):
* emulation/viper-mous.el (viper-multiclick-timeout)
(viper-surrounding-word, viper-mouse-click-insert-word)
(viper-mouse-click-search-word, viper-parse-mouse-key):
* emulation/viper-macs.el (viper-char-array-to-macro):
* emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings):
* emulation/viper-util.el (viper-get-saved-cursor-color-in-replace-mode)
(viper-get-saved-cursor-color-in-insert-mode)
(viper-get-saved-cursor-color-in-emacs-mode)
(viper-check-version, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-set-minibuffer-overlay)
(viper-check-minibuffer-overlay, viper-read-key-sequence)
(viper-key-to-emacs-key): Replace viper-xemacs-p and viper-emacs-p
with their former definitions.
(viper-eventify-list-xemacs): Only do work for XEmacs.
(viper-set-unread-command-events): Only do work for Emacs.
(viper-overlay-p, viper-make-overlay, viper-overlay-live-p)
(viper-move-overlay, viper-overlay-start, viper-overlay-end)
(viper-overlay-get, viper-overlay-put, viper-read-event)
(viper-characterp, viper-int-to-char, viper-get-face)
(viper-color-defined-p, viper-iconify): New defaliases replacing
the old fsets.
* progmodes/fortran.el (comment-region-function)
(uncomment-region-function): Pacify byte compiler.
* vc.el (vc-diff-internal): Remove code for an old version of
gnus.
2007-11-09 05:20:57 +00:00
|
|
|
|
(viper-copy-event (if (featurep 'xemacs)
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(character-to-event ch) ch)))
|
|
|
|
|
) ; let
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
(error nil)
|
2001-09-09 22:33:38 +00:00
|
|
|
|
) ; condition-case
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(viper-set-input-method nil)
|
|
|
|
|
(viper-set-iso-accents-mode nil)
|
|
|
|
|
(viper-set-mode-vars-for viper-current-state)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exec-form-in-vi (form)
|
2010-01-18 04:39:40 +00:00
|
|
|
|
"Execute FORM in Vi state, regardless of the current Vi state."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((buff (current-buffer))
|
|
|
|
|
result)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for 'vi-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
(condition-case nil
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let (viper-vi-kbd-minor-mode) ; execute without kbd macros
|
2006-12-23 21:33:50 +00:00
|
|
|
|
(setq result (eval form)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error
|
|
|
|
|
(signal 'quit nil)))
|
|
|
|
|
|
|
|
|
|
(if (not (equal buff (current-buffer))) ; cmd switched buffer
|
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
|
|
|
|
(with-current-buffer buff
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for viper-current-state)))
|
|
|
|
|
(viper-set-mode-vars-for viper-current-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
result))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exec-form-in-emacs (form)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Execute FORM in Emacs, temporarily disabling Viper's minor modes.
|
2010-01-18 04:39:40 +00:00
|
|
|
|
Similar to `viper-escape-to-emacs', but accepts forms rather than keystrokes."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((buff (current-buffer))
|
|
|
|
|
result)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for 'emacs-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq result (eval form))
|
|
|
|
|
(if (not (equal buff (current-buffer))) ; cmd switched buffer
|
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
|
|
|
|
(with-current-buffer buff
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for viper-current-state)))
|
|
|
|
|
(viper-set-mode-vars-for viper-current-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
result))
|
|
|
|
|
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
;; This executes the last kbd event in emacs mode. Is used when we want to
|
|
|
|
|
;; interpret certain keys directly in emacs (as, for example, in comint mode).
|
|
|
|
|
(defun viper-exec-key-in-emacs (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(viper-escape-to-emacs arg last-command-event))
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; This is needed because minor modes sometimes override essential Viper
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; bindings. By letting Viper know which files these modes are in, it will
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; arrange to reorganize minor-mode-map-alist so that things will work right.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-harness-minor-mode (load-file)
|
2008-11-17 02:24:16 +00:00
|
|
|
|
"Familiarize Viper with a minor mode defined in LOAD-FILE.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
Minor modes that have their own keymaps may overshadow Viper keymaps.
|
|
|
|
|
This function is designed to make Viper aware of the packages that define
|
|
|
|
|
such minor modes.
|
|
|
|
|
Usage:
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-harness-minor-mode load-file)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2010-01-18 04:39:40 +00:00
|
|
|
|
LOAD-FILE is the name of the file where the specific minor mode is defined.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
Suffixes such as .el or .elc should be stripped."
|
|
|
|
|
|
|
|
|
|
(interactive "sEnter name of the load file: ")
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(eval-after-load load-file '(viper-normalize-minor-mode-map-alist))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Change the default for minor-mode-map-alist each time a harnessed minor
|
|
|
|
|
;; mode adds its own keymap to the a-list.
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless
|
|
|
|
|
(and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
|
|
|
|
|
(eval-after-load
|
|
|
|
|
load-file '(setq-default minor-mode-map-alist minor-mode-map-alist)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-ESC (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Emulate ESC key in Emacs.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
Prevents multiple escape keystrokes if viper-no-multiple-ESC is true.
|
|
|
|
|
If viper-no-multiple-ESC is 'twice double ESC would ding in vi-state.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
Other ESC sequences are emulated via the current Emacs's major mode
|
1999-11-01 07:16:15 +00:00
|
|
|
|
keymap. This is more convenient on TTYs, since this won't block
|
2010-01-18 04:39:40 +00:00
|
|
|
|
function keys such as up, down, etc. ESC will also will also work as
|
|
|
|
|
a Meta key in this case. When viper-no-multiple-ESC is nil, ESC works
|
|
|
|
|
as a Meta key and any number of multiple escapes are allowed."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let (char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((and (not viper-no-multiple-ESC) (eq viper-current-state 'vi-state))
|
|
|
|
|
(setq char (viper-read-char-exclusive))
|
|
|
|
|
(viper-escape-to-emacs arg (list ?\e char) ))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
((and (eq viper-no-multiple-ESC 'twice)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(eq viper-current-state 'vi-state))
|
|
|
|
|
(setq char (viper-read-char-exclusive))
|
|
|
|
|
(if (= char (string-to-char viper-ESC-key))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(ding)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-escape-to-emacs arg (list ?\e char) )))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(t (ding)))
|
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-alternate-Meta-key (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Simulate Emacs Meta key."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(sit-for 1) (message "ESC-")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-escape-to-emacs arg '(?\e)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-toggle-key-action ()
|
|
|
|
|
"Action bound to `viper-toggle-key'."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (and (< viper-expert-level 2) (equal viper-toggle-key "\C-z"))
|
|
|
|
|
(if (viper-window-display-p)
|
|
|
|
|
(viper-iconify)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(suspend-emacs))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-state-to-emacs)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Listen to ESC key.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-intercept-ESC-key ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Function that implements ESC key in Viper emulation of Vi."
|
|
|
|
|
(interactive)
|
2012-02-27 13:14:36 +00:00
|
|
|
|
;; `key-binding' needs to be called in a context where Viper's
|
|
|
|
|
;; minor-mode map(s) have been temporarily disabled so the ESC
|
|
|
|
|
;; binding to viper-intercept-ESC-key doesn't hide the binding we're
|
|
|
|
|
;; looking for (Bug#9146):
|
2013-07-07 19:35:54 +00:00
|
|
|
|
(let* ((cmd 'viper-intercept-ESC-key))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; call the actual function to execute ESC (if no other symbols followed)
|
|
|
|
|
;; or the key bound to the ESC sequence (if the sequence was issued
|
2005-02-19 19:32:47 +00:00
|
|
|
|
;; with very short delay between characters).
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (eq cmd 'viper-intercept-ESC-key)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq cmd
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((eq viper-current-state 'vi-state)
|
|
|
|
|
'viper-ESC)
|
|
|
|
|
((eq viper-current-state 'insert-state)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
'viper-exit-insert-state)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((eq viper-current-state 'replace-state)
|
|
|
|
|
'viper-replace-state-exit-cmd)
|
|
|
|
|
(t 'viper-change-state-to-vi)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)))
|
|
|
|
|
(call-interactively cmd)))
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; prefix argument for Vi mode
|
|
|
|
|
|
|
|
|
|
;; In Vi mode, prefix argument is a dotted pair (NUM . COM) where NUM
|
|
|
|
|
;; represents the numeric value of the prefix argument and COM represents
|
|
|
|
|
;; command prefix such as "c", "d", "m" and "y".
|
|
|
|
|
|
|
|
|
|
;; Get value part of prefix-argument ARG.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-p-val (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cond ((null arg) 1)
|
|
|
|
|
((consp arg)
|
|
|
|
|
(if (or (null (car arg)) (equal (car arg) '(nil)))
|
|
|
|
|
1 (car arg)))
|
|
|
|
|
(t arg)))
|
|
|
|
|
|
|
|
|
|
;; Get raw value part of prefix-argument ARG.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-P-val (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cond ((consp arg) (car arg))
|
|
|
|
|
(t arg)))
|
|
|
|
|
|
|
|
|
|
;; Get com part of prefix-argument ARG.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-getcom (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cond ((null arg) nil)
|
|
|
|
|
((consp arg) (cdr arg))
|
|
|
|
|
(t nil)))
|
|
|
|
|
|
|
|
|
|
;; Get com part of prefix-argument ARG and modify it.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-getCom (arg)
|
|
|
|
|
(let ((com (viper-getcom arg)))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(cond ((viper= com ?c) ?c)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; Previously, ?c was being converted to ?C, but this prevented
|
|
|
|
|
;; multiline replace regions.
|
2000-10-29 04:56:45 +00:00
|
|
|
|
;;((viper= com ?c) ?C)
|
|
|
|
|
((viper= com ?d) ?D)
|
|
|
|
|
((viper= com ?y) ?Y)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(t com))))
|
|
|
|
|
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; Compute numeric prefix arg value.
|
2000-10-29 04:56:45 +00:00
|
|
|
|
;; Invoked by EVENT-CHAR. COM is the command part obtained so far.
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(defun viper-prefix-arg-value (event-char com)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((viper-intermediate-command 'viper-digit-argument)
|
|
|
|
|
value func)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; read while number
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(while (and (viper-characterp event-char)
|
|
|
|
|
(>= event-char ?0) (<= event-char ?9))
|
|
|
|
|
(setq value (+ (* (if (integerp value) value 0) 10) (- event-char ?0)))
|
|
|
|
|
(setq event-char (viper-read-event-convert-to-char)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq prefix-arg value)
|
|
|
|
|
(if com (setq prefix-arg (cons prefix-arg com)))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(while (eq event-char ?U)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-describe-arg prefix-arg)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(setq event-char (viper-read-event-convert-to-char)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (or com (and (not (eq viper-current-state 'vi-state))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; make sure it is a Vi command
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(viper-characterp event-char)
|
|
|
|
|
(viper-vi-command-p event-char)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
;; If appears to be one of the vi commands,
|
|
|
|
|
;; then execute it with funcall and clear prefix-arg in order to not
|
|
|
|
|
;; confuse subsequent commands
|
|
|
|
|
(progn
|
2009-01-09 04:36:00 +00:00
|
|
|
|
;; last-command-event is the char we want emacs to think was typed
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; last. If com is not nil, the viper-digit-argument command was
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; called from within viper-prefix-arg command, such as `d', `w',
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; etc., i.e., the user typed, say, d2. In this case, `com' would be
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; `d', `w', etc. If viper-digit-argument was invoked by
|
|
|
|
|
;; viper-escape-to-vi (which is indicated by the fact that the
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; current state is not vi-state), then `event-char' represents the
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; vi command to be executed (e.g., `d', `w', etc). Again,
|
2009-01-09 04:36:00 +00:00
|
|
|
|
;; last-command-event must make emacs believe that this is the command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; we typed.
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(cond ((eq event-char 'return) (setq event-char ?\C-m))
|
|
|
|
|
((eq event-char 'delete) (setq event-char ?\C-?))
|
|
|
|
|
((eq event-char 'backspace) (setq event-char ?\C-h))
|
|
|
|
|
((eq event-char 'space) (setq event-char ?\ )))
|
2010-01-18 04:39:40 +00:00
|
|
|
|
(setq last-command-event
|
2009-11-22 03:14:14 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
|
(character-to-event (or com event-char))
|
|
|
|
|
(or com event-char)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq func (viper-exec-form-in-vi
|
|
|
|
|
`(key-binding (char-to-string ,event-char))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(funcall func prefix-arg)
|
|
|
|
|
(setq prefix-arg nil))
|
1999-11-25 05:20:59 +00:00
|
|
|
|
;; some other command -- let emacs do it in its own way
|
|
|
|
|
(viper-set-unread-command-events event-char))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Vi operator as prefix argument."
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-prefix-arg-com (char value com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((cont t)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
cmd-info
|
1997-07-25 01:42:53 +00:00
|
|
|
|
cmd-to-exec-at-end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(while (and cont
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(viper-memq-char char
|
|
|
|
|
(list ?c ?d ?y ?! ?< ?> ?= ?# ?r ?R ?\"
|
|
|
|
|
viper-buffer-search-char)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
;; this means that we already have a command character, so we
|
|
|
|
|
;; construct a com list and exit while. however, if char is "
|
|
|
|
|
;; it is an error.
|
|
|
|
|
(progn
|
|
|
|
|
;; new com is (CHAR . OLDCOM)
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(if (viper-memq-char char '(?# ?\")) (error "Viper bell"))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq com (cons char com))
|
|
|
|
|
(setq cont nil))
|
1999-11-25 05:20:59 +00:00
|
|
|
|
;; If com is nil we set com as char, and read more. Again, if char is
|
|
|
|
|
;; ", we read the name of register and store it in viper-use-register.
|
|
|
|
|
;; if char is !, =, or #, a complete com is formed so we exit the while
|
|
|
|
|
;; loop.
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(cond ((viper-memq-char char '(?! ?=))
|
1999-11-25 05:20:59 +00:00
|
|
|
|
(setq com char)
|
|
|
|
|
(setq char (read-char))
|
|
|
|
|
(setq cont nil))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= char ?#)
|
1999-11-25 05:20:59 +00:00
|
|
|
|
;; read a char and encode it as com
|
|
|
|
|
(setq com (+ 128 (read-char)))
|
|
|
|
|
(setq char (read-char)))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= char ?\")
|
1999-11-25 05:20:59 +00:00
|
|
|
|
(let ((reg (read-char)))
|
|
|
|
|
(if (viper-valid-register reg)
|
|
|
|
|
(setq viper-use-register reg)
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(error "Viper bell"))
|
1999-11-25 05:20:59 +00:00
|
|
|
|
(setq char (read-char))))
|
|
|
|
|
(t
|
|
|
|
|
(setq com char)
|
|
|
|
|
(setq char (read-char))))))
|
|
|
|
|
|
2006-10-23 19:20:15 +00:00
|
|
|
|
(if (atom com)
|
|
|
|
|
;; `com' is a single char, so we construct the command argument
|
|
|
|
|
;; and if `char' is `?', we describe the arg; otherwise
|
|
|
|
|
;; we prepare the command that will be executed at the end.
|
|
|
|
|
(progn
|
|
|
|
|
(setq cmd-info (cons value com))
|
|
|
|
|
(while (viper= char ?U)
|
|
|
|
|
(viper-describe-arg cmd-info)
|
|
|
|
|
(setq char (read-char)))
|
|
|
|
|
;; `char' is a movement cmd, a digit arg cmd, or a register cmd---so
|
|
|
|
|
;; we execute it at the very end
|
|
|
|
|
(or (viper-movement-command-p char)
|
|
|
|
|
(viper-digit-command-p char)
|
|
|
|
|
(viper-regsuffix-command-p char)
|
|
|
|
|
(viper= char ?!) ; bang command
|
|
|
|
|
(viper= char ?g) ; the gg command (like G0)
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(error "Viper bell"))
|
2006-10-23 19:20:15 +00:00
|
|
|
|
(setq cmd-to-exec-at-end
|
|
|
|
|
(viper-exec-form-in-vi
|
|
|
|
|
`(key-binding (char-to-string ,char)))))
|
|
|
|
|
|
|
|
|
|
;; as com is non-nil, this means that we have a command to execute
|
|
|
|
|
(if (viper-memq-char (car com) '(?r ?R))
|
2010-01-18 04:39:40 +00:00
|
|
|
|
;; execute appropriate region command.
|
2006-10-23 19:20:15 +00:00
|
|
|
|
(let ((char (car com)) (com (cdr com)))
|
|
|
|
|
(setq prefix-arg (cons value com))
|
|
|
|
|
(if (viper= char ?r)
|
|
|
|
|
(viper-region prefix-arg)
|
|
|
|
|
(viper-Region prefix-arg))
|
|
|
|
|
;; reset prefix-arg
|
|
|
|
|
(setq prefix-arg nil))
|
|
|
|
|
;; otherwise, reset prefix arg and call appropriate command
|
|
|
|
|
(setq value (if (null value) 1 value))
|
|
|
|
|
(setq prefix-arg nil)
|
|
|
|
|
(cond
|
|
|
|
|
;; If we change ?C to ?c here, then cc will enter replacement mode
|
|
|
|
|
;; rather than deleting lines. However, it will affect 1 less line
|
|
|
|
|
;; than normal. We decided to not use replacement mode here and
|
|
|
|
|
;; follow Vi, since replacement mode on n full lines can be achieved
|
|
|
|
|
;; with nC.
|
|
|
|
|
((equal com '(?c . ?c)) (viper-line (cons value ?C)))
|
|
|
|
|
((equal com '(?d . ?d)) (viper-line (cons value ?D)))
|
|
|
|
|
((equal com '(?d . ?y)) (viper-yank-defun))
|
|
|
|
|
((equal com '(?y . ?y)) (viper-line (cons value ?Y)))
|
|
|
|
|
((equal com '(?< . ?<)) (viper-line (cons value ?<)))
|
|
|
|
|
((equal com '(?> . ?>)) (viper-line (cons value ?>)))
|
|
|
|
|
((equal com '(?! . ?!)) (viper-line (cons value ?!)))
|
|
|
|
|
((equal com '(?= . ?=)) (viper-line (cons value ?=)))
|
|
|
|
|
;; gg acts as G0
|
|
|
|
|
((equal (car com) ?g) (viper-goto-line 0))
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(t (error "Viper bell")))))
|
2010-01-18 04:39:40 +00:00
|
|
|
|
|
2006-10-23 19:20:15 +00:00
|
|
|
|
(if cmd-to-exec-at-end
|
|
|
|
|
(progn
|
|
|
|
|
(setq last-command-event
|
|
|
|
|
(viper-copy-event
|
* ediff-init.el (ediff-xemacs-p, ediff-emacs-p): Remove.
(ediff-has-face-support-p, ediff-BAD-INFO, ediff-check-version)
(ediff-current-diff-A, ediff-current-diff-B)
(ediff-current-diff-C, ediff-fine-diff-C, ediff-fine-diff-A)
(ediff-fine-diff-B, ediff-fine-diff-Ancestor, ediff-even-diff-A)
(ediff-even-diff-B, ediff-even-diff-C, ediff-even-diff-Ancestor)
(ediff-odd-diff-A, ediff-odd-diff-B, ediff-odd-diff-C)
(ediff-odd-diff-Ancestor, ediff-reset-mouse):
* ediff-wind.el (ediff-narrow-control-frame-leftward-shift)
(ediff-setup-windows-plain-merge)
(ediff-setup-windows-plain-compare, ediff-setup-control-frame)
(ediff-refresh-control-frame, ediff-get-visible-buffer-window):
* ediff-util.el (ediff-setup-keymap, )
(ediff-toggle-wide-display, ediff-toggle-multiframe)
(ediff-toggle-use-toolbar, ediff-really-quit)
(ediff-good-frame-under-mouse)
(ediff-highlight-diff-in-one-buffer)
(ediff-remove-flags-from-buffer, ediff-place-flags-in-buffer1)
(ediff-make-bullet-proof-overlay):
* ediff-mult.el (ediff-setup-meta-map, ediff-emacs-p)
(ediff-set-meta-overlay):
* ediff-help.el (ediff-help-region-map, ediff-set-help-overlays):
* ediff.el (ediff-documentation): Replace ediff-xemacs-p and
ediff-emacs-p with their former definitions.
* emulation/viper-init.el (viper-xemacs-p, viper-emacs-p): Remove.
(viper-has-face-support-p, viper-inactivate-input-method)
(viper-activate-input-method)
(viper-use-replace-region-delimiters, viper-restore-cursor-type):
* emulation/viper-mous.el (viper-multiclick-timeout)
(viper-surrounding-word, viper-mouse-click-insert-word)
(viper-mouse-click-search-word, viper-parse-mouse-key):
* emulation/viper-macs.el (viper-char-array-to-macro):
* emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings):
* emulation/viper-util.el (viper-get-saved-cursor-color-in-replace-mode)
(viper-get-saved-cursor-color-in-insert-mode)
(viper-get-saved-cursor-color-in-emacs-mode)
(viper-check-version, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-set-minibuffer-overlay)
(viper-check-minibuffer-overlay, viper-read-key-sequence)
(viper-key-to-emacs-key): Replace viper-xemacs-p and viper-emacs-p
with their former definitions.
(viper-eventify-list-xemacs): Only do work for XEmacs.
(viper-set-unread-command-events): Only do work for Emacs.
(viper-overlay-p, viper-make-overlay, viper-overlay-live-p)
(viper-move-overlay, viper-overlay-start, viper-overlay-end)
(viper-overlay-get, viper-overlay-put, viper-read-event)
(viper-characterp, viper-int-to-char, viper-get-face)
(viper-color-defined-p, viper-iconify): New defaliases replacing
the old fsets.
* progmodes/fortran.el (comment-region-function)
(uncomment-region-function): Pacify byte compiler.
* vc.el (vc-diff-internal): Remove code for an old version of
gnus.
2007-11-09 05:20:57 +00:00
|
|
|
|
(if (featurep 'xemacs) (character-to-event char) char)))
|
2007-06-12 19:20:25 +00:00
|
|
|
|
(condition-case err
|
2006-10-23 19:20:15 +00:00
|
|
|
|
(funcall cmd-to-exec-at-end cmd-info)
|
|
|
|
|
(error
|
2007-06-12 19:20:25 +00:00
|
|
|
|
(error "%s" (error-message-string err))))))
|
2006-10-23 19:20:15 +00:00
|
|
|
|
))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-describe-arg (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let (val com)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq val (viper-P-val arg)
|
|
|
|
|
com (viper-getcom arg))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (null val)
|
|
|
|
|
(if (null com)
|
|
|
|
|
(message "Value is nil, and command is nil")
|
|
|
|
|
(message "Value is nil, and command is `%c'" com))
|
|
|
|
|
(if (null com)
|
|
|
|
|
(message "Value is `%d', and command is nil" val)
|
|
|
|
|
(message "Value is `%d', and command is `%c'" val com)))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-digit-argument (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Begin numeric argument for the next command."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(viper-prefix-arg-value
|
2009-11-22 03:14:14 +00:00
|
|
|
|
(viper-last-command-char) (if (consp arg) (cdr arg) nil)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-command-argument (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Accept a motion command as an argument."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((viper-intermediate-command 'viper-command-argument))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case nil
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-prefix-arg-com
|
2009-11-22 03:14:14 +00:00
|
|
|
|
(viper-last-command-char)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cond ((null arg) nil)
|
|
|
|
|
((consp arg) (car arg))
|
|
|
|
|
((integerp arg) arg)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (error viper-InvalidCommandArgument)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cond ((null arg) nil)
|
|
|
|
|
((consp arg) (cdr arg))
|
|
|
|
|
((integerp arg) nil)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (error viper-InvalidCommandArgument))))
|
|
|
|
|
(quit (setq viper-use-register nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(signal 'quit nil)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-deactivate-mark)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; repeat last destructive command
|
|
|
|
|
|
|
|
|
|
;; Append region to text in register REG.
|
|
|
|
|
;; START and END are buffer positions indicating what to append.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-append-to-register (reg start end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(set-register reg (concat (if (stringp (get-register reg))
|
|
|
|
|
(get-register reg) "")
|
|
|
|
|
(buffer-substring start end))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; Saves last inserted text for possible use by viper-repeat command.
|
|
|
|
|
(defun viper-save-last-insertion (beg end)
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(condition-case nil
|
|
|
|
|
(setq viper-last-insertion (buffer-substring beg end))
|
|
|
|
|
(error
|
|
|
|
|
;; beg or end marker are somehow screwed up
|
|
|
|
|
(setq viper-last-insertion nil)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-insertion (buffer-substring beg end))
|
|
|
|
|
(or (< (length viper-d-com) 5)
|
|
|
|
|
(setcar (nthcdr 4 viper-d-com) viper-last-insertion))
|
|
|
|
|
(or (null viper-command-ring)
|
|
|
|
|
(ring-empty-p viper-command-ring)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setcar (nthcdr 4 (viper-current-ring-item viper-command-ring))
|
|
|
|
|
viper-last-insertion)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; del most recent elt, if identical to the second most-recent
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-cleanup-ring viper-command-ring)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-yank-last-insertion ()
|
|
|
|
|
"Inserts the text saved by the previous viper-save-last-insertion command."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case nil
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(insert viper-last-insertion)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error nil)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; define functions to be executed
|
|
|
|
|
|
|
|
|
|
;; invoked by the `C' command
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(defun viper-exec-change (m-com com)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(or (and (markerp viper-com-point) (marker-position viper-com-point))
|
|
|
|
|
(set-marker viper-com-point (point) (current-buffer)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; handle C cmd at the eol and at eob.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (or (and (eolp) (= viper-com-point (point)))
|
|
|
|
|
(= viper-com-point (point-max)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(insert " ")(backward-char 1)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (= viper-com-point (point))
|
|
|
|
|
(viper-forward-char-carefully))
|
2011-10-30 03:39:11 +00:00
|
|
|
|
(push-mark viper-com-point)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (eq m-com 'viper-next-line-at-bol)
|
|
|
|
|
(viper-enlarge-region (mark t) (point)))
|
|
|
|
|
(if (< (point) (mark t))
|
|
|
|
|
(exchange-point-and-mark))
|
|
|
|
|
(if (eq (preceding-char) ?\n)
|
|
|
|
|
(viper-backward-char-carefully)) ; give back the newline
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
|
|
|
|
(viper-change-subr (mark t) (point))
|
2011-10-30 03:39:11 +00:00
|
|
|
|
(viper-change (mark t) (point))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; this is invoked by viper-substitute-line
|
|
|
|
|
(defun viper-exec-Change (m-com com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(set-mark viper-com-point)
|
|
|
|
|
(viper-enlarge-region (mark t) (point))
|
|
|
|
|
(if viper-use-register
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-valid-register viper-use-register '(letter digit))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(copy-to-register
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-use-register (mark t) (point) nil))
|
|
|
|
|
((viper-valid-register viper-use-register '(Letter))
|
|
|
|
|
(viper-append-to-register
|
|
|
|
|
(downcase viper-use-register) (mark t) (point)))
|
|
|
|
|
(t (setq viper-use-register nil)
|
|
|
|
|
(error viper-InvalidRegister viper-use-register)))
|
|
|
|
|
(setq viper-use-register nil)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(delete-region (mark t) (point)))
|
|
|
|
|
(open-line 1)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
|
|
|
|
(viper-yank-last-insertion)
|
|
|
|
|
(viper-change-state-to-insert)
|
|
|
|
|
))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
|
|
|
|
|
(defun viper-exec-delete (m-com com)
|
|
|
|
|
(or (and (markerp viper-com-point) (marker-position viper-com-point))
|
|
|
|
|
(set-marker viper-com-point (point) (current-buffer)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(let (chars-deleted)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-use-register
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-valid-register viper-use-register '(letter digit))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(copy-to-register
|
1999-11-01 07:16:15 +00:00
|
|
|
|
viper-use-register viper-com-point (point) nil))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((viper-valid-register viper-use-register '(Letter))
|
|
|
|
|
(viper-append-to-register
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(downcase viper-use-register) viper-com-point (point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (setq viper-use-register nil)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(error viper-InvalidRegister viper-use-register)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-use-register nil)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq last-command
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(if (eq last-command 'd-command) 'kill-region nil))
|
|
|
|
|
(setq chars-deleted (abs (- (point) viper-com-point)))
|
|
|
|
|
(if (> chars-deleted viper-change-notification-threshold)
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless (viper-is-in-minibuffer)
|
|
|
|
|
(message "Deleted %d characters" chars-deleted)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(kill-region viper-com-point (point))
|
|
|
|
|
(setq this-command 'd-command)
|
|
|
|
|
(if viper-ex-style-motion
|
|
|
|
|
(if (and (eolp) (not (bolp))) (backward-char 1)))))
|
|
|
|
|
|
|
|
|
|
(defun viper-exec-Delete (m-com com)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(set-mark viper-com-point)
|
|
|
|
|
(viper-enlarge-region (mark t) (point))
|
|
|
|
|
(let (lines-deleted)
|
|
|
|
|
(if viper-use-register
|
|
|
|
|
(progn
|
|
|
|
|
(cond ((viper-valid-register viper-use-register '(letter digit))
|
|
|
|
|
(copy-to-register
|
|
|
|
|
viper-use-register (mark t) (point) nil))
|
|
|
|
|
((viper-valid-register viper-use-register '(Letter))
|
|
|
|
|
(viper-append-to-register
|
|
|
|
|
(downcase viper-use-register) (mark t) (point)))
|
|
|
|
|
(t (setq viper-use-register nil)
|
|
|
|
|
(error viper-InvalidRegister viper-use-register)))
|
|
|
|
|
(setq viper-use-register nil)))
|
|
|
|
|
(setq last-command
|
|
|
|
|
(if (eq last-command 'D-command) 'kill-region nil))
|
|
|
|
|
(setq lines-deleted (count-lines (point) viper-com-point))
|
|
|
|
|
(if (> lines-deleted viper-change-notification-threshold)
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless (viper-is-in-minibuffer)
|
|
|
|
|
(message "Deleted %d lines" lines-deleted)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(kill-region (mark t) (point))
|
|
|
|
|
(if (eq m-com 'viper-line) (setq this-command 'D-command)))
|
|
|
|
|
(back-to-indentation)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; save region
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exec-yank (m-com com)
|
|
|
|
|
(or (and (markerp viper-com-point) (marker-position viper-com-point))
|
|
|
|
|
(set-marker viper-com-point (point) (current-buffer)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(let (chars-saved)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-use-register
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-valid-register viper-use-register '(letter digit))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(copy-to-register
|
1999-11-01 07:16:15 +00:00
|
|
|
|
viper-use-register viper-com-point (point) nil))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((viper-valid-register viper-use-register '(Letter))
|
|
|
|
|
(viper-append-to-register
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(downcase viper-use-register) viper-com-point (point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (setq viper-use-register nil)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(error viper-InvalidRegister viper-use-register)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-use-register nil)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq last-command nil)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(copy-region-as-kill viper-com-point (point))
|
|
|
|
|
(setq chars-saved (abs (- (point) viper-com-point)))
|
|
|
|
|
(if (> chars-saved viper-change-notification-threshold)
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless (viper-is-in-minibuffer)
|
|
|
|
|
(message "Saved %d characters" chars-saved)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(goto-char viper-com-point)))
|
|
|
|
|
|
|
|
|
|
;; save lines
|
|
|
|
|
(defun viper-exec-Yank (m-com com)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(set-mark viper-com-point)
|
|
|
|
|
(viper-enlarge-region (mark t) (point))
|
|
|
|
|
(let (lines-saved)
|
|
|
|
|
(if viper-use-register
|
|
|
|
|
(progn
|
|
|
|
|
(cond ((viper-valid-register viper-use-register '(letter digit))
|
|
|
|
|
(copy-to-register
|
|
|
|
|
viper-use-register (mark t) (point) nil))
|
|
|
|
|
((viper-valid-register viper-use-register '(Letter))
|
|
|
|
|
(viper-append-to-register
|
|
|
|
|
(downcase viper-use-register) (mark t) (point)))
|
|
|
|
|
(t (setq viper-use-register nil)
|
|
|
|
|
(error viper-InvalidRegister viper-use-register)))
|
|
|
|
|
(setq viper-use-register nil)))
|
|
|
|
|
(setq last-command nil)
|
|
|
|
|
(copy-region-as-kill (mark t) (point))
|
|
|
|
|
(setq lines-saved (count-lines (mark t) (point)))
|
|
|
|
|
(if (> lines-saved viper-change-notification-threshold)
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless (viper-is-in-minibuffer)
|
|
|
|
|
(message "Saved %d lines" lines-saved)))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-deactivate-mark)
|
|
|
|
|
(goto-char viper-com-point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exec-bang (m-com com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(set-mark viper-com-point)
|
|
|
|
|
(viper-enlarge-region (mark t) (point))
|
1997-07-25 01:42:53 +00:00
|
|
|
|
(exchange-point-and-mark)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(shell-command-on-region
|
|
|
|
|
(mark t) (point)
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(if (viper= com ?!)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-shell-com
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(viper-read-string-with-history
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"!"
|
|
|
|
|
nil
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-shell-history
|
|
|
|
|
(car viper-shell-history)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-last-shell-com)
|
2013-06-18 20:24:44 +00:00
|
|
|
|
t t)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exec-equals (m-com com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(set-mark viper-com-point)
|
|
|
|
|
(viper-enlarge-region (mark t) (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (> (mark t) (point)) (exchange-point-and-mark))
|
|
|
|
|
(indent-region (mark t) (point) nil)))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exec-shift (m-com com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(set-mark viper-com-point)
|
|
|
|
|
(viper-enlarge-region (mark t) (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (> (mark t) (point)) (exchange-point-and-mark))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(indent-rigidly (mark t) (point)
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(if (viper= com ?>)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-shift-width
|
|
|
|
|
(- viper-shift-width))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; return point to where it was before shift
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(goto-char viper-com-point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; this is needed because some commands fake com by setting it to ?r, which
|
|
|
|
|
;; denotes repeated insert command.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-exec-dummy (m-com com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exec-buffer-search (m-com com)
|
2005-02-19 19:32:47 +00:00
|
|
|
|
(setq viper-s-string
|
|
|
|
|
(regexp-quote (buffer-substring (point) viper-com-point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-s-forward t)
|
|
|
|
|
(setq viper-search-history (cons viper-s-string viper-search-history))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(setq viper-intermediate-command 'viper-exec-buffer-search)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-search viper-s-string viper-s-forward 1))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defvar viper-exec-array (make-vector 128 nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Using a dispatch array allows adding functions like buffer search
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; without affecting other functions. Buffer search can now be bound
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; to any character.
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(aset viper-exec-array ?c 'viper-exec-change)
|
|
|
|
|
(aset viper-exec-array ?C 'viper-exec-Change)
|
|
|
|
|
(aset viper-exec-array ?d 'viper-exec-delete)
|
|
|
|
|
(aset viper-exec-array ?D 'viper-exec-Delete)
|
|
|
|
|
(aset viper-exec-array ?y 'viper-exec-yank)
|
|
|
|
|
(aset viper-exec-array ?Y 'viper-exec-Yank)
|
|
|
|
|
(aset viper-exec-array ?r 'viper-exec-dummy)
|
|
|
|
|
(aset viper-exec-array ?! 'viper-exec-bang)
|
|
|
|
|
(aset viper-exec-array ?< 'viper-exec-shift)
|
|
|
|
|
(aset viper-exec-array ?> 'viper-exec-shift)
|
|
|
|
|
(aset viper-exec-array ?= 'viper-exec-equals)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; This function is called by various movement commands to execute a
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; destructive command on the region specified by the movement command. For
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; instance, if the user types cw, then the command viper-forward-word will
|
|
|
|
|
;; call viper-execute-com to execute viper-exec-change, which eventually will
|
|
|
|
|
;; call viper-change to invoke the replace mode on the region.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;;
|
2011-11-13 07:48:23 +00:00
|
|
|
|
;; The var viper-d-com is set to (M-COM VAL COM REG INSERTED-TEXT COMMAND-KEYS)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; via a call to viper-set-destructive-command, for later use by viper-repeat.
|
|
|
|
|
(defun viper-execute-com (m-com val com)
|
|
|
|
|
(let ((reg viper-use-register))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; this is the special command `#'
|
|
|
|
|
(if (> com 128)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-special-prefix-com (- com 128))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(let ((fn (aref viper-exec-array com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (null fn)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(error "%c: %s" com viper-InvalidViCommand)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(funcall fn m-com com))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (viper-dotable-command-p com)
|
|
|
|
|
(viper-set-destructive-command
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(list m-com val com reg nil nil)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-repeat (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Re-execute last destructive command.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
Use the info in viper-d-com, which has the form
|
1997-06-02 22:50:31 +00:00
|
|
|
|
\(com val ch reg inserted-text command-keys\),
|
|
|
|
|
where `com' is the command to be re-executed, `val' is the
|
|
|
|
|
argument to `com', `ch' is a flag for repeat, and `reg' is optional;
|
|
|
|
|
if it exists, it is the name of the register for `com'.
|
2010-01-18 04:39:40 +00:00
|
|
|
|
If the prefix argument ARG is non-nil, it is used instead of `val'."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((save-point (point)) ; save point before repeating prev cmd
|
|
|
|
|
;; Pass along that we are repeating a destructive command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; This tells viper-set-destructive-command not to update
|
|
|
|
|
;; viper-command-ring
|
|
|
|
|
(viper-intermediate-command 'viper-repeat))
|
|
|
|
|
(if (eq last-command 'viper-undo)
|
|
|
|
|
;; if the last command was viper-undo, then undo-more
|
|
|
|
|
(viper-undo-more)
|
|
|
|
|
;; otherwise execute the command stored in viper-d-com. if arg is
|
|
|
|
|
;; non-nil its prefix value is used as new prefix value for the command.
|
|
|
|
|
(let ((m-com (car viper-d-com))
|
|
|
|
|
(val (viper-P-val arg))
|
|
|
|
|
(com (nth 2 viper-d-com))
|
|
|
|
|
(reg (nth 3 viper-d-com)))
|
|
|
|
|
(if (null val) (setq val (nth 1 viper-d-com)))
|
2001-07-15 19:53:53 +00:00
|
|
|
|
(if (null m-com) (error "No previous command to repeat"))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-use-register reg)
|
|
|
|
|
(if (nth 4 viper-d-com) ; text inserted by command
|
|
|
|
|
(setq viper-last-insertion (nth 4 viper-d-com)
|
|
|
|
|
viper-d-char (nth 4 viper-d-com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(funcall m-com (cons val com))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((and (< save-point (point)) viper-keep-point-on-repeat)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(goto-char save-point)) ; go back to before repeat.
|
1997-08-22 03:15:57 +00:00
|
|
|
|
((and (< save-point (point)) viper-ex-style-editing)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(or (bolp) (backward-char 1))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eolp) (not (bolp)))
|
|
|
|
|
(backward-char 1))
|
|
|
|
|
))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-adjust-undo) ; take care of undo
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; If the prev cmd was rotating the command ring, this means that `.' has
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; just executed a command from that ring. So, push it on the ring again.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; If we are just executing previous command , then don't push viper-d-com
|
|
|
|
|
;; because viper-d-com is not fully constructed in this case (its keys and
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; the inserted text may be nil). Besides, in this case, the command
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; executed by `.' is already on the ring.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (eq last-command 'viper-display-current-destructive-command)
|
|
|
|
|
(viper-push-onto-ring viper-d-com 'viper-command-ring))
|
|
|
|
|
(viper-deactivate-mark)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-repeat-from-history ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Repeat a destructive command from history.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
Doesn't change viper-command-ring in any way, so `.' will work as before
|
1997-06-02 22:50:31 +00:00
|
|
|
|
executing this command.
|
|
|
|
|
This command is supposed to be bound to a two-character Vi macro where
|
1999-11-01 07:16:15 +00:00
|
|
|
|
the second character is a digit 0 to 9. The digit indicates which
|
1997-06-02 22:50:31 +00:00
|
|
|
|
history command to execute. `<char>0' is equivalent to `.', `<char>1'
|
|
|
|
|
invokes the command before that, etc."
|
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let* ((viper-intermediate-command 'repeating-display-destructive-command)
|
|
|
|
|
(idx (cond (viper-this-kbd-macro
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(string-to-number
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(symbol-name (elt viper-this-kbd-macro 1))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(t 0)))
|
|
|
|
|
(num idx)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-d-com viper-d-com))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
(or (and (numberp num) (<= 0 num) (<= num 9))
|
|
|
|
|
(progn
|
|
|
|
|
(setq idx 0
|
|
|
|
|
num 0)
|
|
|
|
|
(message
|
1997-08-02 06:56:24 +00:00
|
|
|
|
"`viper-repeat-from-history' must be invoked as a Vi macro bound to `<key><digit>'")))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(while (< 0 num)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-d-com (viper-special-ring-rotate1 viper-command-ring -1))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq num (1- num)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-repeat nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(while (> idx num)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-special-ring-rotate1 viper-command-ring 1)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq num (1+ num)))
|
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; The hash-command. It is invoked interactively by the key sequence #<char>.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; The chars that can follow `#' are determined by viper-hash-command-p
|
|
|
|
|
(defun viper-special-prefix-com (char)
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(cond ((viper= char ?c)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(downcase-region (min viper-com-point (point))
|
|
|
|
|
(max viper-com-point (point))))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= char ?C)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(upcase-region (min viper-com-point (point))
|
|
|
|
|
(max viper-com-point (point))))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= char ?g)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(push-mark viper-com-point t)
|
2006-10-23 19:20:15 +00:00
|
|
|
|
;; execute the last emacs kbd macro on each line of the region
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-global-execute))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= char ?q)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(push-mark viper-com-point t)
|
|
|
|
|
(viper-quote-region))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= char ?s)
|
|
|
|
|
(funcall viper-spell-function viper-com-point (point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (error "#%c: %s" char viper-InvalidViCommand))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; undoing
|
|
|
|
|
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
;; hook used inside undo
|
|
|
|
|
(defvar viper-undo-functions nil)
|
|
|
|
|
|
|
|
|
|
;; Runs viper-before-change-functions inside before-change-functions
|
|
|
|
|
(defun viper-undo-sentinel (beg end length)
|
|
|
|
|
(run-hook-with-args 'viper-undo-functions beg end length))
|
|
|
|
|
|
|
|
|
|
(add-hook 'after-change-functions 'viper-undo-sentinel)
|
|
|
|
|
|
|
|
|
|
;; Hook used in viper-undo
|
|
|
|
|
(defun viper-after-change-undo-hook (beg end len)
|
2006-08-31 03:39:42 +00:00
|
|
|
|
(if (and (boundp 'undo-in-progress) undo-in-progress)
|
2006-08-25 16:06:57 +00:00
|
|
|
|
(setq undo-beg-posn beg
|
|
|
|
|
undo-end-posn (or end beg))
|
|
|
|
|
;; some other hooks may be changing various text properties in
|
|
|
|
|
;; the buffer in response to 'undo'; so remove this hook to avoid
|
|
|
|
|
;; its repeated invocation
|
|
|
|
|
(remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)
|
|
|
|
|
))
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-undo ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Undo previous change."
|
|
|
|
|
(interactive)
|
|
|
|
|
(message "undo!")
|
|
|
|
|
(let ((modified (buffer-modified-p))
|
|
|
|
|
(before-undo-pt (point-marker))
|
|
|
|
|
undo-beg-posn undo-end-posn)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
;; the viper-after-change-undo-hook removes itself after the 1st invocation
|
|
|
|
|
(add-hook 'viper-undo-functions 'viper-after-change-undo-hook nil 'local)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(undo-start)
|
|
|
|
|
(undo-more 2)
|
2006-08-25 16:06:57 +00:00
|
|
|
|
;;(setq undo-beg-posn (or undo-beg-posn (point))
|
|
|
|
|
;; undo-end-posn (or undo-end-posn (point)))
|
|
|
|
|
;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt)
|
|
|
|
|
;; undo-end-posn (or undo-end-posn undo-beg-posn))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2006-08-25 16:06:57 +00:00
|
|
|
|
(if (and undo-beg-posn undo-end-posn)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
2006-08-25 16:06:57 +00:00
|
|
|
|
(goto-char undo-beg-posn)
|
|
|
|
|
(sit-for 0)
|
|
|
|
|
(if (and viper-keep-point-on-undo
|
|
|
|
|
(pos-visible-in-window-p before-undo-pt))
|
|
|
|
|
(progn
|
|
|
|
|
(push-mark (point-marker) t)
|
|
|
|
|
(viper-sit-for-short 300)
|
|
|
|
|
(goto-char undo-end-posn)
|
|
|
|
|
(viper-sit-for-short 300)
|
|
|
|
|
(if (pos-visible-in-window-p undo-beg-posn)
|
|
|
|
|
(goto-char before-undo-pt)
|
|
|
|
|
(goto-char undo-beg-posn)))
|
|
|
|
|
(push-mark before-undo-pt t))
|
|
|
|
|
))
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eolp) (not (bolp))) (backward-char 1))
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq this-command 'viper-undo))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Continue undoing previous changes.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-undo-more ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(message "undo more!")
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(undo-more 1)
|
|
|
|
|
(error (beep)
|
|
|
|
|
(message "No further undo information in this buffer")))
|
|
|
|
|
(if (and (eolp) (not (bolp))) (backward-char 1))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq this-command 'viper-undo))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; The following two functions are used to set up undo properly.
|
|
|
|
|
;; In VI, unlike Emacs, if you open a line, say, and add a bunch of lines,
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; they are undone all at once.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-adjust-undo ()
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if viper-undo-needs-adjustment
|
|
|
|
|
(let ((inhibit-quit t)
|
|
|
|
|
tmp tmp2)
|
|
|
|
|
(setq viper-undo-needs-adjustment nil)
|
|
|
|
|
(if (listp buffer-undo-list)
|
|
|
|
|
(if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list))
|
|
|
|
|
(progn
|
|
|
|
|
(setq tmp2 (cdr tmp)) ; the part after mark
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; cut tail from buffer-undo-list temporarily by direct
|
|
|
|
|
;; manipulation with pointers in buffer-undo-list
|
|
|
|
|
(setcdr tmp nil)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(setq buffer-undo-list (delq nil buffer-undo-list))
|
|
|
|
|
(setq buffer-undo-list
|
|
|
|
|
(delq viper-buffer-undo-list-mark buffer-undo-list))
|
|
|
|
|
;; restore tail of buffer-undo-list
|
|
|
|
|
(setq buffer-undo-list (nconc buffer-undo-list tmp2)))
|
|
|
|
|
(setq buffer-undo-list (delq nil buffer-undo-list)))))
|
|
|
|
|
))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
(defun viper-set-complex-command-for-undo ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (listp buffer-undo-list)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (not viper-undo-needs-adjustment)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((inhibit-quit t))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq buffer-undo-list
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cons viper-buffer-undo-list-mark buffer-undo-list))
|
|
|
|
|
(setq viper-undo-needs-adjustment t)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
;;; Viper's destructive Command ring utilities
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-display-current-destructive-command ()
|
|
|
|
|
(let ((text (nth 4 viper-d-com))
|
|
|
|
|
(keys (nth 5 viper-d-com))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(max-text-len 30))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq this-command 'viper-display-current-destructive-command)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(message " `.' runs %s%s"
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(concat "`" (viper-array-to-string keys) "'")
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(viper-abbreviate-string
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
2008-04-03 21:04:18 +00:00
|
|
|
|
(replace-in-string ; xemacs
|
|
|
|
|
(cond ((characterp text) (char-to-string text))
|
|
|
|
|
((stringp text) text)
|
|
|
|
|
(t ""))
|
|
|
|
|
"\n" "^J")
|
|
|
|
|
text ; emacs
|
|
|
|
|
)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
max-text-len
|
|
|
|
|
" inserting `" "'" " ......."))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; don't change viper-d-com if it was viper-repeat command invoked with `.'
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; or in some other way (non-interactively).
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-set-destructive-command (list)
|
|
|
|
|
(or (eq viper-intermediate-command 'viper-repeat)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-d-com list)
|
|
|
|
|
(setcar (nthcdr 5 viper-d-com)
|
|
|
|
|
(viper-array-to-string (if (arrayp viper-this-command-keys)
|
|
|
|
|
viper-this-command-keys
|
|
|
|
|
(this-command-keys))))
|
|
|
|
|
(viper-push-onto-ring viper-d-com 'viper-command-ring)))
|
|
|
|
|
(setq viper-this-command-keys nil))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-prev-destructive-command (next)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Find previous destructive command in the history of destructive commands.
|
|
|
|
|
With prefix argument, find next destructive command."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let (cmd viper-intermediate-command)
|
|
|
|
|
(if (eq last-command 'viper-display-current-destructive-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; repeated search through command history
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-intermediate-command
|
|
|
|
|
'repeating-display-destructive-command)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; first search through command history--set temp ring
|
2007-11-02 06:03:12 +00:00
|
|
|
|
(setq viper-temp-command-ring (ring-copy viper-command-ring)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq cmd (if next
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-special-ring-rotate1 viper-temp-command-ring 1)
|
|
|
|
|
(viper-special-ring-rotate1 viper-temp-command-ring -1)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (null cmd)
|
|
|
|
|
()
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-d-com cmd))
|
|
|
|
|
(viper-display-current-destructive-command)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-next-destructive-command ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Find next destructive command in the history of destructive commands."
|
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-prev-destructive-command 'next))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-insert-prev-from-insertion-ring (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Cycle through insertion ring in the direction of older insertions.
|
|
|
|
|
Undoes previous insertion and inserts new.
|
|
|
|
|
With prefix argument, cycles in the direction of newer elements.
|
|
|
|
|
In minibuffer, this command executes whatever the invocation key is bound
|
|
|
|
|
to in the global map, instead of cycling through the insertion ring."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let (viper-intermediate-command)
|
|
|
|
|
(if (eq last-command 'viper-insert-from-insertion-ring)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn ; repeated search through insertion history
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-intermediate-command 'repeating-insertion-from-ring)
|
|
|
|
|
(if (eq viper-current-state 'replace-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(undo 1)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-last-inserted-string-from-insertion-ring
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-delete-char
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(length viper-last-inserted-string-from-insertion-ring))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
;;first search through insertion history
|
2007-11-02 06:03:12 +00:00
|
|
|
|
(setq viper-temp-insertion-ring (ring-copy viper-insertion-ring)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq this-command 'viper-insert-from-insertion-ring)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; so that things will be undone properly
|
|
|
|
|
(setq buffer-undo-list (cons nil buffer-undo-list))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-inserted-string-from-insertion-ring
|
|
|
|
|
(viper-special-ring-rotate1 viper-temp-insertion-ring (if arg 1 -1)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; this change of viper-intermediate-command must come after
|
|
|
|
|
;; viper-special-ring-rotate1, so that the ring will rotate, but before the
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; insertion.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-intermediate-command nil)
|
|
|
|
|
(if viper-last-inserted-string-from-insertion-ring
|
|
|
|
|
(insert viper-last-inserted-string-from-insertion-ring))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-insert-next-from-insertion-ring ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Cycle through insertion ring in the direction of older insertions.
|
|
|
|
|
Undo previous insertion and inserts new."
|
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-insert-prev-from-insertion-ring 'next))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; some region utilities
|
|
|
|
|
|
|
|
|
|
;; If at the last line of buffer, add \\n before eob, if newline is missing.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-add-newline-at-eob-if-necessary ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line)
|
|
|
|
|
;; make sure all lines end with newline, unless in the minibuffer or
|
|
|
|
|
;; when requested otherwise (require-final-newline is nil)
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(if (and (eobp)
|
|
|
|
|
(not (bolp))
|
|
|
|
|
require-final-newline
|
2006-12-23 21:33:50 +00:00
|
|
|
|
;; add newline only if we actually edited buffer. otherwise it
|
|
|
|
|
;; might unintentionally modify binary buffers
|
2010-01-18 04:39:40 +00:00
|
|
|
|
(buffer-modified-p)
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
(not (viper-is-in-minibuffer))
|
|
|
|
|
(not buffer-read-only))
|
2006-12-23 21:33:50 +00:00
|
|
|
|
;; text property may be read-only
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(insert "\n")
|
|
|
|
|
(error nil))
|
|
|
|
|
))
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-yank-defun ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(mark-defun)
|
|
|
|
|
(copy-region-as-kill (point) (mark t)))
|
|
|
|
|
|
|
|
|
|
;; Enlarge region between BEG and END.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-enlarge-region (beg end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(or beg (setq beg end)) ; if beg is nil, set to end
|
|
|
|
|
(or end (setq end beg)) ; if end is nil, set to beg
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (< beg end)
|
|
|
|
|
(progn (goto-char beg) (set-mark end))
|
|
|
|
|
(goto-char end)
|
|
|
|
|
(set-mark beg))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(exchange-point-and-mark)
|
|
|
|
|
(if (or (not (eobp)) (not (bolp))) (forward-line 1))
|
|
|
|
|
(if (not (eobp)) (beginning-of-line))
|
|
|
|
|
(if (> beg end) (exchange-point-and-mark)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Quote region by each line with a user supplied string.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-quote-region ()
|
1997-11-25 02:10:08 +00:00
|
|
|
|
(let ((quote-str viper-quote-string)
|
2011-12-05 08:55:25 +00:00
|
|
|
|
(donot-change-default t))
|
1997-11-25 02:10:08 +00:00
|
|
|
|
(setq quote-str
|
|
|
|
|
(viper-read-string-with-history
|
|
|
|
|
"Quote string: "
|
|
|
|
|
nil
|
|
|
|
|
'viper-quote-region-history
|
|
|
|
|
(cond ((string-match "tex.*-mode" (symbol-name major-mode)) "%%")
|
|
|
|
|
((string-match "java.*-mode" (symbol-name major-mode)) "//")
|
|
|
|
|
((string-match "perl.*-mode" (symbol-name major-mode)) "#")
|
|
|
|
|
((string-match "lisp.*-mode" (symbol-name major-mode)) ";;")
|
|
|
|
|
((memq major-mode '(c-mode cc-mode c++-mode)) "//")
|
|
|
|
|
((memq major-mode '(sh-mode shell-mode)) "#")
|
2011-12-05 08:55:25 +00:00
|
|
|
|
(t (setq donot-change-default nil)
|
1997-11-25 02:10:08 +00:00
|
|
|
|
quote-str))))
|
2011-12-05 08:55:25 +00:00
|
|
|
|
(or donot-change-default
|
1997-11-25 02:10:08 +00:00
|
|
|
|
(setq viper-quote-string quote-str))
|
|
|
|
|
(viper-enlarge-region (point) (mark t))
|
|
|
|
|
(if (> (point) (mark t)) (exchange-point-and-mark))
|
|
|
|
|
(insert quote-str)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(beginning-of-line)
|
1997-11-25 02:10:08 +00:00
|
|
|
|
(forward-line 1)
|
|
|
|
|
(while (and (< (point) (mark t)) (bolp))
|
|
|
|
|
(insert quote-str)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(forward-line 1))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Tells whether BEG is on the same line as END.
|
|
|
|
|
;; If one of the args is nil, it'll return nil.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-same-line (beg end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((selective-display nil)
|
|
|
|
|
(incr 0)
|
|
|
|
|
temp)
|
|
|
|
|
(if (and beg end (> beg end))
|
|
|
|
|
(setq temp beg
|
|
|
|
|
beg end
|
|
|
|
|
end temp))
|
|
|
|
|
(if (and beg end)
|
|
|
|
|
(cond ((or (> beg (point-max)) (> end (point-max))) ; out of range
|
|
|
|
|
nil)
|
|
|
|
|
(t
|
|
|
|
|
;; This 'if' is needed because Emacs treats the next empty line
|
|
|
|
|
;; as part of the previous line.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (= (viper-line-pos 'start) end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq incr 1))
|
|
|
|
|
(<= (+ incr (count-lines beg end)) 1))))
|
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Check if the string ends with a newline.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-end-with-a-newline-p (string)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(or (string= string "")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(= (viper-seq-last-elt string) ?\n)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-tmp-insert-at-eob (msg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((savemax (point-max)))
|
|
|
|
|
(goto-char savemax)
|
|
|
|
|
(insert msg)
|
|
|
|
|
(sit-for 2)
|
|
|
|
|
(goto-char savemax) (delete-region (point) (point-max))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
))
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Minibuffer business
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-set-minibuffer-style ()
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(add-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
|
|
|
|
|
(add-hook 'post-command-hook 'viper-minibuffer-post-command-hook))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-minibuffer-setup-sentinel ()
|
|
|
|
|
(let ((hook (if viper-vi-style-in-minibuffer
|
|
|
|
|
'viper-change-state-to-insert
|
|
|
|
|
'viper-change-state-to-emacs)))
|
2005-02-19 19:32:47 +00:00
|
|
|
|
;; making buffer-local variables so that normal buffers won't affect the
|
|
|
|
|
;; minibuffer and vice versa. Otherwise, command arguments will affect
|
|
|
|
|
;; minibuffer ops and insertions from the minibuffer will change those in
|
|
|
|
|
;; the normal buffers
|
|
|
|
|
(make-local-variable 'viper-d-com)
|
|
|
|
|
(make-local-variable 'viper-last-insertion)
|
|
|
|
|
(make-local-variable 'viper-command-ring)
|
|
|
|
|
(setq viper-d-com nil
|
|
|
|
|
viper-last-insertion nil
|
|
|
|
|
viper-command-ring nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(funcall hook)
|
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2010-11-06 19:44:11 +00:00
|
|
|
|
;; This is a temp hook that uses free variables init-message and viper-initial.
|
1999-12-07 04:58:54 +00:00
|
|
|
|
;; A dirty feature, but it is the simplest way to have it do the right thing.
|
2010-11-06 19:44:11 +00:00
|
|
|
|
;; The INIT-MESSAGE and VIPER-INITIAL vars come from the scope set by
|
2000-02-28 06:16:44 +00:00
|
|
|
|
;; viper-read-string-with-history
|
1999-12-07 04:58:54 +00:00
|
|
|
|
(defun viper-minibuffer-standard-hook ()
|
|
|
|
|
(if (stringp init-message)
|
|
|
|
|
(viper-tmp-insert-at-eob init-message))
|
2010-11-06 19:44:11 +00:00
|
|
|
|
(when (stringp viper-initial)
|
|
|
|
|
;; don't wait if we have unread events or in kbd macro
|
|
|
|
|
(or unread-command-events
|
|
|
|
|
executing-kbd-macro
|
|
|
|
|
(sit-for 840))
|
|
|
|
|
(if (fboundp 'minibuffer-prompt-end)
|
|
|
|
|
(delete-region (minibuffer-prompt-end) (point-max))
|
|
|
|
|
(erase-buffer))
|
|
|
|
|
(insert viper-initial)))
|
1999-12-07 04:58:54 +00:00
|
|
|
|
|
|
|
|
|
(defsubst viper-minibuffer-real-start ()
|
|
|
|
|
(if (fboundp 'minibuffer-prompt-end)
|
|
|
|
|
(minibuffer-prompt-end)
|
|
|
|
|
(point-min)))
|
|
|
|
|
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(defun viper-minibuffer-post-command-hook()
|
|
|
|
|
(when (active-minibuffer-window)
|
|
|
|
|
(when (< (point) (viper-minibuffer-real-start))
|
|
|
|
|
(goto-char (viper-minibuffer-real-start)))))
|
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-09-05 04:48:58 +00:00
|
|
|
|
;; Interpret last event in the local map first; if fails, use exit-minibuffer.
|
|
|
|
|
;; Run viper-minibuffer-exit-hook before exiting.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exit-minibuffer ()
|
1997-09-05 04:48:58 +00:00
|
|
|
|
"Exit minibuffer Viper way."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let (command)
|
2009-11-22 03:14:14 +00:00
|
|
|
|
(setq command (local-key-binding (char-to-string (viper-last-command-char))))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(run-hooks 'viper-minibuffer-exit-hook)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if command
|
|
|
|
|
(command-execute command)
|
|
|
|
|
(exit-minibuffer))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-09-05 04:48:58 +00:00
|
|
|
|
|
|
|
|
|
(defcustom viper-smart-suffix-list
|
2000-06-05 00:07:02 +00:00
|
|
|
|
'("" "tex" "c" "cc" "C" "java" "el" "html" "htm" "xml"
|
|
|
|
|
"pl" "flr" "P" "p" "h" "H")
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"List of suffixes that Viper tries to append to filenames ending with a `.'.
|
2002-05-31 09:26:18 +00:00
|
|
|
|
This is useful when the current directory contains files with the same
|
1999-11-01 07:16:15 +00:00
|
|
|
|
prefix and many different suffixes. Usually, only one of the suffixes
|
|
|
|
|
represents an editable file. However, file completion will stop at the `.'
|
1997-09-05 04:48:58 +00:00
|
|
|
|
The smart suffix feature lets you hit RET in such a case, and Viper will
|
|
|
|
|
select the appropriate suffix.
|
|
|
|
|
|
|
|
|
|
Suffixes are tried in the order given and the first suffix for which a
|
1999-11-01 07:16:15 +00:00
|
|
|
|
corresponding file exists is selected. If no file exists for any of the
|
1997-09-05 04:48:58 +00:00
|
|
|
|
suffixes, the user is asked to confirm.
|
|
|
|
|
|
|
|
|
|
To turn this feature off, set this variable to nil."
|
1997-09-13 06:11:09 +00:00
|
|
|
|
:type '(repeat string)
|
1997-09-30 01:13:53 +00:00
|
|
|
|
:group 'viper-misc)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-09-05 04:48:58 +00:00
|
|
|
|
|
|
|
|
|
;; Try to add a suitable suffix to files whose name ends with a `.'
|
|
|
|
|
;; Useful when the user hits RET on a non-completed file name.
|
|
|
|
|
;; Used as a minibuffer exit hook in read-file-name
|
|
|
|
|
(defun viper-file-add-suffix ()
|
|
|
|
|
(let ((count 0)
|
|
|
|
|
(len (length viper-smart-suffix-list))
|
1999-12-07 04:58:54 +00:00
|
|
|
|
(file (buffer-substring-no-properties
|
|
|
|
|
(viper-minibuffer-real-start) (point-max)))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
found key cmd suff)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(if (and viper-smart-suffix-list (string-match "\\.$" file))
|
|
|
|
|
(progn
|
|
|
|
|
(while (and (not found) (< count len))
|
|
|
|
|
(setq suff (nth count viper-smart-suffix-list)
|
|
|
|
|
count (1+ count))
|
|
|
|
|
(if (file-exists-p
|
|
|
|
|
(format "%s%s" (substitute-in-file-name file) suff))
|
|
|
|
|
(progn
|
|
|
|
|
(setq found t)
|
|
|
|
|
(insert suff))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(if found
|
|
|
|
|
()
|
|
|
|
|
(viper-tmp-insert-at-eob " [Please complete file name]")
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(unwind-protect
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(while (not (memq cmd
|
|
|
|
|
'(exit-minibuffer viper-exit-minibuffer)))
|
|
|
|
|
(setq cmd
|
|
|
|
|
(key-binding (setq key (read-key-sequence nil))))
|
|
|
|
|
(cond ((eq cmd 'self-insert-command)
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
2008-04-03 21:04:18 +00:00
|
|
|
|
(insert (events-to-keys key)) ; xemacs
|
|
|
|
|
(insert key) ; emacs
|
|
|
|
|
))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
((memq cmd '(exit-minibuffer viper-exit-minibuffer))
|
|
|
|
|
nil)
|
|
|
|
|
(t (command-execute cmd)))
|
|
|
|
|
)))
|
|
|
|
|
))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun viper-minibuffer-trim-tail ()
|
|
|
|
|
"Delete junk at the end of the first line of the minibuffer input.
|
|
|
|
|
Remove this function from `viper-minibuffer-exit-hook', if this causes
|
|
|
|
|
problems."
|
|
|
|
|
(if (viper-is-in-minibuffer)
|
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel,
viper-change-state-to-vi, viper-change-state-to-emacs):
made aware of cursor coloring in the emacs state.
(viper-special-read-and-insert-char): use read-char-exclusive.
(viper-minibuffer-trim-tail): workaround for fields in minibuffer.
* viper-init.el (viper-emacs-state-cursor-color): new variable.
* viper-util.el (viper-save-cursor-color,
viper-get-saved-cursor-color-in-replace-mode,
viper-get-saved-cursor-color-in-insert-mode,
viper-restore-cursor-color): make aware of the cursor color in emacs
state.
(viper-get-saved-cursor-color-in-emacs-mode): new function.
* ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option,
ediff-ignore-case-option3, ediff-actual-diff-options,
ediff-actual-diff3-options): new variables to control case sensitivity.
(ediff-make-diff2-buffer, ediff-setup-fine-diff-regions,
ediff-setup-diff-regions3): made aware of case-sensitivity.
(ediff-toggle-ignore-case): new function.
(ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers.
* ediff-help.el (ediff-long-help-message-narrow2,
ediff-long-help-message-compare2, ediff-long-help-message-compare3,
ediff-long-help-message-word-mode): add ignore-case command.
(ediff-help-for-quick-help): add ignore-case command.
* ediff-merg.el: move provide to the end.
* ediff-ptch.el: move provide to the end.
* ediff-wind.el: move provide to the end.
* ediff-mult.el: move provide to the end.
(ediff-set-meta-overlay): enable follow-link.
* ediff.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-patch-buffer): better heuristics.
* ediff-util.el: move provide to the end.
Break recursive load cycle in eval-when-compile.
(ediff-setup-keymap): add binding for #c. Replaced some defsubsts with
defuns.
(ediff-submit-report): pass the values of ediff-diff3-program,
ediff-diff3-options.
2006-02-19 03:16:45 +00:00
|
|
|
|
(let ((inhibit-field-text-motion t))
|
1999-12-07 04:58:54 +00:00
|
|
|
|
(goto-char (viper-minibuffer-real-start))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(end-of-line)
|
|
|
|
|
(delete-region (point) (point-max)))))
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;;; Reading string with history
|
|
|
|
|
|
2010-11-06 19:44:11 +00:00
|
|
|
|
(defun viper-read-string-with-history (prompt &optional viper-initial
|
1997-11-25 02:10:08 +00:00
|
|
|
|
history-var default keymap
|
|
|
|
|
init-message)
|
2010-11-06 19:44:11 +00:00
|
|
|
|
;; Read string, prompting with PROMPT and inserting the VIPER-INITIAL
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; value. Uses HISTORY-VAR. DEFAULT is the default value to accept if the
|
1997-11-25 02:10:08 +00:00
|
|
|
|
;; input is an empty string.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Default value is displayed until the user types something in the
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; minibuffer.
|
1997-11-25 02:10:08 +00:00
|
|
|
|
;; KEYMAP is used, if given, instead of minibuffer-local-map.
|
|
|
|
|
;; INIT-MESSAGE is the message temporarily displayed after entering the
|
|
|
|
|
;; minibuffer.
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(let ((minibuffer-setup-hook
|
|
|
|
|
;; stolen from add-hook
|
|
|
|
|
(let ((old
|
|
|
|
|
(if (boundp 'minibuffer-setup-hook)
|
|
|
|
|
minibuffer-setup-hook
|
|
|
|
|
nil)))
|
|
|
|
|
(cons
|
|
|
|
|
'viper-minibuffer-standard-hook
|
|
|
|
|
(if (or (not (listp old)) (eq (car old) 'lambda))
|
|
|
|
|
(list old) old))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(val "")
|
|
|
|
|
(padding "")
|
|
|
|
|
temp-msg)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq keymap (or keymap minibuffer-local-map)
|
2010-11-06 19:44:11 +00:00
|
|
|
|
viper-initial (or viper-initial "")
|
1997-06-02 22:50:31 +00:00
|
|
|
|
temp-msg (if default
|
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
* woman.el (woman-file-name):
* wid-edit.el (widget-file-prompt-value)
(widget-coding-system-prompt-value):
* w32-fns.el (set-w32-system-coding-system):
* vc.el (vc-version-diff, vc-annotate):
* textmodes/reftex-auc.el (reftex-arg-cite)
(reftex-arg-index-tag):
* textmodes/refer.el (refer-get-bib-files):
* textmodes/artist.el (artist-figlet-choose-font):
* terminal.el (terminal-emulator):
* replace.el (occur-read-primary-args):
* rect.el (string-rectangle, string-insert-rectangle):
* ps-print.el (ps-print-preprint):
* progmodes/pascal.el (pascal-goto-defun):
* progmodes/etags.el (visit-tags-table, visit-tags-table-buffer):
* progmodes/compile.el (compilation-find-file):
* printing.el (pr-interactive-n-up):
* play/animate.el (animate-birthday-present):
* net/rcompile.el (remote-compile):
* man.el (man, Man-goto-section, Man-follow-manual-reference):
* mail/rmailsum.el (rmail-summary-search-backward)
(rmail-summary-search):
* mail/rmailout.el (rmail-output-read-rmail-file-name)
(rmail-output-read-file-name):
* mail/rmail.el (rmail-search, rmail-search-backwards):
* mail/mailabbrev.el (merge-mail-abbrevs, rebuild-mail-abbrevs):
* locate.el (locate):
* international/quail.el (quail-show-keyboard-layout):
* international/mule.el (set-buffer-file-coding-system)
(revert-buffer-with-coding-system, set-file-name-coding-system)
(set-terminal-coding-system, set-keyboard-coding-system)
(set-next-selection-coding-system):
* international/mule-diag.el (describe-coding-system)
(describe-font, describe-fontset):
* international/mule-cmds.el (universal-coding-system-argument)
(search-unencodable-char, describe-input-method)
(set-language-environment, describe-language-environment):
* international/codepage.el (codepage-setup):
* international/code-pages.el (codepage-setup):
* info.el (Info-search, Info-follow-reference)
(Info-search-backward):
* emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-clear-cache, ad-activate)
(ad-deactivate, ad-update, ad-unadvise, ad-read-advice-name)
(ad-enable-advice, ad-disable-advice, ad-remove-advice)
(ad-read-regexp):
* ediff-util.el (ediff-toggle-regexp-match):
* ediff-ptch.el (ediff-prompt-for-patch-file):
* dired-aux.el (dired-diff):
* diff.el (diff):
* cus-edit.el (custom-variable-prompt):
* calendar/timeclock.el (timeclock-ask-for-project):
* calc/calcalg3.el (calc-get-fit-variables):
* calc/calc-store.el (calc-edit-variable)
(calc-permanent-variable):
* vc-mcvs.el (vc-mcvs-register):
* shadowfile.el (shadow-define-literal-group):
* woman.el (woman-file-name):
* vc.el (vc-version-diff, vc-merge):
* textmodes/reftex-index.el (reftex-index-complete-tag):
* format.el (format-decode-buffer, format-decode-region):
* emulation/viper-cmd.el (viper-read-string-with-history):
* emacs-lisp/debug.el (cancel-debug-on-entry):
* emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* ediff.el (ediff-merge-revisions)
(ediff-merge-revisions-with-ancestor, ediff-revision):
* completion.el (interactive-completion-string-reader):
* calc/calc-prog.el (calc-user-define-formula):
Follow convention for reading with the minibuffer.
2005-09-24 13:44:02 +00:00
|
|
|
|
(format "(default %s) " default)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
""))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-incomplete-ex-cmd nil)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq val (read-from-minibuffer prompt
|
2010-11-06 19:44:11 +00:00
|
|
|
|
(concat temp-msg viper-initial val padding)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
keymap nil history-var))
|
|
|
|
|
(setq minibuffer-setup-hook nil
|
1997-08-02 06:56:24 +00:00
|
|
|
|
padding (viper-array-to-string (this-command-keys))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
temp-msg "")
|
|
|
|
|
;; the following tries to be smart about what to put in history
|
|
|
|
|
(if (not (string= val (car (eval history-var))))
|
|
|
|
|
(set history-var (cons val (eval history-var))))
|
|
|
|
|
(if (or (string= (nth 0 (eval history-var)) (nth 1 (eval history-var)))
|
|
|
|
|
(string= (nth 0 (eval history-var)) ""))
|
|
|
|
|
(set history-var (cdr (eval history-var))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; If the user enters nothing but the prev cmd wasn't viper-ex,
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; viper-command-argument, or `! shell-command', this probably means
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; that the user typed something then erased. Return "" in this case, not
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; the default---the default is too confusing in this case.
|
|
|
|
|
(cond ((and (string= val "")
|
|
|
|
|
(not (string= prompt "!")) ; was a `! shell-command'
|
|
|
|
|
(not (memq last-command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'(viper-ex
|
|
|
|
|
viper-command-argument
|
1997-06-02 22:50:31 +00:00
|
|
|
|
t)
|
|
|
|
|
)))
|
|
|
|
|
"")
|
|
|
|
|
((string= val "") (or default ""))
|
|
|
|
|
(t val))
|
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; insertion commands
|
|
|
|
|
|
|
|
|
|
;; Called when state changes from Insert Vi command mode.
|
|
|
|
|
;; Repeats the insertion command if Insert state was entered with prefix
|
|
|
|
|
;; argument > 1.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-repeat-insert-command ()
|
|
|
|
|
(let ((i-com (car viper-d-com))
|
|
|
|
|
(val (nth 1 viper-d-com))
|
|
|
|
|
(char (nth 2 viper-d-com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and val (> val 1)) ; first check that val is non-nil
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-d-com (list i-com (1- val) ?r nil nil nil))
|
|
|
|
|
(viper-repeat nil)
|
|
|
|
|
(setq viper-d-com (list i-com val char nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-insert (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Insert before point."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-insert val ?r nil nil nil))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val (viper-yank-last-insertion))
|
|
|
|
|
(viper-change-state-to-insert))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-append (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Append after point."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-append val ?r nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (not (eolp)) (forward-char))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val (viper-yank-last-insertion))
|
|
|
|
|
(viper-change-state-to-insert))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-Append (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Append at end of line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-Append val ?r nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(end-of-line)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val (viper-yank-last-insertion))
|
|
|
|
|
(viper-change-state-to-insert))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-Insert (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Insert before first non-white."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-Insert val ?r nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(back-to-indentation)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val (viper-yank-last-insertion))
|
|
|
|
|
(viper-change-state-to-insert))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-open-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Open line below."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-open-line val ?r nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((col (current-indentation)))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(end-of-line)
|
|
|
|
|
(newline 1)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(viper-indent-line col)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-yank-last-insertion))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(end-of-line)
|
|
|
|
|
(newline 1)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(viper-indent-line col)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-state-to-insert)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-Open-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Open line above."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-Open-line val ?r nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((col (current-indentation)))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(open-line 1)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(viper-indent-line col)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-yank-last-insertion))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(open-line 1)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(viper-indent-line col)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-state-to-insert)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-open-line-at-point (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Open line at point."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-open-line-at-point val ?r nil nil nil))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(open-line 1)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-yank-last-insertion))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(open-line 1)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-state-to-insert))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
;; bound to s
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-substitute (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Substitute characters."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(push-mark nil t)
|
|
|
|
|
(forward-char val)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-change-subr (mark t) (point))
|
|
|
|
|
(viper-change (mark t) (point)))
|
2011-02-23 07:15:55 +00:00
|
|
|
|
;; com is set to ?r when we repeat this command with dot
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-substitute val ?r nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; Command bound to S
|
|
|
|
|
(defun viper-substitute-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Substitute lines."
|
|
|
|
|
(interactive "p")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(viper-line (cons arg ?C)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Prepare for replace
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-start-replace ()
|
|
|
|
|
(setq viper-began-as-replace t
|
|
|
|
|
viper-sitting-in-replace t
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-replace-chars-to-delete 0)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(add-hook
|
|
|
|
|
'viper-after-change-functions 'viper-replace-mode-spy-after t 'local)
|
|
|
|
|
(add-hook
|
|
|
|
|
'viper-before-change-functions 'viper-replace-mode-spy-before t 'local)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; this will get added repeatedly, but no harm
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(add-hook 'after-change-functions 'viper-after-change-sentinel t)
|
|
|
|
|
(add-hook 'before-change-functions 'viper-before-change-sentinel t)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(viper-move-marker-locally
|
|
|
|
|
'viper-last-posn-in-replace-region (viper-replace-start))
|
|
|
|
|
(add-hook
|
|
|
|
|
'viper-post-command-hooks 'viper-replace-state-post-command-sentinel
|
|
|
|
|
t 'local)
|
|
|
|
|
(add-hook
|
|
|
|
|
'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel t 'local)
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; guard against a smarty who switched from R-replace to normal replace
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(remove-hook
|
|
|
|
|
'viper-post-command-hooks 'viper-R-state-post-command-sentinel 'local)
|
2000-11-24 08:15:11 +00:00
|
|
|
|
(if overwrite-mode (overwrite-mode -1))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-replace-mode-spy-before (beg end)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(setq viper-replace-region-chars-deleted (viper-chars-in-region beg end))
|
|
|
|
|
)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; Invoked as an after-change-function to calculate how many chars have to be
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; deleted. This function may be called several times within a single command,
|
|
|
|
|
;; if this command performs several separate buffer changes. Therefore, if
|
|
|
|
|
;; adds up the number of chars inserted and subtracts the number of chars
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; deleted.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-replace-mode-spy-after (beg end length)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(if (memq viper-intermediate-command
|
1999-11-01 07:16:15 +00:00
|
|
|
|
'(dabbrev-expand hippie-expand repeating-insertion-from-ring))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; Take special care of text insertion from insertion ring inside
|
|
|
|
|
;; replacement overlays.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-replace-chars-to-delete 0)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(viper-move-marker-locally
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-last-posn-in-replace-region (point)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(let* ((real-end (min end (viper-replace-end)))
|
|
|
|
|
(column-shift (- (save-excursion (goto-char real-end)
|
|
|
|
|
(current-column))
|
|
|
|
|
(save-excursion (goto-char beg)
|
|
|
|
|
(current-column))))
|
|
|
|
|
(chars-deleted 0))
|
|
|
|
|
|
|
|
|
|
(if (> length 0)
|
|
|
|
|
(setq chars-deleted viper-replace-region-chars-deleted))
|
|
|
|
|
(setq viper-replace-region-chars-deleted 0)
|
|
|
|
|
(setq viper-replace-chars-to-delete
|
|
|
|
|
(+ viper-replace-chars-to-delete
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(-
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; if column shift is bigger, due to a TAB insertion, take
|
|
|
|
|
;; column-shift instead of the number of inserted chars
|
|
|
|
|
(max (viper-chars-in-region beg real-end)
|
|
|
|
|
;; This test accounts for Chinese/Japanese/... chars,
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; which occupy 2 columns instead of one. If we use
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; column-shift here, we may delete two chars instead of
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; one when the user types one Chinese character.
|
|
|
|
|
;; Deleting two would be OK, if they were European chars,
|
|
|
|
|
;; but it is not OK if they are Chinese chars.
|
|
|
|
|
;; Since it is hard to
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; figure out which characters are being deleted in any
|
|
|
|
|
;; given region, we decided to treat Eastern and European
|
|
|
|
|
;; characters equally, even though Eastern chars may
|
|
|
|
|
;; occupy more columns.
|
|
|
|
|
(if (memq this-command '(self-insert-command
|
|
|
|
|
quoted-insert viper-insert-tab))
|
|
|
|
|
column-shift
|
|
|
|
|
0))
|
|
|
|
|
;; the number of deleted chars
|
|
|
|
|
chars-deleted)))
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(viper-move-marker-locally
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-last-posn-in-replace-region
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(max (if (> end (viper-replace-end)) (viper-replace-end) end)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(or (marker-position viper-last-posn-in-replace-region)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(viper-replace-start))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)))
|
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
|
|
|
|
|
;; Delete stuff between viper-last-posn-in-replace-region and the end of
|
|
|
|
|
;; viper-replace-overlay-marker, if viper-last-posn-in-replace-region is within
|
|
|
|
|
;; the overlay and current point is before the end of the overlay.
|
|
|
|
|
;; Don't delete anything if current point is past the end of the overlay.
|
|
|
|
|
(defun viper-finish-change ()
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(remove-hook
|
|
|
|
|
'viper-after-change-functions 'viper-replace-mode-spy-after 'local)
|
|
|
|
|
(remove-hook
|
|
|
|
|
'viper-before-change-functions 'viper-replace-mode-spy-before 'local)
|
|
|
|
|
(remove-hook
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
'viper-post-command-hooks 'viper-replace-state-post-command-sentinel 'local)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(remove-hook
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel 'local)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-restore-cursor-color 'after-replace-mode)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-sitting-in-replace nil) ; just in case we'll need to know it
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (and viper-replace-overlay
|
|
|
|
|
(viper-pos-within-region viper-last-posn-in-replace-region
|
|
|
|
|
(viper-replace-start)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(viper-replace-end))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(< (point) (viper-replace-end)))
|
|
|
|
|
(delete-region
|
|
|
|
|
viper-last-posn-in-replace-region (viper-replace-end))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (eq viper-current-state 'replace-state)
|
|
|
|
|
(viper-downgrade-to-insert))
|
|
|
|
|
;; replace mode ended => nullify viper-last-posn-in-replace-region
|
|
|
|
|
(viper-move-marker-locally 'viper-last-posn-in-replace-region nil)
|
|
|
|
|
(viper-hide-replace-overlay)
|
|
|
|
|
(viper-refresh-mode-line)
|
|
|
|
|
(viper-put-string-on-kill-ring viper-last-replace-region)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Make STRING be the first element of the kill ring.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-put-string-on-kill-ring (string)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq kill-ring (cons string kill-ring))
|
|
|
|
|
(if (> (length kill-ring) kill-ring-max)
|
|
|
|
|
(setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))
|
|
|
|
|
(setq kill-ring-yank-pointer kill-ring))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-finish-R-mode ()
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(remove-hook
|
|
|
|
|
'viper-post-command-hooks 'viper-R-state-post-command-sentinel 'local)
|
|
|
|
|
(remove-hook
|
|
|
|
|
'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel 'local)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-downgrade-to-insert))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-start-R-mode ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Leave arg as 1, not t: XEmacs insists that it must be a pos number
|
|
|
|
|
(overwrite-mode 1)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(add-hook
|
|
|
|
|
'viper-post-command-hooks 'viper-R-state-post-command-sentinel t 'local)
|
|
|
|
|
(add-hook
|
|
|
|
|
'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel t 'local)
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; guard against a smarty who switched from R-replace to normal replace
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(remove-hook
|
|
|
|
|
'viper-post-command-hooks 'viper-replace-state-post-command-sentinel 'local)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-replace-state-exit-cmd ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Binding for keys that cause Replace state to switch to Vi or to Insert.
|
2010-01-18 04:39:40 +00:00
|
|
|
|
These keys are ESC, RET, and LineFeed."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if overwrite-mode ; if in replace mode invoked via 'R'
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-finish-R-mode)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-finish-change))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let (com)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (eq this-command 'viper-intercept-ESC-key)
|
|
|
|
|
(setq com 'viper-exit-insert-state)
|
2009-01-09 05:00:56 +00:00
|
|
|
|
(viper-set-unread-command-events last-input-event)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(setq com (key-binding (viper-read-key-sequence nil))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case conds
|
|
|
|
|
(command-execute com)
|
|
|
|
|
(error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-message-conditions conds)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-hide-replace-overlay))
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-replace-state-carriage-return ()
|
|
|
|
|
"Carriage return in Viper replace state."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
;; If Emacs start supporting overlay maps, as it currently supports
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; text-property maps, we could do away with viper-replace-minor-mode and
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; just have keymap attached to replace overlay. Then the "if part" of this
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; statement can be deleted.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (or (< (point) (viper-replace-start))
|
|
|
|
|
(> (point) (viper-replace-end)))
|
|
|
|
|
(let (viper-replace-minor-mode com)
|
2009-01-09 05:00:56 +00:00
|
|
|
|
(viper-set-unread-command-events last-input-event)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq com (key-binding (read-key-sequence nil)))
|
|
|
|
|
(condition-case conds
|
|
|
|
|
(command-execute com)
|
|
|
|
|
(error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-message-conditions conds))))
|
|
|
|
|
(if (not viper-allow-multiline-replace-regions)
|
|
|
|
|
(viper-replace-state-exit-cmd)
|
|
|
|
|
(if (viper-same-line (point) (viper-replace-end))
|
|
|
|
|
(viper-replace-state-exit-cmd)
|
|
|
|
|
;; delete the rest of line
|
|
|
|
|
(delete-region (point) (viper-line-pos 'end))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(if (eobp) (error "Last line in buffer")))
|
|
|
|
|
;; skip to the next line
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; This is the function bound to 'R'---unlimited replace.
|
|
|
|
|
;; Similar to Emacs's own overwrite-mode.
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(defun viper-overwrite (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Begin overwrite mode."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;;(com (viper-getcom arg))
|
|
|
|
|
(len))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command (list 'viper-overwrite val ?r nil nil nil))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq viper-intermediate-command 'viper-repeat)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; Viper saves inserted text in viper-last-insertion
|
|
|
|
|
(setq len (length viper-last-insertion))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(delete-char (min len (- (point-max) (point) 1)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val (viper-yank-last-insertion)))
|
|
|
|
|
(setq last-command 'viper-overwrite)
|
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(viper-set-replace-overlay (point) (viper-line-pos 'end))
|
|
|
|
|
(viper-change-state-to-replace)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; line commands
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((val (car arg))
|
|
|
|
|
(com (cdr arg)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (not (eobp))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-next-line-carefully (1- val)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; the following ensures that dd, cc, D, yy will do the right thing on the
|
|
|
|
|
;; last line of buffer when this line has no \n.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-add-newline-at-eob-if-necessary)
|
|
|
|
|
(viper-execute-com 'viper-line val com))
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-yank-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Yank ARG lines (in Vi's sense)."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg)))
|
|
|
|
|
(viper-line (cons val ?Y))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; region commands
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-region (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Execute command on a region."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-P-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(viper-move-marker-locally 'viper-com-point (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(exchange-point-and-mark)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-region val com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-Region (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Execute command on a Region."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-P-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(viper-move-marker-locally 'viper-com-point (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(exchange-point-and-mark)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-Region val com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-replace-char (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Replace the following ARG chars by the character read."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(if (and (eolp) (bolp)) (error "No character to replace here"))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(viper-replace-char-subr com val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eolp) (not (bolp))) (forward-char 1))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(setq viper-this-command-keys
|
|
|
|
|
(format "%sr" (if (integerp arg) arg "")))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-replace-char val ?r nil viper-d-char nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-replace-char-subr (com arg)
|
2001-09-14 03:34:31 +00:00
|
|
|
|
(let ((inhibit-quit t)
|
|
|
|
|
char)
|
2001-09-09 22:33:38 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(or (eq viper-intermediate-command 'viper-repeat)
|
|
|
|
|
(viper-special-read-and-insert-char))
|
|
|
|
|
|
2001-10-13 21:38:19 +00:00
|
|
|
|
(delete-char 1 t)
|
|
|
|
|
(setq char (if com viper-d-char (viper-char-at-pos 'backward)))
|
2001-12-24 05:50:31 +00:00
|
|
|
|
|
2001-10-13 21:38:19 +00:00
|
|
|
|
(if com (insert char))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2001-10-13 21:38:19 +00:00
|
|
|
|
(setq viper-d-char char)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2001-10-13 21:38:19 +00:00
|
|
|
|
(viper-loop (1- (if (> arg 0) arg (- arg)))
|
|
|
|
|
(delete-char 1 t)
|
|
|
|
|
(insert char))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2001-10-13 21:38:19 +00:00
|
|
|
|
(viper-adjust-undo)
|
|
|
|
|
(backward-char arg)
|
|
|
|
|
))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; basic cursor movement. j, k, l, h commands.
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-forward-char (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Move point right ARG characters (left if ARG negative).
|
|
|
|
|
On reaching end of line, stop and signal error."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(if viper-ex-style-motion
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
;; the boundary condition check gets weird here because
|
|
|
|
|
;; forward-char may be the parameter of a delete, and 'dl' works
|
|
|
|
|
;; just like 'x' for the last char on a line, so we have to allow
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; the forward motion before the 'viper-execute-com', but, of
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; course, 'dl' doesn't work on an empty line, so we have to
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; catch that condition before 'viper-execute-com'
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(if (and (eolp) (bolp)) (error "Viper bell") (forward-char val))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-forward-char val com))
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(if (eolp) (progn (backward-char 1) (error "Viper bell"))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-char val)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-forward-char val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-backward-char (arg)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
"Move point left ARG characters (right if ARG negative).
|
1997-06-02 22:50:31 +00:00
|
|
|
|
On reaching beginning of line, stop and signal error."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(if viper-ex-style-motion
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(if (bolp) (error "Viper bell") (backward-char val))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-backward-char val com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-char val)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-backward-char val com)))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Like forward-char, but doesn't move at end of buffer.
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; Returns distance traveled
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; (positive or 0, if arg positive; negative if arg negative).
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(defun viper-forward-char-carefully (&optional arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq arg (or arg 1))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(let ((pt (point)))
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(forward-char arg)
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
(error nil))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (< (point) pt) ; arg was negative
|
|
|
|
|
(- (viper-chars-in-region pt (point)))
|
|
|
|
|
(viper-chars-in-region pt (point)))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; Like backward-char, but doesn't move at beg of buffer.
|
|
|
|
|
;; Returns distance traveled
|
|
|
|
|
;; (negative or 0, if arg positive; positive if arg negative).
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(defun viper-backward-char-carefully (&optional arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq arg (or arg 1))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(let ((pt (point)))
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(backward-char arg)
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
(error nil))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (> (point) pt) ; arg was negative
|
|
|
|
|
(viper-chars-in-region pt (point))
|
|
|
|
|
(- (viper-chars-in-region pt (point))))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-next-line-carefully (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case nil
|
2007-11-02 06:03:12 +00:00
|
|
|
|
;; do not use forward-line! need to keep column
|
2008-11-16 04:55:45 +00:00
|
|
|
|
(let ((line-move-visual nil))
|
|
|
|
|
(if (featurep 'emacs)
|
|
|
|
|
(with-no-warnings (next-line arg))
|
|
|
|
|
(next-line arg)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error nil)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Word command
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; Words are formed from alpha's and nonalphas - <sp>,\t\n are separators for
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; word movement. When executed with a destructive command, \n is usually left
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; untouched for the last word. Viper uses syntax table to determine what is a
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; word and what is a separator. However, \n is always a separator. Also, if
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; viper-syntax-preference is 'vi, then `_' is part of the word.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; skip only one \n
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-skip-separators (forward)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if forward
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-skip-all-separators-forward 'within-line)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (looking-at "\n")
|
|
|
|
|
(progn
|
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-skip-all-separators-forward 'within-line))))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; check for eob and white space before it. move off of eob
|
1998-05-30 14:28:56 +00:00
|
|
|
|
(if (and (eobp) (save-excursion
|
|
|
|
|
(viper-backward-char-carefully)
|
|
|
|
|
(viper-looking-at-separator)))
|
|
|
|
|
(viper-backward-char-carefully))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-skip-all-separators-backward 'within-line)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-backward-char-carefully)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (looking-at "\n")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-skip-all-separators-backward 'within-line)
|
2005-02-19 19:32:47 +00:00
|
|
|
|
(or (viper-looking-at-separator) (forward-char)))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-forward-word-kernel (val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(while (> val 0)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-looking-at-alpha)
|
|
|
|
|
(viper-skip-alpha-forward "_")
|
|
|
|
|
(viper-skip-separators t))
|
|
|
|
|
((viper-looking-at-separator)
|
|
|
|
|
(viper-skip-separators t))
|
|
|
|
|
((not (viper-looking-at-alphasep))
|
|
|
|
|
(viper-skip-nonalphasep-forward)
|
|
|
|
|
(viper-skip-separators t)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (1- val))))
|
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; first skip non-newline separators backward, then skip \n. Then, if TWICE is
|
1997-08-22 03:15:57 +00:00
|
|
|
|
;; non-nil, skip non-\n back again, but don't overshoot the limit LIM.
|
|
|
|
|
(defun viper-separator-skipback-special (twice lim)
|
|
|
|
|
(let ((prev-char (viper-char-at-pos 'backward))
|
|
|
|
|
(saved-point (point)))
|
|
|
|
|
;; skip non-newline separators backward
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(while (and (not (viper-memq-char prev-char '(nil \n)))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(< lim (point))
|
|
|
|
|
;; must be non-newline separator
|
|
|
|
|
(if (eq viper-syntax-preference 'strict-vi)
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(viper-memq-char prev-char '(?\ ?\t))
|
|
|
|
|
(viper-memq-char (char-syntax prev-char) '(?\ ?-))))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-backward-char-carefully)
|
|
|
|
|
(setq prev-char (viper-char-at-pos 'backward)))
|
|
|
|
|
|
|
|
|
|
(if (and (< lim (point)) (eq prev-char ?\n))
|
|
|
|
|
(backward-char)
|
|
|
|
|
;; If we skipped to the next word and the prefix of this line doesn't
|
|
|
|
|
;; consist of separators preceded by a newline, then don't skip backwards
|
|
|
|
|
;; at all.
|
|
|
|
|
(goto-char saved-point))
|
|
|
|
|
(setq prev-char (viper-char-at-pos 'backward))
|
|
|
|
|
|
|
|
|
|
;; skip again, but make sure we don't overshoot the limit
|
|
|
|
|
(if twice
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(while (and (not (viper-memq-char prev-char '(nil \n)))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(< lim (point))
|
|
|
|
|
;; must be non-newline separator
|
|
|
|
|
(if (eq viper-syntax-preference 'strict-vi)
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(viper-memq-char prev-char '(?\ ?\t))
|
|
|
|
|
(viper-memq-char (char-syntax prev-char) '(?\ ?-))))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-backward-char-carefully)
|
|
|
|
|
(setq prev-char (viper-char-at-pos 'backward))))
|
|
|
|
|
|
|
|
|
|
(if (= (point) lim)
|
|
|
|
|
(viper-forward-char-carefully))
|
|
|
|
|
))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-forward-word (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Forward word."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-forward-word-kernel val)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if com
|
|
|
|
|
(progn
|
|
|
|
|
(cond ((viper-char-equal com ?c)
|
|
|
|
|
(viper-separator-skipback-special 'twice viper-com-point))
|
|
|
|
|
;; Yank words including the whitespace, but not newline
|
|
|
|
|
((viper-char-equal com ?y)
|
|
|
|
|
(viper-separator-skipback-special nil viper-com-point))
|
|
|
|
|
((viper-dotable-command-p com)
|
|
|
|
|
(viper-separator-skipback-special nil viper-com-point)))
|
|
|
|
|
(viper-execute-com 'viper-forward-word val com)))
|
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-forward-Word (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Forward word delimited by white characters."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-loop val
|
|
|
|
|
(viper-skip-nonseparators 'forward)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-skip-separators t))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com (progn
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(cond ((viper-char-equal com ?c)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-separator-skipback-special 'twice viper-com-point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Yank words including the whitespace, but not newline
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
((viper-char-equal com ?y)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-separator-skipback-special nil viper-com-point))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((viper-dotable-command-p com)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-separator-skipback-special nil viper-com-point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-forward-Word val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; this is a bit different from Vi, but Vi's end of word
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; makes no sense whatsoever
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-end-of-word-kernel ()
|
|
|
|
|
(if (viper-end-of-word-p) (forward-char))
|
|
|
|
|
(if (viper-looking-at-separator)
|
|
|
|
|
(viper-skip-all-separators-forward))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-looking-at-alpha) (viper-skip-alpha-forward "_"))
|
|
|
|
|
((not (viper-looking-at-alphasep)) (viper-skip-nonalphasep-forward)))
|
|
|
|
|
(viper-backward-char-carefully))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-end-of-word-p ()
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(or (eobp)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-looking-at-alpha)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(not (viper-looking-at-alpha)))
|
|
|
|
|
((not (viper-looking-at-alphasep))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-looking-at-alphasep))))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-end-of-word (arg &optional careful)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Move point to end of current word."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-loop val (viper-end-of-word-kernel))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(if com
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-end-of-word val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-end-of-Word (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Forward to end of word delimited by white character."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-loop val
|
|
|
|
|
(viper-end-of-word-kernel)
|
|
|
|
|
(viper-skip-nonseparators 'forward)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(backward-char))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(if com
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-end-of-Word val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-backward-word-kernel (val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(while (> val 0)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-backward-char-carefully)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-looking-at-alpha)
|
|
|
|
|
(viper-skip-alpha-backward "_"))
|
|
|
|
|
((viper-looking-at-separator)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-skip-separators nil)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-backward-char-carefully)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-looking-at-alpha)
|
|
|
|
|
(viper-skip-alpha-backward "_"))
|
|
|
|
|
((not (viper-looking-at-alphasep))
|
|
|
|
|
(viper-skip-nonalphasep-backward))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
((bobp)) ; could still be at separator, but at beg of buffer
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(t (forward-char))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((not (viper-looking-at-alphasep))
|
|
|
|
|
(viper-skip-nonalphasep-backward)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (1- val))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-backward-word (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Backward word."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(let (i)
|
|
|
|
|
(if (setq i (save-excursion (backward-char) (looking-at "\n")))
|
|
|
|
|
(backward-char))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if i (forward-char))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-backward-word-kernel val)
|
|
|
|
|
(if com (viper-execute-com 'viper-backward-word val com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-backward-Word (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Backward word delimited by white character."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(let (i)
|
|
|
|
|
(if (setq i (save-excursion (backward-char) (looking-at "\n")))
|
|
|
|
|
(backward-char))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if i (forward-char))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-loop val
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-skip-separators nil) ; nil means backward here
|
|
|
|
|
(viper-skip-nonseparators 'backward))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-backward-Word val com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; line commands
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-beginning-of-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to beginning of line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(beginning-of-line val)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-beginning-of-line val com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-bol-and-skip-white (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Beginning of line at first non-white character."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-to-indentation (1- val))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-bol-and-skip-white val com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-eol (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to end of line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(end-of-line val)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-goto-eol val com))
|
|
|
|
|
(if viper-ex-style-motion
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(if (and (eolp) (not (bolp))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; a fix for viper-change-to-eol
|
|
|
|
|
(not (equal viper-current-state 'insert-state)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-char 1)
|
|
|
|
|
))))
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-col (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to ARG's column."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
line-len)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(setq line-len
|
|
|
|
|
(viper-chars-in-region
|
|
|
|
|
(viper-line-pos 'start) (viper-line-pos 'end)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(forward-char (1- (min line-len val)))
|
|
|
|
|
(while (> (current-column) (1- val))
|
|
|
|
|
(backward-char 1))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-goto-col val com))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line)
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(if (> val (current-column)) (error "Viper bell")))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-next-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to next line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
2007-11-02 06:03:12 +00:00
|
|
|
|
;; do not use forward-line! need to keep column
|
2008-11-16 04:55:45 +00:00
|
|
|
|
(let ((line-move-visual nil))
|
|
|
|
|
(if (featurep 'emacs)
|
|
|
|
|
(with-no-warnings (next-line val))
|
|
|
|
|
(next-line val)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-ex-style-motion
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eolp) (not (bolp))) (backward-char 1)))
|
|
|
|
|
(setq this-command 'next-line)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-next-line val com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2008-01-10 06:54:12 +00:00
|
|
|
|
(declare-function widget-type "wid-edit" (widget))
|
|
|
|
|
(declare-function widget-button-press "wid-edit" (pos &optional event))
|
|
|
|
|
(declare-function viper-set-hooks "viper" ())
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-next-line-at-bol (arg)
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
"Next line at beginning of line.
|
|
|
|
|
If point is on a widget or a button, simulate clicking on that widget/button."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
(let* ((field (get-char-property (point) 'field))
|
|
|
|
|
(button (get-char-property (point) 'button))
|
|
|
|
|
(doc (get-char-property (point) 'widget-doc))
|
|
|
|
|
(widget (or field button doc)))
|
|
|
|
|
(if (and widget
|
|
|
|
|
(if (symbolp widget)
|
|
|
|
|
(get widget 'widget-type)
|
|
|
|
|
(and (consp widget)
|
|
|
|
|
(get (widget-type widget) 'widget-type))))
|
|
|
|
|
(widget-button-press (point))
|
2006-09-18 19:22:31 +00:00
|
|
|
|
(if (and (fboundp 'button-at) (fboundp 'push-button) (button-at (point)))
|
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
2006-06-18 17:08:24 +00:00
|
|
|
|
(push-button)
|
|
|
|
|
;; not a widget or a button
|
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(if (eobp) (error "Last line in buffer")))
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(forward-line val)
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
(if com (viper-execute-com 'viper-next-line-at-bol val com)))))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(defun viper-previous-line (arg)
|
|
|
|
|
"Go to previous line."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
2007-11-02 06:03:12 +00:00
|
|
|
|
;; do not use forward-line! need to keep column
|
2008-11-16 04:55:45 +00:00
|
|
|
|
(let ((line-move-visual nil))
|
|
|
|
|
(if (featurep 'emacs)
|
|
|
|
|
(with-no-warnings (previous-line val))
|
|
|
|
|
(previous-line val)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-ex-style-motion
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eolp) (not (bolp))) (backward-char 1)))
|
|
|
|
|
(setq this-command 'previous-line)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-previous-line val com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-previous-line-at-bol (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Previous line at beginning of line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(if (bobp) (error "First line in buffer")))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-line (- val))
|
|
|
|
|
(back-to-indentation)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-previous-line val com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change-to-eol (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Change to end of line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-goto-eol (cons arg ?c)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-kill-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Delete line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-goto-eol (cons arg ?d)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-erase-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Erase line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-beginning-of-line (cons arg ?d)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Moving around
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-line (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to ARG's line. Without ARG go to end of buffer."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-P-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(viper-move-marker-locally 'viper-com-point (point))
|
|
|
|
|
(viper-deactivate-mark)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(push-mark nil t)
|
|
|
|
|
(if (null val)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line (1- val)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; positioning is done twice: before and after command execution
|
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-goto-line val com))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
))
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; Find ARG's occurrence of CHAR on the current line.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; If FORWARD then search is forward, otherwise backward. OFFSET is used to
|
|
|
|
|
;; adjust point after search.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-find-char (arg char forward offset)
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(or (char-or-string-p char) (error "Viper bell"))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((arg (if forward arg (- arg)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cmd (if (eq viper-intermediate-command 'viper-repeat)
|
|
|
|
|
(nth 5 viper-d-com)
|
|
|
|
|
(viper-array-to-string (this-command-keys))))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
point region-beg region-end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(if (> arg 0) ; forward
|
|
|
|
|
(progn
|
|
|
|
|
(setq region-beg (point))
|
|
|
|
|
(if viper-allow-multiline-replace-regions
|
|
|
|
|
(viper-forward-paragraph 1)
|
|
|
|
|
(end-of-line))
|
|
|
|
|
(setq region-end (point)))
|
|
|
|
|
(setq region-end (point))
|
|
|
|
|
(if viper-allow-multiline-replace-regions
|
|
|
|
|
(viper-backward-paragraph 1)
|
|
|
|
|
(beginning-of-line))
|
|
|
|
|
(setq region-beg (point)))
|
|
|
|
|
(if (or (and (< arg 0)
|
|
|
|
|
(< (- region-end region-beg)
|
|
|
|
|
(if viper-allow-multiline-replace-regions
|
|
|
|
|
2 1))
|
|
|
|
|
(bolp))
|
|
|
|
|
(and (> arg 0)
|
|
|
|
|
(< (- region-end region-beg)
|
|
|
|
|
(if viper-allow-multiline-replace-regions
|
|
|
|
|
3 2))
|
|
|
|
|
(eolp)))
|
|
|
|
|
(error "Command `%s': At %s of %s"
|
|
|
|
|
cmd
|
|
|
|
|
(if (> arg 0) "end" "beginning")
|
|
|
|
|
(if viper-allow-multiline-replace-regions
|
|
|
|
|
"paragraph" "line")))
|
|
|
|
|
(narrow-to-region region-beg region-end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; if arg > 0, point is forwarded before search.
|
|
|
|
|
(if (> arg 0) (goto-char (1+ (point-min)))
|
|
|
|
|
(goto-char (point-max)))
|
|
|
|
|
(if (let ((case-fold-search nil))
|
|
|
|
|
(search-forward (char-to-string char) nil 0 arg))
|
|
|
|
|
(setq point (point))
|
|
|
|
|
(error "Command `%s': `%c' not found" cmd char))))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(goto-char point)
|
|
|
|
|
(if (> arg 0)
|
|
|
|
|
(backward-char (if offset 2 1))
|
|
|
|
|
(forward-char (if offset 1 0)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-find-char-forward (arg)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
"Find char on the line.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
If called interactively read the char to find from the terminal, and if
|
2005-06-10 14:11:45 +00:00
|
|
|
|
called from viper-repeat, the char last used is used. This behavior is
|
1997-06-02 22:50:31 +00:00
|
|
|
|
controlled by the sign of prefix numeric value."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
|
|
|
|
(cmd-representation (nth 5 viper-d-com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (> val 0)
|
|
|
|
|
;; this means that the function was called interactively
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-f-char (read-char)
|
|
|
|
|
viper-f-forward t
|
|
|
|
|
viper-f-offset nil)
|
|
|
|
|
;; viper-repeat --- set viper-F-char from command-keys
|
|
|
|
|
(setq viper-F-char (if (stringp cmd-representation)
|
|
|
|
|
(viper-seq-last-elt cmd-representation)
|
|
|
|
|
viper-F-char)
|
|
|
|
|
viper-f-char viper-F-char)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-find-char
|
|
|
|
|
val (if (> (viper-p-val arg) 0) viper-f-char viper-F-char) t nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val))
|
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-F-char viper-f-char) ; set new viper-F-char
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-find-char-forward val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-char-forward (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go up to char ARG forward on line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
|
|
|
|
(cmd-representation (nth 5 viper-d-com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (> val 0)
|
|
|
|
|
;; this means that the function was called interactively
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-f-char (read-char)
|
|
|
|
|
viper-f-forward t
|
|
|
|
|
viper-f-offset t)
|
|
|
|
|
;; viper-repeat --- set viper-F-char from command-keys
|
|
|
|
|
(setq viper-F-char (if (stringp cmd-representation)
|
|
|
|
|
(viper-seq-last-elt cmd-representation)
|
|
|
|
|
viper-F-char)
|
|
|
|
|
viper-f-char viper-F-char)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-find-char
|
|
|
|
|
val (if (> (viper-p-val arg) 0) viper-f-char viper-F-char) t t)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val))
|
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-F-char viper-f-char) ; set new viper-F-char
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-goto-char-forward val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-find-char-backward (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Find char ARG on line backward."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
|
|
|
|
(cmd-representation (nth 5 viper-d-com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (> val 0)
|
|
|
|
|
;; this means that the function was called interactively
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-f-char (read-char)
|
|
|
|
|
viper-f-forward nil
|
|
|
|
|
viper-f-offset nil)
|
|
|
|
|
;; viper-repeat --- set viper-F-char from command-keys
|
|
|
|
|
(setq viper-F-char (if (stringp cmd-representation)
|
|
|
|
|
(viper-seq-last-elt cmd-representation)
|
|
|
|
|
viper-F-char)
|
|
|
|
|
viper-f-char viper-F-char)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-find-char
|
|
|
|
|
val (if (> (viper-p-val arg) 0) viper-f-char viper-F-char) nil nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val))
|
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-F-char viper-f-char) ; set new viper-F-char
|
|
|
|
|
(viper-execute-com 'viper-find-char-backward val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-char-backward (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go up to char ARG backward on line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
|
|
|
|
(cmd-representation (nth 5 viper-d-com)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (> val 0)
|
|
|
|
|
;; this means that the function was called interactively
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-f-char (read-char)
|
|
|
|
|
viper-f-forward nil
|
|
|
|
|
viper-f-offset t)
|
|
|
|
|
;; viper-repeat --- set viper-F-char from command-keys
|
|
|
|
|
(setq viper-F-char (if (stringp cmd-representation)
|
|
|
|
|
(viper-seq-last-elt cmd-representation)
|
|
|
|
|
viper-F-char)
|
|
|
|
|
viper-f-char viper-F-char)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-find-char
|
|
|
|
|
val (if (> (viper-p-val arg) 0) viper-f-char viper-F-char) nil t)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq val (- val))
|
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-F-char viper-f-char) ; set new viper-F-char
|
|
|
|
|
(viper-execute-com 'viper-goto-char-backward val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-repeat-find (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Repeat previous find command."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(viper-deactivate-mark)
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-find-char val viper-f-char viper-f-forward viper-f-offset)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-f-forward (forward-char))
|
|
|
|
|
(viper-execute-com 'viper-repeat-find val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-repeat-find-opposite (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Repeat previous find command in the opposite direction."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(viper-deactivate-mark)
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(viper-find-char val viper-f-char (not viper-f-forward) viper-f-offset)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-f-forward (forward-char))
|
|
|
|
|
(viper-execute-com 'viper-repeat-find-opposite val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; window scrolling etc.
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-window-top (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to home window line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-leave-region-active)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(push-mark nil t)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(move-to-window-line (1- val))
|
|
|
|
|
|
|
|
|
|
;; positioning is done twice: before and after command execution
|
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-window-top val com))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-window-middle (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to middle window line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(viper-leave-region-active)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(push-mark nil t)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(move-to-window-line (+ (/ (1- (window-height)) 2) (1- val)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; positioning is done twice: before and after command execution
|
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-window-middle val com))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-window-bottom (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to last window line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-leave-region-active)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(push-mark nil t)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(move-to-window-line (- val))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; positioning is done twice: before and after command execution
|
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-window-bottom val com))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-line-to-top (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Put current line on the home line."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(recenter (1- arg)))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-line-to-middle (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Put current line on the middle line."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(recenter (+ (1- arg) (/ (1- (window-height)) 2))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-line-to-bottom (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Put current line on the last line."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(recenter (- (window-height) (1+ arg))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; If point is within viper-search-scroll-threshold of window top or bottom,
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; scroll up or down 1/7 of window height, depending on whether we are at the
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; bottom or at the top of the window. This function is called by viper-search
|
|
|
|
|
;; (which is called from viper-search-forward/backward/next). If the value of
|
1997-08-02 06:56:24 +00:00
|
|
|
|
;; viper-search-scroll-threshold is negative - don't scroll.
|
|
|
|
|
(defun viper-adjust-window ()
|
2008-04-03 21:04:18 +00:00
|
|
|
|
(let ((win-height (if (featurep 'xemacs)
|
|
|
|
|
(window-displayed-height)
|
2012-06-02 10:56:09 +00:00
|
|
|
|
(1- (window-height)))) ; adjust for mode line
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(pt (point))
|
|
|
|
|
at-top-p at-bottom-p
|
|
|
|
|
min-scroll direction)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(move-to-window-line 0) ; top
|
|
|
|
|
(setq at-top-p
|
|
|
|
|
(<= (count-lines pt (point))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-search-scroll-threshold))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(move-to-window-line -1) ; bottom
|
|
|
|
|
(setq at-bottom-p
|
2008-03-01 20:14:46 +00:00
|
|
|
|
(<= (count-lines pt (point)) viper-search-scroll-threshold)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond (at-top-p (setq min-scroll (1- viper-search-scroll-threshold)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
direction 1))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(at-bottom-p (setq min-scroll (1+ viper-search-scroll-threshold)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
direction -1)))
|
|
|
|
|
(if min-scroll
|
|
|
|
|
(recenter
|
|
|
|
|
(* (max min-scroll (/ win-height 7)) direction)))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; paren match
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; must correct this to only match ( to ) etc. On the other hand
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; it is good that paren match gets confused, because that way you
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; catch _all_ imbalances.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-paren-match (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to the matching parenthesis."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-leave-region-active)
|
|
|
|
|
(let ((com (viper-getcom arg))
|
|
|
|
|
(parse-sexp-ignore-comments viper-parse-sexp-ignore-comments)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
anchor-point)
|
|
|
|
|
(if (integerp arg)
|
|
|
|
|
(if (or (> arg 99) (< arg 1))
|
|
|
|
|
(error "Prefix must be between 1 and 99")
|
|
|
|
|
(goto-char
|
|
|
|
|
(if (> (point-max) 80000)
|
|
|
|
|
(* (/ (point-max) 100) arg)
|
|
|
|
|
(/ (* (point-max) arg) 100)))
|
|
|
|
|
(back-to-indentation))
|
|
|
|
|
(let (beg-lim end-lim)
|
|
|
|
|
(if (and (eolp) (not (bolp))) (forward-char -1))
|
|
|
|
|
(if (not (looking-at "[][(){}]"))
|
|
|
|
|
(setq anchor-point (point)))
|
Replace still more end-of-line etc with line-end-position, etc.
* lisp/gnus/nnbabyl.el (nnbabyl-request-move-article, nnbabyl-delete-mail)
(nnbabyl-check-mbox): Use point-at-bol.
* lisp/cedet/semantic/lex.el (semantic-lex-ignore-comments, semantic-flex):
* lisp/cedet/semantic/grammar.el (semantic-grammar-epilogue):
* lisp/cedet/ede/speedbar.el (ede-find-nearest-file-line):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/ede/autoconf-edit.el (autoconf-delete-parameter):
Use point-at-bol and point-at-eol.
* lisp/vc/emerge.el (emerge-line-number-in-buf):
* lisp/textmodes/ispell.el (ispell-region):
* lisp/textmodes/fill.el (current-fill-column):
* lisp/progmodes/xscheme.el (xscheme-send-current-line):
* lisp/progmodes/vhdl-mode.el (vhdl-current-line, vhdl-line-copy):
* lisp/progmodes/tcl.el (tcl-hairy-scan-for-comment):
* lisp/progmodes/sh-script.el (sh-handle-prev-do):
* lisp/progmodes/meta-mode.el (meta-indent-line):
* lisp/progmodes/idlwave.el (idlwave-goto-comment, idlwave-fill-paragraph)
(idlwave-in-quote):
* lisp/progmodes/idlw-shell.el (idlwave-shell-current-frame)
(idlwave-shell-update-bp-overlays, idlwave-shell-sources-filter):
* lisp/progmodes/fortran.el (fortran-looking-at-if-then):
* lisp/progmodes/etags.el (find-tag-in-order, etags-snarf-tag):
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent)
(cperl-find-pods-heres):
* lisp/progmodes/ada-mode.el (ada-get-current-indent, ada-narrow-to-defun):
* lisp/net/quickurl.el (quickurl-list-insert):
* lisp/net/ldap.el (ldap-search-internal):
* lisp/net/eudc.el (eudc-expand-inline):
* lisp/mail/sendmail.el (sendmail-send-it):
* lisp/mail/mspools.el (mspools-visit-spool, mspools-get-spool-name):
* lisp/emulation/viper-cmd.el (viper-paren-match, viper-backward-indent)
(viper-brac-function):
* lisp/calc/calc-yank.el (calc-do-grab-region):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/term.el (term-move-columns, term-insert-spaces):
* lisp/speedbar.el (speedbar-highlight-one-tag-line):
* lisp/simple.el (current-word):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* lisp/info.el (Info-find-node-in-buffer-1, Info-follow-reference)
(Info-scroll-down):
* lisp/hippie-exp.el (he-line-beg):
* lisp/epa.el (epa--marked-keys):
* lisp/dired-aux.el (dired-kill-line, dired-do-kill-lines)
(dired-update-file-line, dired-add-entry, dired-remove-entry)
(dired-relist-entry):
* lisp/buff-menu.el (Buffer-menu-buffer):
* lisp/array.el (current-line):
* lisp/allout.el (allout-resolve-xref)
(allout-latex-verbatim-quote-curr-line):
Replace yet more uses of end-of-line etc with line-end-position.
2010-11-09 05:33:07 +00:00
|
|
|
|
(setq beg-lim (point-at-bol)
|
|
|
|
|
end-lim (point-at-eol))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(cond ((re-search-forward "[][(){}]" end-lim t)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-char) )
|
|
|
|
|
((re-search-backward "[][(){}]" beg-lim t))
|
|
|
|
|
(t
|
|
|
|
|
(error "No matching character on line"))))
|
|
|
|
|
(cond ((looking-at "[\(\[{]")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-sexp 1)
|
|
|
|
|
(if com
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-paren-match nil com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-char)))
|
|
|
|
|
(anchor-point
|
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point anchor-point)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-char 1)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-paren-match nil com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)))
|
|
|
|
|
((looking-at "[])}]")
|
|
|
|
|
(forward-char)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-sexp 1)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-paren-match nil com)))
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(t (error "Viper bell"))))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-toggle-parse-sexp-ignore-comments ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-parse-sexp-ignore-comments
|
|
|
|
|
(not viper-parse-sexp-ignore-comments))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(princ (format
|
|
|
|
|
"From now on, `%%' will %signore parentheses inside comment fields"
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-parse-sexp-ignore-comments "" "NOT "))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; sentence, paragraph and heading
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-forward-sentence (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Forward sentence."
|
|
|
|
|
(interactive "P")
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(or (eq last-command this-command)
|
|
|
|
|
(push-mark nil t))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-sentence val)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-forward-sentence nil com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-backward-sentence (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Backward sentence."
|
|
|
|
|
(interactive "P")
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(or (eq last-command this-command)
|
|
|
|
|
(push-mark nil t))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-sentence val)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-backward-sentence nil com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-forward-paragraph (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Forward paragraph."
|
|
|
|
|
(interactive "P")
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(or (eq last-command this-command)
|
|
|
|
|
(push-mark nil t))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; if you want d} operate on whole lines, change viper-getcom to
|
|
|
|
|
;; viper-getCom below
|
|
|
|
|
(com (viper-getcom arg)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(forward-paragraph val)
|
|
|
|
|
(if com
|
|
|
|
|
(progn
|
|
|
|
|
(backward-char 1)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-forward-paragraph nil com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-backward-paragraph (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Backward paragraph."
|
|
|
|
|
(interactive "P")
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(or (eq last-command this-command)
|
|
|
|
|
(push-mark nil t))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; if you want d{ operate on whole lines, change viper-getcom to
|
|
|
|
|
;; viper-getCom below
|
|
|
|
|
(com (viper-getcom arg)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-paragraph val)
|
|
|
|
|
(if com
|
|
|
|
|
(progn
|
|
|
|
|
(forward-char 1)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com 'viper-backward-paragraph nil com)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-char 1)))))
|
|
|
|
|
|
1997-09-30 01:13:53 +00:00
|
|
|
|
;; should be mode-specific
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-prev-heading (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(re-search-backward viper-heading-start nil t val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-prev-heading nil com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-heading-end (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(re-search-forward viper-heading-end nil t val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-heading-end nil com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-next-heading (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(end-of-line)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(re-search-forward viper-heading-start nil t val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-execute-com 'viper-next-heading nil com))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; scrolling
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-scroll-screen (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Scroll to next screen."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(if (> arg 0)
|
|
|
|
|
(while (> arg 0)
|
|
|
|
|
(scroll-up)
|
|
|
|
|
(setq arg (1- arg)))
|
|
|
|
|
(while (> 0 arg)
|
|
|
|
|
(scroll-down)
|
|
|
|
|
(setq arg (1+ arg))))
|
|
|
|
|
(error (beep 1)
|
|
|
|
|
(if (> arg 0)
|
|
|
|
|
(progn
|
|
|
|
|
(message "End of buffer")
|
|
|
|
|
(goto-char (point-max)))
|
|
|
|
|
(message "Beginning of buffer")
|
|
|
|
|
(goto-char (point-min))))
|
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-scroll-screen-back (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Scroll to previous screen."
|
|
|
|
|
(interactive "p")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-scroll-screen (- arg)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-scroll-down (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Pull down half screen."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(if (null arg)
|
|
|
|
|
(scroll-down (/ (window-height) 2))
|
|
|
|
|
(scroll-down arg))
|
|
|
|
|
(error (beep 1)
|
|
|
|
|
(message "Beginning of buffer")
|
|
|
|
|
(goto-char (point-min)))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-scroll-down-one (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Scroll up one line."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(scroll-down arg))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-scroll-up (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Pull up half screen."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(if (null arg)
|
|
|
|
|
(scroll-up (/ (window-height) 2))
|
|
|
|
|
(scroll-up arg))
|
|
|
|
|
(error (beep 1)
|
|
|
|
|
(message "End of buffer")
|
|
|
|
|
(goto-char (point-max)))))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-scroll-up-one (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Scroll down one line."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(scroll-up arg))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; searching
|
|
|
|
|
|
2009-08-15 05:57:08 +00:00
|
|
|
|
(defun viper-insert-isearch-string ()
|
|
|
|
|
"Insert `isearch' last search string."
|
|
|
|
|
(interactive)
|
|
|
|
|
(when isearch-string (insert isearch-string)))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-if-string (prompt)
|
|
|
|
|
(if (memq viper-intermediate-command
|
|
|
|
|
'(viper-command-argument viper-digit-argument viper-repeat))
|
|
|
|
|
(setq viper-this-command-keys (this-command-keys)))
|
2009-08-15 05:57:08 +00:00
|
|
|
|
(let* ((keymap (let ((keymap (copy-keymap minibuffer-local-map)))
|
|
|
|
|
(define-key keymap [(control ?s)] 'viper-insert-isearch-string)
|
|
|
|
|
keymap))
|
|
|
|
|
(s (viper-read-string-with-history
|
1997-06-02 22:50:31 +00:00
|
|
|
|
prompt
|
|
|
|
|
nil ; no initial
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-search-history
|
2009-08-15 05:57:08 +00:00
|
|
|
|
(car viper-search-history)
|
|
|
|
|
keymap)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (not (string= s ""))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq viper-s-string s))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun viper-toggle-search-style (arg)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
"Toggle the value of viper-case-fold-search/viper-re-search.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
Without prefix argument, will ask which search style to toggle. With prefix
|
2010-01-18 04:39:40 +00:00
|
|
|
|
arg 1, toggles viper-case-fold-search; with arg 2 toggles viper-re-search.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
Although this function is bound to \\[viper-toggle-search-style], the most
|
1997-06-02 22:50:31 +00:00
|
|
|
|
convenient way to use it is to bind `//' to the macro
|
1997-08-02 06:56:24 +00:00
|
|
|
|
`1 M-x viper-toggle-search-style' and `///' to
|
1999-11-01 07:16:15 +00:00
|
|
|
|
`2 M-x viper-toggle-search-style'. In this way, hitting `//' quickly will
|
2011-11-23 07:03:56 +00:00
|
|
|
|
toggle case-fold-search and hitting `/' three times with toggle regexp
|
1999-11-01 07:16:15 +00:00
|
|
|
|
search. Macros are more convenient in this case because they don't affect
|
1997-06-02 22:50:31 +00:00
|
|
|
|
the Emacs binding of `/'."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let (msg)
|
|
|
|
|
(cond ((or (eq arg 1)
|
|
|
|
|
(and (null arg)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(y-or-n-p (format "Search style: '%s'. Want '%s'? "
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-case-fold-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"case-insensitive" "case-sensitive")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-case-fold-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"case-sensitive"
|
|
|
|
|
"case-insensitive")))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-case-fold-search (null viper-case-fold-search))
|
|
|
|
|
(if viper-case-fold-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq msg "Search becomes case-insensitive")
|
|
|
|
|
(setq msg "Search becomes case-sensitive")))
|
|
|
|
|
((or (eq arg 2)
|
|
|
|
|
(and (null arg)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(y-or-n-p (format "Search style: '%s'. Want '%s'? "
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-re-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"regexp-search" "vanilla-search")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-re-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"vanilla-search"
|
|
|
|
|
"regexp-search")))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-re-search (null viper-re-search))
|
|
|
|
|
(if viper-re-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq msg "Search becomes regexp-style")
|
|
|
|
|
(setq msg "Search becomes vanilla-style")))
|
|
|
|
|
(t
|
|
|
|
|
(setq msg "Search style remains unchanged")))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(princ msg t)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2005-02-19 19:32:47 +00:00
|
|
|
|
(defun viper-set-searchstyle-toggling-macros (unset &optional major-mode)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Set the macros for toggling the search style in Viper's vi-state.
|
|
|
|
|
The macro that toggles case sensitivity is bound to `//', and the one that
|
|
|
|
|
toggles regexp search is bound to `///'.
|
2005-02-19 19:32:47 +00:00
|
|
|
|
With a prefix argument, this function unsets the macros.
|
|
|
|
|
If MAJOR-MODE is set, set the macros only in that major mode."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
2005-02-19 19:32:47 +00:00
|
|
|
|
(let (scope)
|
|
|
|
|
(if (and major-mode (symbolp major-mode))
|
|
|
|
|
(setq scope major-mode)
|
|
|
|
|
(setq scope 't))
|
|
|
|
|
(or noninteractive
|
|
|
|
|
(if (not unset)
|
|
|
|
|
(progn
|
|
|
|
|
;; toggle case sensitivity in search
|
|
|
|
|
(viper-record-kbd-macro
|
|
|
|
|
"//" 'vi-state
|
|
|
|
|
[1 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
|
|
|
|
|
scope)
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; toggle regexp/vanilla search
|
2005-02-19 19:32:47 +00:00
|
|
|
|
(viper-record-kbd-macro
|
|
|
|
|
"///" 'vi-state
|
|
|
|
|
[2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
|
|
|
|
|
scope)
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
(if (if (featurep 'xemacs)
|
|
|
|
|
(interactive-p)
|
|
|
|
|
(called-interactively-p 'interactive))
|
2005-02-19 19:32:47 +00:00
|
|
|
|
(message
|
|
|
|
|
"// and /// now toggle case-sensitivity and regexp search")))
|
|
|
|
|
(viper-unrecord-kbd-macro "//" 'vi-state)
|
|
|
|
|
(sit-for 2)
|
|
|
|
|
(viper-unrecord-kbd-macro "///" 'vi-state)))
|
|
|
|
|
))
|
2005-06-10 14:11:45 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-set-parsing-style-toggling-macro (unset)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
"Set `%%%' to be a macro that toggles whether comment fields should be parsed for matching parentheses.
|
|
|
|
|
This is used in conjunction with the `%' command.
|
|
|
|
|
|
|
|
|
|
With a prefix argument, unsets the macro."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(or noninteractive
|
|
|
|
|
(if (not unset)
|
|
|
|
|
(progn
|
|
|
|
|
;; Make %%% toggle parsing comments for matching parentheses
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-record-kbd-macro
|
1997-07-17 19:37:07 +00:00
|
|
|
|
"%%%" 'vi-state
|
1997-08-02 06:56:24 +00:00
|
|
|
|
[(meta x) v i p e r - t o g g l e - p a r s e - s e x p - i g n o r e - c o m m e n t s return]
|
1997-07-17 19:37:07 +00:00
|
|
|
|
't)
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
(if (if (featurep 'xemacs)
|
|
|
|
|
(interactive-p)
|
|
|
|
|
(called-interactively-p 'interactive))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(message
|
|
|
|
|
"%%%%%% now toggles whether comments should be parsed for matching parentheses")))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-unrecord-kbd-macro "%%%" 'vi-state))))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-set-emacs-state-searchstyle-macros (unset &optional arg-majormode)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Set the macros for toggling the search style in Viper's emacs-state.
|
|
|
|
|
The macro that toggles case sensitivity is bound to `//', and the one that
|
|
|
|
|
toggles regexp search is bound to `///'.
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
With a prefix argument, this function unsets the macros.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
If the optional prefix argument is non-nil and specifies a valid major mode,
|
1999-11-01 07:16:15 +00:00
|
|
|
|
this sets the macros only in the macros in that major mode. Otherwise,
|
1997-06-02 22:50:31 +00:00
|
|
|
|
the macros are set in the current major mode.
|
|
|
|
|
\(When unsetting the macros, the second argument has no effect.\)"
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(or noninteractive
|
|
|
|
|
(if (not unset)
|
|
|
|
|
(progn
|
|
|
|
|
;; toggle case sensitivity in search
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-record-kbd-macro
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"//" 'emacs-state
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
[1 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(or arg-majormode major-mode))
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; toggle regexp/vanilla search
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-record-kbd-macro
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"///" 'emacs-state
|
1997-08-02 06:56:24 +00:00
|
|
|
|
[2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(or arg-majormode major-mode))
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
(if (if (featurep 'xemacs)
|
|
|
|
|
(interactive-p)
|
|
|
|
|
(called-interactively-p 'interactive))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(message
|
|
|
|
|
"// and /// now toggle case-sensitivity and regexp search.")))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-unrecord-kbd-macro "//" 'emacs-state)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(sit-for 2)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-unrecord-kbd-macro "///" 'emacs-state))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-search-forward (arg)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
"Search a string forward.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
ARG is used to find the ARG's occurrence of the string.
|
|
|
|
|
Null string will repeat previous search."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-P-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(old-str viper-s-string)
|
|
|
|
|
debug-on-error)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-s-forward t)
|
|
|
|
|
(viper-if-string "/")
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; this is not used at present, but may be used later
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (or (not (equal old-str viper-s-string))
|
|
|
|
|
(not (markerp viper-local-search-start-marker))
|
|
|
|
|
(not (marker-buffer viper-local-search-start-marker)))
|
|
|
|
|
(setq viper-local-search-start-marker (point-marker)))
|
|
|
|
|
(viper-search viper-s-string t val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point (mark t))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(viper-execute-com 'viper-search-next val com)))
|
|
|
|
|
))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-search-backward (arg)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
"Search a string backward.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
ARG is used to find the ARG's occurrence of the string.
|
|
|
|
|
Null string will repeat previous search."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-P-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(old-str viper-s-string)
|
|
|
|
|
debug-on-error)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-s-forward nil)
|
|
|
|
|
(viper-if-string "?")
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; this is not used at present, but may be used later
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (or (not (equal old-str viper-s-string))
|
|
|
|
|
(not (markerp viper-local-search-start-marker))
|
|
|
|
|
(not (marker-buffer viper-local-search-start-marker)))
|
|
|
|
|
(setq viper-local-search-start-marker (point-marker)))
|
|
|
|
|
(viper-search viper-s-string nil val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point (mark t))
|
|
|
|
|
(viper-execute-com 'viper-search-next val com)))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Search for COUNT's occurrence of STRING.
|
|
|
|
|
;; Search is forward if FORWARD is non-nil, otherwise backward.
|
|
|
|
|
;; INIT-POINT is the position where search is to start.
|
|
|
|
|
;; Arguments:
|
|
|
|
|
;; (STRING FORW COUNT &optional NO-OFFSET INIT-POINT LIMIT FAIL-IF-NOT-FOUND)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-search (string forward arg
|
|
|
|
|
&optional no-offset init-point fail-if-not-found)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (not (equal string ""))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(com (viper-getcom arg))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(offset (not no-offset))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(case-fold-search viper-case-fold-search)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(start-point (or init-point (point))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-deactivate-mark)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if forward
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if offset (viper-forward-char-carefully))
|
|
|
|
|
(if viper-re-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(re-search-forward string nil nil val)
|
|
|
|
|
(re-search-backward string))
|
|
|
|
|
(search-forward string nil nil val)
|
|
|
|
|
(search-backward string))
|
|
|
|
|
(if (not (equal start-point (point)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(push-mark start-point t)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(search-failed
|
2008-04-06 19:26:02 +00:00
|
|
|
|
(if (and (not fail-if-not-found) viper-search-wrap-around)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(message "Search wrapped around BOTTOM of buffer")
|
|
|
|
|
(goto-char (point-min))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-search string forward (cons 1 com) t start-point 'fail)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; don't wait in macros
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(or executing-kbd-macro
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(memq viper-intermediate-command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'(viper-repeat
|
|
|
|
|
viper-digit-argument
|
|
|
|
|
viper-command-argument))
|
|
|
|
|
(sit-for 2))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; delete the wrap-around message
|
|
|
|
|
(message "")
|
|
|
|
|
)
|
|
|
|
|
(goto-char start-point)
|
|
|
|
|
(error "`%s': %s not found"
|
|
|
|
|
string
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-re-search "Pattern" "String"))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)))
|
|
|
|
|
;; backward
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-re-search
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(re-search-backward string nil nil val)
|
|
|
|
|
(search-backward string nil nil val))
|
|
|
|
|
(if (not (equal start-point (point)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(push-mark start-point t)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(search-failed
|
2008-04-06 19:26:02 +00:00
|
|
|
|
(if (and (not fail-if-not-found) viper-search-wrap-around)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(message "Search wrapped around TOP of buffer")
|
|
|
|
|
(goto-char (point-max))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-search string forward (cons 1 com) t start-point 'fail)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; don't wait in macros
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(or executing-kbd-macro
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(memq viper-intermediate-command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'(viper-repeat
|
|
|
|
|
viper-digit-argument
|
|
|
|
|
viper-command-argument))
|
|
|
|
|
(sit-for 2))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; delete the wrap-around message
|
|
|
|
|
(message "")
|
|
|
|
|
)
|
|
|
|
|
(goto-char start-point)
|
|
|
|
|
(error "`%s': %s not found"
|
|
|
|
|
string
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-re-search "Pattern" "String"))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))))
|
|
|
|
|
;; pull up or down if at top/bottom of window
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-adjust-window)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; highlight the result of search
|
|
|
|
|
;; don't wait and don't highlight in macros
|
|
|
|
|
(or executing-kbd-macro
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(memq viper-intermediate-command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'(viper-repeat viper-digit-argument viper-command-argument))
|
|
|
|
|
(viper-flash-search-pattern))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-search-next (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Repeat previous search."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(com (viper-getcom arg))
|
|
|
|
|
debug-on-error)
|
2006-08-25 16:06:57 +00:00
|
|
|
|
(if (or (null viper-s-string) (string= viper-s-string ""))
|
|
|
|
|
(error viper-NoPrevSearch))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-search viper-s-string viper-s-forward arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point (mark t))
|
|
|
|
|
(viper-execute-com 'viper-search-next val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-search-Next (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Repeat previous search in the reverse direction."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(com (viper-getcom arg))
|
|
|
|
|
debug-on-error)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (null viper-s-string) (error viper-NoPrevSearch))
|
|
|
|
|
(viper-search viper-s-string (not viper-s-forward) arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-marker-locally 'viper-com-point (mark t))
|
|
|
|
|
(viper-execute-com 'viper-search-Next val com)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Search contents of buffer defined by one of Viper's motion commands.
|
|
|
|
|
;; Repeatable via `n' and `N'.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-buffer-search-enable (&optional c)
|
|
|
|
|
(cond (c (setq viper-buffer-search-char c))
|
|
|
|
|
((null viper-buffer-search-char)
|
2006-10-23 19:20:15 +00:00
|
|
|
|
;; ?g acts as a default value for viper-buffer-search-char
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-buffer-search-char ?g)))
|
|
|
|
|
(define-key viper-vi-basic-map
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(cond ((viper-characterp viper-buffer-search-char)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(char-to-string viper-buffer-search-char))
|
2001-12-24 05:50:31 +00:00
|
|
|
|
(t (error "viper-buffer-search-char: wrong value type, %S"
|
1999-11-01 07:16:15 +00:00
|
|
|
|
viper-buffer-search-char)))
|
|
|
|
|
'viper-command-argument)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(aset viper-exec-array viper-buffer-search-char 'viper-exec-buffer-search)
|
|
|
|
|
(setq viper-prefix-commands
|
|
|
|
|
(cons viper-buffer-search-char viper-prefix-commands)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; This is a Viper wrapper for isearch-forward.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-isearch-forward (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Do incremental search forward."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
;; emacs bug workaround
|
|
|
|
|
(if (listp arg) (setq arg (car arg)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-exec-form-in-emacs (list 'isearch-forward arg)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; This is a Viper wrapper for isearch-backward."
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-isearch-backward (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Do incremental search backward."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
;; emacs bug workaround
|
|
|
|
|
(if (listp arg) (setq arg (car arg)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-exec-form-in-emacs (list 'isearch-backward arg)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; visiting and killing files, buffers
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-switch-to-buffer ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Switch to buffer in the current window."
|
|
|
|
|
(interactive)
|
1998-05-30 14:28:56 +00:00
|
|
|
|
(let ((other-buffer (other-buffer (current-buffer)))
|
|
|
|
|
buffer)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq buffer
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(funcall viper-read-buffer-function
|
|
|
|
|
"Switch to buffer in this window: " other-buffer))
|
1998-05-30 14:28:56 +00:00
|
|
|
|
(switch-to-buffer buffer)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-switch-to-buffer-other-window ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Switch to buffer in another window."
|
|
|
|
|
(interactive)
|
1998-05-30 14:28:56 +00:00
|
|
|
|
(let ((other-buffer (other-buffer (current-buffer)))
|
|
|
|
|
buffer)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq buffer
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(funcall viper-read-buffer-function
|
|
|
|
|
"Switch to buffer in another window: " other-buffer))
|
1998-05-30 14:28:56 +00:00
|
|
|
|
(switch-to-buffer-other-window buffer)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-kill-buffer ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Kill a buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let (buffer buffer-name)
|
|
|
|
|
(setq buffer-name
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(funcall viper-read-buffer-function
|
|
|
|
|
(format "Kill buffer \(%s\): "
|
|
|
|
|
(buffer-name (current-buffer)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq buffer
|
|
|
|
|
(if (null buffer-name)
|
|
|
|
|
(current-buffer)
|
|
|
|
|
(get-buffer buffer-name)))
|
|
|
|
|
(if (null buffer) (error "`%s': No such buffer" buffer-name))
|
|
|
|
|
(if (or (not (buffer-modified-p buffer))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(y-or-n-p
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(format
|
|
|
|
|
"Buffer `%s' is modified, are you sure you want to kill it? "
|
|
|
|
|
buffer-name)))
|
|
|
|
|
(kill-buffer buffer)
|
|
|
|
|
(error "Buffer not killed"))))
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; yank and pop
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defsubst viper-yank (text)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"Yank TEXT silently. This works correctly with Emacs's yank-pop command."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(insert text)
|
|
|
|
|
(setq this-command 'yank))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-put-back (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Put back after point/below line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(text (if viper-use-register
|
|
|
|
|
(cond ((viper-valid-register viper-use-register '(digit))
|
|
|
|
|
(current-kill
|
|
|
|
|
(- viper-use-register ?1) 'do-not-rotate))
|
|
|
|
|
((viper-valid-register viper-use-register)
|
|
|
|
|
(get-register (downcase viper-use-register)))
|
|
|
|
|
(t (error viper-InvalidRegister viper-use-register)))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(current-kill 0)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
sv-point chars-inserted lines-inserted)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (null text)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-use-register
|
|
|
|
|
(let ((reg viper-use-register))
|
|
|
|
|
(setq viper-use-register nil)
|
|
|
|
|
(error viper-EmptyRegister reg))
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(error "Viper bell")))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-use-register nil)
|
|
|
|
|
(if (viper-end-with-a-newline-p text)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(if (eobp)
|
|
|
|
|
(insert "\n")
|
|
|
|
|
(forward-line 1))
|
|
|
|
|
(beginning-of-line))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (not (eolp)) (viper-forward-char-carefully)))
|
|
|
|
|
(set-marker (viper-mark-marker) (point) (current-buffer))
|
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-put-back val nil viper-use-register nil nil))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(setq sv-point (point))
|
|
|
|
|
(viper-loop val (viper-yank text))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(setq chars-inserted (abs (- (point) sv-point))
|
|
|
|
|
lines-inserted (abs (count-lines (point) sv-point)))
|
|
|
|
|
(if (or (> chars-inserted viper-change-notification-threshold)
|
|
|
|
|
(> lines-inserted viper-change-notification-threshold))
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless (viper-is-in-minibuffer)
|
|
|
|
|
(message "Inserted %d character(s), %d line(s)"
|
|
|
|
|
chars-inserted lines-inserted))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Vi puts cursor on the last char when the yanked text doesn't contain a
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; newline; it leaves the cursor at the beginning when the text contains
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; a newline
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (viper-same-line (point) (mark))
|
|
|
|
|
(or (= (point) (mark)) (viper-backward-char-carefully))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(exchange-point-and-mark)
|
|
|
|
|
(if (bolp)
|
|
|
|
|
(back-to-indentation)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-deactivate-mark))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-Put-back (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Put back at point/above line."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
(text (if viper-use-register
|
|
|
|
|
(cond ((viper-valid-register viper-use-register '(digit))
|
|
|
|
|
(current-kill
|
|
|
|
|
(- viper-use-register ?1) 'do-not-rotate))
|
|
|
|
|
((viper-valid-register viper-use-register)
|
|
|
|
|
(get-register (downcase viper-use-register)))
|
|
|
|
|
(t (error viper-InvalidRegister viper-use-register)))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(current-kill 0)))
|
|
|
|
|
sv-point chars-inserted lines-inserted)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (null text)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-use-register
|
|
|
|
|
(let ((reg viper-use-register))
|
|
|
|
|
(setq viper-use-register nil)
|
|
|
|
|
(error viper-EmptyRegister reg))
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(error "Viper bell")))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-use-register nil)
|
|
|
|
|
(if (viper-end-with-a-newline-p text) (beginning-of-line))
|
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-Put-back val nil viper-use-register nil nil))
|
|
|
|
|
(set-marker (viper-mark-marker) (point) (current-buffer))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(setq sv-point (point))
|
|
|
|
|
(viper-loop val (viper-yank text))
|
|
|
|
|
(setq chars-inserted (abs (- (point) sv-point))
|
|
|
|
|
lines-inserted (abs (count-lines (point) sv-point)))
|
|
|
|
|
(if (or (> chars-inserted viper-change-notification-threshold)
|
|
|
|
|
(> lines-inserted viper-change-notification-threshold))
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless (viper-is-in-minibuffer)
|
|
|
|
|
(message "Inserted %d character(s), %d line(s)"
|
|
|
|
|
chars-inserted lines-inserted))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Vi puts cursor on the last char when the yanked text doesn't contain a
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; newline; it leaves the cursor at the beginning when the text contains
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; a newline
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (viper-same-line (point) (mark))
|
|
|
|
|
(or (= (point) (mark)) (viper-backward-char-carefully))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(exchange-point-and-mark)
|
|
|
|
|
(if (bolp)
|
|
|
|
|
(back-to-indentation)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-deactivate-mark))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
;; Copy region to kill-ring.
|
|
|
|
|
;; If BEG and END do not belong to the same buffer, copy empty region.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-copy-region-as-kill (beg end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(condition-case nil
|
|
|
|
|
(copy-region-as-kill beg end)
|
|
|
|
|
(error (copy-region-as-kill beg beg))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-delete-char (arg)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
"Delete next character."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
end-del-pos)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-delete-char val nil nil nil nil))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (and viper-ex-style-editing
|
|
|
|
|
(> val (viper-chars-in-region (point) (viper-line-pos 'end))))
|
|
|
|
|
(setq val (viper-chars-in-region (point) (viper-line-pos 'end))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (and viper-ex-style-motion (eolp))
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(if (bolp) (error "Viper bell") (setq val 0))) ; not bol---simply back 1 ch
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(viper-forward-char-carefully val)
|
|
|
|
|
(setq end-del-pos (point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-use-register
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-valid-register viper-use-register '((Letter)))
|
|
|
|
|
(viper-append-to-register
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(downcase viper-use-register) (point) end-del-pos))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((viper-valid-register viper-use-register)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(copy-to-register
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-use-register (point) end-del-pos nil))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (error viper-InvalidRegister viper-use-register)))
|
|
|
|
|
(setq viper-use-register nil)))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
|
|
|
|
|
(delete-char val t)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-ex-style-motion
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (and (eolp) (not (bolp))) (backward-char 1)))
|
|
|
|
|
))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-delete-backward-char (arg)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"Delete previous character. On reaching beginning of line, stop and beep."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(let ((val (viper-p-val arg))
|
|
|
|
|
end-del-pos)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-delete-backward-char val nil nil nil nil))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(if (and
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-ex-style-editing
|
|
|
|
|
(> val (viper-chars-in-region (viper-line-pos 'start) (point))))
|
|
|
|
|
(setq val (viper-chars-in-region (viper-line-pos 'start) (point))))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(viper-backward-char-carefully val)
|
|
|
|
|
(setq end-del-pos (point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-use-register
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-valid-register viper-use-register '(Letter))
|
|
|
|
|
(viper-append-to-register
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(downcase viper-use-register) end-del-pos (point)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((viper-valid-register viper-use-register)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(copy-to-register
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-use-register end-del-pos (point) nil))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (error viper-InvalidRegister viper-use-register)))
|
|
|
|
|
(setq viper-use-register nil)))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (and (bolp) viper-ex-style-editing)
|
|
|
|
|
(ding))
|
2010-07-02 14:09:36 +00:00
|
|
|
|
(delete-char (- val) t)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-del-backward-char-in-insert ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Delete 1 char backwards while in insert mode."
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(interactive)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (and viper-ex-style-editing (bolp))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(beep 1)
|
2005-02-19 19:32:47 +00:00
|
|
|
|
;; don't put on kill ring
|
2010-07-02 14:09:36 +00:00
|
|
|
|
(delete-char -1 nil)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-del-backward-char-in-replace ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Delete one character in replace mode.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
If `viper-delete-backwards-in-replace' is t, then DEL key actually deletes
|
2010-01-18 04:39:40 +00:00
|
|
|
|
characters. If it is nil, then the cursor just moves backwards, similarly
|
1999-11-01 07:16:15 +00:00
|
|
|
|
to Vi. The variable `viper-ex-style-editing', if t, doesn't let the
|
1997-06-02 22:50:31 +00:00
|
|
|
|
cursor move past the beginning of line."
|
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond (viper-delete-backwards-in-replace
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(cond ((not (bolp))
|
2005-02-19 19:32:47 +00:00
|
|
|
|
;; don't put on kill ring
|
2010-07-02 14:09:36 +00:00
|
|
|
|
(delete-char -1 nil))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-ex-style-editing
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(beep 1))
|
|
|
|
|
((bobp)
|
|
|
|
|
(beep 1))
|
|
|
|
|
(t
|
2005-02-19 19:32:47 +00:00
|
|
|
|
;; don't put on kill ring
|
2010-07-02 14:09:36 +00:00
|
|
|
|
(delete-char -1 nil))))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-ex-style-editing
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (bolp)
|
|
|
|
|
(beep 1)
|
|
|
|
|
(backward-char 1)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(t
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(backward-char 1))))
|
|
|
|
|
|
2013-07-07 19:35:54 +00:00
|
|
|
|
(defun viper-del-forward-char-in-insert ()
|
|
|
|
|
"Delete 1 char forward if in insert or replace state."
|
|
|
|
|
(interactive)
|
|
|
|
|
;; don't put on kill ring
|
|
|
|
|
(delete-char 1 nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; join lines.
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-join-lines (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Join this line to next, if ARG is nil. Otherwise, join ARG lines."
|
|
|
|
|
(interactive "*P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-P-val arg)))
|
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-join-lines val nil nil nil nil))
|
|
|
|
|
(viper-loop (if (null val) 1 (1- val))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(end-of-line)
|
|
|
|
|
(if (not (eobp))
|
|
|
|
|
(progn
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(delete-region (point) (1- (point)))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(fixup-whitespace)
|
|
|
|
|
;; fixup-whitespace sometimes does not leave space
|
|
|
|
|
;; between objects, so we insert it as in Vi
|
|
|
|
|
(or (looking-at " ")
|
|
|
|
|
(insert " ")
|
|
|
|
|
(backward-char 1))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Replace state
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change (beg end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (markerp beg) (setq beg (marker-position beg)))
|
|
|
|
|
(if (markerp end) (setq end (marker-position end)))
|
|
|
|
|
;; beg is sometimes (mark t), which may be nil
|
|
|
|
|
(or beg (setq beg end))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-complex-command-for-undo)
|
|
|
|
|
(if viper-use-register
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(copy-to-register viper-use-register beg end nil)
|
|
|
|
|
(setq viper-use-register nil)))
|
|
|
|
|
(viper-set-replace-overlay beg end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq last-command nil) ; separate repl text from prev kills
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (= (viper-replace-start) (point-max))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error "End of buffer"))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-replace-region
|
|
|
|
|
(buffer-substring (viper-replace-start)
|
|
|
|
|
(viper-replace-end)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; protect against error while inserting "@" and other disasters
|
|
|
|
|
;; (e.g., read-only buff)
|
|
|
|
|
(condition-case conds
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (or viper-allow-multiline-replace-regions
|
|
|
|
|
(viper-same-line (viper-replace-start)
|
1997-08-07 04:48:48 +00:00
|
|
|
|
(viper-replace-end)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
;; tabs cause problems in replace, so untabify
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(goto-char (viper-replace-end))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(insert-before-markers "@") ; put placeholder after the TAB
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(untabify (viper-replace-start) (point))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; del @, don't put on kill ring
|
2010-07-02 14:09:36 +00:00
|
|
|
|
(delete-char -1)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-replace-overlay-glyphs
|
|
|
|
|
viper-replace-region-start-delimiter
|
|
|
|
|
viper-replace-region-end-delimiter)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; this move takes care of the last posn in the overlay, which
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; has to be shifted because of insert. We can't simply insert
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; "$" before-markers because then overlay-start will shift the
|
|
|
|
|
;; beginning of the overlay in case we are replacing a single
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; character. This fixes the bug with `s' and `cl' commands.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-move-replace-overlay (viper-replace-start) (point))
|
|
|
|
|
(goto-char (viper-replace-start))
|
|
|
|
|
(viper-change-state-to-replace t))
|
|
|
|
|
(kill-region (viper-replace-start)
|
|
|
|
|
(viper-replace-end))
|
|
|
|
|
(viper-hide-replace-overlay)
|
|
|
|
|
(viper-change-state-to-insert))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(error ;; make sure that the overlay doesn't stay.
|
|
|
|
|
;; go back to the original point
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(goto-char (viper-replace-start))
|
|
|
|
|
(viper-hide-replace-overlay)
|
|
|
|
|
(viper-message-conditions conds))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-change-subr (beg end)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; beg is sometimes (mark t), which may be nil
|
|
|
|
|
(or beg (setq beg end))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-use-register
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(copy-to-register viper-use-register beg end nil)
|
|
|
|
|
(setq viper-use-register nil)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(kill-region beg end)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq this-command 'viper-change)
|
|
|
|
|
(viper-yank-last-insertion))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-toggle-case (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Toggle character case."
|
|
|
|
|
(interactive "P")
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(let ((val (viper-p-val arg)) (c))
|
|
|
|
|
(viper-set-destructive-command
|
|
|
|
|
(list 'viper-toggle-case val nil nil nil nil))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(while (> val 0)
|
|
|
|
|
(setq c (following-char))
|
|
|
|
|
(delete-char 1 nil)
|
|
|
|
|
(if (eq c (upcase c))
|
|
|
|
|
(insert-char (downcase c) 1)
|
|
|
|
|
(insert-char (upcase c) 1))
|
|
|
|
|
(if (eolp) (backward-char 1))
|
|
|
|
|
(setq val (1- val)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; query replace
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-query-replace ()
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
"Query replace.
|
2011-12-31 01:27:15 +00:00
|
|
|
|
If a null string is supplied as the string to be replaced,
|
1997-06-02 22:50:31 +00:00
|
|
|
|
the query replace mode will toggle between string replace
|
|
|
|
|
and regexp replace."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let (str)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq str (viper-read-string-with-history
|
|
|
|
|
(if viper-re-query-replace "Query replace regexp: "
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Query replace: ")
|
|
|
|
|
nil ; no initial
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-replace1-history
|
|
|
|
|
(car viper-replace1-history) ; default
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
(if (string= str "")
|
|
|
|
|
(progn
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-re-query-replace (not viper-re-query-replace))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(message "Query replace mode changed to %s"
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-re-query-replace "regexp replace"
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"string replace")))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-re-query-replace
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(query-replace-regexp
|
|
|
|
|
str
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-read-string-with-history
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(format "Query replace regexp `%s' with: " str)
|
|
|
|
|
nil ; no initial
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-replace1-history
|
|
|
|
|
(car viper-replace1-history) ; default
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
(query-replace
|
|
|
|
|
str
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-read-string-with-history
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(format "Query replace `%s' with: " str)
|
|
|
|
|
nil ; no initial
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-replace1-history
|
|
|
|
|
(car viper-replace1-history) ; default
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; marking
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-mark-beginning-of-buffer ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Mark beginning of buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(push-mark (point))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(exchange-point-and-mark)
|
|
|
|
|
(message "Mark set at the beginning of buffer"))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-mark-end-of-buffer ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Mark end of buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(push-mark (point))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(exchange-point-and-mark)
|
|
|
|
|
(message "Mark set at the end of buffer"))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-mark-point ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Set mark at point of buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((char (read-char)))
|
|
|
|
|
(cond ((and (<= ?a char) (<= char ?z))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(point-to-register (viper-int-to-char (1+ (- char ?a)))))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= char ?<) (viper-mark-beginning-of-buffer))
|
|
|
|
|
((viper= char ?>) (viper-mark-end-of-buffer))
|
|
|
|
|
((viper= char ?.) (viper-set-mark-if-necessary))
|
|
|
|
|
((viper= char ?,) (viper-cycle-through-mark-ring))
|
|
|
|
|
((viper= char ?^) (push-mark viper-saved-mark t t))
|
|
|
|
|
((viper= char ?D) (mark-defun))
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(t (error "Viper bell"))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
)))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Algorithm: If first invocation of this command save mark on ring, goto
|
|
|
|
|
;; mark, M0, and pop the most recent elt from the mark ring into mark,
|
|
|
|
|
;; making it into the new mark, M1.
|
|
|
|
|
;; Push this mark back and set mark to the original point position, p1.
|
|
|
|
|
;; So, if you hit '' or `` then you can return to p1.
|
|
|
|
|
;;
|
|
|
|
|
;; If repeated command, pop top elt from the ring into mark and
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; jump there. This forgets the position, p1, and puts M1 back into mark.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Then we save the current pos, which is M0, jump to M1 and pop M2 from
|
|
|
|
|
;; the ring into mark. Push M2 back on the ring and set mark to M0.
|
|
|
|
|
;; etc.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-cycle-through-mark-ring ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Visit previous locations on the mark ring.
|
|
|
|
|
One can use `` and '' to temporarily jump 1 step back."
|
|
|
|
|
(let* ((sv-pt (point)))
|
|
|
|
|
;; if repeated `m,' command, pop the previously saved mark.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Prev saved mark is actually prev saved point. It is used if the
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
;; user types `` or '' and is discarded
|
|
|
|
|
;; from the mark ring by the next `m,' command.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; In any case, go to the previous or previously saved mark.
|
|
|
|
|
;; Then push the current mark (popped off the ring) and set current
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; point to be the mark. Current pt as mark is discarded by the next
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; m, command.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if (eq last-command 'viper-cycle-through-mark-ring)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
()
|
|
|
|
|
;; save current mark if the first iteration
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq mark-ring (delete (viper-mark-marker) mark-ring))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (mark t)
|
|
|
|
|
(push-mark (mark t) t)) )
|
|
|
|
|
(pop-mark)
|
|
|
|
|
(set-mark-command 1)
|
|
|
|
|
;; don't duplicate mark on the ring
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq mark-ring (delete (viper-mark-marker) mark-ring))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(push-mark sv-pt t)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-deactivate-mark)
|
|
|
|
|
(setq this-command 'viper-cycle-through-mark-ring)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-mark (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to mark."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((char (read-char))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(com (viper-getcom arg)))
|
|
|
|
|
(viper-goto-mark-subr char com nil)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-mark-and-skip-white (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Go to mark and skip to first non-white character on line."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((char (read-char))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(com (viper-getCom arg)))
|
|
|
|
|
(viper-goto-mark-subr char com t)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-goto-mark-subr (char com skip-white)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(if (eobp)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (bobp)
|
|
|
|
|
(error "Empty buffer")
|
|
|
|
|
(backward-char 1)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-valid-register char '(letter))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let* ((buff (current-buffer))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(reg (viper-int-to-char (1+ (- char ?a))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(text-marker (get-register reg)))
|
2000-02-28 06:16:44 +00:00
|
|
|
|
;; If marker points to file that had markers set (and those markers
|
|
|
|
|
;; were saved (as e.g., in session.el), then restore those markers
|
|
|
|
|
(if (and (consp text-marker)
|
|
|
|
|
(eq (car text-marker) 'file-query)
|
|
|
|
|
(or (find-buffer-visiting (nth 1 text-marker))
|
|
|
|
|
(y-or-n-p (format "Visit file %s again? "
|
|
|
|
|
(nth 1 text-marker)))))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(find-file (nth 1 text-marker))
|
|
|
|
|
(when (and (<= (nth 2 text-marker) (point-max))
|
|
|
|
|
(<= (point-min) (nth 2 text-marker)))
|
|
|
|
|
(setq text-marker (copy-marker (nth 2 text-marker)))
|
|
|
|
|
(set-register reg text-marker))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(if (not (viper-valid-marker text-marker))
|
|
|
|
|
(error viper-EmptyTextmarker char))
|
|
|
|
|
(if (and (viper-same-line (point) viper-last-jump)
|
|
|
|
|
(= (point) viper-last-jump-ignore))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(push-mark viper-last-jump t)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(push-mark nil t)) ; no msg
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-register-to-point reg)
|
|
|
|
|
(setq viper-last-jump (point-marker))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(cond (skip-white
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(back-to-indentation)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-jump-ignore (point))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if com
|
|
|
|
|
(if (equal buff (current-buffer))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-execute-com (if skip-white
|
|
|
|
|
'viper-goto-mark-and-skip-white
|
|
|
|
|
'viper-goto-mark)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
nil com)
|
|
|
|
|
(switch-to-buffer buff)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(goto-char viper-com-point)
|
|
|
|
|
(viper-change-state-to-vi)
|
2007-08-19 13:47:08 +00:00
|
|
|
|
(error "Viper bell")))))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((and (not skip-white) (viper= char ?`))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(if (and (viper-same-line (point) viper-last-jump)
|
|
|
|
|
(= (point) viper-last-jump-ignore))
|
|
|
|
|
(goto-char viper-last-jump))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (null (mark t)) (error "Mark is not set in this buffer"))
|
|
|
|
|
(if (= (point) (mark t)) (pop-mark))
|
|
|
|
|
(exchange-point-and-mark)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-jump (point-marker)
|
|
|
|
|
viper-last-jump-ignore 0)
|
|
|
|
|
(if com (viper-execute-com 'viper-goto-mark nil com)))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((and skip-white (viper= char ?'))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if com (viper-move-marker-locally 'viper-com-point (point)))
|
|
|
|
|
(if (and (viper-same-line (point) viper-last-jump)
|
|
|
|
|
(= (point) viper-last-jump-ignore))
|
|
|
|
|
(goto-char viper-last-jump))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (= (point) (mark t)) (pop-mark))
|
|
|
|
|
(exchange-point-and-mark)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-jump (point))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(back-to-indentation)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-last-jump-ignore (point))
|
|
|
|
|
(if com (viper-execute-com 'viper-goto-mark-and-skip-white nil com)))
|
|
|
|
|
(t (error viper-InvalidTextmarker char))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-insert-tab ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(insert-tab))
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-exchange-point-and-mark ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(exchange-point-and-mark)
|
|
|
|
|
(back-to-indentation))
|
|
|
|
|
|
|
|
|
|
;; Input Mode Indentation
|
|
|
|
|
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
(define-obsolete-function-alias 'viper-looking-back 'looking-back "24.4")
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-forward-indent ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Indent forward -- `C-t' in Vi."
|
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-cted t)
|
|
|
|
|
(indent-to (+ (current-column) viper-shift-width)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-backward-indent ()
|
2010-01-18 04:39:40 +00:00
|
|
|
|
"Backtab, `C-d' in Vi."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-cted
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((p (point)) (c (current-column)) bol (indent t))
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
(if (looking-back "[0^]")
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
|
|
|
|
(if (eq ?^ (preceding-char))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-preserve-indent t))
|
2010-07-02 14:09:36 +00:00
|
|
|
|
(delete-char -1)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq p (point))
|
|
|
|
|
(setq indent nil)))
|
Replace still more end-of-line etc with line-end-position, etc.
* lisp/gnus/nnbabyl.el (nnbabyl-request-move-article, nnbabyl-delete-mail)
(nnbabyl-check-mbox): Use point-at-bol.
* lisp/cedet/semantic/lex.el (semantic-lex-ignore-comments, semantic-flex):
* lisp/cedet/semantic/grammar.el (semantic-grammar-epilogue):
* lisp/cedet/ede/speedbar.el (ede-find-nearest-file-line):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/ede/autoconf-edit.el (autoconf-delete-parameter):
Use point-at-bol and point-at-eol.
* lisp/vc/emerge.el (emerge-line-number-in-buf):
* lisp/textmodes/ispell.el (ispell-region):
* lisp/textmodes/fill.el (current-fill-column):
* lisp/progmodes/xscheme.el (xscheme-send-current-line):
* lisp/progmodes/vhdl-mode.el (vhdl-current-line, vhdl-line-copy):
* lisp/progmodes/tcl.el (tcl-hairy-scan-for-comment):
* lisp/progmodes/sh-script.el (sh-handle-prev-do):
* lisp/progmodes/meta-mode.el (meta-indent-line):
* lisp/progmodes/idlwave.el (idlwave-goto-comment, idlwave-fill-paragraph)
(idlwave-in-quote):
* lisp/progmodes/idlw-shell.el (idlwave-shell-current-frame)
(idlwave-shell-update-bp-overlays, idlwave-shell-sources-filter):
* lisp/progmodes/fortran.el (fortran-looking-at-if-then):
* lisp/progmodes/etags.el (find-tag-in-order, etags-snarf-tag):
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent)
(cperl-find-pods-heres):
* lisp/progmodes/ada-mode.el (ada-get-current-indent, ada-narrow-to-defun):
* lisp/net/quickurl.el (quickurl-list-insert):
* lisp/net/ldap.el (ldap-search-internal):
* lisp/net/eudc.el (eudc-expand-inline):
* lisp/mail/sendmail.el (sendmail-send-it):
* lisp/mail/mspools.el (mspools-visit-spool, mspools-get-spool-name):
* lisp/emulation/viper-cmd.el (viper-paren-match, viper-backward-indent)
(viper-brac-function):
* lisp/calc/calc-yank.el (calc-do-grab-region):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/term.el (term-move-columns, term-insert-spaces):
* lisp/speedbar.el (speedbar-highlight-one-tag-line):
* lisp/simple.el (current-word):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* lisp/info.el (Info-find-node-in-buffer-1, Info-follow-reference)
(Info-scroll-down):
* lisp/hippie-exp.el (he-line-beg):
* lisp/epa.el (epa--marked-keys):
* lisp/dired-aux.el (dired-kill-line, dired-do-kill-lines)
(dired-update-file-line, dired-add-entry, dired-remove-entry)
(dired-relist-entry):
* lisp/buff-menu.el (Buffer-menu-buffer):
* lisp/array.el (current-line):
* lisp/allout.el (allout-resolve-xref)
(allout-latex-verbatim-quote-curr-line):
Replace yet more uses of end-of-line etc with line-end-position.
2010-11-09 05:33:07 +00:00
|
|
|
|
(setq bol (point-at-bol))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (re-search-backward "[^ \t]" bol 1) (forward-char))
|
|
|
|
|
(delete-region (point) p)
|
|
|
|
|
(if indent
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(indent-to (- c viper-shift-width)))
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
(if (or (bolp) (looking-back "[^ \t]"))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-cted nil)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
;; do smart indent
|
|
|
|
|
(defun viper-indent-line (col)
|
|
|
|
|
(if viper-auto-indent
|
|
|
|
|
(progn
|
|
|
|
|
(setq viper-cted t)
|
|
|
|
|
(if (and viper-electric-mode
|
|
|
|
|
(not (memq major-mode '(fundamental-mode
|
|
|
|
|
text-mode
|
|
|
|
|
paragraph-indent-text-mode))))
|
|
|
|
|
(indent-according-to-mode)
|
|
|
|
|
(indent-to col)))))
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-autoindent ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Auto Indentation, Vi-style."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((col (current-indentation)))
|
|
|
|
|
(if abbrev-mode (expand-abbrev))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(if viper-preserve-indent
|
|
|
|
|
(setq viper-preserve-indent nil)
|
|
|
|
|
(setq viper-current-indent col))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; don't leave whitespace lines around
|
|
|
|
|
(if (memq last-command
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'(viper-autoindent
|
|
|
|
|
viper-open-line viper-Open-line
|
|
|
|
|
viper-replace-state-exit-cmd))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(indent-to-left-margin))
|
|
|
|
|
;; use \n instead of newline, or else <Return> will move the insert point
|
|
|
|
|
;;(newline 1)
|
|
|
|
|
(insert "\n")
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(viper-indent-line viper-current-indent)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Viewing registers
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-ket-function (arg)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"Function called by \], the ket. View registers and call \]\]."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((reg (read-char)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(cond ((viper-valid-register reg '(letter Letter))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(view-register (downcase reg)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((viper-valid-register reg '(digit))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(let ((text (current-kill (- reg ?1) 'do-not-rotate)))
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(with-output-to-temp-buffer " *viper-info*"
|
|
|
|
|
(princ (format "Register %c contains the string:\n" reg))
|
|
|
|
|
(princ text))
|
|
|
|
|
))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= ?\] reg)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-next-heading arg))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(t (error
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-InvalidRegister reg)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-brac-function (arg)
|
2010-01-18 04:39:40 +00:00
|
|
|
|
"Function called by \[, the brac. View textmarkers and call \[\[."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((reg (read-char)))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
(cond ((viper= ?\[ reg)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-prev-heading arg))
|
2000-10-29 04:56:45 +00:00
|
|
|
|
((viper= ?\] reg)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-heading-end arg))
|
|
|
|
|
((viper-valid-register reg '(letter))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(let* ((val (get-register (viper-int-to-char (1+ (- reg ?a)))))
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(buf (if (not (markerp val))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(error viper-EmptyTextmarker reg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(marker-buffer val)))
|
|
|
|
|
(pos (marker-position val))
|
|
|
|
|
line-no text (s pos) (e pos))
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(with-output-to-temp-buffer " *viper-info*"
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and buf pos)
|
|
|
|
|
(progn
|
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
|
|
|
|
(with-current-buffer buf
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(setq line-no (1+ (count-lines (point-min) val)))
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(if (re-search-backward "[^ \t]" nil t)
|
Replace still more end-of-line etc with line-end-position, etc.
* lisp/gnus/nnbabyl.el (nnbabyl-request-move-article, nnbabyl-delete-mail)
(nnbabyl-check-mbox): Use point-at-bol.
* lisp/cedet/semantic/lex.el (semantic-lex-ignore-comments, semantic-flex):
* lisp/cedet/semantic/grammar.el (semantic-grammar-epilogue):
* lisp/cedet/ede/speedbar.el (ede-find-nearest-file-line):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/ede/autoconf-edit.el (autoconf-delete-parameter):
Use point-at-bol and point-at-eol.
* lisp/vc/emerge.el (emerge-line-number-in-buf):
* lisp/textmodes/ispell.el (ispell-region):
* lisp/textmodes/fill.el (current-fill-column):
* lisp/progmodes/xscheme.el (xscheme-send-current-line):
* lisp/progmodes/vhdl-mode.el (vhdl-current-line, vhdl-line-copy):
* lisp/progmodes/tcl.el (tcl-hairy-scan-for-comment):
* lisp/progmodes/sh-script.el (sh-handle-prev-do):
* lisp/progmodes/meta-mode.el (meta-indent-line):
* lisp/progmodes/idlwave.el (idlwave-goto-comment, idlwave-fill-paragraph)
(idlwave-in-quote):
* lisp/progmodes/idlw-shell.el (idlwave-shell-current-frame)
(idlwave-shell-update-bp-overlays, idlwave-shell-sources-filter):
* lisp/progmodes/fortran.el (fortran-looking-at-if-then):
* lisp/progmodes/etags.el (find-tag-in-order, etags-snarf-tag):
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent)
(cperl-find-pods-heres):
* lisp/progmodes/ada-mode.el (ada-get-current-indent, ada-narrow-to-defun):
* lisp/net/quickurl.el (quickurl-list-insert):
* lisp/net/ldap.el (ldap-search-internal):
* lisp/net/eudc.el (eudc-expand-inline):
* lisp/mail/sendmail.el (sendmail-send-it):
* lisp/mail/mspools.el (mspools-visit-spool, mspools-get-spool-name):
* lisp/emulation/viper-cmd.el (viper-paren-match, viper-backward-indent)
(viper-brac-function):
* lisp/calc/calc-yank.el (calc-do-grab-region):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/term.el (term-move-columns, term-insert-spaces):
* lisp/speedbar.el (speedbar-highlight-one-tag-line):
* lisp/simple.el (current-word):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* lisp/info.el (Info-find-node-in-buffer-1, Info-follow-reference)
(Info-scroll-down):
* lisp/hippie-exp.el (he-line-beg):
* lisp/epa.el (epa--marked-keys):
* lisp/dired-aux.el (dired-kill-line, dired-do-kill-lines)
(dired-update-file-line, dired-add-entry, dired-remove-entry)
(dired-relist-entry):
* lisp/buff-menu.el (Buffer-menu-buffer):
* lisp/array.el (current-line):
* lisp/allout.el (allout-resolve-xref)
(allout-latex-verbatim-quote-curr-line):
Replace yet more uses of end-of-line etc with line-end-position.
2010-11-09 05:33:07 +00:00
|
|
|
|
(setq s (point-at-bol)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(goto-char pos)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(if (re-search-forward "[^ \t]" nil t)
|
|
|
|
|
(progn
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq e (point))))
|
|
|
|
|
(setq text (buffer-substring s e))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq text (format "%s<%c>%s"
|
|
|
|
|
(substring text 0 (- pos s))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
reg (substring text (- pos s)))))
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(princ
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(format
|
|
|
|
|
"Textmarker `%c' is in buffer `%s' at line %d.\n"
|
|
|
|
|
reg (buffer-name buf) line-no))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(princ (format "Here is some text around %c:\n\n %s"
|
1997-06-02 22:50:31 +00:00
|
|
|
|
reg text)))
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(princ (format viper-EmptyTextmarker reg))))
|
|
|
|
|
))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(t (error viper-InvalidTextmarker reg)))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-delete-backward-word (arg)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Delete previous word."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(push-mark nil t)
|
|
|
|
|
(backward-word arg)
|
|
|
|
|
(delete-region (point) (mark t))
|
|
|
|
|
(pop-mark)))
|
|
|
|
|
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Get viper standard value of SYMBOL. If symbol is customized, get its
|
|
|
|
|
;; standard value. Otherwise, get the value saved in the alist STORAGE. If
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; STORAGE is nil, use viper-saved-user-settings.
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
(defun viper-standard-value (symbol &optional storage)
|
|
|
|
|
(or (eval (car (get symbol 'customized-value)))
|
|
|
|
|
(eval (car (get symbol 'saved-value)))
|
|
|
|
|
(nth 1 (assoc symbol (or storage viper-saved-user-settings)))))
|
|
|
|
|
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(defun viper-set-expert-level (&optional dont-change-unless)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Sets the expert level for a Viper user.
|
|
|
|
|
Can be called interactively to change (temporarily or permanently) the
|
|
|
|
|
current expert level.
|
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
The optional argument DONT-CHANGE-UNLESS, if not nil, says that
|
1997-06-02 22:50:31 +00:00
|
|
|
|
the level should not be changed, unless its current value is
|
|
|
|
|
meaningless (i.e., not one of 1,2,3,4,5).
|
|
|
|
|
|
|
|
|
|
User level determines the setting of Viper variables that are most
|
|
|
|
|
sensitive for VI-style look-and-feel."
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(if (not (natnump viper-expert-level)) (setq viper-expert-level 0))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-window-excursion
|
|
|
|
|
(delete-other-windows)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; if 0 < viper-expert-level < viper-max-expert-level
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; & dont-change-unless = t -- use it; else ask
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-ask-level dont-change-unless))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-always t
|
|
|
|
|
viper-ex-style-motion t
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-ex-style-editing t
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-want-ctl-h-help nil)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(cond ((eq viper-expert-level 1) ; novice or beginner
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(global-set-key ; in emacs-state
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-toggle-key
|
|
|
|
|
(if (viper-window-display-p) 'viper-iconify 'suspend-emacs))
|
|
|
|
|
(setq viper-no-multiple-ESC t
|
|
|
|
|
viper-re-search t
|
|
|
|
|
viper-vi-style-in-minibuffer t
|
2008-04-06 19:26:02 +00:00
|
|
|
|
viper-search-wrap-around t
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-electric-mode nil
|
|
|
|
|
viper-want-emacs-keys-in-vi nil
|
|
|
|
|
viper-want-emacs-keys-in-insert nil))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
((and (> viper-expert-level 1) (< viper-expert-level 5))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; intermediate to guru
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-no-multiple-ESC (if (viper-window-display-p)
|
|
|
|
|
t 'twice)
|
|
|
|
|
viper-electric-mode t
|
|
|
|
|
viper-want-emacs-keys-in-vi t
|
|
|
|
|
viper-want-emacs-keys-in-insert (> viper-expert-level 2))
|
|
|
|
|
|
|
|
|
|
(if (eq viper-expert-level 4) ; respect user's ex-style motion
|
|
|
|
|
; and viper-no-multiple-ESC
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(progn
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(setq-default
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-ex-style-editing
|
|
|
|
|
(viper-standard-value 'viper-ex-style-editing)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-ex-style-motion
|
|
|
|
|
(viper-standard-value 'viper-ex-style-motion))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq viper-ex-style-motion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-standard-value 'viper-ex-style-motion)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-ex-style-editing
|
|
|
|
|
(viper-standard-value 'viper-ex-style-editing)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-re-search
|
|
|
|
|
(viper-standard-value 'viper-re-search)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-no-multiple-ESC
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-standard-value 'viper-no-multiple-ESC)))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; A wizard!!
|
|
|
|
|
;; Ideally, if 5 is selected, a buffer should pop up to let the
|
|
|
|
|
;; user toggle the values of variables.
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(t (setq-default viper-ex-style-editing
|
|
|
|
|
(viper-standard-value 'viper-ex-style-editing)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-ex-style-motion
|
|
|
|
|
(viper-standard-value 'viper-ex-style-motion))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq viper-want-ctl-h-help
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-standard-value 'viper-want-ctl-h-help)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
viper-always
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(viper-standard-value 'viper-always)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-no-multiple-ESC
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-standard-value 'viper-no-multiple-ESC)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-ex-style-motion
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-standard-value 'viper-ex-style-motion)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-ex-style-editing
|
|
|
|
|
(viper-standard-value 'viper-ex-style-editing)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-re-search
|
|
|
|
|
(viper-standard-value 'viper-re-search)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-electric-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-standard-value 'viper-electric-mode)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
viper-want-emacs-keys-in-vi
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-standard-value 'viper-want-emacs-keys-in-vi)
|
|
|
|
|
viper-want-emacs-keys-in-insert
|
|
|
|
|
(viper-standard-value 'viper-want-emacs-keys-in-insert))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-mode-vars-for viper-current-state)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(if (or viper-always
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(and (> viper-expert-level 0) (> 5 viper-expert-level)))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-set-hooks)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1999-11-25 05:20:59 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; Ask user expert level.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-ask-level (dont-change-unless)
|
|
|
|
|
(let ((ask-buffer " *viper-ask-level*")
|
1997-06-02 22:50:31 +00:00
|
|
|
|
level-changed repeated)
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(switch-to-buffer ask-buffer)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(while (or (> viper-expert-level viper-max-expert-level)
|
|
|
|
|
(< viper-expert-level 1)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(null dont-change-unless))
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(if repeated
|
|
|
|
|
(progn
|
|
|
|
|
(message "Invalid user level")
|
|
|
|
|
(beep 1))
|
|
|
|
|
(setq repeated t))
|
|
|
|
|
(setq dont-change-unless t
|
|
|
|
|
level-changed t)
|
|
|
|
|
(insert "
|
|
|
|
|
Please specify your level of familiarity with the venomous VI PERil
|
2005-10-06 00:09:49 +00:00
|
|
|
|
\(and the VI Plan for Emacs Rescue).
|
1997-07-17 19:37:07 +00:00
|
|
|
|
You can change it at any time by typing `M-x viper-set-expert-level RET'
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
1 -- BEGINNER: Almost all Emacs features are suppressed.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
Feels almost like straight Vi. File name completion and
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
command history in the minibuffer are thrown in as a bonus.
|
1997-08-02 06:56:24 +00:00
|
|
|
|
To use Emacs productively, you must reach level 3 or higher.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
2 -- MASTER: C-c now has its standard Emacs meaning in Vi command state,
|
1997-08-02 06:56:24 +00:00
|
|
|
|
so most Emacs commands can be used when Viper is in Vi state.
|
|
|
|
|
Good progress---you are well on the way to level 3!
|
2002-05-31 09:26:18 +00:00
|
|
|
|
3 -- GRAND MASTER: Like 2, but most Emacs commands are available also
|
1997-08-02 06:56:24 +00:00
|
|
|
|
in Viper's insert state.
|
|
|
|
|
4 -- GURU: Like 3, but user settings are respected for viper-no-multiple-ESC,
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-ex-style-motion, viper-ex-style-editing, and
|
1999-11-01 07:16:15 +00:00
|
|
|
|
viper-re-search variables. Adjust these settings to your taste.
|
1997-06-18 01:26:55 +00:00
|
|
|
|
5 -- WIZARD: Like 4, but user settings are also respected for viper-always,
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-electric-mode, viper-want-ctl-h-help, viper-want-emacs-keys-in-vi,
|
1999-11-01 07:16:15 +00:00
|
|
|
|
and viper-want-emacs-keys-in-insert. Adjust these to your taste.
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
Please, specify your level now: ")
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq viper-expert-level (- (viper-read-char-exclusive) ?0))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
) ; end while
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; tell the user if level was changed
|
|
|
|
|
(and level-changed
|
|
|
|
|
(progn
|
|
|
|
|
(insert
|
|
|
|
|
(format "\n\n\n\n\n\t\tYou have selected user level %d"
|
1997-07-17 19:37:07 +00:00
|
|
|
|
viper-expert-level))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (y-or-n-p "Do you wish to make this change permanent? ")
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; save the setting for viper-expert-level
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-save-setting
|
1997-07-17 19:37:07 +00:00
|
|
|
|
'viper-expert-level
|
|
|
|
|
(format "Saving user level %d ..." viper-expert-level)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-custom-file-name))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
))
|
|
|
|
|
(bury-buffer) ; remove ask-buffer from screen
|
|
|
|
|
(message "")
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-nil ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(beep 1))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; if ENFORCE-BUFFER is not nil, error if CHAR is a marker in another buffer
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-register-to-point (char &optional enforce-buffer)
|
2010-01-18 04:39:40 +00:00
|
|
|
|
"Like `jump-to-register', but switches to another buffer in another window."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive "cViper register to point: ")
|
|
|
|
|
(let ((val (get-register char)))
|
|
|
|
|
(cond
|
|
|
|
|
((and (fboundp 'frame-configuration-p)
|
|
|
|
|
(frame-configuration-p val))
|
|
|
|
|
(set-frame-configuration val))
|
|
|
|
|
((window-configuration-p val)
|
|
|
|
|
(set-window-configuration val))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
((viper-valid-marker val)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(if (and enforce-buffer
|
|
|
|
|
(not (equal (current-buffer) (marker-buffer val))))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(error (concat viper-EmptyTextmarker " in this buffer")
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(viper-int-to-char (1- (+ char ?a)))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(pop-to-buffer (marker-buffer val))
|
|
|
|
|
(goto-char val))
|
|
|
|
|
((and (consp val) (eq (car val) 'file))
|
|
|
|
|
(find-file (cdr val)))
|
|
|
|
|
(t
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(error viper-EmptyTextmarker (viper-int-to-char (1- (+ char ?a))))))))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-save-kill-buffer ()
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
"Save then kill current buffer."
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(interactive)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(if (< viper-expert-level 2)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(save-buffers-kill-emacs)
|
2013-07-07 19:35:54 +00:00
|
|
|
|
(if (buffer-modified-p) (save-buffer))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(kill-buffer (current-buffer))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Bug Report
|
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(defun viper-submit-report ()
|
1997-06-02 22:50:31 +00:00
|
|
|
|
"Submit bug report on Viper."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((reporter-prompt-for-summary-p t)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-device-type (viper-device-type))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
color-display-p frame-parameters
|
|
|
|
|
minibuffer-emacs-face minibuffer-vi-face minibuffer-insert-face
|
|
|
|
|
varlist salutation window-config)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
;; If mode info is needed, add variable to `let' and then set it below,
|
|
|
|
|
;; like we did with color-display-p.
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(setq color-display-p (if (viper-window-display-p)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(viper-color-display-p)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'non-x)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
minibuffer-vi-face (if (viper-has-face-support-p)
|
|
|
|
|
(viper-get-face viper-minibuffer-vi-face)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'non-x)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
minibuffer-insert-face (if (viper-has-face-support-p)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
(viper-get-face
|
1997-08-02 06:56:24 +00:00
|
|
|
|
viper-minibuffer-insert-face)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'non-x)
|
1997-08-02 06:56:24 +00:00
|
|
|
|
minibuffer-emacs-face (if (viper-has-face-support-p)
|
|
|
|
|
(viper-get-face
|
|
|
|
|
viper-minibuffer-emacs-face)
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'non-x)
|
|
|
|
|
frame-parameters (if (fboundp 'frame-parameters)
|
|
|
|
|
(frame-parameters (selected-frame))))
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(setq varlist (list 'viper-vi-minibuffer-minor-mode
|
|
|
|
|
'viper-insert-minibuffer-minor-mode
|
|
|
|
|
'viper-vi-intercept-minor-mode
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
'viper-vi-local-user-minor-mode
|
|
|
|
|
'viper-vi-kbd-minor-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-vi-global-user-minor-mode
|
|
|
|
|
'viper-vi-state-modifier-minor-mode
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
'viper-vi-diehard-minor-mode
|
|
|
|
|
'viper-vi-basic-minor-mode
|
|
|
|
|
'viper-replace-minor-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-insert-intercept-minor-mode
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
'viper-insert-local-user-minor-mode
|
|
|
|
|
'viper-insert-kbd-minor-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-insert-global-user-minor-mode
|
|
|
|
|
'viper-insert-state-modifier-minor-mode
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
'viper-insert-diehard-minor-mode
|
|
|
|
|
'viper-insert-basic-minor-mode
|
|
|
|
|
'viper-emacs-intercept-minor-mode
|
|
|
|
|
'viper-emacs-local-user-minor-mode
|
|
|
|
|
'viper-emacs-kbd-minor-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-emacs-global-user-minor-mode
|
|
|
|
|
'viper-emacs-state-modifier-minor-mode
|
|
|
|
|
'viper-automatic-iso-accents
|
1997-08-22 03:15:57 +00:00
|
|
|
|
'viper-special-input-method
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-want-emacs-keys-in-insert
|
|
|
|
|
'viper-want-emacs-keys-in-vi
|
|
|
|
|
'viper-keep-point-on-undo
|
|
|
|
|
'viper-no-multiple-ESC
|
|
|
|
|
'viper-electric-mode
|
|
|
|
|
'viper-ESC-key
|
|
|
|
|
'viper-want-ctl-h-help
|
1997-08-22 03:15:57 +00:00
|
|
|
|
'viper-ex-style-editing
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-delete-backwards-in-replace
|
|
|
|
|
'viper-vi-style-in-minibuffer
|
|
|
|
|
'viper-vi-state-hook
|
|
|
|
|
'viper-insert-state-hook
|
|
|
|
|
'viper-replace-state-hook
|
|
|
|
|
'viper-emacs-state-hook
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'ex-cycle-other-window
|
|
|
|
|
'ex-cycle-through-non-files
|
1997-07-17 19:37:07 +00:00
|
|
|
|
'viper-expert-level
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'major-mode
|
1997-08-02 06:56:24 +00:00
|
|
|
|
'viper-device-type
|
1997-06-02 22:50:31 +00:00
|
|
|
|
'color-display-p
|
|
|
|
|
'frame-parameters
|
|
|
|
|
'minibuffer-vi-face
|
|
|
|
|
'minibuffer-insert-face
|
|
|
|
|
'minibuffer-emacs-face
|
|
|
|
|
))
|
|
|
|
|
(setq salutation "
|
|
|
|
|
Congratulations! You may have unearthed a bug in Viper!
|
|
|
|
|
Please mail a concise, accurate summary of the problem to the address above.
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------")
|
|
|
|
|
(setq window-config (current-window-configuration))
|
1997-08-02 06:56:24 +00:00
|
|
|
|
(with-output-to-temp-buffer " *viper-info*"
|
|
|
|
|
(switch-to-buffer " *viper-info*")
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(delete-other-windows)
|
|
|
|
|
(princ "
|
|
|
|
|
PLEASE FOLLOW THESE PROCEDURES
|
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
|
|
Before reporting a bug, please verify that it is related to Viper, and is
|
2010-01-18 04:39:40 +00:00
|
|
|
|
not caused by other packages you are using.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
Don't report compilation warnings, unless you are certain that there is a
|
1999-11-01 07:16:15 +00:00
|
|
|
|
problem. These warnings are normal and unavoidable.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
Please note that users should not modify variables and keymaps other than
|
1999-11-01 07:16:15 +00:00
|
|
|
|
those advertised in the manual. Such `customization' is likely to crash
|
1997-06-02 22:50:31 +00:00
|
|
|
|
Viper, as it would any other improperly customized Emacs package.
|
|
|
|
|
|
|
|
|
|
If you are reporting an error message received while executing one of the
|
|
|
|
|
Viper commands, type:
|
|
|
|
|
|
|
|
|
|
M-x set-variable <Return> debug-on-error <Return> t <Return>
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
Then reproduce the error. The above command will cause Emacs to produce a
|
|
|
|
|
back trace of the execution that leads to the error. Please include this
|
1997-06-02 22:50:31 +00:00
|
|
|
|
trace in your bug report.
|
|
|
|
|
|
|
|
|
|
If you believe that one of Viper's commands goes into an infinite loop
|
|
|
|
|
\(e.g., Emacs freezes\), type:
|
|
|
|
|
|
|
|
|
|
M-x set-variable <Return> debug-on-quit <Return> t <Return>
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
Then reproduce the problem. Wait for a few seconds, then type C-g to abort
|
|
|
|
|
the current command. Include the resulting back trace in the bug report.
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
|
|
|
|
Mail anyway (y or n)? ")
|
|
|
|
|
(if (y-or-n-p "Mail anyway? ")
|
|
|
|
|
()
|
|
|
|
|
(set-window-configuration window-config)
|
|
|
|
|
(error "Bug report aborted")))
|
|
|
|
|
|
|
|
|
|
(require 'reporter)
|
|
|
|
|
(set-window-configuration window-config)
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2013-02-23 21:54:00 +00:00
|
|
|
|
(reporter-submit-bug-report
|
|
|
|
|
"kifer@cs.stonybrook.edu, bug-gnu-emacs@gnu.org"
|
|
|
|
|
(viper-version)
|
|
|
|
|
varlist
|
|
|
|
|
nil 'delete-other-windows
|
|
|
|
|
salutation)))
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
1999-11-12 18:40:24 +00:00
|
|
|
|
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
2001-07-15 19:53:53 +00:00
|
|
|
|
;;; viper-cmd.el ends here
|