diff options
| author | Michael Kifer | 1999-12-07 04:58:54 +0000 |
|---|---|---|
| committer | Michael Kifer | 1999-12-07 04:58:54 +0000 |
| commit | 1da04da19b299687d4100ba044c5cbcede5a0299 (patch) | |
| tree | 74bbfe06411cef744991741fe0be192e04d57d02 | |
| parent | 7dae4502b6f69a9f0961f8abbb83b254e24dcc8d (diff) | |
| download | emacs-1da04da19b299687d4100ba044c5cbcede5a0299.tar.gz emacs-1da04da19b299687d4100ba044c5cbcede5a0299.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/emulation/viper-cmd.el | 41 |
2 files changed, 34 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9eb39fb73dd..1885aa18b5f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 1999-12-06 Michael Kifer <kifer@cs.sunysb.edu> | ||
| 2 | |||
| 3 | * viper-cmd.el (viper-minibuffer-standard-hook, | ||
| 4 | viper-minibuffer-real-start): new functions. | ||
| 5 | (viper-read-string-with-history,viper-file-add-suffix, | ||
| 6 | viper-trim-replace-chars-to-delete-if-necessary): adapt to the | ||
| 7 | change in the status of the minibuffer prompt. | ||
| 8 | |||
| 1 | 1999-12-06 Gerd Moellmann <gerd@gnu.org> | 9 | 1999-12-06 Gerd Moellmann <gerd@gnu.org> |
| 2 | 10 | ||
| 3 | * comint.el (comint-redirect-results-list) | 11 | * comint.el (comint-redirect-results-list) |
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 90f17223ec3..a2b94552204 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el | |||
| @@ -1855,6 +1855,28 @@ Undo previous insertion and inserts new." | |||
| 1855 | (funcall hook) | 1855 | (funcall hook) |
| 1856 | )) | 1856 | )) |
| 1857 | 1857 | ||
| 1858 | ;; Thie is a temp hook that uses free variables init-message and initial. | ||
| 1859 | ;; A dirty feature, but it is the simplest way to have it do the right thing. | ||
| 1860 | (defun viper-minibuffer-standard-hook () | ||
| 1861 | (if (stringp init-message) | ||
| 1862 | (viper-tmp-insert-at-eob init-message)) | ||
| 1863 | (if (stringp initial) | ||
| 1864 | (progn | ||
| 1865 | ;; don't wait if we have unread events or in kbd macro | ||
| 1866 | (or unread-command-events | ||
| 1867 | executing-kbd-macro | ||
| 1868 | (sit-for 840)) | ||
| 1869 | (if (fboundp 'minibuffer-prompt-end) | ||
| 1870 | (delete-region (minibuffer-prompt-end) (point-max)) | ||
| 1871 | (erase-buffer)) | ||
| 1872 | (insert initial))) | ||
| 1873 | (viper-minibuffer-setup-sentinel)) | ||
| 1874 | |||
| 1875 | (defsubst viper-minibuffer-real-start () | ||
| 1876 | (if (fboundp 'minibuffer-prompt-end) | ||
| 1877 | (minibuffer-prompt-end) | ||
| 1878 | (point-min))) | ||
| 1879 | |||
| 1858 | 1880 | ||
| 1859 | ;; Interpret last event in the local map first; if fails, use exit-minibuffer. | 1881 | ;; Interpret last event in the local map first; if fails, use exit-minibuffer. |
| 1860 | ;; Run viper-minibuffer-exit-hook before exiting. | 1882 | ;; Run viper-minibuffer-exit-hook before exiting. |
| @@ -1893,7 +1915,8 @@ To turn this feature off, set this variable to nil." | |||
| 1893 | (defun viper-file-add-suffix () | 1915 | (defun viper-file-add-suffix () |
| 1894 | (let ((count 0) | 1916 | (let ((count 0) |
| 1895 | (len (length viper-smart-suffix-list)) | 1917 | (len (length viper-smart-suffix-list)) |
| 1896 | (file (buffer-string)) | 1918 | (file (buffer-substring-no-properties |
| 1919 | (viper-minibuffer-real-start) (point-max))) | ||
| 1897 | found key cmd suff) | 1920 | found key cmd suff) |
| 1898 | (goto-char (point-max)) | 1921 | (goto-char (point-max)) |
| 1899 | (if (and viper-smart-suffix-list (string-match "\\.$" file)) | 1922 | (if (and viper-smart-suffix-list (string-match "\\.$" file)) |
| @@ -1932,7 +1955,7 @@ Remove this function from `viper-minibuffer-exit-hook', if this causes | |||
| 1932 | problems." | 1955 | problems." |
| 1933 | (if (viper-is-in-minibuffer) | 1956 | (if (viper-is-in-minibuffer) |
| 1934 | (progn | 1957 | (progn |
| 1935 | (goto-char (point-min)) | 1958 | (goto-char (viper-minibuffer-real-start)) |
| 1936 | (end-of-line) | 1959 | (end-of-line) |
| 1937 | (delete-region (point) (point-max))))) | 1960 | (delete-region (point) (point-max))))) |
| 1938 | 1961 | ||
| @@ -1950,19 +1973,7 @@ problems." | |||
| 1950 | ;; KEYMAP is used, if given, instead of minibuffer-local-map. | 1973 | ;; KEYMAP is used, if given, instead of minibuffer-local-map. |
| 1951 | ;; INIT-MESSAGE is the message temporarily displayed after entering the | 1974 | ;; INIT-MESSAGE is the message temporarily displayed after entering the |
| 1952 | ;; minibuffer. | 1975 | ;; minibuffer. |
| 1953 | (let ((minibuffer-setup-hook | 1976 | (let ((minibuffer-setup-hook 'viper-minibuffer-standard-hook) |
| 1954 | (lambda () | ||
| 1955 | (if (stringp init-message) | ||
| 1956 | (viper-tmp-insert-at-eob init-message)) | ||
| 1957 | (if (stringp initial) | ||
| 1958 | (progn | ||
| 1959 | ;; don't wait if we have unread events or in kbd macro | ||
| 1960 | (or unread-command-events | ||
| 1961 | executing-kbd-macro | ||
| 1962 | (sit-for 840)) | ||
| 1963 | (erase-buffer) | ||
| 1964 | (insert initial))) | ||
| 1965 | (viper-minibuffer-setup-sentinel))) | ||
| 1966 | (val "") | 1977 | (val "") |
| 1967 | (padding "") | 1978 | (padding "") |
| 1968 | temp-msg) | 1979 | temp-msg) |