changeset 104277:affb617d6101

2009-08-15 Michael Kifer <kifer@cs.stonybrook.edu> * viper-cmd.el (viper-insert-isearch-string): new function. (viper-if-string): redefine C-s in the minibuffer to insert the last incremental search string. * ediff-init.el (ediff-coding-system): use escape-quoted in case of XEmacs. * ediff-merg.el (ediff-merge-region-is-non-clash-to-skip, ediff-merge-region-is-non-clash, ediff-skip-merge-region-if-changed-from-default-p): use defun. Also check if the job is really a merge job. * ediff.el (ediff-current-file): new function.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 15 Aug 2009 05:57:08 +0000
parents 2c69ae7c48d0
children 25648648783d
files lisp/ChangeLog lisp/ediff-init.el lisp/ediff-merg.el lisp/ediff.el lisp/emulation/viper-cmd.el lisp/emulation/viper.el
diffstat 6 files changed, 77 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Aug 15 01:13:18 2009 +0000
+++ b/lisp/ChangeLog	Sat Aug 15 05:57:08 2009 +0000
@@ -1,3 +1,19 @@
+2009-08-15  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* viper-cmd.el (viper-insert-isearch-string): new function.
+	(viper-if-string): redefine C-s in the minibuffer to insert the last
+	incremental search string.
+	
+	* ediff-init.el (ediff-coding-system): use escape-quoted in case of
+	XEmacs.
+	
+	* ediff-merg.el (ediff-merge-region-is-non-clash-to-skip,
+	ediff-merge-region-is-non-clash,
+	ediff-skip-merge-region-if-changed-from-default-p): use defun.
+	Also check if the job is really a merge job.
+	
+	* ediff.el (ediff-current-file): new function.
+	
 2009-08-15  Chong Yidong  <cyd@stupidchicken.com>
 
 	* progmodes/js.el: Edit docstrings throughout to follow Emacs
--- a/lisp/ediff-init.el	Sat Aug 15 01:13:18 2009 +0000
+++ b/lisp/ediff-init.el	Sat Aug 15 05:57:08 2009 +0000
@@ -727,7 +727,9 @@
   :type 'symbol
   :group 'ediff)
 
-(defcustom ediff-coding-system-for-write 'emacs-internal
+(defcustom ediff-coding-system-for-write (if (featurep 'xemacs)
+					     'escape-quoted
+					   'emacs-internal)
   "The coding system for write to use when writing out difference regions
 to temp files in buffer jobs and when Ediff needs to find fine differences."
   :type 'symbol
--- a/lisp/ediff-merg.el	Sat Aug 15 01:13:18 2009 +0000
+++ b/lisp/ediff-merg.el	Sat Aug 15 05:57:08 2009 +0000
@@ -97,23 +97,25 @@
 
 ;; check if there is no clash between the ancestor and one of the variants.
 ;; if it is not a merge job then return true
-(defsubst ediff-merge-region-is-non-clash (n)
+(defun ediff-merge-region-is-non-clash (n)
   (if (ediff-merge-job)
       (string-match "prefer" (or (ediff-get-state-of-merge n) ""))
     t))
 
 ;; 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-to-skip (n)
-  (and ediff-show-clashes-only
+(defun ediff-merge-region-is-non-clash-to-skip (n)
+  (and (ediff-merge-job)
+       ediff-show-clashes-only
        (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
 ;; that the user has made determination as to how to merge for this particular
 ;; region.
-(defsubst ediff-skip-merge-region-if-changed-from-default-p (n)
-  (and ediff-skip-merge-regions-that-differ-from-default
+(defun ediff-skip-merge-region-if-changed-from-default-p (n)
+  (and (ediff-merge-job)
+       ediff-skip-merge-regions-that-differ-from-default
        (ediff-merge-changed-from-default-p n 'prefers-too)))
 
 
--- a/lisp/ediff.el	Sat Aug 15 01:13:18 2009 +0000
+++ b/lisp/ediff.el	Sat Aug 15 05:57:08 2009 +0000
@@ -12,8 +12,8 @@
 ;; filed in the Emacs bug reporting system against this file, a copy
 ;; of the bug report be sent to the maintainer's email address.
 
-(defconst ediff-version "2.81.2" "The current version of Ediff")
-(defconst ediff-date "November 22, 2008" "Date of last update")
+(defconst ediff-version "2.81.3" "The current version of Ediff")
+(defconst ediff-date "August 15, 2009" "Date of last update")
 
 
 ;; This file is part of GNU Emacs.
@@ -361,6 +361,43 @@
 (defalias 'ediff 'ediff-files)
 
 ;;;###autoload
+(defun ediff-current-file ()
+  "Start ediff between current buffer and its file on disk.
+This command can be used instead of `revert-buffer'.  If there is
+nothing to revert then this command fails."
+  (interactive)
+  (unless (or revert-buffer-function
+              revert-buffer-insert-file-contents-function
+              (and buffer-file-number
+                   (or (buffer-modified-p)
+                       (not (verify-visited-file-modtime
+                             (current-buffer))))))
+    (error "Nothing to revert"))
+  (let* ((auto-save-p (and (recent-auto-save-p)
+                           buffer-auto-save-file-name
+                           (file-readable-p buffer-auto-save-file-name)
+                           (y-or-n-p
+                            "Buffer has been auto-saved recently.  Compare with auto-save file? ")))
+         (file-name (if auto-save-p
+                        buffer-auto-save-file-name
+                      buffer-file-name))
+         (revert-buf-name (concat "FILE=" file-name))
+         (revert-buf (get-buffer revert-buf-name))
+         (current-major major-mode))
+    (unless file-name
+      (error "Buffer does not seem to be associated with any file"))
+    (when revert-buf
+      (kill-buffer revert-buf)
+      (setq revert-buf nil))
+    (setq revert-buf (get-buffer-create revert-buf-name))
+    (with-current-buffer revert-buf
+      (insert-file-contents file-name)
+      ;; Assume same modes:
+      (funcall current-major))
+    (ediff-buffers revert-buf (current-buffer))))
+
+
+;;;###autoload
 (defun ediff-backup (file)
   "Run Ediff on FILE and its backup file.
 Uses the latest backup, if there are several numerical backups.
--- a/lisp/emulation/viper-cmd.el	Sat Aug 15 01:13:18 2009 +0000
+++ b/lisp/emulation/viper-cmd.el	Sat Aug 15 05:57:08 2009 +0000
@@ -3685,15 +3685,24 @@
 
 ;; searching
 
+(defun viper-insert-isearch-string ()
+  "Insert `isearch' last search string."
+  (interactive)
+  (when isearch-string (insert isearch-string)))
+
 (defun viper-if-string (prompt)
   (if (memq viper-intermediate-command
 	    '(viper-command-argument viper-digit-argument viper-repeat))
       (setq viper-this-command-keys (this-command-keys)))
-  (let ((s (viper-read-string-with-history
+  (let* ((keymap (let ((keymap (copy-keymap minibuffer-local-map)))
+                   (define-key keymap [(control ?s)] 'viper-insert-isearch-string)
+                   keymap))
+         (s (viper-read-string-with-history
 	    prompt
 	    nil ; no initial
 	    'viper-search-history
-	    (car viper-search-history))))
+             (car viper-search-history)
+             keymap)))
     (if (not (string= s ""))
 	(setq viper-s-string s))))
 
--- a/lisp/emulation/viper.el	Sat Aug 15 01:13:18 2009 +0000
+++ b/lisp/emulation/viper.el	Sat Aug 15 05:57:08 2009 +0000
@@ -14,7 +14,7 @@
 ;; filed in the Emacs bug reporting system against this file, a copy
 ;; of the bug report be sent to the maintainer's email address.
 
-(defconst viper-version "3.14 of November 22, 2008"
+(defconst viper-version "3.14.1 of August 15, 2009"
   "The current version of Viper")
 
 ;; This file is part of GNU Emacs.