# HG changeset patch # User Michael Kifer # Date 944542734 0 # Node ID 2ddbff6366e94d4a184040bbd2cdc4639409e5df # Parent 936b39bd05b41ab91ca5dbd968d8c0fc3d25f317 * viper-cmd.el (viper-minibuffer-standard-hook, viper-minibuffer-real-start): new functions. (viper-read-string-with-history,viper-file-add-suffix, viper-trim-replace-chars-to-delete-if-necessary): adapt to the change in the status of the minibuffer prompt. diff -r 936b39bd05b4 -r 2ddbff6366e9 lisp/ChangeLog --- a/lisp/ChangeLog Tue Dec 07 04:42:40 1999 +0000 +++ b/lisp/ChangeLog Tue Dec 07 04:58:54 1999 +0000 @@ -1,3 +1,11 @@ +1999-12-06 Michael Kifer + + * viper-cmd.el (viper-minibuffer-standard-hook, + viper-minibuffer-real-start): new functions. + (viper-read-string-with-history,viper-file-add-suffix, + viper-trim-replace-chars-to-delete-if-necessary): adapt to the + change in the status of the minibuffer prompt. + 1999-12-06 Gerd Moellmann * comint.el (comint-redirect-results-list) diff -r 936b39bd05b4 -r 2ddbff6366e9 lisp/emulation/viper-cmd.el --- a/lisp/emulation/viper-cmd.el Tue Dec 07 04:42:40 1999 +0000 +++ b/lisp/emulation/viper-cmd.el Tue Dec 07 04:58:54 1999 +0000 @@ -1855,6 +1855,28 @@ (funcall hook) )) +;; Thie is a temp hook that uses free variables init-message and initial. +;; A dirty feature, but it is the simplest way to have it do the right thing. +(defun viper-minibuffer-standard-hook () + (if (stringp init-message) + (viper-tmp-insert-at-eob init-message)) + (if (stringp initial) + (progn + ;; don't wait if we have unread events or in kbd macro + (or unread-command-events + executing-kbd-macro + (sit-for 840)) + (if (fboundp 'minibuffer-prompt-end) + (delete-region (minibuffer-prompt-end) (point-max)) + (erase-buffer)) + (insert initial))) + (viper-minibuffer-setup-sentinel)) + +(defsubst viper-minibuffer-real-start () + (if (fboundp 'minibuffer-prompt-end) + (minibuffer-prompt-end) + (point-min))) + ;; Interpret last event in the local map first; if fails, use exit-minibuffer. ;; Run viper-minibuffer-exit-hook before exiting. @@ -1893,7 +1915,8 @@ (defun viper-file-add-suffix () (let ((count 0) (len (length viper-smart-suffix-list)) - (file (buffer-string)) + (file (buffer-substring-no-properties + (viper-minibuffer-real-start) (point-max))) found key cmd suff) (goto-char (point-max)) (if (and viper-smart-suffix-list (string-match "\\.$" file)) @@ -1932,7 +1955,7 @@ problems." (if (viper-is-in-minibuffer) (progn - (goto-char (point-min)) + (goto-char (viper-minibuffer-real-start)) (end-of-line) (delete-region (point) (point-max))))) @@ -1950,19 +1973,7 @@ ;; KEYMAP is used, if given, instead of minibuffer-local-map. ;; INIT-MESSAGE is the message temporarily displayed after entering the ;; minibuffer. - (let ((minibuffer-setup-hook - (lambda () - (if (stringp init-message) - (viper-tmp-insert-at-eob init-message)) - (if (stringp initial) - (progn - ;; don't wait if we have unread events or in kbd macro - (or unread-command-events - executing-kbd-macro - (sit-for 840)) - (erase-buffer) - (insert initial))) - (viper-minibuffer-setup-sentinel))) + (let ((minibuffer-setup-hook 'viper-minibuffer-standard-hook) (val "") (padding "") temp-msg)