changeset 81331:c3779fe5830e

2007-06-12 Michael Kifer <kifer@cs.stonybrook.edu> * viper-cmd.el (viper-prefix-arg-com,viper-prefix-arg-value): display error messages (viper-prev-destructive-command,viper-insert-prev-from-insertion-ring): get rid of cl.el dependencies. * viper-init.el (viper-suppress-input-method-change-message): new variable. (viper-activate-input-method-action,viper-inactivate-input-method-action): use viper-suppress-input-method-change-message. * viper-kem.el (viper-vi-basic-map): disable the bindings for C-s, C-r. * viper-util.el (viper-set-cursor-color-according-to-state): use viper-replace-overlay-cursor-color instead of viper-replace-overlay-cursor-color. (viper-sit-for-short): use sit-for with 3 arguments. * viper.el (viper-insert-state-mode-list): add gud-mode. (viper-major-mode-modifier-list): add viper-comint-mode-modifier-map to gud-mode. * ediff-mult.el (ediff-meta-buffer-brief-message,ediff-meta-buffer-verbose-message): new variables. (ediff-meta-buffer-message): variable deleted. (ediff-verbose-help-enabled): new variable. (ediff-toggle-verbose-help-meta-buffer): new function. (ediff-redraw-directory-group-buffer): made aware of short/verbose message options * ediff-ptch.el (ediff-context-diff-label-regexp): better regexp. (ediff-fixup-patch-map): improved heuristic.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Tue, 12 Jun 2007 19:20:25 +0000
parents f7754bd2e73f
children 712d2e76f444
files lisp/ChangeLog lisp/diff-mode.el lisp/ediff-mult.el lisp/ediff-ptch.el lisp/emulation/viper-cmd.el lisp/emulation/viper-init.el lisp/emulation/viper-keym.el lisp/emulation/viper-util.el lisp/emulation/viper.el
diffstat 9 files changed, 113 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/ChangeLog	Tue Jun 12 19:20:25 2007 +0000
@@ -1,3 +1,38 @@
+2007-06-12  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* emulation/viper-cmd.el (viper-prefix-arg-com,viper-prefix-arg-value): display
+	error messages
+	(viper-prev-destructive-command,viper-insert-prev-from-insertion-ring):
+	get rid of cl.el dependencies.
+	
+	* emulation/viper-init.el (viper-suppress-input-method-change-message): new
+	variable.
+	(viper-activate-input-method-action,viper-inactivate-input-method-action):
+	use viper-suppress-input-method-change-message.
+	
+	* emulation/viper-kem.el (viper-vi-basic-map): disable the bindings for C-s, C-r.
+	
+	* emulation/viper-util.el (viper-set-cursor-color-according-to-state): use
+	viper-replace-overlay-cursor-color instead of
+	viper-replace-overlay-cursor-color.
+	(viper-sit-for-short): use sit-for with 3 arguments.
+	
+	* emulation/viper.el (viper-insert-state-mode-list): add gud-mode.
+	(viper-major-mode-modifier-list): add viper-comint-mode-modifier-map to
+	gud-mode.
+	
+	* ediff-mult.el
+	(ediff-meta-buffer-brief-message,ediff-meta-buffer-verbose-message):
+	new variables.
+	(ediff-meta-buffer-message): variable deleted.
+	(ediff-verbose-help-enabled): new variable.
+	(ediff-toggle-verbose-help-meta-buffer): new function.
+	(ediff-redraw-directory-group-buffer): made aware of short/verbose
+	message options
+	
+	* ediff-ptch.el (ediff-context-diff-label-regexp): better regexp.
+	(ediff-fixup-patch-map): improved heuristic.
+	
 2007-06-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* log-view.el (log-view-file-re, log-view-message-re): Use \(?1:...\).
--- a/lisp/diff-mode.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/diff-mode.el	Tue Jun 12 19:20:25 2007 +0000
@@ -338,7 +338,7 @@
     ("^--- .+ ----$"             . diff-hunk-header-face) ;context
     ("^[0-9,]+[acd][0-9,]+$"     . diff-hunk-header-face) ;normal
     ("^---$"                     . diff-hunk-header-face) ;normal
-    ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\(\\S-+\\)\\(.*[^*-]\\)?\n"
+    ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\([^\t]+\\)\\(.*[^*-]\\)?\n"
      (0 diff-header-face) (2 diff-file-header-face prepend))
     ("^\\([-<]\\)\\(.*\n\\)"
      (1 diff-indicator-removed-face) (2 diff-removed-face))
--- a/lisp/ediff-mult.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/ediff-mult.el	Tue Jun 12 19:20:25 2007 +0000
@@ -129,9 +129,15 @@
 ;; the registry buffer
 (defvar ediff-registry-buffer nil)
 
-(defconst ediff-meta-buffer-message "This is an Ediff Session Group Panel: %s
+(defconst ediff-meta-buffer-brief-message "Ediff Session Group Panel: %s
+
+     Type ? to show useful commands in this buffer
 
-Useful commands:
+")
+
+(defconst ediff-meta-buffer-verbose-message "Ediff Session Group Panel: %s
+
+Useful commands (type ? to hide them and free up screen):
      button2, v, or RET over session record:   start that Ediff session
      M:\tin sessions invoked from here, brings back this group panel
      R:\tdisplay the registry of active Ediff sessions
@@ -360,10 +366,24 @@
        (if (stringp (ediff-get-session-objC-name session-info))
 	   (file-directory-p (ediff-get-session-objC-name session-info)) t)))
 
+
+(ediff-defvar-local ediff-verbose-help-enabled nil
+  "If t, display redundant help in ediff-directories and other meta buffers.
+Toggled by ediff-toggle-verbose-help-meta-buffer" )
+  
+;; Toggle verbose help in meta-buffers
+;; TODO: Someone who understands all this can make it better.
+(defun ediff-toggle-verbose-help-meta-buffer ()
+  "Toggle showing tediously verbose help in meta buffers."
+  (interactive)
+  (setq ediff-verbose-help-enabled (not ediff-verbose-help-enabled))
+  (ediff-update-meta-buffer (current-buffer) 'must-redraw))
+
 ;; set up the keymap in the meta buffer
 (defun ediff-setup-meta-map ()
   (setq ediff-meta-buffer-map (make-sparse-keymap))
   (suppress-keymap ediff-meta-buffer-map)
+  (define-key ediff-meta-buffer-map "?" 'ediff-toggle-verbose-help-meta-buffer)
   (define-key ediff-meta-buffer-map "q" 'ediff-quit-meta-buffer)
   (define-key ediff-meta-buffer-map "T" 'ediff-toggle-filename-truncation)
   (define-key ediff-meta-buffer-map "R" 'ediff-show-registry)
@@ -924,27 +944,31 @@
        (mapcar 'delete-overlay (overlays-in 1 1))  ; emacs
        )
 
-      (insert (format ediff-meta-buffer-message
-		      (ediff-abbrev-jobname ediff-metajob-name)))
-
       (setq regexp (ediff-get-group-regexp meta-list)
 	    merge-autostore-dir
 	    (ediff-get-group-merge-autostore-dir meta-list))
 
-      (cond ((ediff-collect-diffs-metajob)
-	     (insert
-	      "     P:\tcollect custom diffs of all marked sessions\n"))
-	    ((ediff-patch-metajob)
-	     (insert
-	      "     P:\tshow patch appropriately for the context (session or group)\n")))
-      (insert
-       "     ^:\tshow parent session group\n")
-      (or (ediff-one-filegroup-metajob)
-	  (insert
-	   "     D:\tshow differences among directories\n"
-	   "    ==:\tfor each session, show which files are identical\n"
-	   "    =h:\tlike ==, but also marks those sessions for hiding\n"
-	   "    =m:\tlike ==, but also marks those sessions for operation\n\n"))
+      (if ediff-verbose-help-enabled
+	  (progn
+	    (insert (format ediff-meta-buffer-verbose-message
+			    (ediff-abbrev-jobname ediff-metajob-name)))
+
+	    (cond ((ediff-collect-diffs-metajob)
+		   (insert
+		    "     P:\tcollect custom diffs of all marked sessions\n"))
+		  ((ediff-patch-metajob)
+		   (insert
+		    "     P:\tshow patch appropriately for the context (session or group)\n")))
+	    (insert
+	     "     ^:\tshow parent session group\n")
+	    (or (ediff-one-filegroup-metajob)
+		(insert
+		 "     D:\tshow differences among directories\n"
+		 "    ==:\tfor each session, show which files are identical\n"
+		 "    =h:\tlike ==, but also marks sessions for hiding\n"
+		 "    =m:\tlike ==, but also marks sessions for operation\n\n")))
+	(insert (format ediff-meta-buffer-brief-message
+			(ediff-abbrev-jobname ediff-metajob-name))))
 
       (insert "\n")
       (if (and (stringp regexp) (> (length regexp) 0))
--- a/lisp/ediff-ptch.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/ediff-ptch.el	Tue Jun 12 19:20:25 2007 +0000
@@ -136,10 +136,10 @@
 
 (defcustom ediff-context-diff-label-regexp
   (concat "\\(" 	; context diff 2-liner
-	  "^\\*\\*\\* \\([^ \t]+\\)[^*]+[\t ]*\n--- \\([^ \t]+\\)"
+	  "^\\*\\*\\* \\([^\t]+\\)[^*]+[\t ]*\n--- \\([^\t]+\\)"
 	  "\\|" 	; GNU unified format diff 2-liner
-	  "^--- \\([^ \t]+\\)[\t ]+.*\n\\+\\+\\+ \\([^ \t]+\\)"
-	  "\\)")
+	  "^--- \\([^\t]+\\)[\t ]+.*\n\\+\\+\\+ \\([^\t]+\\)"
+	  "\\)"))
   "*Regexp matching filename 2-liners at the start of each context diff.
 You probably don't want to change that, unless you are using an obscure patch
 program."
@@ -231,7 +231,7 @@
 	    ;; possible-file-names is holding the new file names until we
 	    ;; insert the old file name in the patch map
 	    ;; It is a pair
-	    ;;     (filename-from-1st-header-line . fn from 2nd line)
+	    ;;     (filename-from-1st-header-line . filename-from-2nd-line)
 	    (setq possible-file-names
 		  (cons (if (and beg1 end1)
 			    (buffer-substring beg1 end1)
@@ -309,12 +309,13 @@
 		;; 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 (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 ""))
+		(let ((default-directory (file-name-directory filename)))
+		  (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")
 		    (setcar proposed-file-names
 			    (ediff-file-name-sans-prefix
--- a/lisp/emulation/viper-cmd.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/emulation/viper-cmd.el	Tue Jun 12 19:20:25 2007 +0000
@@ -106,7 +106,7 @@
 ;; define viper-charpair-command-p
 (viper-test-com-defun viper-charpair-command)
 
-(defconst viper-movement-commands '(?b ?B ?e ?E ?f ?F ?G ?h ?H ?j ?k ?l
+(defconst viper-movement-commands '(?b ?B ?e ?E ?f ?F ?G ?h ?j ?k ?l
 				     ?H ?M ?L ?n ?t ?T ?w ?W ?$ ?%
 				     ?^ ?( ?) ?- ?+ ?| ?{ ?} ?[ ?] ?' ?`
 				     ?\; ?, ?0 ?? ?/ ?\  ?\C-m
@@ -1321,10 +1321,10 @@
 	  (setq last-command-event
 		(viper-copy-event
 		 (if viper-xemacs-p (character-to-event char) char)))
-	  (condition-case nil
+	  (condition-case err
 	      (funcall cmd-to-exec-at-end cmd-info)
 	    (error
-	     (error "")))))
+	     (error "%s" (error-message-string err))))))
     ))
 
 (defun viper-describe-arg (arg)
@@ -1902,7 +1902,7 @@
 	(setq viper-intermediate-command
 	      'repeating-display-destructive-command)
       ;; first search through command history--set temp ring
-      (setq viper-temp-command-ring (copy-list viper-command-ring)))
+      (setq viper-temp-command-ring (copy-sequence viper-command-ring)))
     (setq cmd (if next
 		  (viper-special-ring-rotate1 viper-temp-command-ring 1)
 		(viper-special-ring-rotate1 viper-temp-command-ring -1)))
@@ -1936,7 +1936,7 @@
 		 (length viper-last-inserted-string-from-insertion-ring))))
 	  )
       ;;first search through insertion history
-      (setq viper-temp-insertion-ring (copy-list viper-insertion-ring)))
+      (setq viper-temp-insertion-ring (copy-sequence viper-insertion-ring)))
     (setq this-command 'viper-insert-from-insertion-ring)
     ;; so that things will be undone properly
     (setq buffer-undo-list (cons nil buffer-undo-list))
--- a/lisp/emulation/viper-init.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/emulation/viper-init.el	Tue Jun 12 19:20:25 2007 +0000
@@ -97,6 +97,13 @@
   :tag "Is it VMS?"
   :group 'viper-misc)
 
+(defcustom viper-suppress-input-method-change-message nil
+  "If t, the message notifying about changes in the input method is not displayed.
+Normally, a message is displayed each time on enters the vi, insert or replace
+state."
+  :type 'boolean
+  :group 'viper-misc)
+
 (defcustom viper-force-faces nil
   "If t, Viper will think that it is running on a display that supports faces.
 This is provided as a temporary relief for users of graphics-capable terminals
@@ -326,7 +333,8 @@
     ;; turn off special input methods in vi-state
     (if (eq viper-current-state 'vi-state)
 	(viper-set-input-method nil))
-    (if (memq viper-current-state '(vi-state insert-state replace-state))
+    (if (and (memq viper-current-state '(vi-state insert-state replace-state))
+	     (not viper-suppress-input-method-change-message))
 	(message "Viper special input method%s: on"
 		 (if (or current-input-method default-input-method)
 		     (format " %S"
@@ -339,7 +347,8 @@
   (if (null viper-mule-hook-flag)
       ()
     (setq viper-special-input-method nil)
-    (if (memq viper-current-state '(vi-state insert-state replace-state))
+    (if (and (memq viper-current-state '(vi-state insert-state replace-state))
+	     (not viper-suppress-input-method-change-message))
 	(message "Viper special input method%s: off"
 		 (if (or current-input-method default-input-method)
 		     (format " %S"
@@ -369,7 +378,7 @@
 ;; Set quail-mode to ARG
 (defun viper-set-input-method (arg)
   (setq viper-mule-hook-flag t) ; just a precaution
-  (let (viper-mule-hook-flag) ; temporarily inactivate viper mule hooks
+  (let (viper-mule-hook-flag) ; temporarily deactivate viper mule hooks
     (cond ((and arg (> (prefix-numeric-value arg) 0) default-input-method)
 	   ;; activate input method
 	   (viper-activate-input-method))
--- a/lisp/emulation/viper-keym.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/emulation/viper-keym.el	Tue Jun 12 19:20:25 2007 +0000
@@ -339,8 +339,8 @@
 (define-key viper-vi-basic-map "\C-m" 'viper-next-line-at-bol)
 (define-key viper-vi-basic-map "\C-u" 'viper-scroll-down)
 (define-key viper-vi-basic-map "\C-y" 'viper-scroll-down-one)
-(define-key viper-vi-basic-map "\C-s" 'viper-isearch-forward)
-(define-key viper-vi-basic-map "\C-r" 'viper-isearch-backward)
+;;(define-key viper-vi-basic-map "\C-s" 'viper-isearch-forward)
+;;(define-key viper-vi-basic-map "\C-r" 'viper-isearch-backward)
 (define-key viper-vi-basic-map "\C-c/" 'viper-toggle-search-style)
 (define-key viper-vi-basic-map "\C-c\C-g" 'viper-info-on-file)
 
--- a/lisp/emulation/viper-util.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/emulation/viper-util.el	Tue Jun 12 19:20:25 2007 +0000
@@ -168,7 +168,7 @@
 
 (defun viper-set-cursor-color-according-to-state (&optional frame)
   (cond ((eq viper-current-state 'replace-state)
-	 (viper-change-cursor-color viper-replace-state-cursor-color frame))
+	 (viper-change-cursor-color viper-replace-overlay-cursor-color frame))
 	((and (eq viper-current-state 'emacs-state)
 	      viper-emacs-state-cursor-color)
 	 (viper-change-cursor-color viper-emacs-state-cursor-color frame))
@@ -889,9 +889,7 @@
 ;; Sit for VAL milliseconds.  XEmacs doesn't support the millisecond arg
 ;; in sit-for, so this function smoothes out the differences.
 (defsubst viper-sit-for-short (val &optional nodisp)
-  (if viper-xemacs-p
-      (sit-for (/ val 1000.0) nodisp)
-    (sit-for 0 val nodisp)))
+  (sit-for (/ val 1000.0) nodisp))
 
 ;; EVENT may be a single event of a sequence of events
 (defsubst viper-ESC-event-p (event)
--- a/lisp/emulation/viper.el	Tue Jun 12 18:52:05 2007 +0000
+++ b/lisp/emulation/viper.el	Tue Jun 12 19:20:25 2007 +0000
@@ -298,7 +298,6 @@
 ;;; Code:
 
 (require 'advice)
-(require 'cl)
 (require 'ring)
 
 ;; compiler pacifier
@@ -457,6 +456,7 @@
 (defcustom viper-insert-state-mode-list
   '(internal-ange-ftp-mode
     comint-mode
+    gud-mode
     inferior-emacs-lisp-mode
     erc-mode
     eshell-mode
@@ -481,6 +481,7 @@
   '((help-mode emacs-state viper-slash-and-colon-map)
     (comint-mode insert-state viper-comint-mode-modifier-map)
     (comint-mode vi-state viper-comint-mode-modifier-map)
+    (gud-mode insert-state viper-comint-mode-modifier-map)
     (shell-mode insert-state viper-comint-mode-modifier-map)
     (inferior-emacs-lisp-mode insert-state viper-comint-mode-modifier-map)
     (shell-mode vi-state viper-comint-mode-modifier-map)