diff options
| author | Stefan Monnier | 2007-09-10 03:42:14 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-09-10 03:42:14 +0000 |
| commit | ad1412601fa7ead45bb7cd9aac2ba6a8642c2377 (patch) | |
| tree | 9b365929fe7d5950f7d3070780bdd2c628805c5f | |
| parent | 3643fbbcae6eb019575b8b722f4cb4f6847da4d0 (diff) | |
| download | emacs-ad1412601fa7ead45bb7cd9aac2ba6a8642c2377.tar.gz emacs-ad1412601fa7ead45bb7cd9aac2ba6a8642c2377.zip | |
Remove spurious * in docstrings.
(vcursor-map): Initialize in the declaration.
(vcursor-use-vcursor-map): Use define-minor-mode.
(vcursor-toggle-vcursor-map): Keep as an obsolete alias.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vcursor.el | 144 |
2 files changed, 67 insertions, 82 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6e084849de1..fadb8ab8744 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2007-09-10 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2007-09-10 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * vcursor.el: Remove spurious * in docstrings. | ||
| 4 | (vcursor-map): Initialize in the declaration. | ||
| 5 | (vcursor-use-vcursor-map): Use define-minor-mode. | ||
| 6 | (vcursor-toggle-vcursor-map): Keep as an obsolete alias. | ||
| 7 | |||
| 3 | * wid-browse.el (widget-browse-mode-map, widget-minor-mode-map): | 8 | * wid-browse.el (widget-browse-mode-map, widget-minor-mode-map): |
| 4 | Initialize in the declaration. | 9 | Initialize in the declaration. |
| 5 | (widget-minor-mode): Use define-minor-mode. | 10 | (widget-minor-mode): Use define-minor-mode. |
diff --git a/lisp/vcursor.el b/lisp/vcursor.el index b8c93f64ff5..a05bb3c60c5 100644 --- a/lisp/vcursor.el +++ b/lisp/vcursor.el | |||
| @@ -268,7 +268,7 @@ | |||
| 268 | ;; and also as usual \C-h in this map will list the key definitions, which | 268 | ;; and also as usual \C-h in this map will list the key definitions, which |
| 269 | ;; are designed to be easy to remember. | 269 | ;; are designed to be easy to remember. |
| 270 | ;; | 270 | ;; |
| 271 | ;; A special feature is provided by (vcursor-toggle-vcursor-map), bound | 271 | ;; A special feature is provided by (vcursor-use-vcursor-map), bound |
| 272 | ;; to t in that keymap. With this in effect, the main keymap | 272 | ;; to t in that keymap. With this in effect, the main keymap |
| 273 | ;; is overridden by the vcursor map, so keys like \C-p and so on | 273 | ;; is overridden by the vcursor map, so keys like \C-p and so on |
| 274 | ;; move the vcursor instead. Remember how to turn it off (type t), | 274 | ;; move the vcursor instead. Remember how to turn it off (type t), |
| @@ -336,7 +336,7 @@ | |||
| 336 | :group 'vcursor) | 336 | :group 'vcursor) |
| 337 | 337 | ||
| 338 | (defcustom vcursor-auto-disable nil | 338 | (defcustom vcursor-auto-disable nil |
| 339 | "*If non-nil, disable the virtual cursor after use. | 339 | "If non-nil, disable the virtual cursor after use. |
| 340 | Any non-vcursor command will force `vcursor-disable' to be called. | 340 | Any non-vcursor command will force `vcursor-disable' to be called. |
| 341 | If non-nil but not t, just make sure copying is toggled off, but don't | 341 | If non-nil but not t, just make sure copying is toggled off, but don't |
| 342 | disable the vcursor." | 342 | disable the vcursor." |
| @@ -344,7 +344,7 @@ disable the vcursor." | |||
| 344 | :group 'vcursor) | 344 | :group 'vcursor) |
| 345 | 345 | ||
| 346 | (defcustom vcursor-modifiers (list 'control 'shift) | 346 | (defcustom vcursor-modifiers (list 'control 'shift) |
| 347 | "*A list of modifiers that are used to define vcursor key bindings." | 347 | "A list of modifiers that are used to define vcursor key bindings." |
| 348 | :type '(repeat symbol) | 348 | :type '(repeat symbol) |
| 349 | :group 'vcursor) | 349 | :group 'vcursor) |
| 350 | 350 | ||
| @@ -464,7 +464,7 @@ on loading vcursor and from the customize package." | |||
| 464 | ))) | 464 | ))) |
| 465 | 465 | ||
| 466 | (defcustom vcursor-key-bindings nil | 466 | (defcustom vcursor-key-bindings nil |
| 467 | "*How to bind keys when vcursor is loaded. | 467 | "How to bind keys when vcursor is loaded. |
| 468 | If t, guess; if `xterm', use bindings suitable for an X terminal; if | 468 | If t, guess; if `xterm', use bindings suitable for an X terminal; if |
| 469 | `oemacs', use bindings which work on a PC with Oemacs. If nil, don't | 469 | `oemacs', use bindings which work on a PC with Oemacs. If nil, don't |
| 470 | define any key bindings. | 470 | define any key bindings. |
| @@ -476,7 +476,7 @@ Default is nil." | |||
| 476 | :version "20.3") | 476 | :version "20.3") |
| 477 | 477 | ||
| 478 | (defcustom vcursor-interpret-input nil | 478 | (defcustom vcursor-interpret-input nil |
| 479 | "*If non-nil, input from the vcursor is treated as interactive input. | 479 | "If non-nil, input from the vcursor is treated as interactive input. |
| 480 | This will cause text insertion to be much slower. Note that no special | 480 | This will cause text insertion to be much slower. Note that no special |
| 481 | interpretation of strings is done: \"\C-x\" is a string of four | 481 | interpretation of strings is done: \"\C-x\" is a string of four |
| 482 | characters. The default is simply to copy strings." | 482 | characters. The default is simply to copy strings." |
| @@ -506,49 +506,48 @@ scrolling set this. It is used by the `vcursor-auto-disable' code.") | |||
| 506 | ;; automatically handle any new commands using the primitives. | 506 | ;; automatically handle any new commands using the primitives. |
| 507 | 507 | ||
| 508 | (defcustom vcursor-copy-flag nil | 508 | (defcustom vcursor-copy-flag nil |
| 509 | "*Non-nil means moving vcursor should copy characters moved over to point." | 509 | "Non-nil means moving vcursor should copy characters moved over to point." |
| 510 | :type 'boolean | 510 | :type 'boolean |
| 511 | :group 'vcursor) | 511 | :group 'vcursor) |
| 512 | 512 | ||
| 513 | (defvar vcursor-temp-goal-column nil | 513 | (defvar vcursor-temp-goal-column nil |
| 514 | "Keeps track of temporary goal columns for the virtual cursor.") | 514 | "Keeps track of temporary goal columns for the virtual cursor.") |
| 515 | 515 | ||
| 516 | (defvar vcursor-use-vcursor-map nil | 516 | (defvar vcursor-map |
| 517 | "Non-nil if the vcursor map is mapped directly onto the main keymap. | 517 | (let ((map (make-sparse-keymap))) |
| 518 | See `vcursor-toggle-vcursor-map'.") | 518 | (define-key map "t" 'vcursor-use-vcursor-map) |
| 519 | (make-variable-buffer-local 'vcursor-use-vcursor-map) | 519 | |
| 520 | 520 | (define-key map "\C-p" 'vcursor-previous-line) | |
| 521 | (defvar vcursor-map nil "Keymap for vcursor command.") | 521 | (define-key map "\C-n" 'vcursor-next-line) |
| 522 | (define-prefix-command 'vcursor-map) | 522 | (define-key map "\C-b" 'vcursor-backward-char) |
| 523 | 523 | (define-key map "\C-f" 'vcursor-forward-char) | |
| 524 | (define-key vcursor-map "t" 'vcursor-toggle-vcursor-map) | 524 | |
| 525 | 525 | (define-key map "\r" 'vcursor-disable) | |
| 526 | (define-key vcursor-map "\C-p" 'vcursor-previous-line) | 526 | (define-key map " " 'vcursor-copy) |
| 527 | (define-key vcursor-map "\C-n" 'vcursor-next-line) | 527 | (define-key map "\C-y" 'vcursor-copy-word) |
| 528 | (define-key vcursor-map "\C-b" 'vcursor-backward-char) | 528 | (define-key map "\C-i" 'vcursor-toggle-copy) |
| 529 | (define-key vcursor-map "\C-f" 'vcursor-forward-char) | 529 | (define-key map "<" 'vcursor-beginning-of-buffer) |
| 530 | 530 | (define-key map ">" 'vcursor-end-of-buffer) | |
| 531 | (define-key vcursor-map "\r" 'vcursor-disable) | 531 | (define-key map "\M-v" 'vcursor-scroll-down) |
| 532 | (define-key vcursor-map " " 'vcursor-copy) | 532 | (define-key map "\C-v" 'vcursor-scroll-up) |
| 533 | (define-key vcursor-map "\C-y" 'vcursor-copy-word) | 533 | (define-key map "o" 'vcursor-other-window) |
| 534 | (define-key vcursor-map "\C-i" 'vcursor-toggle-copy) | 534 | (define-key map "g" 'vcursor-goto) |
| 535 | (define-key vcursor-map "<" 'vcursor-beginning-of-buffer) | 535 | (define-key map "x" 'vcursor-swap-point) |
| 536 | (define-key vcursor-map ">" 'vcursor-end-of-buffer) | 536 | (define-key map "\C-s" 'vcursor-isearch-forward) |
| 537 | (define-key vcursor-map "\M-v" 'vcursor-scroll-down) | 537 | (define-key map "\C-r" 'vcursor-isearch-backward) |
| 538 | (define-key vcursor-map "\C-v" 'vcursor-scroll-up) | 538 | (define-key map "\C-a" 'vcursor-beginning-of-line) |
| 539 | (define-key vcursor-map "o" 'vcursor-other-window) | 539 | (define-key map "\C-e" 'vcursor-end-of-line) |
| 540 | (define-key vcursor-map "g" 'vcursor-goto) | 540 | (define-key map "\M-w" 'vcursor-forward-word) |
| 541 | (define-key vcursor-map "x" 'vcursor-swap-point) | 541 | (define-key map "\M-b" 'vcursor-backward-word) |
| 542 | (define-key vcursor-map "\C-s" 'vcursor-isearch-forward) | 542 | (define-key map "\M-l" 'vcursor-copy-line) |
| 543 | (define-key vcursor-map "\C-r" 'vcursor-isearch-backward) | 543 | (define-key map "c" 'vcursor-compare-windows) |
| 544 | (define-key vcursor-map "\C-a" 'vcursor-beginning-of-line) | 544 | (define-key map "k" 'vcursor-execute-key) |
| 545 | (define-key vcursor-map "\C-e" 'vcursor-end-of-line) | 545 | (define-key map "\M-x" 'vcursor-execute-command) |
| 546 | (define-key vcursor-map "\M-w" 'vcursor-forward-word) | 546 | map) |
| 547 | (define-key vcursor-map "\M-b" 'vcursor-backward-word) | 547 | "Keymap for vcursor command.") |
| 548 | (define-key vcursor-map "\M-l" 'vcursor-copy-line) | 548 | ;; This seems unused, but it was done as part of define-prefix-command, |
| 549 | (define-key vcursor-map "c" 'vcursor-compare-windows) | 549 | ;; so let's keep it for now. |
| 550 | (define-key vcursor-map "k" 'vcursor-execute-key) | 550 | (fset 'vcursor-map vcursor-map) |
| 551 | (define-key vcursor-map "\M-x" 'vcursor-execute-command) | ||
| 552 | 551 | ||
| 553 | ;; If vcursor-key-bindings is already set on loading, bind the keys now. | 552 | ;; If vcursor-key-bindings is already set on loading, bind the keys now. |
| 554 | ;; This hybrid way of doing it retains compatibility while allowing | 553 | ;; This hybrid way of doing it retains compatibility while allowing |
| @@ -716,8 +715,7 @@ not be visible otherwise, display it in another window." | |||
| 716 | (interactive) | 715 | (interactive) |
| 717 | (let ((buf (current-buffer)) (here (point)) (win (selected-window))) | 716 | (let ((buf (current-buffer)) (here (point)) (win (selected-window))) |
| 718 | (vcursor-goto) ; will disable the vcursor | 717 | (vcursor-goto) ; will disable the vcursor |
| 719 | (save-excursion | 718 | (with-current-buffer buf |
| 720 | (set-buffer buf) | ||
| 721 | (setq vcursor-window win) | 719 | (setq vcursor-window win) |
| 722 | (vcursor-move here))) | 720 | (vcursor-move here))) |
| 723 | ) | 721 | ) |
| @@ -801,8 +799,7 @@ This is called by most of the virtual-cursor copying commands to find | |||
| 801 | out how much to copy." | 799 | out how much to copy." |
| 802 | 800 | ||
| 803 | (vcursor-check) | 801 | (vcursor-check) |
| 804 | (save-excursion | 802 | (with-current-buffer (overlay-buffer vcursor-overlay) |
| 805 | (set-buffer (overlay-buffer vcursor-overlay)) | ||
| 806 | (let ((start (goto-char (overlay-start vcursor-overlay)))) | 803 | (let ((start (goto-char (overlay-start vcursor-overlay)))) |
| 807 | (- (progn (apply func args) (point)) start))) | 804 | (- (progn (apply func args) (point)) start))) |
| 808 | ) | 805 | ) |
| @@ -817,6 +814,16 @@ out how much to copy." | |||
| 817 | (t (error "The virtual cursor is not active now"))) | 814 | (t (error "The virtual cursor is not active now"))) |
| 818 | ) | 815 | ) |
| 819 | 816 | ||
| 817 | (define-minor-mode vcursor-use-vcursor-map | ||
| 818 | "Toggle the state of the vcursor key map. | ||
| 819 | When on, the keys defined in it are mapped directly on top of the main | ||
| 820 | keymap, allowing you to move the vcursor with ordinary motion keys. | ||
| 821 | An indication \"!VC\" appears in the mode list. The effect is | ||
| 822 | local to the current buffer. | ||
| 823 | Disabling the vcursor automatically turns this off." | ||
| 824 | :keymap vcursor-map | ||
| 825 | :lighter " !VC") | ||
| 826 | |||
| 820 | (defun vcursor-disable (&optional arg) | 827 | (defun vcursor-disable (&optional arg) |
| 821 | "Disable the virtual cursor. | 828 | "Disable the virtual cursor. |
| 822 | Next time you use it, it will start from point. | 829 | Next time you use it, it will start from point. |
| @@ -844,7 +851,7 @@ not copy text until you turn it on again." | |||
| 844 | ((and arg (< (prefix-numeric-value arg) 0)) | 851 | ((and arg (< (prefix-numeric-value arg) 0)) |
| 845 | (vcursor-move (point)) | 852 | (vcursor-move (point)) |
| 846 | (setq vcursor-window (selected-window))) | 853 | (setq vcursor-window (selected-window))) |
| 847 | (vcursor-use-vcursor-map (vcursor-toggle-vcursor-map 0))) | 854 | (vcursor-use-vcursor-map (vcursor-use-vcursor-map 0))) |
| 848 | (setq vcursor-copy-flag nil) | 855 | (setq vcursor-copy-flag nil) |
| 849 | ) | 856 | ) |
| 850 | 857 | ||
| @@ -867,8 +874,7 @@ ALL-FRAMES is also used to decide whether to split the window." | |||
| 867 | ;; We don't use fancy vcursor-find-window trickery, since we're | 874 | ;; We don't use fancy vcursor-find-window trickery, since we're |
| 868 | ;; quite happy to have the vcursor cycle back into the current | 875 | ;; quite happy to have the vcursor cycle back into the current |
| 869 | ;; window. | 876 | ;; window. |
| 870 | (let ((sw (selected-window)) | 877 | (let ((win (vcursor-find-window nil nil (not all-frames)))) |
| 871 | (win (vcursor-find-window nil nil (not all-frames)))) | ||
| 872 | (if win (select-window win)) | 878 | (if win (select-window win)) |
| 873 | ;; else start from here | 879 | ;; else start from here |
| 874 | (other-window n all-frames) | 880 | (other-window n all-frames) |
| @@ -891,7 +897,7 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored." | |||
| 891 | ;; (vcursor-window-funcall 'compare-windows arg) | 897 | ;; (vcursor-window-funcall 'compare-windows arg) |
| 892 | (require 'compare-w) | 898 | (require 'compare-w) |
| 893 | (let* (p1 p2 maxp1 maxp2 b1 b2 w2 | 899 | (let* (p1 p2 maxp1 maxp2 b1 b2 w2 |
| 894 | success size | 900 | success |
| 895 | (opoint1 (point)) | 901 | (opoint1 (point)) |
| 896 | opoint2 | 902 | opoint2 |
| 897 | (skip-whitespace (if ignore-whitespace | 903 | (skip-whitespace (if ignore-whitespace |
| @@ -905,8 +911,7 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored." | |||
| 905 | (setq p2 (point) b2 (current-buffer))) | 911 | (setq p2 (point) b2 (current-buffer))) |
| 906 | (setq opoint2 p2) | 912 | (setq opoint2 p2) |
| 907 | (setq maxp1 (point-max)) | 913 | (setq maxp1 (point-max)) |
| 908 | (save-excursion | 914 | (with-current-buffer b2 |
| 909 | (set-buffer b2) | ||
| 910 | (setq maxp2 (point-max))) | 915 | (setq maxp2 (point-max))) |
| 911 | 916 | ||
| 912 | (setq success t) | 917 | (setq success t) |
| @@ -921,7 +926,7 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored." | |||
| 921 | 926 | ||
| 922 | (and skip-whitespace | 927 | (and skip-whitespace |
| 923 | (save-excursion | 928 | (save-excursion |
| 924 | (let (p1a p2a w1 w2 result1 result2) | 929 | (let (p1a p2a result1 result2) |
| 925 | (setq result1 | 930 | (setq result1 |
| 926 | (if (stringp skip-whitespace) | 931 | (if (stringp skip-whitespace) |
| 927 | (compare-windows-skip-whitespace opoint1) | 932 | (compare-windows-skip-whitespace opoint1) |
| @@ -1096,8 +1101,7 @@ is called interactively, so prefix argument etc. are usable." | |||
| 1096 | (interactive "p") | 1101 | (interactive "p") |
| 1097 | (vcursor-check) | 1102 | (vcursor-check) |
| 1098 | (vcursor-insert | 1103 | (vcursor-insert |
| 1099 | (save-excursion | 1104 | (with-current-buffer (overlay-buffer vcursor-overlay) |
| 1100 | (set-buffer (overlay-buffer vcursor-overlay)) | ||
| 1101 | (let* ((ostart (overlay-start vcursor-overlay)) | 1105 | (let* ((ostart (overlay-start vcursor-overlay)) |
| 1102 | (end (+ ostart arg))) | 1106 | (end (+ ostart arg))) |
| 1103 | (prog1 | 1107 | (prog1 |
| @@ -1126,32 +1130,8 @@ line is treated like ordinary characters." | |||
| 1126 | (vcursor-copy (if (or (= count 0) arg) (1+ count) count))) | 1130 | (vcursor-copy (if (or (= count 0) arg) (1+ count) count))) |
| 1127 | ) | 1131 | ) |
| 1128 | 1132 | ||
| 1129 | (defun vcursor-toggle-vcursor-map (&optional force noredisp) | 1133 | (define-obsolete-function-alias |
| 1130 | "Toggle the state of the vcursor key map. | 1134 | 'vcursor-toggle-vcursor-map 'vcursor-use-vcursor-map "23.1") |
| 1131 | When on, the keys defined in it are mapped directly on top of the main | ||
| 1132 | keymap, allowing you to move the vcursor with ordinary motion keys. | ||
| 1133 | An indication \"!VC\" appears in the mode list. The effect is | ||
| 1134 | local to the current buffer. | ||
| 1135 | With prefix FORCE, turn on, or off if it is 0. | ||
| 1136 | With NOREDISP, don't force redisplay. | ||
| 1137 | Disabling the vcursor automatically turns this off." | ||
| 1138 | (interactive "P") | ||
| 1139 | (let ((new (cond ((not force) (not vcursor-use-vcursor-map)) | ||
| 1140 | ((eq force 0) nil) | ||
| 1141 | (t)))) | ||
| 1142 | (or (eq new vcursor-use-vcursor-map) | ||
| 1143 | (progn | ||
| 1144 | (setq vcursor-use-vcursor-map new) | ||
| 1145 | (or (assq 'vcursor-use-vcursor-map minor-mode-map-alist) | ||
| 1146 | (setq minor-mode-map-alist | ||
| 1147 | (cons (cons 'vcursor-use-vcursor-map vcursor-map) | ||
| 1148 | minor-mode-map-alist))) | ||
| 1149 | (or (assq 'vcursor-use-vcursor-map minor-mode-alist) | ||
| 1150 | (setq minor-mode-alist | ||
| 1151 | (cons (list 'vcursor-use-vcursor-map " !VC") | ||
| 1152 | minor-mode-alist))) | ||
| 1153 | (or noredisp (redraw-display))))) | ||
| 1154 | ) | ||
| 1155 | 1135 | ||
| 1156 | (defun vcursor-post-command () | 1136 | (defun vcursor-post-command () |
| 1157 | (and vcursor-auto-disable (not vcursor-last-command) | 1137 | (and vcursor-auto-disable (not vcursor-last-command) |
| @@ -1166,5 +1146,5 @@ Disabling the vcursor automatically turns this off." | |||
| 1166 | 1146 | ||
| 1167 | (provide 'vcursor) | 1147 | (provide 'vcursor) |
| 1168 | 1148 | ||
| 1169 | ;;; arch-tag: cdfe1cdc-2c46-4046-88e4-ed57d20f7aca | 1149 | ;; arch-tag: cdfe1cdc-2c46-4046-88e4-ed57d20f7aca |
| 1170 | ;;; vcursor.el ends here | 1150 | ;;; vcursor.el ends here |