From c004db972f6954c6aaf9690045b1d2fdf8396472 Mon Sep 17 00:00:00 2001 From: Michael Kifer Date: Tue, 25 Nov 1997 02:10:08 +0000 Subject: [PATCH] new version --- lisp/ediff-diff.el | 16 ++++- lisp/ediff-init.el | 158 +++++++++++++++++++++++--------------------- lisp/ediff-mult.el | 12 ++-- lisp/ediff-vers.el | 6 +- lisp/emulation/viper-cmd.el | 55 +++++++++------ lisp/emulation/viper-ex.el | 42 +++++++++--- lisp/emulation/viper.el | 33 +++++---- 7 files changed, 197 insertions(+), 125 deletions(-) diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el index a12959eea12..e773ba44e04 100644 --- a/lisp/ediff-diff.el +++ b/lisp/ediff-diff.el @@ -133,14 +133,24 @@ Use `setq-default' if setting it in .emacs") ;;; General (defvar ediff-diff-ok-lines-regexp - "^\\([0-9,]+[acd][0-9,]+$\\|[<>] \\|---\\|.*Warning *:\\|.*No +newline\\|.*missing +newline\\|^\C-m$\\)" + (concat + "^\\(" + "[0-9,]+[acd][0-9,]+\C-m?$" + "\\|[<>] " + "\\|---" + "\\|.*Warning *:" + "\\|.*No +newline" + "\\|.*missing +newline" + "\\|^\C-m?$" + "\\)") "Regexp that matches normal output lines from `ediff-diff-program'. This is mostly lifted from Emerge, except that Ediff also considers warnings and `Missing newline'-type messages to be normal output. Lines that do not match are assumed to be error messages.") -(defvar ediff-match-diff-line (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)")) - (concat "^" x "\\([acd]\\)" x "$")) +(defvar ediff-match-diff-line + (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)")) + (concat "^" x "\\([acd]\\)" x "\C-m?$")) "Pattern to match lines produced by diff that describe differences.") (ediff-defvar-local ediff-setup-diff-regions-function nil diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el index 77e8f1c9ad6..db06f27771b 100644 --- a/lisp/ediff-init.el +++ b/lisp/ediff-init.el @@ -1048,12 +1048,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-face-A' this variable represents.") (ediff-hide-face 'ediff-fine-diff-face-A) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-fine-diff-face-A "gray3")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-fine-diff-face-A "gray3")) ;;(defvar ediff-fine-diff-face-B ;; (if (ediff-has-face-support-p) @@ -1084,12 +1085,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-face-B' this variable represents.") (ediff-hide-face 'ediff-fine-diff-face-B) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-fine-diff-face-B "gray3")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-fine-diff-face-B "gray3")) ;;(defvar ediff-fine-diff-face-C ;; (if (ediff-has-face-support-p) @@ -1121,12 +1123,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-face-C' this variable represents.") (ediff-hide-face 'ediff-fine-diff-face-C) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-fine-diff-face-C "gray3")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-fine-diff-face-C "gray3")) ;;(defvar ediff-fine-diff-face-Ancestor ;; (if (ediff-has-face-support-p) @@ -1159,13 +1162,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-face-Ancestor' this variable represents.") (ediff-hide-face 'ediff-fine-diff-face-Ancestor) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap - 'ediff-fine-diff-face-Ancestor "gray3")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-fine-diff-face-Ancestor "gray3")) ;;(defvar ediff-even-diff-face-A ;; (if (ediff-has-face-support-p) @@ -1198,12 +1201,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-face-A' this variable represents.") (ediff-hide-face 'ediff-even-diff-face-A) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-even-diff-face-A "Stipple")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-even-diff-face-A "Stipple")) ;;(defvar ediff-even-diff-face-B ;; (if (ediff-has-face-support-p) @@ -1236,12 +1240,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-face-B' this variable represents.") (ediff-hide-face 'ediff-even-diff-face-B) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-even-diff-face-B "Stipple")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-even-diff-face-B "Stipple")) ;;(defvar ediff-even-diff-face-C ;; (if (ediff-has-face-support-p) @@ -1269,12 +1274,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-face-C' this variable represents.") (ediff-hide-face 'ediff-even-diff-face-C) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-even-diff-face-C "Stipple")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-even-diff-face-C "Stipple")) ;;(defvar ediff-even-diff-face-Ancestor ;; (if (ediff-has-face-support-p) @@ -1303,13 +1309,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-face-Ancestor' this variable represents.") (ediff-hide-face 'ediff-even-diff-face-Ancestor) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap - 'ediff-even-diff-face-Ancestor "Stipple")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-even-diff-face-Ancestor "Stipple")) ;; Association between buffer types and even-diff-face symbols (defconst ediff-even-diff-face-alist @@ -1349,12 +1355,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-face-A' this variable represents.") (ediff-hide-face 'ediff-odd-diff-face-A) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-odd-diff-face-A "gray1")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-odd-diff-face-A "gray1")) ;;(defvar ediff-odd-diff-face-B ;; (if (ediff-has-face-support-p) @@ -1388,12 +1395,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-face-B' this variable represents.") (ediff-hide-face 'ediff-odd-diff-face-B) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-odd-diff-face-B "gray1")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-odd-diff-face-B "gray1")) ;;(defvar ediff-odd-diff-face-C ;; (if (ediff-has-face-support-p) @@ -1420,12 +1428,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-face-C' this variable represents.") (ediff-hide-face 'ediff-odd-diff-face-C) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-odd-diff-face-C "gray1")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-odd-diff-face-C "gray1")) ;;(defvar ediff-odd-diff-face-Ancestor ;; (if (ediff-has-face-support-p) @@ -1452,12 +1461,13 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-face-Ancestor' this variable represents.") (ediff-hide-face 'ediff-odd-diff-face-Ancestor) -;; Until custom.el for XEmacs starts supporting :stipple we do this. -;; This means that some use customization may be trashed. -(if (and ediff-xemacs-p - (ediff-has-face-support-p) - (not (ediff-color-display-p))) - (ediff-set-face-pixmap 'ediff-odd-diff-face-Ancestor "gray1")) + +;;;; Until custom.el for XEmacs starts supporting :stipple we do this. +;;;; This means that some user customization may be trashed. +;;(if (and ediff-xemacs-p +;; (ediff-has-face-support-p) +;; (not (ediff-color-display-p))) +;; (ediff-set-face-pixmap 'ediff-odd-diff-face-Ancestor "gray1")) ;; Association between buffer types and odd-diff-face symbols (defconst ediff-odd-diff-face-alist diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el index 230938ee8e4..c5d4e61d670 100644 --- a/lisp/ediff-mult.el +++ b/lisp/ediff-mult.el @@ -1456,7 +1456,7 @@ all marked sessions must be active." ;; ediff-get-meta-info gives error if meta-buf or pos are invalid (info (ediff-get-meta-info meta-buf pos)) (session-buf (ediff-get-session-buffer info)) - (session-number (ediff-get-session-number-at-pos pos)) + (session-number (ediff-get-session-number-at-pos pos meta-buf)) merge-autostore-dir file1 file2 file3 regexp) (setq file1 (ediff-get-session-objA-name info) @@ -1897,9 +1897,13 @@ If this is a session registry buffer then just bury it." overl (car overl-list))) overl))) -(defsubst ediff-get-session-number-at-pos (point) - (ediff-overlay-get - (ediff-get-meta-overlay-at-pos point) 'ediff-meta-session-number)) +(defsubst ediff-get-session-number-at-pos (point &optional meta-buffer) + (setq meta-buffer (if (ediff-buffer-live-p meta-buffer) + meta-buffer + (current-buffer))) + (ediff-with-current-buffer meta-buffer + (ediff-overlay-get + (ediff-get-meta-overlay-at-pos point) 'ediff-meta-session-number))) ;; Return location of the next meta overlay after point diff --git a/lisp/ediff-vers.el b/lisp/ediff-vers.el index 1d5f5fcd008..db555e11b19 100644 --- a/lisp/ediff-vers.el +++ b/lisp/ediff-vers.el @@ -337,6 +337,8 @@ (type (cvs-fileinfo->type fileinfo)) (tmp-file (cvs-retrieve-revision-to-tmpfile fileinfo)) + (default-directory + (file-name-as-directory (cvs-fileinfo->dir fileinfo))) ancestor-file) (or (memq type '(MERGED CONFLICT MODIFIED)) @@ -356,11 +358,11 @@ nil ; startup-hooks 'ediff-merge-revisions-with-ancestor)) ((eq type 'MODIFIED) - (ediff-merge-buffers + (ediff-buffers (find-file-noselect tmp-file) (find-file-noselect (cvs-fileinfo->full-path fileinfo)) nil ; startup-hooks - 'ediff-merge-revisions))) + 'ediff-revisions))) (if (stringp tmp-file) (delete-file tmp-file)) (if (stringp ancestor-file) (delete-file ancestor-file)))) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 51de44bee54..3fb8cce6dfa 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -1720,21 +1720,32 @@ Undo previous insertion and inserts new." ;; Quote region by each line with a user supplied string. (defun viper-quote-region () - (setq viper-quote-string - (viper-read-string-with-history - "Quote string: " - nil - 'viper-quote-region-history - viper-quote-string)) - (viper-enlarge-region (point) (mark t)) - (if (> (point) (mark t)) (exchange-point-and-mark)) - (insert viper-quote-string) - (beginning-of-line) - (forward-line 1) - (while (and (< (point) (mark t)) (bolp)) - (insert viper-quote-string) + (let ((quote-str viper-quote-string) + (donot-change-dafault t)) + (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)) "#") + (t (setq donot-change-dafault nil) + quote-str)))) + (or donot-change-dafault + (setq viper-quote-string quote-str)) + (viper-enlarge-region (point) (mark t)) + (if (> (point) (mark t)) (exchange-point-and-mark)) + (insert quote-str) (beginning-of-line) - (forward-line 1))) + (forward-line 1) + (while (and (< (point) (mark t)) (bolp)) + (insert quote-str) + (beginning-of-line) + (forward-line 1)))) ;; Tells whether BEG is on the same line as END. ;; If one of the args is nil, it'll return nil. @@ -1870,15 +1881,21 @@ problems." ;;; Reading string with history (defun viper-read-string-with-history (prompt &optional initial - history-var default keymap) + history-var default keymap + init-message) ;; Read string, prompting with PROMPT and inserting the INITIAL ;; value. Uses HISTORY-VAR. DEFAULT is the default value to accept if the - ;; input is an empty string. Use KEYMAP, if given, or the - ;; minibuffer-local-map. + ;; input is an empty string. ;; Default value is displayed until the user types something in the ;; minibuffer. + ;; KEYMAP is used, if given, instead of minibuffer-local-map. + ;; INIT-MESSAGE is the message temporarily displayed after entering the + ;; minibuffer. (let ((minibuffer-setup-hook - '(lambda () + (function + (lambda () + (if (stringp init-message) + (viper-tmp-insert-at-eob init-message)) (if (stringp initial) (progn ;; don't wait if we have unread events or in kbd macro @@ -1887,7 +1904,7 @@ problems." (sit-for 840)) (erase-buffer) (insert initial))) - (viper-minibuffer-setup-sentinel))) + (viper-minibuffer-setup-sentinel)))) (val "") (padding "") temp-msg) diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index bd9ac3d3eb7..0cc2bd1bc3d 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -524,8 +524,8 @@ reversed." ;; Read Ex commands -(defun viper-ex (&optional string) - (interactive) +(defun viper-ex (arg &optional string) + (interactive "P") (or string (setq ex-g-flag nil ex-g-variant nil)) @@ -533,16 +533,40 @@ reversed." (address nil) (cont t) (dot (point)) + reg-beg-line reg-end-line + reg-beg reg-end + initial-str prev-token-type com-str) - (viper-add-keymap viper-ex-cmd-map map) + + (if arg + (progn + (viper-enlarge-region (mark t) (point)) + (if (> (point) (mark t)) + (setq reg-beg (mark t) + reg-end (point)) + (setq reg-end (mark t) + reg-beg (point))) + (save-excursion + (goto-char reg-beg) + (setq reg-beg-line (1+ (count-lines (point-min) (point))) + reg-end-line + (+ reg-beg-line (count-lines reg-beg reg-end) -1))))) + (if reg-beg-line + (setq initial-str (format "%d,%d" reg-beg-line reg-end-line))) - (setq com-str (or string (viper-read-string-with-history - ":" - nil - 'viper-ex-history - (car viper-ex-history) - map))) + (setq com-str + (or string (viper-read-string-with-history + ":" + initial-str + 'viper-ex-history + ;; no default when working on region + (if initial-str + "none" + (car viper-ex-history)) + map + (if initial-str + " [Type command to execute on current region]")))) (save-window-excursion ;; just a precaution (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 303c50645c9..91feb773a24 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -8,7 +8,7 @@ ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. -(defconst viper-version "3.002 (Polyglot) of October 23, 1997" +(defconst viper-version "3.004 (Polyglot) of November 11, 1997" "The current version of Viper") ;; This file is part of GNU Emacs. @@ -531,7 +531,7 @@ remains buffer-local." (viper-standard-value 'mode-line-buffer-identification viper-saved-non-viper-variables) global-mode-string - (viper-standard-value 'global-mode-string viper-saved-non-viper-variables)) + (delq 'viper-mode-string global-mode-string)) (if viper-emacs-p (setq-default @@ -576,6 +576,9 @@ remains buffer-local." (viper-delocalize-var 'viper-emacs-global-user-minor-mode) (viper-delocalize-var 'viper-emacs-state-modifier-minor-mode) + (viper-delocalize-var 'viper-current-state) + (viper-delocalize-var 'viper-mode-string) + (setq-default viper-vi-minibuffer-minor-mode nil viper-insert-minibuffer-minor-mode nil viper-vi-intercept-minor-mode nil @@ -602,6 +605,9 @@ remains buffer-local." viper-emacs-kbd-minor-mode nil viper-emacs-global-user-minor-mode nil viper-emacs-state-modifier-minor-mode nil + + viper-current-state 'emacs-state + viper-mode-string viper-emacs-state-id ) ;; remove all hooks set by viper @@ -1218,18 +1224,17 @@ These two lines must come in the order given. viper-insert-intercept-map "\C-c\\" 'viper-escape-to-vi) (if viper-mode - (progn - (setq viper-emacs-intercept-minor-mode t - viper-emacs-local-user-minor-mode t - viper-emacs-global-user-minor-mode t - viper-emacs-kbd-minor-mode t - viper-emacs-state-modifier-minor-mode t) - (setq-default viper-emacs-intercept-minor-mode t - viper-emacs-local-user-minor-mode t - viper-emacs-global-user-minor-mode t - viper-emacs-kbd-minor-mode t - viper-emacs-state-modifier-minor-mode t) - )) + (setq-default viper-emacs-intercept-minor-mode t + viper-emacs-local-user-minor-mode t + viper-emacs-global-user-minor-mode t + viper-emacs-kbd-minor-mode t + viper-emacs-state-modifier-minor-mode t)) +(if (and viper-mode (eq viper-current-state 'emacs-state)) + (setq viper-emacs-intercept-minor-mode t + viper-emacs-local-user-minor-mode t + viper-emacs-global-user-minor-mode t + viper-emacs-kbd-minor-mode t + viper-emacs-state-modifier-minor-mode t)) (if (and viper-mode -- 2.11.4.GIT