diff options
| author | Michael Kifer | 1997-09-05 04:48:58 +0000 |
|---|---|---|
| committer | Michael Kifer | 1997-09-05 04:48:58 +0000 |
| commit | 96dffd25b0668f11da338a68f4d1be69cc65bd94 (patch) | |
| tree | 0ff12820dad1728525968da420f8bc803a3e60d4 | |
| parent | f152949dc80593916da13be5e7aec477d25796c9 (diff) | |
| download | emacs-96dffd25b0668f11da338a68f4d1be69cc65bd94.tar.gz emacs-96dffd25b0668f11da338a68f4d1be69cc65bd94.zip | |
new version
| -rw-r--r-- | lisp/emulation/viper-cmd.el | 138 | ||||
| -rw-r--r-- | lisp/emulation/viper-ex.el | 184 | ||||
| -rw-r--r-- | lisp/emulation/viper-init.el | 6 | ||||
| -rw-r--r-- | lisp/emulation/viper-mous.el | 86 | ||||
| -rw-r--r-- | lisp/emulation/viper.el | 12 |
5 files changed, 231 insertions, 195 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index a2d11325511..85eb264a208 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el | |||
| @@ -163,8 +163,10 @@ | |||
| 163 | )) | 163 | )) |
| 164 | (if (and (eq this-command 'dabbrev-expand) | 164 | (if (and (eq this-command 'dabbrev-expand) |
| 165 | (integerp viper-pre-command-point) | 165 | (integerp viper-pre-command-point) |
| 166 | (markerp viper-insert-point) | ||
| 167 | (marker-position viper-insert-point) | ||
| 166 | (> viper-insert-point viper-pre-command-point)) | 168 | (> viper-insert-point viper-pre-command-point)) |
| 167 | (move-marker viper-insert-point viper-pre-command-point)) | 169 | (viper-move-marker-locally viper-insert-point viper-pre-command-point)) |
| 168 | ) | 170 | ) |
| 169 | 171 | ||
| 170 | (defsubst viper-insert-state-pre-command-sentinel () | 172 | (defsubst viper-insert-state-pre-command-sentinel () |
| @@ -1137,6 +1139,11 @@ as a Meta key and any number of multiple escapes is allowed." | |||
| 1137 | 1139 | ||
| 1138 | ;; Saves last inserted text for possible use by viper-repeat command. | 1140 | ;; Saves last inserted text for possible use by viper-repeat command. |
| 1139 | (defun viper-save-last-insertion (beg end) | 1141 | (defun viper-save-last-insertion (beg end) |
| 1142 | (condition-case nil | ||
| 1143 | (setq viper-last-insertion (buffer-substring beg end)) | ||
| 1144 | (error | ||
| 1145 | ;; beg or end marker are somehow screwed up | ||
| 1146 | (setq viper-last-insertion nil))) | ||
| 1140 | (setq viper-last-insertion (buffer-substring beg end)) | 1147 | (setq viper-last-insertion (buffer-substring beg end)) |
| 1141 | (or (< (length viper-d-com) 5) | 1148 | (or (< (length viper-d-com) 5) |
| 1142 | (setcar (nthcdr 4 viper-d-com) viper-last-insertion)) | 1149 | (setcar (nthcdr 4 viper-d-com) viper-last-insertion)) |
| @@ -1765,15 +1772,86 @@ Undo previous insertion and inserts new." | |||
| 1765 | (funcall hook) | 1772 | (funcall hook) |
| 1766 | )) | 1773 | )) |
| 1767 | 1774 | ||
| 1768 | ;; Interpret last event in the local map | 1775 | ;; Interpret last event in the local map first; if fails, use exit-minibuffer. |
| 1776 | ;; Run viper-minibuffer-exit-hook before exiting. | ||
| 1769 | (defun viper-exit-minibuffer () | 1777 | (defun viper-exit-minibuffer () |
| 1778 | "Exit minibuffer Viper way." | ||
| 1770 | (interactive) | 1779 | (interactive) |
| 1771 | (let (command) | 1780 | (let (command) |
| 1772 | (setq command (local-key-binding (char-to-string last-command-char))) | 1781 | (setq command (local-key-binding (char-to-string last-command-char))) |
| 1782 | (run-hooks 'viper-minibuffer-exit-hook) | ||
| 1773 | (if command | 1783 | (if command |
| 1774 | (command-execute command) | 1784 | (command-execute command) |
| 1775 | (exit-minibuffer)))) | 1785 | (exit-minibuffer)))) |
| 1776 | 1786 | ||
| 1787 | |||
| 1788 | (defcustom viper-smart-suffix-list | ||
| 1789 | '("" "tex" "c" "cc" "C" "el" "java" "html" "htm" "pl" "P" "p") | ||
| 1790 | "*List of suffixes that Viper automatically tries to append to filenames ending with a `.'. | ||
| 1791 | This is useful when you the current directory contains files with the same | ||
| 1792 | prefix and many different suffixes. Usually, only one of the suffixes | ||
| 1793 | represents an editable file. However, file completion will stop at the `.' | ||
| 1794 | The smart suffix feature lets you hit RET in such a case, and Viper will | ||
| 1795 | select the appropriate suffix. | ||
| 1796 | |||
| 1797 | Suffixes are tried in the order given and the first suffix for which a | ||
| 1798 | corresponding file exists is selected. If no file exists for any of the | ||
| 1799 | suffixes, the user is asked to confirm. | ||
| 1800 | |||
| 1801 | To turn this feature off, set this variable to nil." | ||
| 1802 | :type '(set string) | ||
| 1803 | :group 'viper) | ||
| 1804 | |||
| 1805 | |||
| 1806 | ;; Try to add a suitable suffix to files whose name ends with a `.' | ||
| 1807 | ;; Useful when the user hits RET on a non-completed file name. | ||
| 1808 | ;; Used as a minibuffer exit hook in read-file-name | ||
| 1809 | (defun viper-file-add-suffix () | ||
| 1810 | (let ((count 0) | ||
| 1811 | (len (length viper-smart-suffix-list)) | ||
| 1812 | (file (buffer-string)) | ||
| 1813 | found key cmd suff) | ||
| 1814 | (goto-char (point-max)) | ||
| 1815 | (if (and viper-smart-suffix-list (string-match "\\.$" file)) | ||
| 1816 | (progn | ||
| 1817 | (while (and (not found) (< count len)) | ||
| 1818 | (setq suff (nth count viper-smart-suffix-list) | ||
| 1819 | count (1+ count)) | ||
| 1820 | (if (file-exists-p | ||
| 1821 | (format "%s%s" (substitute-in-file-name file) suff)) | ||
| 1822 | (progn | ||
| 1823 | (setq found t) | ||
| 1824 | (insert suff)))) | ||
| 1825 | |||
| 1826 | (if found | ||
| 1827 | () | ||
| 1828 | (viper-tmp-insert-at-eob " [Please complete file name]") | ||
| 1829 | (unwind-protect | ||
| 1830 | (while (not (memq cmd | ||
| 1831 | '(exit-minibuffer viper-exit-minibuffer))) | ||
| 1832 | (setq cmd | ||
| 1833 | (key-binding (setq key (read-key-sequence nil)))) | ||
| 1834 | (cond ((eq cmd 'self-insert-command) | ||
| 1835 | (if viper-xemacs-p | ||
| 1836 | (insert (events-to-keys key)) | ||
| 1837 | (insert key))) | ||
| 1838 | ((memq cmd '(exit-minibuffer viper-exit-minibuffer)) | ||
| 1839 | nil) | ||
| 1840 | (t (command-execute cmd))) | ||
| 1841 | ))) | ||
| 1842 | )))) | ||
| 1843 | |||
| 1844 | |||
| 1845 | (defun viper-minibuffer-trim-tail () | ||
| 1846 | "Delete junk at the end of the first line of the minibuffer input. | ||
| 1847 | Remove this function from `viper-minibuffer-exit-hook', if this causes | ||
| 1848 | problems." | ||
| 1849 | (if (viper-is-in-minibuffer) | ||
| 1850 | (progn | ||
| 1851 | (goto-char (point-min)) | ||
| 1852 | (end-of-line) | ||
| 1853 | (delete-region (point) (point-max))))) | ||
| 1854 | |||
| 1777 | 1855 | ||
| 1778 | ;;; Reading string with history | 1856 | ;;; Reading string with history |
| 1779 | 1857 | ||
| @@ -3636,62 +3714,6 @@ Null string will repeat previous search." | |||
| 3636 | (kill-buffer buffer) | 3714 | (kill-buffer buffer) |
| 3637 | (error "Buffer not killed")))) | 3715 | (error "Buffer not killed")))) |
| 3638 | 3716 | ||
| 3639 | |||
| 3640 | (defcustom viper-smart-suffix-list | ||
| 3641 | '("" "tex" "c" "cc" "C" "el" "java" "html" "htm" "pl" "P" "p") | ||
| 3642 | "*List of suffixes that Viper automatically tries to append to filenames ending with a `.'. | ||
| 3643 | This is useful when you the current directory contains files with the same | ||
| 3644 | prefix and many different suffixes. Usually, only one of the suffixes | ||
| 3645 | represents an editable file. However, file completion will stop at the `.' | ||
| 3646 | The smart suffix feature lets you hit RET in such a case, and Viper will | ||
| 3647 | select the appropriate suffix. | ||
| 3648 | |||
| 3649 | Suffixes are tried in the order given and the first suffix for which a | ||
| 3650 | corresponding file exists is selected. If no file exists for any of the | ||
| 3651 | suffixes, the user is asked to confirm. | ||
| 3652 | |||
| 3653 | To turn this feature off, set this variable to nil." | ||
| 3654 | :type '(set string) | ||
| 3655 | :group 'viper) | ||
| 3656 | |||
| 3657 | ;; Try to add suffix to files ending with a `.' | ||
| 3658 | ;; Useful when the user hits RET on a non-completed file name. | ||
| 3659 | (defun viper-file-add-suffix () | ||
| 3660 | (let ((count 0) | ||
| 3661 | (len (length viper-smart-suffix-list)) | ||
| 3662 | (file (buffer-string)) | ||
| 3663 | found key cmd suff) | ||
| 3664 | (goto-char (point-max)) | ||
| 3665 | (if (and viper-smart-suffix-list (string-match "\\.$" file)) | ||
| 3666 | (progn | ||
| 3667 | (while (and (not found) (< count len)) | ||
| 3668 | (setq suff (nth count viper-smart-suffix-list) | ||
| 3669 | count (1+ count)) | ||
| 3670 | (if (file-exists-p | ||
| 3671 | (format "%s%s" (substitute-in-file-name file) suff)) | ||
| 3672 | (progn | ||
| 3673 | (setq found t) | ||
| 3674 | (insert suff)))) | ||
| 3675 | |||
| 3676 | (if found | ||
| 3677 | () | ||
| 3678 | (viper-tmp-insert-at-eob " [Please complete file name]") | ||
| 3679 | (unwind-protect | ||
| 3680 | (while (not (memq cmd | ||
| 3681 | '(exit-minibuffer viper-exit-minibuffer))) | ||
| 3682 | (setq cmd | ||
| 3683 | (key-binding (setq key (read-key-sequence nil)))) | ||
| 3684 | (cond ((eq cmd 'self-insert-command) | ||
| 3685 | (if viper-xemacs-p | ||
| 3686 | (insert (events-to-keys key)) | ||
| 3687 | (insert key))) | ||
| 3688 | ((memq cmd '(exit-minibuffer viper-exit-minibuffer)) | ||
| 3689 | nil) | ||
| 3690 | (t (command-execute cmd))) | ||
| 3691 | ))) | ||
| 3692 | )))) | ||
| 3693 | |||
| 3694 | |||
| 3695 | 3717 | ||
| 3696 | 3718 | ||
| 3697 | ;; yank and pop | 3719 | ;; yank and pop |
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index 216c1ade83b..dc4d1c3eebd 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el | |||
| @@ -326,98 +326,100 @@ reversed." | |||
| 326 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) | 326 | (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) |
| 327 | (set-buffer viper-ex-work-buf) | 327 | (set-buffer viper-ex-work-buf) |
| 328 | (skip-chars-forward " \t|") | 328 | (skip-chars-forward " \t|") |
| 329 | (cond ((looking-at "#") | 329 | (let ((case-fold-search t)) |
| 330 | (setq ex-token-type 'command) | 330 | (cond ((looking-at "#") |
| 331 | (setq ex-token (char-to-string (following-char))) | 331 | (setq ex-token-type 'command) |
| 332 | (forward-char 1)) | 332 | (setq ex-token (char-to-string (following-char))) |
| 333 | ((looking-at "[a-z]") (viper-get-ex-com-subr)) | 333 | (forward-char 1)) |
| 334 | ((looking-at "\\.") | 334 | ((looking-at "[a-z]") (viper-get-ex-com-subr)) |
| 335 | (forward-char 1) | 335 | ((looking-at "\\.") |
| 336 | (setq ex-token-type 'dot)) | 336 | (forward-char 1) |
| 337 | ((looking-at "[0-9]") | 337 | (setq ex-token-type 'dot)) |
| 338 | (set-mark (point)) | 338 | ((looking-at "[0-9]") |
| 339 | (re-search-forward "[0-9]*") | 339 | (set-mark (point)) |
| 340 | (setq ex-token-type | 340 | (re-search-forward "[0-9]*") |
| 341 | (cond ((eq ex-token-type 'plus) 'add-number) | 341 | (setq ex-token-type |
| 342 | ((eq ex-token-type 'minus) 'sub-number) | 342 | (cond ((eq ex-token-type 'plus) 'add-number) |
| 343 | (t 'abs-number))) | 343 | ((eq ex-token-type 'minus) 'sub-number) |
| 344 | (setq ex-token (string-to-int (buffer-substring (point) (mark t))))) | 344 | (t 'abs-number))) |
| 345 | ((looking-at "\\$") | 345 | (setq ex-token |
| 346 | (forward-char 1) | 346 | (string-to-int (buffer-substring (point) (mark t))))) |
| 347 | (setq ex-token-type 'end)) | 347 | ((looking-at "\\$") |
| 348 | ((looking-at "%") | 348 | (forward-char 1) |
| 349 | (forward-char 1) | 349 | (setq ex-token-type 'end)) |
| 350 | (setq ex-token-type 'whole)) | 350 | ((looking-at "%") |
| 351 | ((looking-at "+") | 351 | (forward-char 1) |
| 352 | (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]")) | 352 | (setq ex-token-type 'whole)) |
| 353 | (forward-char 1) | 353 | ((looking-at "+") |
| 354 | (insert "1") | 354 | (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]")) |
| 355 | (backward-char 1) | 355 | (forward-char 1) |
| 356 | (insert "1") | ||
| 357 | (backward-char 1) | ||
| 356 | (setq ex-token-type 'plus)) | 358 | (setq ex-token-type 'plus)) |
| 357 | ((looking-at "+[0-9]") | 359 | ((looking-at "+[0-9]") |
| 358 | (forward-char 1) | 360 | (forward-char 1) |
| 359 | (setq ex-token-type 'plus)) | 361 | (setq ex-token-type 'plus)) |
| 360 | (t | 362 | (t |
| 361 | (error viper-BadAddress)))) | 363 | (error viper-BadAddress)))) |
| 362 | ((looking-at "-") | 364 | ((looking-at "-") |
| 363 | (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]")) | 365 | (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]")) |
| 364 | (forward-char 1) | 366 | (forward-char 1) |
| 365 | (insert "1") | 367 | (insert "1") |
| 366 | (backward-char 1) | 368 | (backward-char 1) |
| 367 | (setq ex-token-type 'minus)) | 369 | (setq ex-token-type 'minus)) |
| 368 | ((looking-at "-[0-9]") | 370 | ((looking-at "-[0-9]") |
| 369 | (forward-char 1) | 371 | (forward-char 1) |
| 370 | (setq ex-token-type 'minus)) | 372 | (setq ex-token-type 'minus)) |
| 371 | (t | 373 | (t |
| 372 | (error viper-BadAddress)))) | 374 | (error viper-BadAddress)))) |
| 373 | ((looking-at "/") | 375 | ((looking-at "/") |
| 374 | (forward-char 1) | 376 | (forward-char 1) |
| 375 | (set-mark (point)) | 377 | (set-mark (point)) |
| 376 | (let ((cont t)) | 378 | (let ((cont t)) |
| 377 | (while (and (not (eolp)) cont) | 379 | (while (and (not (eolp)) cont) |
| 378 | ;;(re-search-forward "[^/]*/") | 380 | ;;(re-search-forward "[^/]*/") |
| 379 | (re-search-forward "[^/]*\\(/\\|\n\\)") | 381 | (re-search-forward "[^/]*\\(/\\|\n\\)") |
| 380 | (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/")) | 382 | (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/")) |
| 381 | (setq cont nil)))) | 383 | (setq cont nil)))) |
| 382 | (backward-char 1) | 384 | (backward-char 1) |
| 383 | (setq ex-token (buffer-substring (point) (mark t))) | 385 | (setq ex-token (buffer-substring (point) (mark t))) |
| 384 | (if (looking-at "/") (forward-char 1)) | 386 | (if (looking-at "/") (forward-char 1)) |
| 385 | (setq ex-token-type 'search-forward)) | 387 | (setq ex-token-type 'search-forward)) |
| 386 | ((looking-at "\\?") | 388 | ((looking-at "\\?") |
| 387 | (forward-char 1) | 389 | (forward-char 1) |
| 388 | (set-mark (point)) | 390 | (set-mark (point)) |
| 389 | (let ((cont t)) | 391 | (let ((cont t)) |
| 390 | (while (and (not (eolp)) cont) | 392 | (while (and (not (eolp)) cont) |
| 391 | ;;(re-search-forward "[^\\?]*\\?") | 393 | ;;(re-search-forward "[^\\?]*\\?") |
| 392 | (re-search-forward "[^\\?]*\\(\\?\\|\n\\)") | 394 | (re-search-forward "[^\\?]*\\(\\?\\|\n\\)") |
| 393 | (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?")) | 395 | (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?")) |
| 394 | (setq cont nil)) | 396 | (setq cont nil)) |
| 395 | (backward-char 1) | 397 | (backward-char 1) |
| 396 | (if (not (looking-at "\n")) (forward-char 1)))) | 398 | (if (not (looking-at "\n")) (forward-char 1)))) |
| 397 | (setq ex-token-type 'search-backward) | 399 | (setq ex-token-type 'search-backward) |
| 398 | (setq ex-token (buffer-substring (1- (point)) (mark t)))) | 400 | (setq ex-token (buffer-substring (1- (point)) (mark t)))) |
| 399 | ((looking-at ",") | 401 | ((looking-at ",") |
| 400 | (forward-char 1) | 402 | (forward-char 1) |
| 401 | (setq ex-token-type 'comma)) | 403 | (setq ex-token-type 'comma)) |
| 402 | ((looking-at ";") | 404 | ((looking-at ";") |
| 403 | (forward-char 1) | 405 | (forward-char 1) |
| 404 | (setq ex-token-type 'semi-colon)) | 406 | (setq ex-token-type 'semi-colon)) |
| 405 | ((looking-at "[!=><&~]") | 407 | ((looking-at "[!=><&~]") |
| 406 | (setq ex-token-type 'command) | 408 | (setq ex-token-type 'command) |
| 407 | (setq ex-token (char-to-string (following-char))) | 409 | (setq ex-token (char-to-string (following-char))) |
| 408 | (forward-char 1)) | 410 | (forward-char 1)) |
| 409 | ((looking-at "'") | 411 | ((looking-at "'") |
| 410 | (setq ex-token-type 'goto-mark) | 412 | (setq ex-token-type 'goto-mark) |
| 411 | (forward-char 1) | 413 | (forward-char 1) |
| 412 | (cond ((looking-at "'") (setq ex-token nil)) | 414 | (cond ((looking-at "'") (setq ex-token nil)) |
| 413 | ((looking-at "[a-z]") (setq ex-token (following-char))) | 415 | ((looking-at "[a-z]") (setq ex-token (following-char))) |
| 414 | (t (error "Marks are ' and a-z"))) | 416 | (t (error "Marks are ' and a-z"))) |
| 415 | (forward-char 1)) | 417 | (forward-char 1)) |
| 416 | ((looking-at "\n") | 418 | ((looking-at "\n") |
| 417 | (setq ex-token-type 'end-mark) | 419 | (setq ex-token-type 'end-mark) |
| 418 | (setq ex-token "goto")) | 420 | (setq ex-token "goto")) |
| 419 | (t | 421 | (t |
| 420 | (error viper-BadExCommand))))) | 422 | (error viper-BadExCommand)))))) |
| 421 | 423 | ||
| 422 | ;; Reads Ex command. Tries to determine if it has to exit because command | 424 | ;; Reads Ex command. Tries to determine if it has to exit because command |
| 423 | ;; is complete or invalid. If not, keeps reading command. | 425 | ;; is complete or invalid. If not, keeps reading command. |
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 83d6038129a..4da276c881d 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el | |||
| @@ -420,7 +420,9 @@ It is used only with TTYs or if `viper-use-replace-region-delimiters' | |||
| 420 | is non-nil." | 420 | is non-nil." |
| 421 | :type 'string | 421 | :type 'string |
| 422 | :group 'viper) | 422 | :group 'viper) |
| 423 | (defcustom viper-use-replace-region-delimiters (not (viper-has-face-support-p)) | 423 | (defcustom viper-use-replace-region-delimiters |
| 424 | (or (not (viper-has-face-support-p)) | ||
| 425 | (and viper-xemacs-p (eq (viper-device-type) 'tty))) | ||
| 424 | "*If non-nil, Viper will always use `viper-replace-region-end-delimiter' and | 426 | "*If non-nil, Viper will always use `viper-replace-region-end-delimiter' and |
| 425 | `viper-replace-region-start-delimiter' to delimit replacement regions, even on | 427 | `viper-replace-region-start-delimiter' to delimit replacement regions, even on |
| 426 | color displays. By default, the delimiters are used only on TTYs." | 428 | color displays. By default, the delimiters are used only on TTYs." |
| @@ -979,7 +981,7 @@ Should be set in `~/.viper' file." | |||
| 979 | ;; Hook, specific to Viper, which is run just *before* exiting the minibuffer. | 981 | ;; Hook, specific to Viper, which is run just *before* exiting the minibuffer. |
| 980 | ;; Beginning with Emacs 19.26, the standard `minibuffer-exit-hook' is run | 982 | ;; Beginning with Emacs 19.26, the standard `minibuffer-exit-hook' is run |
| 981 | ;; *after* exiting the minibuffer | 983 | ;; *after* exiting the minibuffer |
| 982 | (defvar viper-minibuffer-exit-hook nil) | 984 | (defvar viper-minibuffer-exit-hook '(viper-minibuffer-trim-tail)) |
| 983 | 985 | ||
| 984 | 986 | ||
| 985 | ;; Mode line | 987 | ;; Mode line |
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el index d630a64f303..3b3fa94a6fe 100644 --- a/lisp/emulation/viper-mous.el +++ b/lisp/emulation/viper-mous.el | |||
| @@ -256,42 +256,47 @@ See `viper-surrounding-word' for the definition of a word in this case." | |||
| 256 | (interactive "e\nP") | 256 | (interactive "e\nP") |
| 257 | (if viper-frame-of-focus ;; to handle clicks in another frame | 257 | (if viper-frame-of-focus ;; to handle clicks in another frame |
| 258 | (select-frame viper-frame-of-focus)) | 258 | (select-frame viper-frame-of-focus)) |
| 259 | 259 | (if (or (not (eq (key-binding viper-mouse-down-insert-key-parsed) | |
| 260 | ;; turn arg into a number | 260 | 'viper-mouse-catch-frame-switch)) |
| 261 | (cond ((integerp arg) nil) | 261 | (not (eq (key-binding viper-mouse-up-insert-key-parsed) |
| 262 | ;; prefix arg is a list when one hits C-u then command | 262 | 'viper-mouse-click-insert-word)) |
| 263 | ((and (listp arg) (integerp (car arg))) | 263 | (and viper-xemacs-p (not (event-over-text-area-p click)))) |
| 264 | (setq arg (car arg))) | 264 | () ; do nothing, if binding isn't right or not over text |
| 265 | (t (setq arg 1))) | 265 | ;; turn arg into a number |
| 266 | 266 | (cond ((integerp arg) nil) | |
| 267 | (if (not (eq (key-binding viper-mouse-down-insert-key-parsed) | 267 | ;; prefix arg is a list when one hits C-u then command |
| 268 | 'viper-mouse-catch-frame-switch)) | 268 | ((and (listp arg) (integerp (car arg))) |
| 269 | () ; do nothing | 269 | (setq arg (car arg))) |
| 270 | (let (click-count interrupting-event) | 270 | (t (setq arg 1))) |
| 271 | (if (and | 271 | |
| 272 | (viper-multiclick-p) | 272 | (if (not (eq (key-binding viper-mouse-down-insert-key-parsed) |
| 273 | ;; This trick checks if there is a pending mouse event if so, we use | 273 | 'viper-mouse-catch-frame-switch)) |
| 274 | ;; this latter event and discard the current mouse click If the next | 274 | () ; do nothing |
| 275 | ;; pending event is not a mouse event, we execute the current mouse | 275 | (let (click-count interrupting-event) |
| 276 | ;; event | 276 | (if (and |
| 277 | (progn | 277 | (viper-multiclick-p) |
| 278 | (setq interrupting-event (viper-read-event)) | 278 | ;; This trick checks if there is a pending mouse event if so, we |
| 279 | (viper-mouse-event-p last-input-event))) | 279 | ;; use this latter event and discard the current mouse click If |
| 280 | (progn ; interrupted wait | 280 | ;; the next pending event is not a mouse event, we execute the |
| 281 | (setq viper-global-prefix-argument arg) | 281 | ;; current mouse event |
| 282 | ;; count this click for XEmacs | 282 | (progn |
| 283 | (viper-event-click-count click)) | 283 | (setq interrupting-event (viper-read-event)) |
| 284 | ;; uninterrupted wait or the interrupting event wasn't a mouse event | 284 | (viper-mouse-event-p last-input-event))) |
| 285 | (setq click-count (viper-event-click-count click)) | 285 | (progn ; interrupted wait |
| 286 | (if (> click-count 1) | 286 | (setq viper-global-prefix-argument arg) |
| 287 | (setq arg viper-global-prefix-argument | 287 | ;; count this click for XEmacs |
| 288 | viper-global-prefix-argument nil)) | 288 | (viper-event-click-count click)) |
| 289 | (insert (viper-mouse-click-get-word click arg click-count)) | 289 | ;; uninterrupted wait or the interrupting event wasn't a mouse event |
| 290 | (if (and interrupting-event | 290 | (setq click-count (viper-event-click-count click)) |
| 291 | (eventp interrupting-event) | 291 | (if (> click-count 1) |
| 292 | (not (viper-mouse-event-p interrupting-event))) | 292 | (setq arg viper-global-prefix-argument |
| 293 | (viper-set-unread-command-events interrupting-event)) | 293 | viper-global-prefix-argument nil)) |
| 294 | )))) | 294 | (insert (viper-mouse-click-get-word click arg click-count)) |
| 295 | (if (and interrupting-event | ||
| 296 | (eventp interrupting-event) | ||
| 297 | (not (viper-mouse-event-p interrupting-event))) | ||
| 298 | (viper-set-unread-command-events interrupting-event)) | ||
| 299 | ))))) | ||
| 295 | 300 | ||
| 296 | ;; arg is an event. accepts symbols and numbers, too | 301 | ;; arg is an event. accepts symbols and numbers, too |
| 297 | (defun viper-mouse-event-p (event) | 302 | (defun viper-mouse-event-p (event) |
| @@ -324,9 +329,12 @@ this command." | |||
| 324 | (interactive "e\nP") | 329 | (interactive "e\nP") |
| 325 | (if viper-frame-of-focus ;; to handle clicks in another frame | 330 | (if viper-frame-of-focus ;; to handle clicks in another frame |
| 326 | (select-frame viper-frame-of-focus)) | 331 | (select-frame viper-frame-of-focus)) |
| 327 | (if (not (eq (key-binding viper-mouse-down-search-key-parsed) | 332 | (if (or (not (eq (key-binding viper-mouse-down-search-key-parsed) |
| 328 | 'viper-mouse-catch-frame-switch)) | 333 | 'viper-mouse-catch-frame-switch)) |
| 329 | () ; do nothing | 334 | (not (eq (key-binding viper-mouse-up-search-key-parsed) |
| 335 | 'viper-mouse-click-search-word)) | ||
| 336 | (and viper-xemacs-p (not (event-over-text-area-p click)))) | ||
| 337 | () ; do nothing, if binding isn't right or not over text | ||
| 330 | (let ((previous-search-string viper-s-string) | 338 | (let ((previous-search-string viper-s-string) |
| 331 | click-word click-count) | 339 | click-word click-count) |
| 332 | 340 | ||
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index f87f47a81f1..f0643339510 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el | |||
| @@ -952,10 +952,11 @@ remains buffer-local." | |||
| 952 | (read-key-sequence "Describe key briefly: "))))) | 952 | (read-key-sequence "Describe key briefly: "))))) |
| 953 | 953 | ||
| 954 | 954 | ||
| 955 | ;; Advice for use in find-file and read-file-name commands. | 955 | ;; This is now done in viper-minibuffer-exit-hook |
| 956 | (defadvice exit-minibuffer (before viper-exit-minibuffer-advice activate) | 956 | ;;;; Advice for use in find-file and read-file-name commands. |
| 957 | "Run `viper-minibuffer-exit-hook' just before exiting the minibuffer." | 957 | ;;(defadvice exit-minibuffer (before viper-exit-minibuffer-advice activate) |
| 958 | (run-hooks 'viper-minibuffer-exit-hook)) | 958 | ;; "Run `viper-minibuffer-exit-hook' just before exiting the minibuffer." |
| 959 | ;; (run-hooks 'viper-minibuffer-exit-hook)) | ||
| 959 | 960 | ||
| 960 | (defadvice find-file (before viper-add-suffix-advice activate) | 961 | (defadvice find-file (before viper-add-suffix-advice activate) |
| 961 | "Use `read-file-name' for reading arguments." | 962 | "Use `read-file-name' for reading arguments." |
| @@ -1011,7 +1012,8 @@ remains buffer-local." | |||
| 1011 | 1012 | ||
| 1012 | (defadvice read-file-name (around viper-suffix-advice activate) | 1013 | (defadvice read-file-name (around viper-suffix-advice activate) |
| 1013 | "Tell `exit-minibuffer' to run `viper-file-add-suffix' as a hook." | 1014 | "Tell `exit-minibuffer' to run `viper-file-add-suffix' as a hook." |
| 1014 | (let ((viper-minibuffer-exit-hook 'viper-file-add-suffix)) | 1015 | (let ((viper-minibuffer-exit-hook |
| 1016 | (append viper-minibuffer-exit-hook '(viper-file-add-suffix)))) | ||
| 1015 | ad-do-it)) | 1017 | ad-do-it)) |
| 1016 | 1018 | ||
| 1017 | (defadvice start-kbd-macro (after viper-kbd-advice activate) | 1019 | (defadvice start-kbd-macro (after viper-kbd-advice activate) |