]> git.eshelyaron.com Git - emacs.git/commitdiff
2005-10-05 Michael Kifer <kifer@cs.stonybrook.edu>
authorMichael Kifer <kifer@cs.stonybrook.edu>
Thu, 6 Oct 2005 00:09:49 +0000 (00:09 +0000)
committerMichael Kifer <kifer@cs.stonybrook.edu>
Thu, 6 Oct 2005 00:09:49 +0000 (00:09 +0000)
* ediff-merge.el (ediff-merge-region-is-non-clash): new defsubst.
(ediff-merge-region-is-non-clash-to-skip): previouslu called
ediff-merge-region-is-non-clash.

* ediff-mult.el (ediff-append-custom-diff,ediff-meta-show-patch): use
insert-buffer-substring.

* ediff-ptch.el (ediff-fixup-patch-map): use better heuristics for
selecting files to patch. Also bug fixes.

* ediff-util.el (ediff-setup): bug fix.
(ediff-next-difference): Never skip clashes that differ in white space
only.

* ediff-wind.el (ediff-setup-control-frame,ediff-destroy-control-frame):
check the menubar feature.

* viper-cmd.el (viper-normalize-minor-mode-map-alist,
viper-refresh-mode-line): use make-local-variable to localize some vars
instead of make-variable-buffer-local. Suggested by Stefan Monnier.

* viper-init.el (viper-make-variable-buffer-local): delete alias.
(viper-restore-cursor-type,viper-set-insert-cursor-type): use
make-local-variable instead of make-variable-buffer-local. Suggested by
Stefan Monnier.

* viper.el (viper-mode): don't use viper-make-variable-buffer-local.
(viper-comint-mode-hook): use make-local-variable on
require-final-newline.
(viper-non-hook-settings): don't use make-variable-buffer-local.

lisp/ChangeLog
lisp/ediff-merg.el
lisp/ediff-mult.el
lisp/ediff-ptch.el
lisp/ediff-util.el
lisp/ediff-wind.el
lisp/ediff.el
lisp/emulation/viper-cmd.el
lisp/emulation/viper-init.el
lisp/emulation/viper.el

index 4e1ffe963d1be760c9c46e39c7f5017cd0564fad..2584c184dada3cd495d145e3aaa755c102397100 100644 (file)
        (gdb-locals-mode): Use `gdb-local-font-lock-keywords'
        (gdb-threads-font-lock-keywords): New font lock keywords definition.
        (gdb-threads-mode): Use `gdb-threads-font-lock-keywords'.
+       
+2005-10-05  Michael Kifer  <kifer@cs.stonybrook.edu>
+       
+       * ediff-merge.el (ediff-merge-region-is-non-clash): new defsubst.
+       (ediff-merge-region-is-non-clash-to-skip): previouslu called
+       ediff-merge-region-is-non-clash.
+       
+       * ediff-mult.el (ediff-append-custom-diff,ediff-meta-show-patch): use
+       insert-buffer-substring.
+       
+       * ediff-ptch.el (ediff-fixup-patch-map): use better heuristics for
+       selecting files to patch. Also bug fixes.
+       
+       * ediff-util.el (ediff-setup): bug fix.
+       (ediff-next-difference): Never skip clashes that differ in white space
+       only.
+       
+       * ediff-wind.el (ediff-setup-control-frame,ediff-destroy-control-frame):
+       check the menubar feature.
+       
+       * viper-cmd.el (viper-normalize-minor-mode-map-alist,
+       viper-refresh-mode-line): use make-local-variable to localize some vars
+       instead of make-variable-buffer-local. Suggested by Stefan Monnier.
+       
+       * viper-init.el (viper-make-variable-buffer-local): delete alias.
+       (viper-restore-cursor-type,viper-set-insert-cursor-type): use
+       make-local-variable instead of make-variable-buffer-local. Suggested by
+       Stefan Monnier.
+       
+       * viper.el (viper-mode): don't use viper-make-variable-buffer-local.
+       (viper-comint-mode-hook): use make-local-variable on
+       require-final-newline.
+       (viper-non-hook-settings): don't use make-variable-buffer-local.
 
 2005-10-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index cb93dea3831c4561e1846ad535f85681bac00cc7..b08238467df45d8c787570fa8164d7948fde8fcf 100644 (file)
@@ -103,11 +103,15 @@ Buffer B."
   )
 (make-variable-buffer-local 'ediff-skip-merge-regions-that-differ-from-default)
 
+;; check if there is no clash between the ancestor and one of the variants.
+(defsubst ediff-merge-region-is-non-clash (n)
+  (string-match "prefer" (or (ediff-get-state-of-merge n) "")))
+
 ;; If ediff-show-clashes-only, check if there is no clash between the ancestor
 ;; and one of the variants.
-(defsubst ediff-merge-region-is-non-clash (n)
+(defsubst ediff-merge-region-is-non-clash-to-skip (n)
   (and ediff-show-clashes-only
-       (string-match "prefer" (or (ediff-get-state-of-merge n) ""))))
+       (ediff-merge-region-is-non-clash n)))
 
 ;; If ediff-skip-changed-regions, check if the merge region differs from
 ;; the current default. If a region is different from the default, it means
index 436c1817edfd5b109b04df8e6a15e13189646958..532b491adfa7e908dcf8b44f08682841db8de4ad 100644 (file)
@@ -1624,7 +1624,7 @@ Useful commands:
           (save-excursion
             (set-buffer meta-diff-buff)
             (goto-char (point-max))
-            (insert-buffer custom-diff-buf)
+            (insert-buffer-substring custom-diff-buf)
             (insert "\n")))
          ;; if ediff session is not live, run diff directly on the files
          ((memq metajob '(ediff-directories
@@ -1643,7 +1643,7 @@ Useful commands:
           (save-excursion
             (set-buffer meta-diff-buff)
             (goto-char (point-max))
-            (insert-buffer tmp-buf)
+            (insert-buffer-substring tmp-buf)
             (insert "\n")))
          (t
           (ediff-kill-buffer-carefully meta-diff-buff)
@@ -1691,7 +1691,8 @@ all marked sessions must be active."
               (ediff-get-session-objC-name info)))
            (set-buffer (get-buffer-create ediff-tmp-buffer))
            (erase-buffer)
-           (insert-buffer patchbuffer)
+           (insert-buffer-substring patchbuffer)
+           (goto-char (point-min))
            (display-buffer ediff-tmp-buffer 'not-this-window)
            ))
       (error "The patch buffer wasn't found"))))
index 78bad19bab8cf539731e2337cc611c6305fc741d..9379b6127a9355be275167d502dd594a4468b14b 100644 (file)
@@ -297,16 +297,23 @@ program."
                      ;; (file1 . file2). Get it using ediff-get-session-objA.
                      (ediff-get-session-objA-name session-info))
                     ;; base-dir1 is  the dir part of the 1st file in the patch
-                    (base-dir1 (file-name-directory (car proposed-file-names)))
+                    (base-dir1
+                     (or (file-name-directory (car proposed-file-names))
+                         ""))
                     ;; directory part of the 2nd file in the patch
-                    (base-dir2 (file-name-directory (cdr proposed-file-names)))
+                    (base-dir2
+                     (or (file-name-directory (cdr proposed-file-names))
+                         ""))
                     )
-               ;; If both base-dir1 and base-dir2 are relative, assume that
+               ;; If both base-dir1 and base-dir2 are relative and exist,
+               ;; assume that
                ;; these dirs lead to the actual files starting at the present
                ;; directory. So, we don't strip these relative dirs from the
                ;; file names. This is a heuristic intended to improve guessing
-               (unless (or (and base-dir1 (file-name-absolute-p base-dir1))
-                           (and base-dir2 (file-name-absolute-p base-dir2)))
+               (unless (or (file-name-absolute-p base-dir1)
+                           (file-name-absolute-p base-dir2)
+                           (not (file-exists-p base-dir1))
+                           (not (file-exists-p base-dir2)))
                  (setq base-dir1 ""
                        base-dir2 ""))
                (or (string= (car proposed-file-names) "/dev/null")
@@ -377,8 +384,8 @@ other files, enter /dev/null
                           (concat actual-dir (cdr proposed-file-names)))))
                ))
            ediff-patch-map)
-    ;; check for the shorter existing file in each pair and discard the other
-    ;; one
+    ;; Check for the existing files in each pair and discard the nonexisting
+    ;; ones. If both exist, ask the user.
     (mapcar (lambda (session-info)
              (let* ((file1 (car (ediff-get-session-objA-name session-info)))
                     (file2 (cdr (ediff-get-session-objA-name session-info)))
index 9ab24ce5f64aa448294196526feb1fee79885ffa..41f294c1b13de5ba725d0a5125845dd2ad0964a4 100644 (file)
@@ -329,7 +329,7 @@ to invocation.")
            ediff-word-mode-job (ediff-word-mode-job))
 
       ;; Don't delete variants in case of ediff-buffer-* jobs without asking.
-      ;; This is because u may loose work---dangerous.
+      ;; This is because one may loose work---dangerous.
       (if (string-match "buffer" (symbol-name ediff-job-name))
          (setq ediff-keep-variants t))
 
@@ -368,6 +368,7 @@ to invocation.")
            (save-excursion
              (set-buffer buffer-C)
              (insert-buffer-substring buf)
+             (goto-char (point-min))
              (funcall (ediff-with-current-buffer buf major-mode))
              (widen) ; merge buffer is always widened
              (add-hook 'local-write-file-hooks 'ediff-set-merge-mode nil t)
@@ -1729,7 +1730,7 @@ With a prefix argument, go forward that many differences."
        (or (>= n ediff-number-of-differences)
            (setq regexp-skip (funcall ediff-skip-diff-region-function n))
            ;; this won't exec if regexp-skip is t
-           (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+           (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
                  skip-changed
                  (ediff-skip-merge-region-if-changed-from-default-p n))
            (ediff-install-fine-diff-if-necessary n))
@@ -1744,6 +1745,7 @@ With a prefix argument, go forward that many differences."
                     skip-changed
                     ;; skip difference regions that differ in white space
                     (and ediff-ignore-similar-regions
+                         (ediff-merge-region-is-non-clash n)
                          (or (eq (ediff-no-fine-diffs-p n) t)
                              (and (ediff-merge-job)
                                   (eq (ediff-no-fine-diffs-p n) 'C)))
@@ -1754,7 +1756,7 @@ With a prefix argument, go forward that many differences."
          (or (>= n ediff-number-of-differences)
              (setq regexp-skip (funcall ediff-skip-diff-region-function n))
              ;; this won't exec if regexp-skip is t
-             (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+             (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
                    skip-changed
                    (ediff-skip-merge-region-if-changed-from-default-p n))
              (ediff-install-fine-diff-if-necessary n))
@@ -1778,7 +1780,7 @@ With a prefix argument, go back that many differences."
        (or (< n 0)
            (setq regexp-skip (funcall ediff-skip-diff-region-function n))
            ;; this won't exec if regexp-skip is t
-           (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+           (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
                  skip-changed
                  (ediff-skip-merge-region-if-changed-from-default-p n))
            (ediff-install-fine-diff-if-necessary n))
@@ -1802,7 +1804,7 @@ With a prefix argument, go back that many differences."
          (or (< n 0)
              (setq regexp-skip (funcall ediff-skip-diff-region-function n))
              ;; this won't exec if regexp-skip is t
-             (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+             (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
                    skip-changed
                    (ediff-skip-merge-region-if-changed-from-default-p n))
              (ediff-install-fine-diff-if-necessary n))
index 26ff106088f3afd8b6df31ec8347513aa3e16303..e15c92d4bc9d0460b95272bad5fe2170ef2070e8 100644 (file)
@@ -900,7 +900,7 @@ into icons, regardless of the window manager."
 
     (ediff-with-current-buffer ctl-buffer
       (ediff-cond-compile-for-xemacs-or-emacs
-       (set-buffer-menubar nil) ; xemacs
+       (when (featurep 'menubar) (set-buffer-menubar nil)) ; xemacs
        nil ; emacs
        )
       ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse))
@@ -1054,7 +1054,8 @@ into icons, regardless of the window manager."
     (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
        (let ((ctl-frame ediff-control-frame))
          (ediff-cond-compile-for-xemacs-or-emacs
-          (set-buffer-menubar default-menubar) ; xemacs
+          (when (featurep 'menubar)
+            (set-buffer-menubar default-menubar)) ; xemacs
           nil ; emacs
           )
          (setq ediff-control-frame nil)
index 8d4bb4d86fe0f3b1803a7ad444f53e22040b19ec..696fc9668e6b78656bdc90fed48a4e12dd3dce5b 100644 (file)
@@ -8,7 +8,7 @@
 ;; Keywords: comparing, merging, patching, tools, unix
 
 (defconst ediff-version "2.80.1" "The current version of Ediff")
-(defconst ediff-date "September 19, 2005" "Date of last update")
+(defconst ediff-date "October 5, 2005" "Date of last update")
 
 
 ;; This file is part of GNU Emacs.
index 398c47d4784a99d0f6f0711479dc7b3d765a125a..08ebbbcc9d0c5d59fb661727fa6e5aca226629bb 100644 (file)
                       viper-empty-keymap))
               ))
        
-  ;; in emacs with emulation-mode-map-alists, nothing needs to be done
+  ;; 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
   (unless
       (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
-    (setq minor-mode-map-alist
-         (viper-append-filter-alist
-          (append viper--intercept-key-maps viper--key-maps)
-          minor-mode-map-alist)))
+    (set (make-local-variable 'minor-mode-map-alist)
+         (viper-append-filter-alist
+          (append viper--intercept-key-maps viper--key-maps)
+          minor-mode-map-alist)))
   )
 
 
 
 ;; Modifies mode-line-buffer-identification.
 (defun viper-refresh-mode-line ()
-  (setq viper-mode-string
+  (set (make-local-variable 'viper-mode-string)
        (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)
@@ -4781,7 +4788,7 @@ sensitive for VI-style look-and-feel."
              level-changed t)
        (insert "
 Please specify your level of familiarity with the venomous VI PERil
-(and the VI Plan for Emacs Rescue).
+\(and the VI Plan for Emacs Rescue).
 You can change it at any time by typing `M-x viper-set-expert-level RET'
 
  1 -- BEGINNER: Almost all Emacs features are suppressed.
@@ -5000,5 +5007,5 @@ Mail anyway (y or n)? ")
 
 
 
-;;; arch-tag: 739a6450-5fda-44d0-88b0-325053d888c2
+;; arch-tag: 739a6450-5fda-44d0-88b0-325053d888c2
 ;;; viper-cmd.el ends here
index 8aa7e4649d440ab55ee71192d628e0c20e7d4b4f..33713e8a8692261bc7d9aa247c2190af22c88d9e 100644 (file)
@@ -115,11 +115,6 @@ In all likelihood, you don't need to bother with this setting."
 \f
 ;;; Macros
 
-;; Fool the compiler to avoid warnings.
-;; Viper calls make-variable-buffer-local from within other functions, which
-;; triggers compiler warnings.
-(defalias 'viper-make-variable-buffer-local 'make-variable-buffer-local)
-
 (defmacro viper-deflocalvar (var default-value &optional documentation)
   `(progn
     (defvar ,var ,default-value
@@ -1019,19 +1014,19 @@ Should be set in `~/.viper' file."
 (defun viper-restore-cursor-type ()
   (condition-case nil
       (if viper-xemacs-p
-         (setq bar-cursor nil)
+         (set (make-local-variable 'bar-cursor) nil)
        (setq cursor-type default-cursor-type))
     (error nil)))
 
 (defun viper-set-insert-cursor-type ()
   (if viper-xemacs-p
-      (setq bar-cursor 2)
+      (set (make-local-variable 'bar-cursor) 2)
     (setq cursor-type '(bar . 2))))
 
 
-;;; Local Variables:
-;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
-;;; End:
+;; Local Variables:
+;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
+;; End:
 
-;;; arch-tag: 4efa2416-1fcb-4690-be10-1a2a0248d250
+;; arch-tag: 4efa2416-1fcb-4690-be10-1a2a0248d250
 ;;; viper-init.el ends here
index b3fd6d139c0c42e8829ee44ac2a7a65934d2194a..a361469382e27e17c04ff181fe16dfb93ee0c50a 100644 (file)
@@ -9,7 +9,7 @@
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Keywords: emulations
 
-(defconst viper-version "3.11.5 of September 19, 2005"
+(defconst viper-version "3.11.5 of October 5, 2005"
   "The current version of Viper")
 
 ;; This file is part of GNU Emacs.
@@ -605,8 +605,6 @@ This startup message appears whenever you load Viper, unless you type `y' now."
                    ))
              (viper-set-expert-level 'dont-change-unless)))
 
-       (if viper-xemacs-p
-           (viper-make-variable-buffer-local 'bar-cursor))
        (if (eq major-mode 'viper-mode)
            (setq major-mode 'fundamental-mode))
 
@@ -627,8 +625,8 @@ This startup message appears whenever you load Viper, unless you type `y' now."
 \f
 ;; This hook designed to enable Vi-style editing in comint-based modes."
 (defun viper-comint-mode-hook ()
-  (setq require-final-newline nil
-       viper-ex-style-editing nil
+  (set (make-local-variable 'require-final-newline) nil)
+  (setq viper-ex-style-editing nil
        viper-ex-style-motion nil)
   (viper-change-state-to-insert))
 
@@ -1000,17 +998,6 @@ It also can't undo some Viper settings."
 ;; these are primarily advices and Vi-ish variable settings
 (defun viper-non-hook-settings ()
 
-  ;; 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
-  (unless
-      (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
-    (viper-make-variable-buffer-local 'minor-mode-map-alist))
-
   ;; Viper changes the default mode-line-buffer-identification
   (setq-default mode-line-buffer-identification '(" %b"))
 
@@ -1018,8 +1005,6 @@ It also can't undo some Viper settings."
   (setq next-line-add-newlines nil
        require-final-newline t)
 
-  (viper-make-variable-buffer-local 'require-final-newline)
-
   ;; don't bark when mark is inactive
   (if viper-emacs-p
       (setq mark-even-if-inactive t))
@@ -1027,7 +1012,6 @@ It also can't undo some Viper settings."
   (setq scroll-step 1)
 
   ;; Variable displaying the current Viper state in the mode line.
-  (viper-deflocalvar viper-mode-string viper-emacs-state-id)
   (or (memq 'viper-mode-string global-mode-string)
       (setq global-mode-string
            (append '("" viper-mode-string) (cdr global-mode-string))))
@@ -1336,9 +1320,9 @@ These two lines must come in the order given.
 (provide 'viper)
 
 
-;;; Local Variables:
-;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
-;;; End:
+;; Local Variables:
+;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
+;; End:
 
-;;; arch-tag: 5f3e844c-c4e6-4bbd-9b73-63bdc14e7d79
+;; arch-tag: 5f3e844c-c4e6-4bbd-9b73-63bdc14e7d79
 ;;; viper.el ends here