(viper-ex-print-buf-name): New variable.
(viper-ex-print-buf): New variable.
(ex-token-alist): Invoke ex-print on ":print" Ex commands.
(ex-g-marks): New variable.
(ex-print): New function.
(ex-print-display-lines): New function.
* viper.el (viper-set-hooks): add window-setup-hook, which sets
the cursor color.
* ediff-util.el (ediff-cleanup-mess): delete ctl window on exit
when the window is not in its own frame.
(ediff-clone-buffer-for-region-comparison): more robust window
arrangement while prompting for regions to compare.
(ediff-make-cloned-buffer): use generate-new-buffer-name.
(ediff-inferior-compare-regions): deleted unused vars
ctl-buf and quit-now.
+2002-04-16 Michael Kifer <kifer@cs.stonybrook.edu>
+
+ * viper-ex.el: Patch by Samuel Padgett. Copyright papers received.
+ (viper-ex-print-buf-name): New variable.
+ (viper-ex-print-buf): New variable.
+ (ex-token-alist): Invoke ex-print on ":print" Ex commands.
+ (ex-g-marks): New variable.
+ (ex-print): New function.
+ (ex-print-display-lines): New function.
+
+ * viper.el (viper-set-hooks): add window-setup-hook, which sets
+ the cursor color.
+
+ * ediff-util.el (ediff-cleanup-mess): delete ctl window on exit
+ when the window is not in its own frame.
+ (ediff-clone-buffer-for-region-comparison): more robust window
+ arrangement while prompting for regions to compare.
+ (ediff-make-cloned-buffer): use generate-new-buffer-name.
+ (ediff-inferior-compare-regions): deleted unused vars
+ ctl-buf and quit-now.
+
2002-04-15 Richard M. Stallman <rms@gnu.org>
* facemenu.el (facemenu-add-new-face): Use this only for faces.
(defvar ediff-after-quit-hook-internal nil)
+(and noninteractive
+ (eval-when-compile
+ (load "reporter" 'noerror)))
+
(eval-when-compile
(let ((load-path (cons (expand-file-name ".") load-path)))
(or (featurep 'ediff-init)
(buff-B ediff-buffer-B)
(buff-C ediff-buffer-C)
(ctl-buf ediff-control-buffer)
+ (ctl-wind (ediff-get-visible-buffer-window ctl-buf))
(ctl-frame ediff-control-frame)
(three-way-job ediff-3way-job)
(main-frame (cond ((window-live-p ediff-window-A)
(if (boundp 'ediff-patch-diagnostics)
(ediff-kill-buffer-carefully ediff-patch-diagnostics))
- (if (and (ediff-window-display-p) (frame-live-p ctl-frame))
- (delete-frame ctl-frame))
+ ;; delete control frame or window
+ (cond ((and (ediff-window-display-p) (frame-live-p ctl-frame))
+ (delete-frame ctl-frame))
+ ((window-live-p ctl-wind)
+ (delete-window ctl-wind)))
+
;; Hide bottom toolbar. --marcpa
(if (not (ediff-multiframe-setup-p))
(ediff-kill-bottom-toolbar))
(ediff-get-visible-buffer-window buff-B))
(ediff-buffer-live-p buff-C))
(funcall ediff-split-window-function))
- (switch-to-buffer buff-C)
- (balance-windows)))
+ (switch-to-buffer buff-C)))
(error)))
+ (balance-windows)
(message "")
))
;; idea suggested by Hannu Koivisto <azure@iki.fi>
(defun ediff-clone-buffer-for-region-comparison (buff region-name)
(let ((cloned-buff (ediff-make-cloned-buffer buff region-name))
- (wind (ediff-get-visible-buffer-window buff))
(pop-up-windows t)
+ wind
other-wind
msg-buf)
(ediff-with-current-buffer cloned-buff
(setq ediff-temp-indirect-buffer t))
- (if (window-live-p wind)
- (set-window-buffer wind cloned-buff))
(pop-to-buffer cloned-buff)
+ (setq wind (ediff-get-visible-buffer-window cloned-buff))
+ (select-window wind)
+ (delete-other-windows)
+ (split-window-vertically)
+ (ediff-select-lowest-window)
+ (setq other-wind (selected-window))
(with-temp-buffer
(erase-buffer)
(insert
(format "\n ******* Mark a region in buffer %s *******\n"
(buffer-name cloned-buff)))
(insert
- (format "\n\t When done, type %s Use %s to abort\n "
- (ediff-format-bindings-of 'exit-recursive-edit)
- (ediff-format-bindings-of 'abort-recursive-edit)))
+ (ediff-with-current-buffer buff
+ (format "\n\t When done, type %s Use %s to abort\n "
+ (ediff-format-bindings-of 'exit-recursive-edit)
+ (ediff-format-bindings-of 'abort-recursive-edit))))
(goto-char (point-min))
(setq msg-buf (current-buffer))
- (other-window 1)
- (set-window-buffer (selected-window) msg-buf)
+ (set-window-buffer other-wind msg-buf)
(shrink-window-if-larger-than-buffer)
(if (window-live-p wind)
(select-window wind))
(defun ediff-make-cloned-buffer (buff region-name)
(ediff-make-indirect-buffer
- buff (concat
- (if (stringp buff) buff (buffer-name buff))
- region-name (symbol-name (gensym)))))
+ buff (generate-new-buffer-name
+ (concat (if (stringp buff) buff (buffer-name buff)) region-name))
+ ))
(defun ediff-make-indirect-buffer (base-buf indirect-buf-name)
(let ((answer "")
(possibilities (list ?A ?B ?C))
(zmacs-regions t)
- (ctl-buf (current-buffer))
- quit-now
use-current-diff-p
begA begB endA endB bufA bufB)
(defconst viper-ex-work-buf-name " *ex-working-space*")
(defconst viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
(defconst viper-ex-tmp-buf-name " *ex-tmp*")
+(defconst viper-ex-print-buf-name " *ex-print*")
+(defconst viper-ex-print-buf (get-buffer-create viper-ex-print-buf-name))
;;; ex-commands...
("next" (ex-next ex-cycle-other-window))
("p" "print")
("preserve" (ex-preserve))
+ ("print" (ex-print))
("put" (ex-put))
("pwd" (ex-pwd))
("quit" (ex-quit))
("open" (ex-cmd-obsolete "open"))
("list" (ex-cmd-not-yet "list"))
- ("print" (ex-cmd-not-yet "print"))
("z" (ex-cmd-not-yet "z"))
("#" (ex-cmd-not-yet "#"))
(defvar ex-g-flag nil)
;; Flag indicating that :vglobal Ex command is being executed.
(defvar ex-g-variant nil)
+;; Marks to operate on during a :global Ex command.
+(defvar ex-g-marks nil)
;; Save reg-exp used in substitute.
(defvar ex-reg-exp nil)
(if (null ex-addresses)
(setq ex-addresses (list (point-max) (point-min)))
(viper-default-ex-addresses))
- (let ((marks nil)
- (mark-count 0)
+ (setq ex-g-marks nil)
+ (let ((mark-count 0)
(end (car ex-addresses))
(beg (car (cdr ex-addresses)))
com-str)
(progn
(end-of-line)
(setq mark-count (1+ mark-count))
- (setq marks (cons (point-marker) marks)))))
+ (setq ex-g-marks (cons (point-marker) ex-g-marks)))))
(beginning-of-line)
(if (bobp) (setq cont nil)
(forward-line -1)
(set-buffer viper-ex-work-buf)
;; com-str is the command string, i.e., g/pattern/ or v/pattern'
(setq com-str (buffer-substring (1+ (point)) (1- (point-max)))))
- (while marks
- (goto-char (car marks))
+ (while ex-g-marks
+ (goto-char (car ex-g-marks))
(viper-ex nil com-str)
(setq mark-count (1- mark-count))
- (setq marks (cdr marks)))))
+ (setq ex-g-marks (cdr ex-g-marks)))))
;; Ex goto command
(defun ex-goto ()
'none)))
))
+(defun ex-print ()
+ (viper-default-ex-addresses)
+ (let ((end (car ex-addresses))
+ (beg (car (cdr ex-addresses))))
+ (if (> beg end) (error viper-FirstAddrExceedsSecond))
+ (save-excursion
+ (viper-enlarge-region beg end)
+ (if (or ex-g-flag ex-g-variant)
+ ;; When executing a global command, collect output of each
+ ;; print in viper-ex-print-buf.
+ (progn
+ (append-to-buffer viper-ex-print-buf (point) (mark t))
+ ;; Is this the last mark for the global command?
+ (unless (cdr ex-g-marks)
+ (with-current-buffer viper-ex-print-buf
+ (ex-print-display-lines (buffer-string))
+ (erase-buffer))))
+ (ex-print-display-lines (buffer-substring (point) (mark t)))))))
+
+(defun ex-print-display-lines (lines)
+ (cond
+ ;; String doesn't contain a newline.
+ ((not (string-match "\n" lines))
+ (message "%s" lines))
+ ;; String contains only one newline at the end. Strip it off.
+ ((= (string-match "\n" lines) (1- (length lines)))
+ (message "%s" (substring lines 0 -1)))
+ ;; String spans more than one line. Use a temporary buffer.
+ (t
+ (save-current-buffer
+ (with-output-to-temp-buffer " *viper-info*"
+ (princ lines))))))
+
(add-hook 'flyspell-mode-hook
'(lambda ()
(define-key flyspell-mouse-map viper-ESC-key nil)))
+ ;; if viper is started from .emacs, it might be impossible to get certain
+ ;; info about the display and windows until emacs initialization is complete
+ ;; So do it via the window-setup-hook
+ (add-hook 'window-setup-hook
+ '(lambda ()
+ (setq viper-vi-state-cursor-color (viper-get-cursor-color))))
;; Tell vc-diff to put *vc* in Vi mode
(if (featurep 'vc)
toolbar support package for Ediff, and Hrvoje Niksic <hniksic@@xemacs.org>
adapted it to the Emacs customization package.
-Many people provided help with bug reports, patches, and advice.
+Many people provided help with bug reports, feature suggestions, and advice.
Without them, Ediff would not be nearly as useful as it is today.
-Here is a full list of contributors (I hope I didn't miss anyone):
+Here is a hopefully full list of contributors:
@example
Adrian Aichner (aichner@@ecf.teradyne.com),
@item &
Repeat latest Ex substitute command, e.g.
@kbd{:s/wrong/right}.
-@item C-c /
-Toggle case-sensitive search. With prefix argument, toggle vanilla/regular
-expression search.
+@item :x,yp
+@itemx :g/Pat/p
+@itemx :v/Pat/p
+The above commands display certain buffer lines in a
+temporary buffer. The first form above displays the buffer lines between
+@kbd{x} and @kbd{y}. The second displays the lines of the buffer, which
+match a given pattern. The third form displays the lines that do @emph{not}
+match the given pattern.
@item #c<move>
Change upper-case characters in the region to lower-case.
@item #C<move>
wrapping around.
@table @kbd
+@item C-c /
+Toggle case-sensitive search. With prefix argument, toggle vanilla/regular
+expression search.
@item <count> /<string>
To the <count>th occurrence of <string>.
VIP 4.4, by Aamod Sane. This manual is an adaptation of the manual for VIP
4.4, which, in turn, was based on Sato's manual for VIP 3.5.
-Many contributors on the net pointed out bugs and suggested a number of
-useful features. Here is a (hopefully) complete list of contributors:
+Many contributors on the Net pointed out bugs and suggested a number of
+useful features. Scott Bronson and Samuel Padgett contributed patches that
+were incorporated in this code. Here is a hopefully complete list of
+contributors:
@example
aaronl@@vitelus.com (Aaron Lehmann),
dominik@@strw.LeidenUniv.nl (Carsten Dominik),
dwallach@@cs.princeton.edu (Dan Wallach),
dwight@@toolucky.llnl.gov (Dwight Shih),
-dxc@@xprt.net (David X. Callaway),
+dxc@@xprt.net (David X Callaway),
edmonds@@edmonds.home.cs.ubc.ca (Brian Edmonds),
gin@@mo.msk.ru (Golubev I.N.),
gviswana@@cs.wisc.edu (Guhan Viswanathan),