]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/ediff-util.el
Update copyright year to 2015
[gnu-emacs] / lisp / vc / ediff-util.el
index 81146c0c931d74c8797613218573c0f5bb9e876b..62a0d9da0ab95dac782d5d71cea56e2f7da24aab 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ediff-util.el --- the core commands and utilities of ediff
 
-;; Copyright (C) 1994-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2015 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
 (defvar ediff-after-quit-hook-internal nil)
 
 (eval-and-compile
-  (unless (fboundp 'declare-function) (defmacro declare-function (&rest  r))))
-
-(eval-when-compile
-  (require 'ediff))
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest  _r))))
 
 ;; end pacifier
 
@@ -540,7 +537,7 @@ to invocation.")
 ;; to reside.
 (defun ediff-setup-control-buffer (ctl-buf)
   "Set up window for control buffer."
-  (if (window-dedicated-p (selected-window))
+  (if (window-dedicated-p)
       (set-buffer ctl-buf) ; we are in control frame but just in case
     (switch-to-buffer ctl-buf))
   (let ((window-min-height 2))
@@ -961,7 +958,7 @@ On a dumb terminal, switches between ASCII highlighting and no highlighting."
         (message "Auto-refining is OFF")
         (setq ediff-auto-refine 'off))
        (t ;; nix 'em
-        (ediff-set-fine-diff-properties ediff-current-difference 'default)
+        (ediff-set-fine-diff-properties ediff-current-difference t)
         (message "Refinements are HIDDEN")
         (setq ediff-auto-refine 'nix))
        ))
@@ -1030,8 +1027,8 @@ of the current buffer."
                                 (file-writable-p file)))
             (toggle-ro-cmd (cond (ediff-toggle-read-only-function)
                                  ((ediff-file-checked-out-p file)
-                                  'toggle-read-only)
-                                 (file-writable 'toggle-read-only)
+                                  'read-only-mode)
+                                 (file-writable 'read-only-mode)
                                  (t (key-binding "\C-x\C-q")))))
        ;; If the file is checked in, make sure we don't make buffer modifiable
        ;; without warning the user.  The user can fool our checks by making the
@@ -1042,7 +1039,7 @@ of the current buffer."
                 ;; non-interactively, in which case don't ask questions
                 ctl-buf)
            (cond ((not buffer-read-only)
-                  (setq toggle-ro-cmd 'toggle-read-only))
+                  (setq toggle-ro-cmd 'read-only-mode))
                  ((and (or (beep 1) t) ; always beep
                        (y-or-n-p
                         (format
@@ -1057,13 +1054,13 @@ of the current buffer."
                     (ediff-change-saved-variable
                      'buffer-read-only nil buf-type)))
                  (t
-                  (setq toggle-ro-cmd 'toggle-read-only)
+                  (setq toggle-ro-cmd 'read-only-mode)
                   (beep 1) (beep 1)
                   (message
                    "Boy, this is risky! Don't modify this file...")
                   (sit-for 3)))) ; let the user see the warning
        (if (and toggle-ro-cmd
-                (string-match "toggle-read-only" (symbol-name toggle-ro-cmd)))
+                (string-match "read-only-mode" (symbol-name toggle-ro-cmd)))
            (save-excursion
              (save-window-excursion
                (select-window (ediff-get-visible-buffer-window buf))
@@ -1605,7 +1602,7 @@ the width of the A/B/C windows."
 ;;BEG, END show the region to be positioned.
 ;;JOB-NAME holds ediff-job-name.  The ediff-windows job positions regions
 ;;differently.
-(defun ediff-position-region (beg end pos job-name)
+(defun ediff-position-region (beg end pos _job-name)
   (if (> end (point-max))
       (setq end (point-max)))
   (if ediff-windows-job
@@ -1632,7 +1629,7 @@ the width of the A/B/C windows."
            (setq lines (1+ lines)))
          ;; And position the beginning on the right line
          (goto-char beg)
-         (recenter (/ (1+ (max (- (1- (window-height (selected-window)))
+         (recenter (/ (1+ (max (- (1- (window-height))
                                   lines)
                                1)
                           )
@@ -1688,7 +1685,7 @@ the width of the A/B/C windows."
                            'ediff-get-lines-to-region-start)
                           ((eq op 'scroll-up)
                            'ediff-get-lines-to-region-end)
-                          (t (lambda (a b c) 0))))
+                          (t (lambda (_a _b _c) 0))))
               (max-lines (max (funcall func 'A n ctl-buf)
                               (funcall func 'B n ctl-buf)
                               (if (ediff-buffer-live-p ediff-buffer-C)
@@ -2821,7 +2818,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
   (with-output-to-temp-buffer ediff-msg-buffer
     (ediff-with-current-buffer standard-output
       (fundamental-mode))
-    (raise-frame (selected-frame))
+    (raise-frame)
     (princ (ediff-version))
     (princ "\n\n")
     (ediff-with-current-buffer ediff-buffer-A
@@ -2976,7 +2973,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
               ))
 
        ;; unhighlight fine diffs
-       (ediff-set-fine-diff-properties ediff-current-difference 'default)
+       (ediff-set-fine-diff-properties ediff-current-difference t)
        (run-hooks 'ediff-unselect-hook))))
 
 
@@ -3026,8 +3023,6 @@ Hit \\[ediff-recenter] to reset the windows afterward."
        (if (featurep 'xemacs)
            (ediff-move-overlay current-diff-overlay begin end-hilit)
          (ediff-move-overlay current-diff-overlay begin end-hilit buff))
-       (ediff-overlay-put current-diff-overlay 'priority
-                          (ediff-highest-priority begin end-hilit buff))
        (ediff-overlay-put current-diff-overlay 'ediff-diff-num n)
 
        ;; unhighlight the background overlay for diff n so it won't
@@ -3471,12 +3466,15 @@ Without an argument, it saves customized diff argument, if available
          (ediff-with-current-buffer buf
            (goto-char (point-min)))
          (switch-to-buffer buf)
-         (raise-frame (selected-frame)))))
+         (raise-frame))))
   (if (frame-live-p ediff-control-frame)
       (ediff-reset-mouse ediff-control-frame))
   (if (window-live-p ediff-control-window)
       (select-window ediff-control-window)))
 
+(declare-function ediff-regions-internal "ediff"
+                 (buffer-a beg-a end-a buffer-b beg-b end-b
+                           startup-hooks job-name word-mode setup-parameters))
 
 (defun ediff-inferior-compare-regions ()
   "Compare regions in an active Ediff session.
@@ -3494,7 +3492,7 @@ Ediff Control Panel to restore highlighting."
 
     (if (ediff-valid-difference-p ediff-current-difference)
        (progn
-         (ediff-set-fine-diff-properties ediff-current-difference 'default)
+         (ediff-set-fine-diff-properties ediff-current-difference t)
          (ediff-unhighlight-diff)))
     (ediff-paint-background-regions 'unhighlight)