ediff-diff-options file1 file2)
;;(message "Computing differences ... done")
(message "")
- (ediff-eval-in-buffer diff-buffer
+ (ediff-with-current-buffer diff-buffer
(buffer-size))))))
(setq ediff-error-buffer
(get-buffer-create (ediff-unique-buffer-name
"*ediff-errors" "*"))))
- (ediff-eval-in-buffer ediff-error-buffer
+ (ediff-with-current-buffer ediff-error-buffer
(erase-buffer)
- (insert (ediff-eval-in-buffer diff-buff (buffer-string)))
+ (insert (ediff-with-current-buffer diff-buff (buffer-string)))
(goto-char (point-min))
(delete-matching-lines ok-regexp)
(if (memq system-type '(vax-vms axp-vms))
(delete-matching-lines "^$")))
;; If diff reports errors, show them then quit.
- (if (/= 0 (ediff-eval-in-buffer ediff-error-buffer (buffer-size)))
+ (if (/= 0 (ediff-with-current-buffer ediff-error-buffer (buffer-size)))
(let ((ctl-buf ediff-control-buffer)
(error-buf ediff-error-buffer))
(ediff-skip-unsuitable-frames)
(ediff-get-value-according-to-buffer-type 'B bounds))))
;; reset point in buffers A/B/C
- (ediff-eval-in-buffer A-buffer
+ (ediff-with-current-buffer A-buffer
(goto-char (if shift-A shift-A (point-min))))
- (ediff-eval-in-buffer B-buffer
+ (ediff-with-current-buffer B-buffer
(goto-char (if shift-B shift-B (point-min))))
(if (ediff-buffer-live-p C-buffer)
- (ediff-eval-in-buffer C-buffer
+ (ediff-with-current-buffer C-buffer
(goto-char (point-min))))
- (ediff-eval-in-buffer diff-buffer
+ (ediff-with-current-buffer diff-buffer
(goto-char (point-min))
(while (re-search-forward ediff-match-diff-line nil t)
(let* ((a-begin (string-to-int (buffer-substring (match-beginning 1)
b-prev b-end
c-prev c-end)
;; else convert lines to points
- (ediff-eval-in-buffer A-buffer
+ (ediff-with-current-buffer A-buffer
(forward-line (- a-begin a-prev))
(setq a-begin-pt (point))
(forward-line (- a-end a-begin))
(setq a-end-pt (point)
a-prev a-end))
- (ediff-eval-in-buffer B-buffer
+ (ediff-with-current-buffer B-buffer
(forward-line (- b-begin b-prev))
(setq b-begin-pt (point))
(forward-line (- b-end b-begin))
(setq b-end-pt (point)
b-prev b-end))
(if (ediff-buffer-live-p C-buffer)
- (ediff-eval-in-buffer C-buffer
+ (ediff-with-current-buffer C-buffer
(forward-line (- c-begin c-prev))
(setq c-begin-pt (point))
(forward-line (- c-end c-begin))
)))
)))
- ))) ; end ediff-eval-in-buffer
+ ))) ; end ediff-with-current-buffer
diff-list
))
(setq total-diffs (length diff-list))
;; shift, if necessary
- (ediff-eval-in-buffer buff (setq pt-saved shift))
+ (ediff-with-current-buffer buff (setq pt-saved shift))
(while diff-list
(setq current-diff (1+ current-diff)
;; convert word numbers to points, if necessary
(if (eq diff-list-type 'words)
(progn
- (ediff-eval-in-buffer buff (goto-char pt-saved))
+ (ediff-with-current-buffer buff (goto-char pt-saved))
(setq begin (ediff-goto-word (1+ begin) buff)
end (ediff-goto-word end buff 'end))
(if (> end limit) (setq end limit))
(if (> begin end) (setq begin end))
- (setq pt-saved (ediff-eval-in-buffer buff (point)))))
+ (setq pt-saved (ediff-with-current-buffer buff (point)))))
(setq overlay (ediff-make-bullet-proof-overlay begin end buff))
(ediff-overlay-put overlay 'priority ediff-shadow-overlay-priority)
(cdr diff-list))
) ; while
- (set (intern (format "ediff-difference-vector-%S" buf-type))
+ (set (ediff-get-symbol-from-alist buf-type ediff-difference-vector-alist)
(vconcat diff-overlay-list))
))
(face (if default
'default
(face-name
- (intern (format "ediff-fine-diff-face-%S" buf-type)))))
+ (ediff-get-symbol-from-alist
+ buf-type ediff-fine-diff-face-alist))))
(priority (if default
0
(1+ (or (ediff-overlay-get
(symbol-value
- (intern
- (format
- "ediff-current-diff-overlay-%S" buf-type)))
+ (ediff-get-symbol-from-alist
+ buf-type
+ ediff-current-diff-overlay-alist))
'priority)
0)))))
(mapcar
(ediff-clear-fine-differences-in-one-buffer region-num buf-type)
(setq diff-list (cdr diff-list)) ; discard list type (words or points)
- (ediff-eval-in-buffer buff (goto-char reg-start))
+ (ediff-with-current-buffer buff (goto-char reg-start))
;; if it is a combined merge then set overlays in buff C specially
(if (and ediff-merge-job (eq buf-type 'C)
(ediff-get-value-according-to-buffer-type 'C bounds)))))
;; reset point in buffers A, B, C
- (ediff-eval-in-buffer A-buffer
+ (ediff-with-current-buffer A-buffer
(goto-char (if shift-A shift-A (point-min))))
- (ediff-eval-in-buffer B-buffer
+ (ediff-with-current-buffer B-buffer
(goto-char (if shift-B shift-B (point-min))))
(if three-way-comp
- (ediff-eval-in-buffer C-buffer
+ (ediff-with-current-buffer C-buffer
(goto-char (if shift-C shift-C (point-min)))))
(if (ediff-buffer-live-p anc-buffer)
- (ediff-eval-in-buffer anc-buffer
+ (ediff-with-current-buffer anc-buffer
(goto-char (point-min))))
- (ediff-eval-in-buffer diff-buffer
+ (ediff-with-current-buffer diff-buffer
(goto-char (point-min))
(while (re-search-forward ediff-match-diff3-line nil t)
;; leave point after matched line
b-prev b-end
c-prev c-end)
;; else convert lines to points
- (ediff-eval-in-buffer A-buffer
+ (ediff-with-current-buffer A-buffer
(forward-line (- a-begin a-prev))
(setq a-begin-pt (point))
(forward-line (- a-end a-begin))
(setq a-end-pt (point)
a-prev a-end))
- (ediff-eval-in-buffer B-buffer
+ (ediff-with-current-buffer B-buffer
(forward-line (- b-begin b-prev))
(setq b-begin-pt (point))
(forward-line (- b-end b-begin))
(setq b-end-pt (point)
b-prev b-end))
- (ediff-eval-in-buffer C-buffer
+ (ediff-with-current-buffer C-buffer
(forward-line (- c-begin c-prev))
(setq c-begin-pt (point))
(forward-line (- c-end c-begin))
(setq c-end-pt (point)
c-prev c-end))
(if (ediff-buffer-live-p anc-buffer)
- (ediff-eval-in-buffer anc-buffer
+ (ediff-with-current-buffer anc-buffer
(forward-line (- c-or-anc-begin anc-prev))
(setq anc-begin-pt (point))
(forward-line (- c-or-anc-end c-or-anc-begin))
)))
))
- ))) ; end ediff-eval-in-buffer
+ ))) ; end ediff-with-current-buffer
diff-list
))
;; Execute PROGRAM asynchronously, unless OS/2, Windows-*, or DOS, or unless
-;; SYNCH is non-nil. BUFFER must be a buffer object, and must be alive. All
-;; arguments in ARGS must be strings. The first arg may be a blank string, in
-;; which case we delete it from ARGS list. We also delete nil from args.
-(defun ediff-exec-process (program buffer synch &rest args)
- (let ((data (match-data)))
- (if (string-match "^[ \t]*$" (car args)) ; delete blank string
- (setq args (cdr args)))
- (setq args (delq nil args)) ; delete nil from arguments
- (setq args (ediff-split-string (mapconcat 'identity args " ")))
+;; SYNCH is non-nil. BUFFER must be a buffer object, and must be alive. The
+;; OPTIONS arg is a list of options to pass to PROGRAM. It may be a blank
+;; string. All elements in FILES must be strings. We also delete nil from
+;; args.
+(defun ediff-exec-process (program buffer synch options &rest files)
+ (let ((data (match-data))
+ args)
+ (setq args (append (split-string options) files))
+ (setq args (delete "" (delq nil args))) ; delete nil and "" from arguments
(unwind-protect
(let ((directory default-directory)
proc)
(let (sv-point string)
(save-excursion
(set-buffer in-buffer)
- (setq string (buffer-substring beg end))
+ (setq string (buffer-substring-no-properties beg end))
(set-buffer out-buffer)
(erase-buffer)
;; different invocations
(if control-buf
(funcall
- (ediff-eval-in-buffer control-buf ediff-forward-word-function))
+ (ediff-with-current-buffer control-buf ediff-forward-word-function))
(funcall ediff-forward-word-function))
(setq sv-point (point))
(skip-chars-forward ediff-whitespace)
(defun ediff-goto-word (n buf &optional flag)
;; remember val ediff-forward-word-function has in ctl buf
(let ((fwd-word-fun ediff-forward-word-function))
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(skip-chars-forward ediff-whitespace)
(while (> n 1)
(funcall fwd-word-fun)
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
;; The Ediff control buffer
(ediff-defvar-local ediff-control-buffer nil "")
+
+;; Association between buff-type and ediff-buffer-*
+(defconst ediff-buffer-alist
+ '((?A . ediff-buffer-A)
+ (?B . ediff-buffer-B)
+ (?C . ediff-buffer-C)))
+
;;; Macros
(defmacro ediff-odd-p (arg)
(` (eq (logand (, arg) 1) 1)))
((memq (, arg) '(?c ?C)) 'C)
)
))
+
+;; A-list is supposed to be of the form (A . symb) (B . symb)...)
+;; where the first part of any association is a buffer type and the second is
+;; an appropriate symbol. Given buffer-type, this function returns the
+;; symbol. This is used to avoid using `intern'
+(defsubst ediff-get-symbol-from-alist (buf-type alist)
+ (cdr (assoc buf-type alist)))
+(defconst ediff-difference-vector-alist
+ '((A . ediff-difference-vector-A)
+ (B . ediff-difference-vector-B)
+ (C . ediff-difference-vector-C)
+ (Ancestor . ediff-difference-vector-Ancestor)))
+
(defmacro ediff-get-difference (n buf-type)
(` (aref
(symbol-value
- (intern (format "ediff-difference-vector-%S" (, buf-type)))) (, n))))
+ (ediff-get-symbol-from-alist
+ (, buf-type) ediff-difference-vector-alist))
+ (, n))))
;; Tell if it has been previously determined that the region has
;; no diffs other than the white space and newlines
(` (ediff-get-fine-diff-vector-from-diff-record
(ediff-get-difference (, n) (, buf-type)))))
-;; Macro to switch to BUFFER, evaluate FORMS, returns to original buffer.
-;; Differs from `save-excursion' in that it doesn't save the point and mark.
-;; This is essentially `emerge-eval-in-buffer' with the test for live buffers."
-(defmacro ediff-eval-in-buffer (buffer &rest forms)
- (` (let ((StartBuffer (current-buffer)))
- (if (ediff-buffer-live-p (, buffer))
- (unwind-protect
- (progn
- (set-buffer (, buffer))
- (,@ forms))
- (set-buffer StartBuffer))
- (or (eq this-command 'ediff-quit)
- (error ediff-KILLED-VITAL-BUFFER))
- ))))
-
+;; Macro to switch to BUFFER, evaluate BODY, returns to original buffer.
+;; Doesn't save the point and mark.
+;; This is `with-current-buffer' with the added test for live buffers."
+(defmacro ediff-with-current-buffer (buffer &rest body)
+ (` (if (ediff-buffer-live-p (, buffer))
+ (save-current-buffer
+ (set-buffer (, buffer))
+ (,@ body))
+ (or (eq this-command 'ediff-quit)
+ (error ediff-KILLED-VITAL-BUFFER))
+ )))
+
(defsubst ediff-multiframe-setup-p ()
(and (ediff-window-display-p) ediff-multiframe))
;; The original values of ediff-protected-variables for buffer Ancestor
(ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "")
+;; association between buff-type and ediff-buffer-values-orig-*
+(defconst ediff-buffer-values-orig-alist
+ '((A . ediff-buffer-values-orig-A)
+ (B . ediff-buffer-values-orig-B)
+ (C . ediff-buffer-values-orig-C)
+ (Ancestor . ediff-buffer-values-orig-Ancestor)))
+
;; Buffer-local variables to be saved then restored during Ediff sessions
(defconst ediff-protected-variables '(
;;buffer-read-only
(ediff-defvar-local ediff-difference-vector-B nil "")
(ediff-defvar-local ediff-difference-vector-C nil "")
(ediff-defvar-local ediff-difference-vector-Ancestor nil "")
+;; A-list of diff vector types associated with buffer types
+(defconst ediff-difference-vector-alist
+ '((A . ediff-difference-vector-A)
+ (B . ediff-difference-vector-B)
+ (C . ediff-difference-vector-C)
+ (Ancestor . ediff-difference-vector-Ancestor)))
;; [ status status status ...]
;; Each status: [state-of-merge state-of-ancestor]
(fset 'ediff-display-pixel-height
(symbol-function 'x-display-pixel-height))))
+;; A-list of current-diff-overlay symbols asssociated with buf types
+(defconst ediff-current-diff-overlay-alist
+ '((A . ediff-current-diff-overlay-A)
+ (B . ediff-current-diff-overlay-B)
+ (C . ediff-current-diff-overlay-C)
+ (Ancestor . ediff-current-diff-overlay-Ancestor)))
+
+;; A-list of current-diff-face-* symbols asssociated with buf types
+(defconst ediff-current-diff-face-alist
+ '((A . ediff-current-diff-face-A)
+ (B . ediff-current-diff-face-B)
+ (C . ediff-current-diff-face-C)
+ (Ancestor . ediff-current-diff-face-Ancestor)))
+
(defun ediff-make-current-diff-overlay (type)
(if (ediff-has-face-support-p)
- (let ((overlay (intern (format "ediff-current-diff-overlay-%S" type)))
+ (let ((overlay (ediff-get-symbol-from-alist
+ type ediff-current-diff-overlay-alist))
(buffer (ediff-get-buffer type))
(face (face-name
(symbol-value
- (intern (format "ediff-current-diff-face-%S" type))))))
+ (ediff-get-symbol-from-alist
+ type ediff-current-diff-face-alist)))))
(set overlay
(ediff-make-bullet-proof-overlay (point-max) (point-max) buffer))
(ediff-set-overlay-face (symbol-value overlay) face)
ediff-even-diff-pixmap)))
'ediff-even-diff-face-Ancestor))
"Face highlighting even-numbered differences in the ancestor buffer.")
-
+
+;; Association between buffer types and even-diff-face symbols
+(defconst ediff-even-diff-face-alist
+ '((A . ediff-even-diff-face-A)
+ (B . ediff-even-diff-face-B)
+ (C . ediff-even-diff-face-C)
+ (Ancestor . ediff-even-diff-face-Ancestor)))
+
(defvar ediff-odd-diff-face-A
(if (ediff-has-face-support-p)
(progn
'ediff-odd-diff-face-Ancestor))
"Face used to highlight even-numbered differences in the ancestor buffer.")
+;; Association between buffer types and odd-diff-face symbols
+(defconst ediff-odd-diff-face-alist
+ '((A . ediff-odd-diff-face-A)
+ (B . ediff-odd-diff-face-B)
+ (C . ediff-odd-diff-face-C)
+ (Ancestor . ediff-odd-diff-face-Ancestor)))
+
+;; A-list of fine-diff face symbols associated with buffer types
+(defconst ediff-fine-diff-face-alist
+ '((A . ediff-fine-diff-face-A)
+ (B . ediff-fine-diff-face-B)
+ (C . ediff-fine-diff-face-C)
+ (Ancestor . ediff-fine-diff-face-Ancestor)))
+
;; Help echo
(put 'ediff-fine-diff-face-A 'ediff-help-echo
"A `refinement' of the current difference region")
"Overlay for the current difference region in buffer C.")
(ediff-defvar-local ediff-current-diff-overlay-Ancestor nil
"Overlay for the current difference region in the ancestor buffer.")
-
+
;; Compute priority of ediff overlay.
(defun ediff-highest-priority (start end buffer)
(let ((pos (max 1 (1- start)))
ovr-list)
(if ediff-xemacs-p
(1+ ediff-shadow-overlay-priority)
- (ediff-eval-in-buffer buffer
+ (ediff-with-current-buffer buffer
(while (< pos (min (point-max) (1+ end)))
(setq ovr-list (append (overlays-at pos) ovr-list))
(setq pos (next-overlay-change pos)))
(defsubst ediff-background-face (buf-type dif-num)
;; The value of dif-num is always 1- the one that user sees.
;; This is why even face is used when dif-num is odd.
- (intern (format (if (ediff-odd-p dif-num)
- "ediff-even-diff-face-%S"
- "ediff-odd-diff-face-%S")
- buf-type)))
+ (ediff-get-symbol-from-alist
+ buf-type (if (ediff-odd-p dif-num)
+ ediff-even-diff-face-alist
+ ediff-odd-diff-face-alist)
+ ))
;; activate faces on diff regions in buffer
(defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight)
(let ((diff-vector
- (eval (intern (format "ediff-difference-vector-%S" buf-type))))
+ (eval (ediff-get-symbol-from-alist
+ buf-type ediff-difference-vector-alist)))
overl diff-num)
(mapcar (function
(lambda (rec)
(defun ediff-highlight-diff-in-one-buffer (n buf-type)
(if (ediff-buffer-live-p (ediff-get-buffer buf-type))
(let* ((buff (ediff-get-buffer buf-type))
- (last (ediff-eval-in-buffer buff (point-max)))
+ (last (ediff-with-current-buffer buff (point-max)))
(begin (ediff-get-diff-posn buf-type 'beg n))
(end (ediff-get-diff-posn buf-type 'end n))
(xtra (if (equal begin end) 1 0))
(end-hilit (min last (+ end xtra)))
(current-diff-overlay
(symbol-value
- (intern (format "ediff-current-diff-overlay-%S" buf-type)))))
+ (ediff-get-symbol-from-alist
+ buf-type ediff-current-diff-overlay-alist))))
(if ediff-xemacs-p
(ediff-move-overlay current-diff-overlay begin end-hilit)
(if (ediff-buffer-live-p (ediff-get-buffer buf-type))
(let ((current-diff-overlay
(symbol-value
- (intern (format "ediff-current-diff-overlay-%S" buf-type))))
+ (ediff-get-symbol-from-alist
+ buf-type ediff-current-diff-overlay-alist)))
(overlay
(ediff-get-diff-overlay ediff-current-difference buf-type))
)
(if (and (ediff-has-face-support-p) ediff-use-faces)
(let* ((inhibit-quit t)
(current-diff-overlay-var
- (intern (format "ediff-current-diff-overlay-%S" buf-type)))
+ (ediff-get-symbol-from-alist
+ buf-type ediff-current-diff-overlay-alist))
(current-diff-overlay (symbol-value current-diff-overlay-var)))
(ediff-paint-background-regions 'unhighlight)
(if (ediff-overlayp current-diff-overlay)
(ediff-empty-diff-region-p n buf-type)
(let ((beg (ediff-get-diff-posn buf-type 'beg n))
(end (ediff-get-diff-posn buf-type 'end n)))
- (ediff-eval-in-buffer (ediff-get-buffer buf-type)
+ (ediff-with-current-buffer (ediff-get-buffer buf-type)
(save-excursion
(goto-char beg)
(skip-chars-forward ediff-whitespace)
(defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end)
- (ediff-eval-in-buffer
- (ediff-eval-in-buffer ctrl-buf (ediff-get-buffer buf-type))
+ (ediff-with-current-buffer
+ (ediff-with-current-buffer ctrl-buf (ediff-get-buffer buf-type))
(buffer-substring
(or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf))
(or end (ediff-get-diff-posn buf-type 'end n ctrl-buf)))))
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
(provide 'ediff-init)
reg-a-beg reg-a-end reg-b-beg reg-b-end reg-c-beg reg-c-end)
(if combined
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(goto-char reg-beg)
(search-forward pat1 reg-end 'noerror)
(setq reg-a-beg (match-beginning 0))
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
;; ediff-merg.el ends here
(let* ((meta-buffer-name
(ediff-unique-buffer-name meta-buffer-name "*"))
(meta-buffer (get-buffer-create meta-buffer-name)))
- (ediff-eval-in-buffer meta-buffer
+ (ediff-with-current-buffer meta-buffer
;; comes first
(ediff-meta-mode)
regexp elt session-buf f1 f2 f3 pt
merge-autostore-dir
point tmp-list buffer-read-only)
- (ediff-eval-in-buffer meta-buf
+ (ediff-with-current-buffer meta-buf
(setq point (point))
(erase-buffer)
(insert (format ediff-meta-buffer-message
;; skip the directory part
(setq diff-list (cdr diff-list))
(setq ediff-dir-diffs-buffer (get-buffer-create buf-name))
- (ediff-eval-in-buffer ediff-dir-diffs-buffer
+ (ediff-with-current-buffer ediff-dir-diffs-buffer
(use-local-map ediff-dir-diffs-buffer-map)
(erase-buffer)
(setq ediff-meta-buffer meta-buf)
;; argument is ignored
(defun ediff-redraw-registry-buffer (&optional ignore)
- (ediff-eval-in-buffer ediff-registry-buffer
+ (ediff-with-current-buffer ediff-registry-buffer
(let ((point (point))
elt bufAname bufBname bufCname cur-diff total-diffs pt
job-name meta-list registry-list buffer-read-only)
registry-list (cdr registry-list))
(if (ediff-buffer-live-p elt)
- (if (ediff-eval-in-buffer elt
+ (if (ediff-with-current-buffer elt
(setq job-name ediff-metajob-name
meta-list ediff-meta-list)
(and ediff-metajob-name
""))))
(ediff-set-meta-overlay pt (point) elt))
(progn
- (ediff-eval-in-buffer elt
+ (ediff-with-current-buffer elt
(setq bufAname (if (ediff-buffer-live-p ediff-buffer-A)
(buffer-name ediff-buffer-A)
"!!!killed buffer!!!")
(metajob ediff-metajob-name)
tmp-buf custom-diff-buf)
(if (ediff-buffer-live-p session-buf)
- (ediff-eval-in-buffer session-buf
+ (ediff-with-current-buffer session-buf
(if (eq ediff-control-buffer session-buf) ; individual session
(progn
(ediff-compute-custom-diffs-maybe)
(setq ediff-meta-diff-buffer
(get-buffer-create
(ediff-unique-buffer-name "*Ediff Multifile Diffs" "*"))))
- (ediff-eval-in-buffer ediff-meta-diff-buffer
+ (ediff-with-current-buffer ediff-meta-diff-buffer
(erase-buffer))
(if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0)
;; did something
(info (ediff-get-meta-info meta-buf pos 'noerror))
(patchbuffer ediff-meta-patchbufer))
(if (ediff-buffer-live-p patchbuffer)
- (ediff-eval-in-buffer patchbuffer
+ (ediff-with-current-buffer patchbuffer
(save-restriction
(if (not info)
(widen)
(ediff-update-meta-buffer meta-buf))
(error "Aborted"))))
- (ediff-eval-in-buffer meta-buf
+ (ediff-with-current-buffer meta-buf
(setq merge-autostore-dir
(ediff-get-group-merge-autostore-dir ediff-meta-list))
(goto-char pos) ; if the user clicked on session--move point there
;; handle an individual session with a live control buffer
((ediff-buffer-live-p session-buf)
- (ediff-eval-in-buffer session-buf
+ (ediff-with-current-buffer session-buf
(setq ediff-mouse-pixel-position (mouse-pixel-position))
(ediff-recenter 'no-rehighlight)))
(if (ediff-buffer-live-p ctl-buf)
;; check if this is ediff-control-buffer or ediff-meta-buffer
- (if (ediff-eval-in-buffer ctl-buf
+ (if (ediff-with-current-buffer ctl-buf
(eq (key-binding "q") 'ediff-quit-meta-buffer))
;; it's a meta-buffer -- last action should just display it
(ediff-show-meta-buffer ctl-buf)
;; it's a session buffer -- invoke go back to session
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(setq ediff-mouse-pixel-position (mouse-pixel-position))
(ediff-recenter 'no-rehighlight)))
(beep)
(message "You've selected a stale session --- try again")
(ediff-update-registry))
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(goto-char pos))
))
"Can't find this session's group panel -- session itself is ok")))
(ediff-cleanup-meta-buffer meta-buf)
- (ediff-eval-in-buffer meta-buf
+ (ediff-with-current-buffer meta-buf
(save-excursion
(cond ((setq wind (ediff-get-visible-buffer-window meta-buf))
(or silent
(meta-buf (ediff-event-buffer last-command-event))
(info (ediff-get-meta-info meta-buf pos))
(meta-or-session-buf info))
- (ediff-eval-in-buffer meta-or-session-buf
+ (ediff-with-current-buffer meta-or-session-buf
(ediff-show-meta-buffer))))
;;;###autoload
(let (wind frame)
;; for some reason, point moves in ediff-registry-buffer, so we preserve it
;; explicitly
- (ediff-eval-in-buffer ediff-registry-buffer
+ (ediff-with-current-buffer ediff-registry-buffer
(save-excursion
(cond ((setq wind
(ediff-get-visible-buffer-window ediff-registry-buffer))
;; parent meta-buf
;; Check if META-BUF exists before calling this function
(defun ediff-update-meta-buffer (meta-buf)
- (ediff-eval-in-buffer (current-buffer)
+ (ediff-with-current-buffer (current-buffer)
(if (ediff-buffer-live-p meta-buf)
- (ediff-eval-in-buffer meta-buf
+ (ediff-with-current-buffer meta-buf
(funcall ediff-meta-redraw-function ediff-meta-list))
)))
(defun ediff-update-registry ()
- (ediff-eval-in-buffer (current-buffer)
+ (ediff-with-current-buffer (current-buffer)
(if (ediff-buffer-live-p ediff-registry-buffer)
(ediff-redraw-registry-buffer)
(ediff-prepare-meta-buffer
;; Otherwise, nothing happens.
(defun ediff-cleanup-meta-buffer (meta-buffer)
(if (ediff-buffer-live-p meta-buffer)
- (ediff-eval-in-buffer meta-buffer
+ (ediff-with-current-buffer meta-buffer
(ediff-update-meta-buffer meta-buffer)
(if (ediff-buffer-live-p ediff-parent-meta-buffer)
(ediff-update-meta-buffer ediff-parent-meta-buffer)))))
(cont t)
buffer-read-only)
(ediff-update-meta-buffer meta-buffer)
- (ediff-eval-in-buffer meta-buffer
+ (ediff-with-current-buffer meta-buffer
(setq lis (cdr lis)) ; discard the description part of meta-list
(while (and cont lis)
(if (ediff-buffer-live-p
(defun ediff-dispose-of-meta-buffer (buf)
(setq ediff-session-registry (delq buf ediff-session-registry))
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(if (ediff-buffer-live-p ediff-dir-diffs-buffer)
(kill-buffer ediff-dir-diffs-buffer)))
(kill-buffer buf))
(defun ediff-get-meta-info (buf point &optional noerror)
(let (result olist tmp)
(if (and point (ediff-buffer-live-p buf))
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(if ediff-xemacs-p
(setq result
(if (setq tmp (extent-at point buf 'ediff-meta-info))
(error
"Patch has been already applied to this file--cannot be repeated!"))
- (ediff-eval-in-buffer meta-patchbuf
+ (ediff-with-current-buffer meta-patchbuf
(save-restriction
(widen)
(narrow-to-region beg-marker end-marker)
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
;;; ediff-mult.el ends here
;; no longer used
;; return the number of matches of regexp in buf starting from the beginning
(defun ediff-count-matches (regexp buf)
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(let ((count 0) opoint)
(save-excursion
(goto-char (point-min))
;; it for the end. This list is then assigned to ediff-patch-map.
;; Returns the number of elements in the list ediff-patch-map
(defun ediff-map-patch-buffer (buf)
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(let ((count 0)
(mark1 (move-marker (make-marker) (point-min)))
(mark1-end (point-min))
(read-file-name "Which file contains the patch? "
dir nil 'must-match))))
- (ediff-eval-in-buffer patch-buf
+ (ediff-with-current-buffer patch-buf
(goto-char (point-min))
(or (ediff-get-visible-buffer-window patch-buf)
(progn
;; Should return either the ctl buffer or the meta-buffer
(defun ediff-dispatch-file-patching-job (patch-buf filename
&optional startup-hooks)
- (ediff-eval-in-buffer patch-buf
+ (ediff-with-current-buffer patch-buf
;; relativize names in the patch with respect to source-file
(ediff-fixup-patch-map filename)
(if (< (length ediff-patch-map) 2)
(let* ((buf-to-patch (get-buffer buf-to-patch-name))
(file-name-ok (if buf-to-patch (buffer-file-name buf-to-patch)))
(buf-mod-status (buffer-modified-p buf-to-patch))
- (multifile-patch-p (> (length (ediff-eval-in-buffer patch-buf
+ (multifile-patch-p (> (length (ediff-with-current-buffer patch-buf
ediff-patch-map)) 1))
default-dir file-name ctl-buf)
(if file-name-ok
(if multifile-patch-p
(error
"Can't apply multi-file patches to buffers that visit no files"))
- (ediff-eval-in-buffer buf-to-patch
+ (ediff-with-current-buffer buf-to-patch
(setq default-dir default-directory)
(setq file-name (ediff-make-temp-file buf-to-patch))
(set-visited-file-name file-name)
()
;; buffer wasn't visiting any file,
;; so we will not run meta-level ediff here
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(delete-file (buffer-file-name ediff-buffer-A))
(delete-file (buffer-file-name ediff-buffer-B))
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(if default-dir (setq default-directory default-dir))
(set-visited-file-name nil)
(rename-buffer buf-to-patch-name)
(set-buffer-modified-p buf-mod-status))
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(setq buffer-auto-save-file-name nil) ; don't create auto-save file
(if default-dir (setq default-directory default-dir))
(set-visited-file-name nil)
(true-source-filename source-filename)
(target-filename source-filename)
target-buf buf-to-patch file-name-magic-p
- patch-return-code ctl-buf backup-style)
+ patch-return-code ctl-buf backup-style aux-wind)
(if (string-match "-V" ediff-patch-options)
(error
;; could be checked back in.
(ediff-maybe-checkout buf-to-patch)
- (ediff-eval-in-buffer patch-diagnostics
+ (ediff-with-current-buffer patch-diagnostics
(insert-buffer patch-buf)
(message "Applying patch ... ")
;; fix environment for gnu patch, so it won't make numbered extensions
;; old-name_orig) and the result of patching will have the same name as
;; the original.
(if (not file-name-magic-p)
- (ediff-eval-in-buffer buf-to-patch
+ (ediff-with-current-buffer buf-to-patch
(set-visited-file-name
(concat source-filename ediff-backup-extension))
(set-buffer-modified-p nil))
(ediff-buffers-internal
buf-to-patch target-buf nil
startup-hooks 'epatch))
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(setq ediff-patchbufer patch-buf
ediff-patch-diagnostics patch-diagnostics))
startup-hooks))
(setq meta-buf (ediff-prepare-meta-buffer
'ediff-filegroup-action
- (ediff-eval-in-buffer patch-buf
+ (ediff-with-current-buffer patch-buf
;; nil replaces a regular expression
(cons (list nil (format "%S" patch-buf))
ediff-patch-map))
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
;;; ediff-ptch.el ends here
(ediff-convert-standard-filename (expand-file-name file-C))))
(let* ((control-buffer-name
(ediff-unique-buffer-name "*Ediff Control Panel" "*"))
- (control-buffer (ediff-eval-in-buffer buffer-A
+ (control-buffer (ediff-with-current-buffer buffer-A
(get-buffer-create control-buffer-name))))
- (ediff-eval-in-buffer control-buffer
+ (ediff-with-current-buffer control-buffer
(ediff-mode)
(make-local-variable 'ediff-use-long-help-message)
(save-excursion
(set-buffer buffer-C)
(insert-buffer buf)
- (funcall (ediff-eval-in-buffer buf major-mode))
+ (funcall (ediff-with-current-buffer buf major-mode))
;; after Stig@hackvan.com
(add-hook 'local-write-file-hooks 'ediff-set-merge-mode nil t)
)))
(setq ediff-error-buffer
(get-buffer-create (ediff-unique-buffer-name "*ediff-errors" "*")))
- (ediff-eval-in-buffer buffer-A (ediff-strip-mode-line-format))
- (ediff-eval-in-buffer buffer-B (ediff-strip-mode-line-format))
+ (ediff-with-current-buffer buffer-A (ediff-strip-mode-line-format))
+ (ediff-with-current-buffer buffer-B (ediff-strip-mode-line-format))
(if ediff-3way-job
- (ediff-eval-in-buffer buffer-C (ediff-strip-mode-line-format)))
+ (ediff-with-current-buffer buffer-C (ediff-strip-mode-line-format)))
(if (ediff-buffer-live-p ediff-ancestor-buffer)
- (ediff-eval-in-buffer ediff-ancestor-buffer
+ (ediff-with-current-buffer ediff-ancestor-buffer
(ediff-strip-mode-line-format)))
(ediff-save-protected-variables) ; save variables to be restored on exit
(or ediff-narrow-bounds
(setq ediff-narrow-bounds ediff-wide-bounds))
- ;; All these must be inside ediff-eval-in-buffer control-buffer,
+ ;; All these must be inside ediff-with-current-buffer control-buffer,
;; since these vars are local to control-buffer
;; These won't run if there are errors in diff
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(ediff-nuke-selective-display)
(run-hooks 'ediff-prepare-buffer-hook)
- (if (ediff-eval-in-buffer control-buffer ediff-merge-job)
+ (if (ediff-with-current-buffer control-buffer ediff-merge-job)
(setq buffer-read-only t))
;; add control-buffer to the list of sessions--no longer used, but may
;; be used again in the future
(setq buffer-read-only t))
)
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(ediff-nuke-selective-display)
(run-hooks 'ediff-prepare-buffer-hook)
- (if (ediff-eval-in-buffer control-buffer ediff-merge-job)
+ (if (ediff-with-current-buffer control-buffer ediff-merge-job)
(setq buffer-read-only t))
;; add control-buffer to the list of sessions
(or (memq control-buffer ediff-this-buffer-ediff-sessions)
)
(if ediff-3way-job
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(ediff-nuke-selective-display)
(run-hooks 'ediff-prepare-buffer-hook)
;; add control-buffer to the list of sessions
))
(if (ediff-buffer-live-p ediff-ancestor-buffer)
- (ediff-eval-in-buffer ediff-ancestor-buffer
+ (ediff-with-current-buffer ediff-ancestor-buffer
(ediff-nuke-selective-display)
(setq buffer-read-only t)
(run-hooks 'ediff-prepare-buffer-hook)
(interactive)
(ediff-barf-if-not-control-buffer)
(if (and (ediff-buffer-live-p ediff-ancestor-buffer)
- (not (y-or-n-p "Recompute differences during merge, really? ")))
- (error "Recomputation of differences cancelled"))
+ (not
+ (y-or-n-p
+ "Ancestor buffer will not be used. Recompute diffs anyway? ")))
+ (error "Recomputation of differences canceled"))
- (let ((point-A (ediff-eval-in-buffer ediff-buffer-A (point)))
- ;;(point-B (ediff-eval-in-buffer ediff-buffer-B (point)))
+ (let ((point-A (ediff-with-current-buffer ediff-buffer-A (point)))
+ ;;(point-B (ediff-with-current-buffer ediff-buffer-B (point)))
(tmp-buffer (get-buffer-create ediff-tmp-buffer))
- (buf-A-file-name
- (file-name-nondirectory (or (buffer-file-name ediff-buffer-A)
- (buffer-name ediff-buffer-A)
- )))
- (buf-B-file-name
- (file-name-nondirectory (or (buffer-file-name ediff-buffer-B)
- (buffer-name ediff-buffer-B)
- )))
- (buf-C-file-name
- (file-name-nondirectory (or (buffer-file-name ediff-buffer-C)
- ;; if (null ediff-buffer-C), there is
- ;; no danger, since we later check if
- ;; ediff-buffer-C is alive
- (buffer-name ediff-buffer-C)
- )))
+ (buf-A-file-name (buffer-file-name ediff-buffer-A))
+ (buf-B-file-name (buffer-file-name ediff-buffer-B))
+ ;; (null ediff-buffer-C) is no problem, as we later check if
+ ;; ediff-buffer-C is alive
+ (buf-C-file-name (buffer-file-name ediff-buffer-C))
(overl-A (ediff-get-value-according-to-buffer-type
'A ediff-narrow-bounds))
(overl-B (ediff-get-value-according-to-buffer-type
'C ediff-narrow-bounds))
beg-A end-A beg-B end-B beg-C end-C
file-A file-B file-C)
+
+ (if (stringp buf-A-file-name)
+ (setq buf-A-file-name (file-name-nondirectory buf-A-file-name)))
+ (if (stringp buf-B-file-name)
+ (setq buf-B-file-name (file-name-nondirectory buf-B-file-name)))
+ (if (stringp buf-C-file-name)
+ (setq buf-C-file-name (file-name-nondirectory buf-C-file-name)))
+
(ediff-unselect-and-select-difference -1)
(setq beg-A (ediff-overlay-start overl-A)
(ancestor-job ediff-merge-with-ancestor-job)
(merge ediff-merge-job)
(comparison ediff-3way-comparison-job))
- (ediff-eval-in-buffer bufA
+ (ediff-with-current-buffer bufA
(revert-buffer t noconfirm))
- (ediff-eval-in-buffer bufB
+ (ediff-with-current-buffer bufB
(revert-buffer t noconfirm))
;; this should only be executed in a 3way comparison, not in merge
(if comparison
- (ediff-eval-in-buffer bufC
+ (ediff-with-current-buffer bufC
(revert-buffer t noconfirm)))
(if merge
(progn
(if ediff-3way-job
(ediff-recenter-one-window 'C))
- (ediff-eval-in-buffer control-buf
+ (ediff-with-current-buffer control-buf
(ediff-recenter-ancestor) ; check if ancestor is alive
(if (and (ediff-multiframe-setup-p)
))
(ediff-restore-highlighting)
- (ediff-eval-in-buffer control-buf (ediff-refresh-mode-lines))
+ (ediff-with-current-buffer control-buf (ediff-refresh-mode-lines))
))
;; this function returns to the window it was called from
buf-type ediff-narrow-bounds)))
(job-name ediff-job-name)
(control-buf ediff-control-buffer)
- (window-name (intern (format "ediff-window-%S" buf-type)))
+ (window-name (ediff-get-symbol-from-alist
+ buf-type ediff-window-alist))
(window (if (window-live-p (symbol-value window-name))
(symbol-value window-name))))
(ctl-wind (selected-window))
(job-name ediff-job-name)
(ctl-buf ediff-control-buffer))
- (ediff-eval-in-buffer ediff-ancestor-buffer
+ (ediff-with-current-buffer ediff-ancestor-buffer
(goto-char (ediff-get-diff-posn 'Ancestor 'beg nil ctl-buf))
(if window
(progn
(or buf
(setq buf (ediff-get-buffer buf-type)))
- (ediff-eval-in-buffer buf ; eval in buf A/B/C
+ (ediff-with-current-buffer buf ; eval in buf A/B/C
(let* ((file (buffer-file-name buf))
(file-writable (and file
(file-exists-p file)
;; do this, the mode line will show %%, since the file was
;; RO before ediff started, so the user will think the file
;; is checked in.
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(ediff-change-saved-variable
'buffer-read-only nil buf-type)))
(t
(format
"File %s is under version control. Check it out? "
(ediff-abbreviate-file-name file))))
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(command-execute checkout-function)))))
(let ((ctl-buf ediff-control-buffer))
(setq ediff-wide-display-p (not ediff-wide-display-p))
(if (not ediff-wide-display-p)
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(modify-frame-parameters
ediff-wide-display-frame ediff-wide-display-orig-parameters)
;;(sit-for (if ediff-xemacs-p 0.4 0))
(ediff-recenter 'no-rehighlight))
(funcall ediff-make-wide-display-function)
;;(sit-for (if ediff-xemacs-p 0.4 0))
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(setq ediff-window-B nil) ; force update of window config
(ediff-recenter 'no-rehighlight)))))
(setq-default ediff-window-setup-function window-setup-func)
;; change in all active ediff sessions
(mapcar (function (lambda(buf)
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(setq ediff-window-setup-function window-setup-func
ediff-window-B nil))))
ediff-session-registry)
(setq ediff-use-toolbar-p (not ediff-use-toolbar-p))
(mapcar (function (lambda(buf)
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
;; force redisplay
(setq ediff-window-config-saved "")
)))
(overl-C (ediff-get-value-according-to-buffer-type
'C ediff-visible-bounds))
)
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(narrow-to-region
(ediff-overlay-start overl-A) (ediff-overlay-end overl-A)))
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(narrow-to-region
(ediff-overlay-start overl-B) (ediff-overlay-end overl-B)))
(if ediff-3way-job
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(narrow-to-region
(ediff-overlay-start overl-C) (ediff-overlay-end overl-C))))
)))
(defun ediff-get-lines-to-region-end (buf-type &optional n ctl-buf)
(or n (setq n ediff-current-difference))
(or ctl-buf (setq ctl-buf ediff-control-buffer))
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(let* ((buf (ediff-get-buffer buf-type))
- (wind (eval (intern (format "ediff-window-%S" buf-type))))
+ (wind (eval (ediff-get-symbol-from-alist
+ buf-type ediff-window-alist)))
(beg (window-start wind))
(end (ediff-get-diff-posn buf-type 'end))
lines)
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(if (< beg end)
(setq lines (count-lines beg end))
(setq lines 0))
(defun ediff-get-lines-to-region-start (buf-type &optional n ctl-buf)
(or n (setq n ediff-current-difference))
(or ctl-buf (setq ctl-buf ediff-control-buffer))
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(let* ((buf (ediff-get-buffer buf-type))
- (wind (eval (intern (format "ediff-window-%S" buf-type))))
+ (wind (eval (ediff-get-symbol-from-alist
+ buf-type ediff-window-alist)))
(end (window-end wind))
(beg (ediff-get-diff-posn buf-type 'beg)))
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(if (< beg end) (count-lines beg end) 0))
)))
;;
;; If the difference region is invalid, the coefficient is 1
(defun ediff-get-region-size-coefficient (buf-type op &optional n ctl-buf)
- (ediff-eval-in-buffer (or ctl-buf ediff-control-buffer)
+ (ediff-with-current-buffer (or ctl-buf ediff-control-buffer)
(if (ediff-valid-difference-p n)
(let* ((func (cond ((eq op 'scroll-down)
'ediff-get-lines-to-region-start)
(ediff-barf-if-not-control-buffer)
(let* ((buf-type (ediff-char-to-buftype last-command-char))
(buffer (ediff-get-buffer buf-type))
- (pt (ediff-eval-in-buffer buffer (point)))
+ (pt (ediff-with-current-buffer buffer (point)))
(diff-no (ediff-diff-at-point buf-type nil (if arg 'after)))
(past-last-diff (< ediff-number-of-differences diff-no))
(beg (if past-last-diff
- (ediff-eval-in-buffer buffer (point-max))
+ (ediff-with-current-buffer buffer (point-max))
(ediff-get-diff-posn buf-type 'beg (1- diff-no))))
ctl-wind wind-A wind-B wind-C
shift)
wind-C ediff-window-C)
(if arg
(progn
- (ediff-eval-in-buffer buffer
+ (ediff-with-current-buffer buffer
(setq shift (- beg pt)))
(select-window wind-A)
(if past-last-diff (goto-char (point-max)))
(beg 0)
(end 0))
- (ediff-eval-in-buffer buffer
+ (ediff-with-current-buffer buffer
(setq pos (or pos (point)))
(while (and (or (< pos prev-beg) (> pos beg))
(< diff-no max-dif-num))
(if (or batch-invocation (ediff-test-save-region n to-buf-type))
(condition-case conds
(progn
- (ediff-eval-in-buffer to-buf
+ (ediff-with-current-buffer to-buf
;; to prevent flags from interfering if buffer is writable
(let ((inhibit-read-only (null buffer-read-only)))
(setq reg-end (ediff-get-diff-posn buf-type 'end n ediff-control-buffer))
(condition-case conds
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(let ((inhibit-read-only (null buffer-read-only)))
(goto-char reg-end)
(regex-A ediff-regexp-focus-A)
(regex-B ediff-regexp-focus-B)
(regex-C ediff-regexp-focus-C)
- (reg-A-match (ediff-eval-in-buffer ediff-buffer-A
+ (reg-A-match (ediff-with-current-buffer ediff-buffer-A
(save-restriction
(narrow-to-region
(ediff-get-diff-posn 'A 'beg n ctl-buf)
(ediff-get-diff-posn 'A 'end n ctl-buf))
(goto-char (point-min))
(re-search-forward regex-A nil t))))
- (reg-B-match (ediff-eval-in-buffer ediff-buffer-B
+ (reg-B-match (ediff-with-current-buffer ediff-buffer-B
(save-restriction
(narrow-to-region
(ediff-get-diff-posn 'B 'beg n ctl-buf)
(ediff-get-diff-posn 'B 'end n ctl-buf))
(re-search-forward regex-B nil t))))
(reg-C-match (if ediff-3way-comparison-job
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(save-restriction
(narrow-to-region
(ediff-get-diff-posn 'C 'beg n ctl-buf)
(regex-A ediff-regexp-hide-A)
(regex-B ediff-regexp-hide-B)
(regex-C ediff-regexp-hide-C)
- (reg-A-match (ediff-eval-in-buffer ediff-buffer-A
+ (reg-A-match (ediff-with-current-buffer ediff-buffer-A
(save-restriction
(narrow-to-region
(ediff-get-diff-posn 'A 'beg n ctl-buf)
(ediff-get-diff-posn 'A 'end n ctl-buf))
(goto-char (point-min))
(re-search-forward regex-A nil t))))
- (reg-B-match (ediff-eval-in-buffer ediff-buffer-B
+ (reg-B-match (ediff-with-current-buffer ediff-buffer-B
(save-restriction
(narrow-to-region
(ediff-get-diff-posn 'B 'beg n ctl-buf)
(goto-char (point-min))
(re-search-forward regex-B nil t))))
(reg-C-match (if ediff-3way-comparison-job
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(save-restriction
(narrow-to-region
(ediff-get-diff-posn 'C 'beg n ctl-buf)
(window-frame ediff-window-B))
(t (next-frame))))))
(condition-case nil
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(setq ediff-this-buffer-ediff-sessions
(delq control-buffer ediff-this-buffer-ediff-sessions))
(kill-local-variable 'mode-line-buffer-identification)
(error))
(condition-case nil
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(setq ediff-this-buffer-ediff-sessions
(delq control-buffer ediff-this-buffer-ediff-sessions))
(kill-local-variable 'mode-line-buffer-identification)
(error))
(condition-case nil
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(setq ediff-this-buffer-ediff-sessions
(delq control-buffer ediff-this-buffer-ediff-sessions))
(kill-local-variable 'mode-line-buffer-identification)
(error))
(condition-case nil
- (ediff-eval-in-buffer ediff-ancestor-buffer
+ (ediff-with-current-buffer ediff-ancestor-buffer
(setq ediff-this-buffer-ediff-sessions
(delq control-buffer ediff-this-buffer-ediff-sessions))
(kill-local-variable 'mode-line-buffer-identification)
(ediff-write-merge-buffer-and-maybe-kill
ediff-buffer-C merge-store-file nil save-and-continue))
((and (ediff-buffer-live-p ediff-meta-buffer)
- (ediff-eval-in-buffer ediff-meta-buffer
+ (ediff-with-current-buffer ediff-meta-buffer
(ediff-merge-metajob)))
;; This case shouldn't occur, as the parent metajob must pass on
;; a file name, ediff-merge-store-file, where to save the result
(defun ediff-write-merge-buffer-and-maybe-kill (buf file
&optional
show-file save-and-continue)
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(if (or (not (file-exists-p file))
(y-or-n-p (format "File %s exists, overwrite? " file)))
(progn
(raise-frame (selected-frame))
(princ (ediff-version))
(princ "\n\n")
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(if buffer-file-name
(princ
(format "File A = %S\n" buffer-file-name))
(princ
(format "Buffer A = %S\n" (buffer-name)))))
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(if buffer-file-name
(princ
(format "File B = %S\n" buffer-file-name))
(princ
(format "Buffer B = %S\n" (buffer-name)))))
(if ediff-3way-job
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(if buffer-file-name
(princ
(format "File C = %S\n" buffer-file-name))
(buffer-name ediff-diff-buffer))
" is not available")))
- (let* ((A-line (ediff-eval-in-buffer ediff-buffer-A
+ (let* ((A-line (ediff-with-current-buffer ediff-buffer-A
(1+ (count-lines (point-min) (point)))))
- (B-line (ediff-eval-in-buffer ediff-buffer-B
+ (B-line (ediff-with-current-buffer ediff-buffer-B
(1+ (count-lines (point-min) (point)))))
C-line)
(princ (format "\Buffer A's point is on line %d\n" A-line))
(princ (format "Buffer B's point is on line %d\n" B-line))
(if ediff-3way-job
(progn
- (setq C-line (ediff-eval-in-buffer ediff-buffer-C
+ (setq C-line (ediff-with-current-buffer ediff-buffer-C
(1+ (count-lines (point-min) (point)))))
(princ (format "Buffer C's point is on line %d\n" C-line)))))
(setq ediff-current-difference n)
) ; end protected section
- (ediff-eval-in-buffer control-buf (ediff-refresh-mode-lines))
+ (ediff-with-current-buffer control-buf (ediff-refresh-mode-lines))
)))
(t (make-temp-name f))))
;; create the file
- (ediff-eval-in-buffer buff
+ (ediff-with-current-buffer buff
(write-region (if start start (point-min))
(if end end (point-max))
f
(interactive "P")
(ediff-barf-if-not-control-buffer)
(ediff-compute-custom-diffs-maybe)
- (ediff-eval-in-buffer
+ (ediff-with-current-buffer
(cond ((memq last-command-char '(?a ?b ?c))
(ediff-get-buffer
(ediff-char-to-buftype last-command-char)))
nil))))
(if buf
(progn
- (ediff-eval-in-buffer buf
+ (ediff-with-current-buffer buf
(goto-char (point-min)))
(switch-to-buffer buf)
(raise-frame (selected-frame)))))
(setq possibilities (delq answer possibilities))
(setq bufA
(eval
- (intern (format "ediff-buffer-%c" answer))))
+ (ediff-get-symbol-from-alist
+ answer ediff-buffer-alist)))
nil)
((equal answer ""))
(t (beep 1)
(setq possibilities (delq answer possibilities))
(setq bufB
(eval
- (intern (format "ediff-buffer-%c" answer))))
+ (ediff-get-symbol-from-alist
+ answer ediff-buffer-alist)))
nil)
((equal answer ""))
(t (beep 1)
bufB ediff-buffer-B
possibilities nil)))
- (ediff-eval-in-buffer bufA
+ (ediff-with-current-buffer bufA
(or (mark t)
(error "You forgot to specify a region in buffer %s" (buffer-name)))
(setq begA (region-beginning)
(end-of-line)
(or (eobp) (forward-char)) ; include the newline char
(setq endA (point)))
- (ediff-eval-in-buffer bufB
+ (ediff-with-current-buffer bufB
(or (mark t)
(error "You forgot to specify a region in buffer %s" (buffer-name)))
(setq begB (region-beginning)
ediff-current-difference 'unselect-only)
(ediff-paint-background-regions 'unhighlight)
- (ediff-eval-in-buffer bufA
+ (ediff-with-current-buffer bufA
(goto-char begA)
(set-mark endA)
(narrow-to-region begA endA)
;; (ediff-activate-mark)
)
;; (sit-for 0)
- (ediff-eval-in-buffer bufB
+ (ediff-with-current-buffer bufB
(goto-char begB)
(set-mark endB)
(narrow-to-region begB endB)
;; that was not selected, or it is nil. We delete the window that is not
;; selected.
(if possibilities
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(let* ((wind-to-delete (eval
- (intern
- (format
- "ediff-window-%c" (car possibilities)))))
+ (ediff-get-symbol-from-alist
+ (car possibilities)
+ ediff-window-alist)))
(frame (window-frame wind-to-delete)))
(delete-window wind-to-delete)
(select-frame frame)
"Please check regions selected for comparison. Continue? ")
(setq quit-now t))
- (ediff-eval-in-buffer bufA
+ (ediff-with-current-buffer bufA
(widen))
- (ediff-eval-in-buffer bufB
+ (ediff-with-current-buffer bufB
(widen))
(if quit-now
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(ediff-recenter)
(sit-for 0)
(error "All right. Make up your mind and come back...")))
(defun ediff-remove-flags-from-buffer (buffer overlay)
- (ediff-eval-in-buffer buffer
+ (ediff-with-current-buffer buffer
(let ((inhibit-read-only t))
(if ediff-xemacs-p
(ediff-overlay-put overlay 'begin-glyph nil)
(defun ediff-place-flags-in-buffer (buf-type buffer ctl-buffer diff)
- (ediff-eval-in-buffer buffer
+ (ediff-with-current-buffer buffer
(ediff-place-flags-in-buffer1 buf-type ctl-buffer diff)))
(defun ediff-place-flags-in-buffer1 (buf-type ctl-buffer diff-no)
- (let* ((curr-overl (ediff-eval-in-buffer ctl-buffer
+ (let* ((curr-overl (ediff-with-current-buffer ctl-buffer
(ediff-get-diff-overlay diff-no buf-type)))
(before (ediff-get-diff-posn buf-type 'beg diff-no ctl-buffer))
after beg-of-line flag)
(goto-char before)
(setq beg-of-line (bolp))
- (setq flag (ediff-eval-in-buffer ctl-buffer
+ (setq flag (ediff-with-current-buffer ctl-buffer
(if (eq ediff-highlighting-style 'ascii)
(if beg-of-line
ediff-before-flag-bol ediff-before-flag-mol))))
(goto-char after)
(setq beg-of-line (bolp))
- (setq flag (ediff-eval-in-buffer ctl-buffer
+ (setq flag (ediff-with-current-buffer ctl-buffer
(if (eq ediff-highlighting-style 'ascii)
(if beg-of-line
ediff-after-flag-eol ediff-after-flag-mol))))
(or control-buf
(setq control-buf (current-buffer)))
- (ediff-eval-in-buffer control-buf
+ (ediff-with-current-buffer control-buf
(or n (setq n ediff-current-difference))
(if (or (< n 0) (>= n ediff-number-of-differences))
(if (> ediff-number-of-differences 0)
;; Restore highlighting to what it should be according to ediff-use-faces,
;; ediff-highlighting-style, and ediff-highlight-all-diffs variables.
(defun ediff-restore-highlighting (&optional ctl-buf)
- (ediff-eval-in-buffer (or ctl-buf (current-buffer))
+ (ediff-with-current-buffer (or ctl-buf (current-buffer))
(if (and (ediff-has-face-support-p)
ediff-use-faces
ediff-highlight-all-diffs)
(defun ediff-make-bullet-proof-overlay (beg end buff)
(if (ediff-buffer-live-p buff)
(let (overl)
- (ediff-eval-in-buffer buff
+ (ediff-with-current-buffer buff
(or (number-or-marker-p beg)
(setq beg (eval beg)))
(or (number-or-marker-p end)
(format "%s<%d>%s" prefix n suffix))))
-;; splits at a white space, returns a list
-(defun ediff-split-string (string)
- (let ((start 0)
- (result '())
- substr)
- (while (string-match "[ \t]+" string start)
- (let ((match (string-match "[ \t]+" string start)))
- (setq substr (substring string start match))
- (if (> (length substr) 0)
- (setq result (cons substr result)))
- (setq start (match-end 0))))
- (setq substr (substring string start nil))
- (if (> (length substr) 0)
- (setq result (cons substr result)))
- (nreverse result)))
-
(defun ediff-submit-report ()
"Submit bug report on Ediff."
(interactive)
(bury-buffer)
(beep 1)(message "Bug report aborted")
(if (ediff-buffer-live-p ctl-buf)
- (ediff-eval-in-buffer ctl-buf
+ (ediff-with-current-buffer ctl-buf
(ediff-recenter 'no-rehighlight))))
))
(defun ediff-change-saved-variable (var value buf-type)
(let* ((assoc-list
- (symbol-value (intern
- (concat "ediff-buffer-values-orig-"
- (symbol-name buf-type)))))
+ (symbol-value (ediff-get-symbol-from-alist
+ buf-type
+ ediff-buffer-values-orig-alist)))
(assoc-elt (assoc var assoc-list)))
(if assoc-elt
(setcdr assoc-elt value))))
;; must execute in control buf
(defun ediff-save-protected-variables ()
(setq ediff-buffer-values-orig-A
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(ediff-save-variables ediff-protected-variables)))
(setq ediff-buffer-values-orig-B
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(ediff-save-variables ediff-protected-variables)))
(if ediff-3way-comparison-job
(setq ediff-buffer-values-orig-C
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(ediff-save-variables ediff-protected-variables))))
(if (ediff-buffer-live-p ediff-ancestor-buffer)
(setq ediff-buffer-values-orig-Ancestor
- (ediff-eval-in-buffer ediff-ancestor-buffer
+ (ediff-with-current-buffer ediff-ancestor-buffer
(ediff-save-variables ediff-protected-variables)))))
;; must execute in control buf
(values-B ediff-buffer-values-orig-B)
(values-C ediff-buffer-values-orig-C)
(values-Ancestor ediff-buffer-values-orig-Ancestor))
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(ediff-restore-variables ediff-protected-variables values-A))
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(ediff-restore-variables ediff-protected-variables values-B))
(if ediff-3way-comparison-job
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(ediff-restore-variables ediff-protected-variables values-C)))
(if (ediff-buffer-live-p ediff-ancestor-buffer)
- (ediff-eval-in-buffer ediff-ancestor-buffer
+ (ediff-with-current-buffer ediff-ancestor-buffer
(ediff-restore-variables ediff-protected-variables values-Ancestor)))
))
;; save BUFFER in FILE. used in hooks.
(defun ediff-save-buffer-in-file (buffer file)
- (ediff-eval-in-buffer buffer
+ (ediff-with-current-buffer buffer
(write-file file)))
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
;;; ediff-util.el ends here
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
(provide 'ediff-vers)
;; Used to minimize the need to rearrange windows.
(ediff-defvar-local ediff-window-config-saved "" "")
+;; Association between buff-type and ediff-window-*
+(defconst ediff-window-alist
+ '((A . ediff-window-A)
+ (?A . ediff-window-A)
+ (B . ediff-window-B)
+ (?B . ediff-window-B)
+ (C . ediff-window-C)
+ (?C . ediff-window-C)))
+
(defcustom ediff-split-window-function 'split-window-vertically
"*The function used to split the main window between buffer-A and buffer-B.
(or (ediff-keep-window-config control-buffer)
(funcall
- (ediff-eval-in-buffer control-buffer ediff-window-setup-function)
+ (ediff-with-current-buffer control-buffer ediff-window-setup-function)
buffer-A buffer-B buffer-C control-buffer))
(run-hooks 'ediff-after-setup-windows-hook))
;; Usually used without windowing systems
;; With windowing, we want to use dedicated frames.
(defun ediff-setup-windows-plain (buffer-A buffer-B buffer-C control-buffer)
- (ediff-eval-in-buffer control-buffer
+ (ediff-with-current-buffer control-buffer
(setq ediff-multiframe nil))
(if ediff-merge-job
(ediff-setup-windows-plain-merge
split-window-function
merge-window-share merge-window-lines
wind-A wind-B wind-C)
- (ediff-eval-in-buffer control-buffer
+ (ediff-with-current-buffer control-buffer
(setq merge-window-share ediff-merge-window-share
;; this lets us have local versions of ediff-split-window-function
split-window-function ediff-split-window-function))
(switch-to-buffer buf-B)
(setq wind-B (selected-window))
- (ediff-eval-in-buffer control-buffer
+ (ediff-with-current-buffer control-buffer
(setq ediff-window-A wind-A
ediff-window-B wind-B
ediff-window-C wind-C))
split-window-function wind-width-or-height
three-way-comparison
wind-A-start wind-B-start wind-A wind-B wind-C)
- (ediff-eval-in-buffer control-buffer
+ (ediff-with-current-buffer control-buffer
(setq wind-A-start (ediff-overlay-start
(ediff-get-value-according-to-buffer-type
'A ediff-narrow-bounds))
(switch-to-buffer buf-C)
(setq wind-C (selected-window))))
- (ediff-eval-in-buffer control-buffer
+ (ediff-with-current-buffer control-buffer
(setq ediff-window-A wind-A
ediff-window-B wind-B
ediff-window-C wind-C))
;; dispatch an appropriate window setup function
(defun ediff-setup-windows-multiframe (buf-A buf-B buf-C control-buf)
- (ediff-eval-in-buffer control-buf
+ (ediff-with-current-buffer control-buf
(setq ediff-multiframe t))
(if ediff-merge-job
(ediff-setup-windows-multiframe-merge buf-A buf-B buf-C control-buf)
(frame-C (if wind-C (window-frame wind-C)))
;; on wide display, do things in one frame
(force-one-frame
- (ediff-eval-in-buffer control-buf ediff-wide-display-p))
+ (ediff-with-current-buffer control-buf ediff-wide-display-p))
;; this lets us have local versions of ediff-split-window-function
(split-window-function
- (ediff-eval-in-buffer control-buf ediff-split-window-function))
+ (ediff-with-current-buffer control-buf ediff-split-window-function))
(orig-wind (selected-window))
(orig-frame (selected-frame))
(use-same-frame (or force-one-frame
;; use-same-frame-for-AB implies wind A and B are ok for display
(use-same-frame-for-AB (and (not use-same-frame)
(eq frame-A frame-B)))
- (merge-window-share (ediff-eval-in-buffer control-buf
+ (merge-window-share (ediff-with-current-buffer control-buf
ediff-merge-window-share))
merge-window-lines
designated-minibuffer-frame
(setq wind-C (selected-window))
))
- (ediff-eval-in-buffer control-buf
+ (ediff-with-current-buffer control-buf
(setq ediff-window-A wind-A
ediff-window-B wind-B
ediff-window-C wind-C)
(frame-A (if wind-A (window-frame wind-A)))
(frame-B (if wind-B (window-frame wind-B)))
(frame-C (if wind-C (window-frame wind-C)))
- (ctl-frame-exists-p (ediff-eval-in-buffer control-buf
+ (ctl-frame-exists-p (ediff-with-current-buffer control-buf
(frame-live-p ediff-control-frame)))
;; on wide display, do things in one frame
(force-one-frame
- (ediff-eval-in-buffer control-buf ediff-wide-display-p))
+ (ediff-with-current-buffer control-buf ediff-wide-display-p))
;; this lets us have local versions of ediff-split-window-function
(split-window-function
- (ediff-eval-in-buffer control-buf ediff-split-window-function))
+ (ediff-with-current-buffer control-buf ediff-split-window-function))
(three-way-comparison
- (ediff-eval-in-buffer control-buf ediff-3way-comparison-job))
+ (ediff-with-current-buffer control-buf ediff-3way-comparison-job))
(orig-wind (selected-window))
(use-same-frame (or force-one-frame
(eq frame-A frame-B)
designated-minibuffer-frame
done-A done-B done-C)
- (ediff-eval-in-buffer control-buf
+ (ediff-with-current-buffer control-buf
(setq wind-A-start (ediff-overlay-start
(ediff-get-value-according-to-buffer-type
'A ediff-narrow-bounds))
(setq wind-C (selected-window))
)))
- (ediff-eval-in-buffer control-buf
+ (ediff-with-current-buffer control-buf
(setq ediff-window-A wind-A
ediff-window-B wind-B
ediff-window-C wind-C)
;; user-grabbed-mouse
fheight fwidth adjusted-parameters)
- (ediff-eval-in-buffer ctl-buffer
+ (ediff-with-current-buffer ctl-buffer
(if ediff-xemacs-p (set-buffer-menubar nil))
;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse))
(run-hooks 'ediff-before-setup-control-frame-hook))
- (setq old-ctl-frame (ediff-eval-in-buffer ctl-buffer ediff-control-frame))
- (ediff-eval-in-buffer ctl-buffer
+ (setq old-ctl-frame (ediff-with-current-buffer ctl-buffer ediff-control-frame))
+ (ediff-with-current-buffer ctl-buffer
(setq ctl-frame (if (frame-live-p old-ctl-frame)
old-ctl-frame
(make-frame ediff-control-frame-parameters))
;; must be before ediff-setup-control-buffer
;; just a precaution--we should be in ctl-buffer already
- (ediff-eval-in-buffer ctl-buffer
+ (ediff-with-current-buffer ctl-buffer
(make-local-variable 'frame-title-format)
(make-local-variable 'frame-icon-title-format) ; XEmacs
(make-local-variable 'icon-title-format)) ; Emacs
(not (eq ediff-grab-mouse t)))))
(if ediff-xemacs-p
- (ediff-eval-in-buffer ctl-buffer
+ (ediff-with-current-buffer ctl-buffer
(make-local-hook 'select-frame-hook)
(add-hook 'select-frame-hook 'ediff-xemacs-select-frame-hook nil t)
))
- (ediff-eval-in-buffer ctl-buffer
+ (ediff-with-current-buffer ctl-buffer
(run-hooks 'ediff-after-setup-control-frame-hook))
))
(defun ediff-destroy-control-frame (ctl-buffer)
- (ediff-eval-in-buffer ctl-buffer
+ (ediff-with-current-buffer ctl-buffer
(if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
(let ((ctl-frame ediff-control-frame))
(if ediff-xemacs-p
;; finds a good place to clip control frame
(defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height)
- (ediff-eval-in-buffer ctl-buffer
+ (ediff-with-current-buffer ctl-buffer
(let* ((frame-A (window-frame ediff-window-A))
(frame-A-parameters (frame-parameters frame-A))
(frame-A-top (eval (cdr (assoc 'top frame-A-parameters))))
(if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
(ediff-refresh-control-frame))
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(setq ediff-diff-status buf-A-state-diff)
(ediff-strip-mode-line-format)
(setq mode-line-format
(list " A: " 'ediff-diff-status mode-line-format))
(force-mode-line-update))
- (ediff-eval-in-buffer ediff-buffer-B
+ (ediff-with-current-buffer ediff-buffer-B
(setq ediff-diff-status buf-B-state-diff)
(ediff-strip-mode-line-format)
(setq mode-line-format
(list " B: " 'ediff-diff-status mode-line-format))
(force-mode-line-update))
(if ediff-3way-job
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(setq ediff-diff-status buf-C-state-diff)
(ediff-strip-mode-line-format)
(setq mode-line-format
(list " C: " 'ediff-diff-status mode-line-format))
(force-mode-line-update)))
(if (ediff-buffer-live-p ediff-ancestor-buffer)
- (ediff-eval-in-buffer ediff-ancestor-buffer
+ (ediff-with-current-buffer ediff-ancestor-buffer
(ediff-strip-mode-line-format)
;; we keep the second dummy string in the mode line format of the
;; ancestor, since for other buffers Ediff prepends 2 strings and
(defun ediff-keep-window-config (control-buf)
(and (eq control-buf (current-buffer))
(/= (buffer-size) 0)
- (ediff-eval-in-buffer control-buf
+ (ediff-with-current-buffer control-buf
(let ((ctl-wind ediff-control-window)
(A-wind ediff-window-A)
(B-wind ediff-window-B)
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
;;; ediff-wind.el ends here
;; Created: February 2, 1994
;; Keywords: comparing, merging, patching, version control.
-(defconst ediff-version "2.66" "The current version of Ediff")
-(defconst ediff-date "July 9, 1997" "Date of last update")
+(defconst ediff-version "2.67" "The current version of Ediff")
+(defconst ediff-date "July 31, 1997" "Date of last update")
;; This file is part of GNU Emacs.
;; Used as a startup hook to set `_orig' patch file read-only.
(defun ediff-set-read-only-in-buf-A ()
- (ediff-eval-in-buffer ediff-buffer-A
+ (ediff-with-current-buffer ediff-buffer-A
(toggle-read-only 1)))
;; Return a plausible default for ediff's first file:
;; Setup the buffer
(set buffer-name (find-file-noselect file))
- (ediff-eval-in-buffer (symbol-value buffer-name)
+ (ediff-with-current-buffer (symbol-value buffer-name)
(widen) ; Make sure the entire file is seen
(cond (file-magic ; file has a handler, such as jka-compr-handler or
;;; ange-ftp-hook-function--arrange for temp file
file-A file-B)
;; in case beg/end-A/B aren't markers--make them into markers
- (ediff-eval-in-buffer buffer-A
+ (ediff-with-current-buffer buffer-A
(setq beg-A (move-marker (make-marker) beg-A)
end-A (move-marker (make-marker) end-A)))
- (ediff-eval-in-buffer buffer-B
+ (ediff-with-current-buffer buffer-B
(setq beg-B (move-marker (make-marker) beg-B)
end-B (move-marker (make-marker) end-B)))
(defsubst ediff-merge-on-startup ()
(ediff-do-merge 0)
- (ediff-eval-in-buffer ediff-buffer-C
+ (ediff-with-current-buffer ediff-buffer-C
(set-buffer-modified-p nil)))
;;;###autoload
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
+;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;;; End:
(require 'ediff-util)