Mercurial > emacs
changeset 44615:a1448e19a9f8
* 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.
author | Michael Kifer <kifer@cs.stonybrook.edu> |
---|---|
date | Tue, 16 Apr 2002 05:49:11 +0000 |
parents | 5adf2b1c20bb |
children | fe5006134263 |
files | lisp/ChangeLog lisp/ediff-util.el lisp/emulation/viper-ex.el lisp/emulation/viper.el man/ediff.texi man/viper.texi |
diffstat | 6 files changed, 117 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Apr 16 00:02:55 2002 +0000 +++ b/lisp/ChangeLog Tue Apr 16 05:49:11 2002 +0000 @@ -1,3 +1,24 @@ +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.
--- a/lisp/ediff-util.el Tue Apr 16 00:02:55 2002 +0000 +++ b/lisp/ediff-util.el Tue Apr 16 05:49:11 2002 +0000 @@ -42,6 +42,10 @@ (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) @@ -2554,6 +2558,7 @@ (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) @@ -2571,8 +2576,12 @@ (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)) @@ -2603,9 +2612,9 @@ (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 "") )) @@ -3308,28 +3317,32 @@ ;; 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)) @@ -3363,9 +3376,9 @@ (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) @@ -3444,8 +3457,6 @@ (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)
--- a/lisp/emulation/viper-ex.el Tue Apr 16 00:02:55 2002 +0000 +++ b/lisp/emulation/viper-ex.el Tue Apr 16 05:49:11 2002 +0000 @@ -69,6 +69,8 @@ (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... @@ -133,6 +135,7 @@ ("next" (ex-next ex-cycle-other-window)) ("p" "print") ("preserve" (ex-preserve)) + ("print" (ex-print)) ("put" (ex-put)) ("pwd" (ex-pwd)) ("quit" (ex-quit)) @@ -176,7 +179,6 @@ ("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 "#")) @@ -279,6 +281,8 @@ (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) @@ -1345,8 +1349,8 @@ (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) @@ -1369,7 +1373,7 @@ (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) @@ -1379,11 +1383,11 @@ (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 () @@ -2277,6 +2281,39 @@ '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)))))) +
--- a/lisp/emulation/viper.el Tue Apr 16 00:02:55 2002 +0000 +++ b/lisp/emulation/viper.el Tue Apr 16 05:49:11 2002 +0000 @@ -834,6 +834,12 @@ (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)
--- a/man/ediff.texi Tue Apr 16 00:02:55 2002 +0000 +++ b/man/ediff.texi Tue Apr 16 05:49:11 2002 +0000 @@ -2385,9 +2385,9 @@ 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),
--- a/man/viper.texi Tue Apr 16 00:02:55 2002 +0000 +++ b/man/viper.texi Tue Apr 16 05:49:11 2002 +0000 @@ -3691,9 +3691,14 @@ @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> @@ -3743,6 +3748,9 @@ 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>. @@ -4436,8 +4444,10 @@ 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), @@ -4452,7 +4462,7 @@ 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),