356 |
|
|
357 |
(defun vcursor-bind-keys (var value) |
(defun vcursor-bind-keys (var value) |
358 |
"Alter the value of the variable VAR to VALUE, binding keys as required. |
"Alter the value of the variable VAR to VALUE, binding keys as required. |
359 |
VAR is usually vcursor-key-bindings. Normally this function is called |
VAR is usually `vcursor-key-bindings'. Normally this function is called |
360 |
on loading vcursor and from the customize package." |
on loading vcursor and from the customize package." |
361 |
(set var value) |
(set var value) |
362 |
(cond |
(cond |
464 |
|
|
465 |
(defcustom vcursor-key-bindings nil |
(defcustom vcursor-key-bindings nil |
466 |
"*How to bind keys when vcursor is loaded. |
"*How to bind keys when vcursor is loaded. |
467 |
If t, guess; if xterm, use bindings suitable for an X terminal; if |
If t, guess; if `xterm', use bindings suitable for an X terminal; if |
468 |
oemacs, use bindings which work on a PC with Oemacs. If nil, don't |
`oemacs', use bindings which work on a PC with Oemacs. If nil, don't |
469 |
define any key bindings. |
define any key bindings. |
470 |
|
|
471 |
Default is nil." |
Default is nil." |
514 |
|
|
515 |
(defvar vcursor-use-vcursor-map nil |
(defvar vcursor-use-vcursor-map nil |
516 |
"Non-nil if the vcursor map is mapped directly onto the main keymap. |
"Non-nil if the vcursor map is mapped directly onto the main keymap. |
517 |
See vcursor-toggle-vcursor-map.") |
See `vcursor-toggle-vcursor-map'.") |
518 |
(make-variable-buffer-local 'vcursor-use-vcursor-map) |
(make-variable-buffer-local 'vcursor-use-vcursor-map) |
519 |
|
|
520 |
(defvar vcursor-map nil "Keymap for vcursor command.") |
(defvar vcursor-map nil "Keymap for vcursor command.") |
575 |
|
|
576 |
With NEW-WIN non-nil, display the virtual cursor buffer in another |
With NEW-WIN non-nil, display the virtual cursor buffer in another |
577 |
window if the virtual cursor is not currently visible \(note, however, |
window if the virtual cursor is not currently visible \(note, however, |
578 |
that this function never changes window-point\). |
that this function never changes `window-point'\). |
579 |
|
|
580 |
With THIS-FRAME non-nil, don't search other frames for a new window |
With THIS-FRAME non-nil, don't search other frames for a new window |
581 |
\(though if the vcursor is already off-frame then its current window is |
\(though if the vcursor is already off-frame then its current window is |
674 |
(insert text)) |
(insert text)) |
675 |
) |
) |
676 |
|
|
677 |
(defun vcursor-relative-move (fn &rest args) |
(defun vcursor-relative-move (func &rest args) |
678 |
"Use FUNCTION with arbitrary ARG1 ... to move the virtual cursor. |
"Call FUNC with arbitrary ARGS ... to move the virtual cursor. |
679 |
|
|
680 |
This is called by most of the virtual-cursor motion commands." |
This is called by most of the virtual-cursor motion commands." |
681 |
(let (text opoint) |
(let (text opoint) |
682 |
(save-excursion |
(save-excursion |
683 |
(vcursor-locate) |
(vcursor-locate) |
684 |
(setq opoint (point)) |
(setq opoint (point)) |
685 |
(apply fn args) |
(apply func args) |
686 |
(and (eq opoint (point-max)) (eq opoint (point)) |
(and (eq opoint (point-max)) (eq opoint (point)) |
687 |
(signal 'end-of-buffer nil)) |
(signal 'end-of-buffer nil)) |
688 |
(vcursor-move (point)) |
(vcursor-move (point)) |
730 |
) |
) |
731 |
|
|
732 |
(defun vcursor-scroll-down (&optional n) |
(defun vcursor-scroll-down (&optional n) |
733 |
"Scroll down the vcursor window ARG lines or near-full screen if none. |
"Scroll down the vcursor window ARG lines or near full screen if none. |
734 |
The vcursor will always appear in an unselected window." |
The vcursor will always appear in an unselected window." |
735 |
|
|
736 |
(interactive "P") |
(interactive "P") |
791 |
(setq vcursor-last-command t) |
(setq vcursor-last-command t) |
792 |
) |
) |
793 |
|
|
794 |
(defun vcursor-get-char-count (fn &rest args) |
(defun vcursor-get-char-count (func &rest args) |
795 |
"Apply FN to ARG1 ... and return the number of characters moved. |
"Apply FUNC to ARGS ... and return the number of characters moved. |
796 |
Point is temporarily set to the virtual cursor position before FN is |
Point is temporarily set to the virtual cursor position before FUNC |
797 |
called. |
is called. |
798 |
|
|
799 |
This is called by most of the virtual-cursor copying commands to find |
This is called by most of the virtual-cursor copying commands to find |
800 |
out how much to copy." |
out how much to copy." |
803 |
(save-excursion |
(save-excursion |
804 |
(set-buffer (overlay-buffer vcursor-overlay)) |
(set-buffer (overlay-buffer vcursor-overlay)) |
805 |
(let ((start (goto-char (overlay-start vcursor-overlay)))) |
(let ((start (goto-char (overlay-start vcursor-overlay)))) |
806 |
(- (progn (apply fn args) (point)) start))) |
(- (progn (apply func args) (point)) start))) |
807 |
) |
) |
808 |
|
|
809 |
;; Make sure the virtual cursor is active. Unless arg is non-nil, |
;; Make sure the virtual cursor is active. Unless arg is non-nil, |
822 |
|
|
823 |
With a positive prefix ARG, the first window in cyclic order |
With a positive prefix ARG, the first window in cyclic order |
824 |
displaying the virtual cursor (or which was recently displaying the |
displaying the virtual cursor (or which was recently displaying the |
825 |
virtual cursor) will be deleted unless it's the selected |
virtual cursor) will be deleted unless it's the selected window. |
|
window. |
|
826 |
|
|
827 |
With a negative prefix argument, enable the virtual cursor: make it |
With a negative prefix argument, enable the virtual cursor: make it |
828 |
active at the same point as the real cursor. |
active at the same point as the real cursor. |
829 |
|
|
830 |
Copying mode is always turned off: the next use of the vcursor will |
Copying mode is always turned off: the next use of the vcursor will |
831 |
not copy text until you turn it on again." |
not copy text until you turn it on again." |
832 |
|
|
833 |
(interactive "P") |
(interactive "P") |
853 |
virtual cursor, or else after the current selected window. If there |
virtual cursor, or else after the current selected window. If there |
854 |
is no other window, the current window is split. |
is no other window, the current window is split. |
855 |
|
|
856 |
Arguments N and optional ALL-FRAMES are the same as with other-window. |
Arguments N and optional ALL-FRAMES are the same as with `other-window'. |
857 |
ALL-FRAMES is also used to decide whether to split the window." |
ALL-FRAMES is also used to decide whether to split the window." |
858 |
|
|
859 |
(interactive "p") |
(interactive "p") |
1041 |
|
|
1042 |
(defun vcursor-beginning-of-buffer (&optional arg) |
(defun vcursor-beginning-of-buffer (&optional arg) |
1043 |
"Move the virtual cursor to the beginning of its buffer. |
"Move the virtual cursor to the beginning of its buffer. |
1044 |
ARG is as for beginning-of-buffer." |
ARG is as for `beginning-of-buffer'." |
1045 |
(interactive "P") |
(interactive "P") |
1046 |
(vcursor-relative-move |
(vcursor-relative-move |
1047 |
(lambda (arg) |
(lambda (arg) |
1052 |
|
|
1053 |
(defun vcursor-end-of-buffer (&optional arg) |
(defun vcursor-end-of-buffer (&optional arg) |
1054 |
"Move the virtual cursor to the end of its buffer. |
"Move the virtual cursor to the end of its buffer. |
1055 |
ARG is as for end-of-buffer. |
ARG is as for `end-of-buffer'. |
1056 |
|
|
1057 |
Actually, the vcursor is moved to the second from last character or it |
Actually, the vcursor is moved to the second from last character or it |
1058 |
would be invisible." |
would be invisible." |