From: Michael Kifer Date: Mon, 25 Dec 2000 07:57:37 +0000 (+0000) Subject: 2000-12-25 Michael Kifer X-Git-Tag: emacs-pretest-21.0.95~287 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7261ece3c08f89db35cd3f486b02fb71249df240;p=emacs.git 2000-12-25 Michael Kifer * ediff-init.el (ediff-quit-hook,ediff-suspend-hook): changed initialization; use add-hook. (ediff-file-remote-p): use file-local-copy. * ediff-ptch.el (ediff-prompt-for-patch-buffer): improved defaults. * ediff.el (ediff-patch-buffer): bug fix. (ediff-revision): allow selection of the file at the prompt. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d09a5f17e1..06ff37f90ff 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2000-12-25 Michael Kifer + * viper-init (viper-restore-cursor-type): added condition-case + guard. + + * ediff-init.el (ediff-quit-hook,ediff-suspend-hook): changed + initialization; use add-hook. + (ediff-file-remote-p): use file-local-copy. + + * ediff-ptch.el (ediff-prompt-for-patch-buffer): improved defaults. + + * ediff.el (ediff-patch-buffer): bug fix. + (ediff-revision): allow selection of the file at the prompt. + 2000-12-23 Stefan Monnier * subr.el (combine-run-hooks): Remove. diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el index 4c1fc9b48a3..8f3d472bd5d 100644 --- a/lisp/ediff-init.el +++ b/lisp/ediff-init.el @@ -443,11 +443,11 @@ set local variables that determine how the display looks like." :type 'hook :group 'ediff-hook) -(defcustom ediff-suspend-hook (list 'ediff-default-suspend-function) +(defcustom ediff-suspend-hook nil "*Hooks to run in the Ediff control buffer when Ediff is suspended." :type 'hook :group 'ediff-hook) -(defcustom ediff-quit-hook (list 'ediff-cleanup-mess) +(defcustom ediff-quit-hook nil "*Hooks to run in the Ediff control buffer after finishing Ediff." :type 'hook :group 'ediff-hook) @@ -1152,6 +1152,9 @@ this variable represents.") (put 'ediff-fine-diff-face-Ancestor 'ediff-help-echo "A `refinement' of the current difference region") +(add-hook 'ediff-quit-hook 'ediff-cleanup-mess) +(add-hook 'ediff-suspend-hook 'ediff-default-suspend-function) + ;;; Overlays @@ -1273,11 +1276,12 @@ This default should work without changes." (or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it (defun ediff-file-remote-p (file-name) - (car (cond ((featurep 'efs-auto) (efs-ftp-path file-name)) - ((fboundp 'file-remote-p) (file-remote-p file-name)) - (t (require 'ange-ftp) - ;; Can happen only in Emacs, since XEmacs has file-remote-p - (ange-ftp-ftp-name file-name)))))) + (find-file-name-handler file-name 'file-local-copy))) +;;; (or (and (featurep 'efs-auto) (efs-ftp-path file-name)) +;;; (and (featurep 'tramp) (tramp-tramp-file-p file-name)) +;;; (and (fboundp 'file-remote-p) (file-remote-p file-name)) +;;; ;; Can happen only in Emacs, since XEmacs has file-remote-p +;;; (and (require 'ange-ftp) (ange-ftp-ftp-name file-name))))) (defsubst ediff-frame-unsplittable-p (frame) diff --git a/lisp/ediff-ptch.el b/lisp/ediff-ptch.el index 873e45060e0..18b2f75b4df 100644 --- a/lisp/ediff-ptch.el +++ b/lisp/ediff-ptch.el @@ -427,7 +427,7 @@ are two possible targets for this patch. However, these files do not exist." (defun ediff-prompt-for-patch-buffer () (get-buffer (read-buffer - "Patch is in buffer: " + "Buffer that holds the patch: " (cond ((save-excursion (goto-char (point-min)) (re-search-forward ediff-context-diff-label-regexp nil t)) @@ -444,7 +444,7 @@ are two possible targets for this patch. However, these files do not exist." (goto-char (point-min)) (and (re-search-forward ediff-context-diff-label-regexp nil t) (current-buffer))))) - (t nil)) + (t (other-buffer (current-buffer) 'visible-ok))) 'must-match))) diff --git a/lisp/ediff.el b/lisp/ediff.el index 7146f564dad..7e68f26708a 100644 --- a/lisp/ediff.el +++ b/lisp/ediff.el @@ -1265,7 +1265,11 @@ buffer. If odd -- assume it is in a file." ;;;###autoload (defun ediff-patch-buffer (&optional arg patch-buf) - "Run Ediff by patching BUFFER-NAME." + "Run Ediff by patching BUFFER-NAME. +Without prefix argument: asks if the patch is in some buffer and prompts for +the buffer or a file, depending on the answer. +With prefix arg=1: assumes the patch is in a file and prompts for the file. +With prefix arg=2: assumes the patch is in a buffer and prompts for the buffer." (interactive "P") (require 'ediff-ptch) (setq patch-buf @@ -1275,7 +1279,7 @@ buffer. If odd -- assume it is in a file." patch-buf (read-buffer "Which buffer to patch? " - (ediff-prompt-for-patch-buffer)))) + (current-buffer)))) ;;;###autoload @@ -1291,22 +1295,32 @@ buffer. If odd -- assume it is in a file." ;;;###autoload (defun ediff-revision (&optional file startup-hooks) "Run Ediff by comparing versions of a file. -The file is an optional FILE argument or the file visited by the current -buffer. Use `vc.el' or `rcs.el' depending on `ediff-version-control-package'." +The file is an optional FILE argument or the file entered at the prompt. +Default: the file visited by the current buffer. +Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'." ;; if buffer is non-nil, use that buffer instead of the current buffer (interactive "P") - (if (stringp file) (find-file file)) + (if (not (stringp file)) + (setq file + (ediff-read-file-name "Compare revisions for file" + (if ediff-use-last-dir + ediff-last-dir-A + default-directory) + (ediff-get-default-file-name)))) + (find-file file) + (if (and (buffer-modified-p) + (y-or-n-p (message "Buffer %s is modified. Save buffer? " + (buffer-name)))) + (save-buffer (current-buffer))) (let (rev1 rev2) (setq rev1 (read-string (format "Version 1 to compare (default: %s's latest version): " - (if (stringp file) - (file-name-nondirectory file) "current buffer"))) + (file-name-nondirectory file))) rev2 (read-string (format "Version 2 to compare (default: %s): " - (if (stringp file) - (file-name-nondirectory file) "current buffer")))) + (file-name-nondirectory file)))) (ediff-load-version-control) (funcall (intern (format "ediff-%S-internal" ediff-version-control-package))