From ac64a7284e79d99ed5aadbd39d53f14e0f512fc3 Mon Sep 17 00:00:00 2001 From: Michael Kifer Date: Tue, 12 Jun 2007 19:20:25 +0000 Subject: [PATCH] 2007-06-12 Michael Kifer * 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. --- lisp/ChangeLog | 35 ++++++++++++++++++++ lisp/diff-mode.el | 2 +- lisp/ediff-mult.el | 62 +++++++++++++++++++++++++----------- lisp/ediff-ptch.el | 21 ++++++------ lisp/emulation/viper-cmd.el | 10 +++--- lisp/emulation/viper-init.el | 15 +++++++-- lisp/emulation/viper-keym.el | 4 +-- lisp/emulation/viper-util.el | 6 ++-- lisp/emulation/viper.el | 3 +- 9 files changed, 113 insertions(+), 45 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 11397368f6d..2bf7ad7cb4c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,38 @@ +2007-06-12 Michael Kifer + + * 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 * log-view.el (log-view-file-re, log-view-message-re): Use \(?1:...\). diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 87fade841ca..7346de8567a 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -338,7 +338,7 @@ when editing big diffs)." ("^--- .+ ----$" . 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)) diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el index 8fdd319746c..12dca168412 100644 --- a/lisp/ediff-mult.el +++ b/lisp/ediff-mult.el @@ -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 -Useful commands: + Type ? to show useful commands in this buffer + +") + +(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 @@ buffers." (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 @@ behavior." (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)) diff --git a/lisp/ediff-ptch.el b/lisp/ediff-ptch.el index c8a8b70f162..5b345a8d4d6 100644 --- a/lisp/ediff-ptch.el +++ b/lisp/ediff-ptch.el @@ -136,10 +136,10 @@ patch. So, don't change these variables, unless the default doesn't work." (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 @@ program." ;; 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 @@ program." ;; 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 diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 9bd1654020b..f4c0650b1c8 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -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 @@ as a Meta key and any number of multiple escapes is allowed." (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 @@ With prefix argument, find next destructive command." (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 @@ to in the global map, instead of cycling through the insertion ring." (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)) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 86e0e044641..4a1bae82711 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -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 @@ Use `M-x viper-set-expert-level' to change this.") ;; 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 @@ Use `M-x viper-set-expert-level' to change this.") (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 @@ Use `M-x viper-set-expert-level' to change this.") ;; 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)) diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index 9dd78ce8aa1..1d158274198 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el @@ -339,8 +339,8 @@ If running in a terminal, [(escape)] is not understood, so must use \"\\e\"." (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) diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 0419af5fedf..eef92106de2 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -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) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 67ec3660c65..3cc8974248c 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -298,7 +298,6 @@ ;;; Code: (require 'advice) -(require 'cl) (require 'ring) ;; compiler pacifier @@ -457,6 +456,7 @@ unless it is coming up in a wrong Viper state." (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 @@ unless it is coming up in a wrong Viper state." '((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) -- 2.39.2