diff options
| author | Stefan Monnier | 2021-04-03 14:15:43 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2021-04-03 14:15:43 -0400 |
| commit | ebc2b78c8bffc40f3bc863d333dccc0b26def3b4 (patch) | |
| tree | e085cbfb3d1c56f90dc44b96e94fec637867d126 | |
| parent | 4eca3bd8df9a1092d322eb6af7108a3ea27c21b1 (diff) | |
| download | emacs-ebc2b78c8bffc40f3bc863d333dccc0b26def3b4.tar.gz emacs-ebc2b78c8bffc40f3bc863d333dccc0b26def3b4.zip | |
* lisp/vcursor.el: Use lexical-binding
Remove redundant `:group` args.
(vcursor): Remove unused var declaration.
| -rw-r--r-- | lisp/vcursor.el | 298 |
1 files changed, 146 insertions, 152 deletions
diff --git a/lisp/vcursor.el b/lisp/vcursor.el index 595a25381ab..e219dc2d1a5 100644 --- a/lisp/vcursor.el +++ b/lisp/vcursor.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; vcursor.el --- manipulate an alternative ("virtual") cursor | 1 | ;;; vcursor.el --- manipulate an alternative ("virtual") cursor -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1996, 1998, 2001-2021 Free Software Foundation, | 3 | ;; Copyright (C) 1994, 1996, 1998, 2001-2021 Free Software Foundation, |
| 4 | ;; Inc. | 4 | ;; Inc. |
| @@ -27,24 +27,24 @@ | |||
| 27 | ;; Latest changes | 27 | ;; Latest changes |
| 28 | ;; ============== | 28 | ;; ============== |
| 29 | ;; | 29 | ;; |
| 30 | ;; - *IMPORTANT* vcursor-key-bindings is now nil by default, to avoid | 30 | ;; - *IMPORTANT* `vcursor-key-bindings' is now nil by default, to avoid |
| 31 | ;; side-effects when the package is loaded. This means no keys are | 31 | ;; side-effects when the package is loaded. This means no keys are |
| 32 | ;; bound by default. Use customize to change it to t to restore | 32 | ;; bound by default. Use customize to change it to t to restore |
| 33 | ;; the old behavior. (If you do it by hand in .emacs, it | 33 | ;; the old behavior. (If you do it by hand in .emacs, it |
| 34 | ;; must come before vcursor is loaded.) | 34 | ;; must come before vcursor is loaded.) |
| 35 | ;; - You can alter the main variables and the vcursor face via | 35 | ;; - You can alter the main variables and the vcursor face via |
| 36 | ;; M-x customize: go to the Editing group and find Vcursor. | 36 | ;; M-x customize: go to the Editing group and find Vcursor. |
| 37 | ;; - vcursor-auto-disable can now be 'copy (actually any value not nil | 37 | ;; - `vcursor-auto-disable' can now be 'copy (actually any value not nil |
| 38 | ;; or t), which means that copying from the vcursor will be turned | 38 | ;; or t), which means that copying from the vcursor will be turned |
| 39 | ;; off after any operation not involving the vcursor, but the | 39 | ;; off after any operation not involving the vcursor, but the |
| 40 | ;; vcursor itself will be left alone. | 40 | ;; vcursor itself will be left alone. |
| 41 | ;; - works on dumb terminals | 41 | ;; - works on dumb terminals |
| 42 | ;; - new keymap vcursor-map for binding to a prefix key | 42 | ;; - new keymap vcursor-map for binding to a prefix key |
| 43 | ;; - vcursor-compare-windows substantially improved | 43 | ;; - `vcursor-compare-windows' substantially improved |
| 44 | ;; - vcursor-execute-{key,command} much better about using the | 44 | ;; - `vcursor-execute-{key,command}' much better about using the |
| 45 | ;; right keymaps and arranging for the correct windows to be used | 45 | ;; right keymaps and arranging for the correct windows to be used |
| 46 | ;; - vcursor-window-funcall can call functions interactively | 46 | ;; - `vcursor-window-funcall' can call functions interactively |
| 47 | ;; - vcursor-interpret-input for special effects | 47 | ;; - `vcursor-interpret-input' for special effects |
| 48 | ;; | 48 | ;; |
| 49 | ;; Introduction | 49 | ;; Introduction |
| 50 | ;; ============ | 50 | ;; ============ |
| @@ -326,21 +326,18 @@ | |||
| 326 | (defface vcursor | 326 | (defface vcursor |
| 327 | '((((class color)) (:foreground "blue" :background "cyan" :underline t)) | 327 | '((((class color)) (:foreground "blue" :background "cyan" :underline t)) |
| 328 | (t (:inverse-video t :underline t))) | 328 | (t (:inverse-video t :underline t))) |
| 329 | "Face for the virtual cursor." | 329 | "Face for the virtual cursor.") |
| 330 | :group 'vcursor) | ||
| 331 | 330 | ||
| 332 | (defcustom vcursor-auto-disable nil | 331 | (defcustom vcursor-auto-disable nil |
| 333 | "If non-nil, disable the virtual cursor after use. | 332 | "If non-nil, disable the virtual cursor after use. |
| 334 | Any non-vcursor command will force `vcursor-disable' to be called. | 333 | Any non-vcursor command will force `vcursor-disable' to be called. |
| 335 | If non-nil but not t, just make sure copying is toggled off, but don't | 334 | If non-nil but not t, just make sure copying is toggled off, but don't |
| 336 | disable the vcursor." | 335 | disable the vcursor." |
| 337 | :type '(choice (const t) (const nil) (const copy)) | 336 | :type '(choice (const t) (const nil) (const copy))) |
| 338 | :group 'vcursor) | ||
| 339 | 337 | ||
| 340 | (defcustom vcursor-modifiers (list 'control 'shift) | 338 | (defcustom vcursor-modifiers (list 'control 'shift) |
| 341 | "A list of modifiers that are used to define vcursor key bindings." | 339 | "A list of modifiers that are used to define vcursor key bindings." |
| 342 | :type '(repeat symbol) | 340 | :type '(repeat symbol)) |
| 343 | :group 'vcursor) | ||
| 344 | 341 | ||
| 345 | ;; Needed for defcustom, must be up here | 342 | ;; Needed for defcustom, must be up here |
| 346 | (defun vcursor-cs-binding (base &optional meta) | 343 | (defun vcursor-cs-binding (base &optional meta) |
| @@ -349,112 +346,114 @@ disable the vcursor." | |||
| 349 | (cons 'meta key) | 346 | (cons 'meta key) |
| 350 | key)))) | 347 | key)))) |
| 351 | 348 | ||
| 349 | ;; (defvar vcursor) | ||
| 350 | |||
| 352 | (defun vcursor-bind-keys (var value) | 351 | (defun vcursor-bind-keys (var value) |
| 353 | "Alter the value of the variable VAR to VALUE, binding keys as required. | 352 | "Alter the value of the variable VAR to VALUE, binding keys as required. |
| 354 | VAR is usually `vcursor-key-bindings'. Normally this function is called | 353 | VAR is usually `vcursor-key-bindings'. Normally this function is called |
| 355 | on loading vcursor and from the customize package." | 354 | on loading vcursor and from the customize package." |
| 356 | (set var value) | 355 | (set var value) |
| 357 | (cond | 356 | (cond |
| 358 | ((not value));; don't set any key bindings | 357 | ((not value)) ;; Don't set any key bindings. |
| 359 | ((or (eq value 'oemacs) | 358 | ((or (eq value 'oemacs) |
| 360 | (and (eq value t) (fboundp 'oemacs-version))) | 359 | (and (eq value t) (fboundp 'oemacs-version))) |
| 361 | (global-set-key [C-f1] 'vcursor-toggle-copy) | 360 | (global-set-key [C-f1] #'vcursor-toggle-copy) |
| 362 | (global-set-key [C-f2] 'vcursor-copy) | 361 | (global-set-key [C-f2] #'vcursor-copy) |
| 363 | (global-set-key [C-f3] 'vcursor-copy-word) | 362 | (global-set-key [C-f3] #'vcursor-copy-word) |
| 364 | (global-set-key [C-f4] 'vcursor-copy-line) | 363 | (global-set-key [C-f4] #'vcursor-copy-line) |
| 365 | 364 | ||
| 366 | (global-set-key [S-f1] 'vcursor-disable) | 365 | (global-set-key [S-f1] #'vcursor-disable) |
| 367 | (global-set-key [S-f2] 'vcursor-other-window) | 366 | (global-set-key [S-f2] #'vcursor-other-window) |
| 368 | (global-set-key [S-f3] 'vcursor-goto) | 367 | (global-set-key [S-f3] #'vcursor-goto) |
| 369 | (global-set-key [S-f4] 'vcursor-swap-point) | 368 | (global-set-key [S-f4] #'vcursor-swap-point) |
| 370 | 369 | ||
| 371 | (global-set-key [C-f5] 'vcursor-backward-char) | 370 | (global-set-key [C-f5] #'vcursor-backward-char) |
| 372 | (global-set-key [C-f6] 'vcursor-previous-line) | 371 | (global-set-key [C-f6] #'vcursor-previous-line) |
| 373 | (global-set-key [C-f7] 'vcursor-next-line) | 372 | (global-set-key [C-f7] #'vcursor-next-line) |
| 374 | (global-set-key [C-f8] 'vcursor-forward-char) | 373 | (global-set-key [C-f8] #'vcursor-forward-char) |
| 375 | 374 | ||
| 376 | (global-set-key [M-f5] 'vcursor-beginning-of-line) | 375 | (global-set-key [M-f5] #'vcursor-beginning-of-line) |
| 377 | (global-set-key [M-f6] 'vcursor-backward-word) | 376 | (global-set-key [M-f6] #'vcursor-backward-word) |
| 378 | (global-set-key [M-f6] 'vcursor-forward-word) | 377 | (global-set-key [M-f6] #'vcursor-forward-word) |
| 379 | (global-set-key [M-f8] 'vcursor-end-of-line) | 378 | (global-set-key [M-f8] #'vcursor-end-of-line) |
| 380 | 379 | ||
| 381 | (global-set-key [S-f5] 'vcursor-beginning-of-buffer) | 380 | (global-set-key [S-f5] #'vcursor-beginning-of-buffer) |
| 382 | (global-set-key [S-f6] 'vcursor-scroll-down) | 381 | (global-set-key [S-f6] #'vcursor-scroll-down) |
| 383 | (global-set-key [S-f7] 'vcursor-scroll-up) | 382 | (global-set-key [S-f7] #'vcursor-scroll-up) |
| 384 | (global-set-key [S-f8] 'vcursor-end-of-buffer) | 383 | (global-set-key [S-f8] #'vcursor-end-of-buffer) |
| 385 | 384 | ||
| 386 | (global-set-key [C-f9] 'vcursor-isearch-forward) | 385 | (global-set-key [C-f9] #'vcursor-isearch-forward) |
| 387 | 386 | ||
| 388 | (global-set-key [S-f9] 'vcursor-execute-key) | 387 | (global-set-key [S-f9] #'vcursor-execute-key) |
| 389 | (global-set-key [S-f10] 'vcursor-execute-command) | 388 | (global-set-key [S-f10] #'vcursor-execute-command) |
| 390 | 389 | ||
| 391 | ;;; Partial dictionary of Oemacs key sequences for you to roll your own, | 390 | ;; Partial dictionary of Oemacs key sequences for you to roll your own, |
| 392 | ;;; e.g C-S-up: (global-set-key "\M-[\C-f\M-\C-m" 'vcursor-previous-line) | 391 | ;; e.g C-S-up: (global-set-key "\M-[\C-f\M-\C-m" 'vcursor-previous-line) |
| 393 | ;;; Sequence: Sends: | 392 | ;; Sequence: Sends: |
| 394 | ;;; "\M-[\C-f\M-\C-m" C-S-up | 393 | ;; "\M-[\C-f\M-\C-m" C-S-up |
| 395 | ;;; "\M-[\C-f\M-\C-q" C-S-down | 394 | ;; "\M-[\C-f\M-\C-q" C-S-down |
| 396 | ;;; "\M-[\C-fs" C-S-left | 395 | ;; "\M-[\C-fs" C-S-left |
| 397 | ;;; "\M-[\C-ft" C-S-right | 396 | ;; "\M-[\C-ft" C-S-right |
| 398 | ;;; | 397 | ;; |
| 399 | ;;; "\M-[\C-fw" C-S-home | 398 | ;; "\M-[\C-fw" C-S-home |
| 400 | ;;; "\M-[\C-b\C-o" S-tab | 399 | ;; "\M-[\C-b\C-o" S-tab |
| 401 | ;;; "\M-[\C-f\M-\C-r" C-S-insert | 400 | ;; "\M-[\C-f\M-\C-r" C-S-insert |
| 402 | ;;; "\M-[\C-fu" C-S-end | 401 | ;; "\M-[\C-fu" C-S-end |
| 403 | ;;; "\M-[\C-f\M-\C-s" C-S-delete | 402 | ;; "\M-[\C-f\M-\C-s" C-S-delete |
| 404 | ;;; "\M-[\C-f\M-\C-d" C-S-prior | 403 | ;; "\M-[\C-f\M-\C-d" C-S-prior |
| 405 | ;;; "\M-[\C-fv" C-S-next | 404 | ;; "\M-[\C-fv" C-S-next |
| 406 | ;;; | 405 | ;; |
| 407 | ;;; "\M-[\C-f^" C-S-f1 | 406 | ;; "\M-[\C-f^" C-S-f1 |
| 408 | ;;; "\M-[\C-f_" C-S-f2 | 407 | ;; "\M-[\C-f_" C-S-f2 |
| 409 | ;;; "\M-[\C-f`" C-S-f3 | 408 | ;; "\M-[\C-f`" C-S-f3 |
| 410 | ;;; "\M-[\C-fa" C-S-f4 | 409 | ;; "\M-[\C-fa" C-S-f4 |
| 411 | ;;; "\M-[\C-fb" C-S-f5 | 410 | ;; "\M-[\C-fb" C-S-f5 |
| 412 | ;;; "\M-[\C-fc" C-S-f6 | 411 | ;; "\M-[\C-fc" C-S-f6 |
| 413 | ;;; "\M-[\C-fd" C-S-f7 | 412 | ;; "\M-[\C-fd" C-S-f7 |
| 414 | ;;; "\M-[\C-fe" C-S-f8 | 413 | ;; "\M-[\C-fe" C-S-f8 |
| 415 | ;;; "\M-[\C-ff" C-S-f9 | 414 | ;; "\M-[\C-ff" C-S-f9 |
| 416 | ;;; "\M-[\C-fg" C-S-f10 | 415 | ;; "\M-[\C-fg" C-S-f10 |
| 417 | ) | 416 | ) |
| 418 | (t | 417 | (t |
| 419 | (global-set-key (vcursor-cs-binding "up") 'vcursor-previous-line) | 418 | (global-set-key (vcursor-cs-binding "up") #'vcursor-previous-line) |
| 420 | (global-set-key (vcursor-cs-binding "down") 'vcursor-next-line) | 419 | (global-set-key (vcursor-cs-binding "down") #'vcursor-next-line) |
| 421 | (global-set-key (vcursor-cs-binding "left") 'vcursor-backward-char) | 420 | (global-set-key (vcursor-cs-binding "left") #'vcursor-backward-char) |
| 422 | (global-set-key (vcursor-cs-binding "right") 'vcursor-forward-char) | 421 | (global-set-key (vcursor-cs-binding "right") #'vcursor-forward-char) |
| 423 | 422 | ||
| 424 | (global-set-key (vcursor-cs-binding "return") 'vcursor-disable) | 423 | (global-set-key (vcursor-cs-binding "return") #'vcursor-disable) |
| 425 | (global-set-key (vcursor-cs-binding "insert") 'vcursor-copy) | 424 | (global-set-key (vcursor-cs-binding "insert") #'vcursor-copy) |
| 426 | (global-set-key (vcursor-cs-binding "delete") 'vcursor-copy-word) | 425 | (global-set-key (vcursor-cs-binding "delete") #'vcursor-copy-word) |
| 427 | (global-set-key (vcursor-cs-binding "remove") 'vcursor-copy-word) | 426 | (global-set-key (vcursor-cs-binding "remove") #'vcursor-copy-word) |
| 428 | (global-set-key (vcursor-cs-binding "tab") 'vcursor-toggle-copy) | 427 | (global-set-key (vcursor-cs-binding "tab") #'vcursor-toggle-copy) |
| 429 | (global-set-key (vcursor-cs-binding "backtab") 'vcursor-toggle-copy) | 428 | (global-set-key (vcursor-cs-binding "backtab") #'vcursor-toggle-copy) |
| 430 | (global-set-key (vcursor-cs-binding "home") 'vcursor-beginning-of-buffer) | 429 | (global-set-key (vcursor-cs-binding "home") #'vcursor-beginning-of-buffer) |
| 431 | (global-set-key (vcursor-cs-binding "up" t) 'vcursor-beginning-of-buffer) | 430 | (global-set-key (vcursor-cs-binding "up" t) #'vcursor-beginning-of-buffer) |
| 432 | (global-set-key (vcursor-cs-binding "end") 'vcursor-end-of-buffer) | 431 | (global-set-key (vcursor-cs-binding "end") #'vcursor-end-of-buffer) |
| 433 | (global-set-key (vcursor-cs-binding "down" t) 'vcursor-end-of-buffer) | 432 | (global-set-key (vcursor-cs-binding "down" t) #'vcursor-end-of-buffer) |
| 434 | (global-set-key (vcursor-cs-binding "prior") 'vcursor-scroll-down) | 433 | (global-set-key (vcursor-cs-binding "prior") #'vcursor-scroll-down) |
| 435 | (global-set-key (vcursor-cs-binding "next") 'vcursor-scroll-up) | 434 | (global-set-key (vcursor-cs-binding "next") #'vcursor-scroll-up) |
| 436 | 435 | ||
| 437 | (global-set-key (vcursor-cs-binding "f6") 'vcursor-other-window) | 436 | (global-set-key (vcursor-cs-binding "f6") #'vcursor-other-window) |
| 438 | (global-set-key (vcursor-cs-binding "f7") 'vcursor-goto) | 437 | (global-set-key (vcursor-cs-binding "f7") #'vcursor-goto) |
| 439 | 438 | ||
| 440 | (global-set-key (vcursor-cs-binding "select") | 439 | (global-set-key (vcursor-cs-binding "select") |
| 441 | 'vcursor-swap-point) ; DEC keyboards | 440 | #'vcursor-swap-point) ; DEC keyboards |
| 442 | (global-set-key (vcursor-cs-binding "tab" t) 'vcursor-swap-point) | 441 | (global-set-key (vcursor-cs-binding "tab" t) #'vcursor-swap-point) |
| 443 | 442 | ||
| 444 | (global-set-key (vcursor-cs-binding "find") | 443 | (global-set-key (vcursor-cs-binding "find") |
| 445 | 'vcursor-isearch-forward) ; DEC keyboards | 444 | #'vcursor-isearch-forward) ; DEC keyboards |
| 446 | (global-set-key (vcursor-cs-binding "f8") 'vcursor-isearch-forward) | 445 | (global-set-key (vcursor-cs-binding "f8") #'vcursor-isearch-forward) |
| 447 | 446 | ||
| 448 | (global-set-key (vcursor-cs-binding "left" t) 'vcursor-beginning-of-line) | 447 | (global-set-key (vcursor-cs-binding "left" t) #'vcursor-beginning-of-line) |
| 449 | (global-set-key (vcursor-cs-binding "right" t) 'vcursor-end-of-line) | 448 | (global-set-key (vcursor-cs-binding "right" t) #'vcursor-end-of-line) |
| 450 | 449 | ||
| 451 | (global-set-key (vcursor-cs-binding "prior" t) 'vcursor-backward-word) | 450 | (global-set-key (vcursor-cs-binding "prior" t) #'vcursor-backward-word) |
| 452 | (global-set-key (vcursor-cs-binding "next" t) 'vcursor-forward-word) | 451 | (global-set-key (vcursor-cs-binding "next" t) #'vcursor-forward-word) |
| 453 | 452 | ||
| 454 | (global-set-key (vcursor-cs-binding "return" t) 'vcursor-copy-line) | 453 | (global-set-key (vcursor-cs-binding "return" t) #'vcursor-copy-line) |
| 455 | 454 | ||
| 456 | (global-set-key (vcursor-cs-binding "f9") 'vcursor-execute-key) | 455 | (global-set-key (vcursor-cs-binding "f9") #'vcursor-execute-key) |
| 457 | (global-set-key (vcursor-cs-binding "f10") 'vcursor-execute-command) | 456 | (global-set-key (vcursor-cs-binding "f10") #'vcursor-execute-command) |
| 458 | ))) | 457 | ))) |
| 459 | 458 | ||
| 460 | (defcustom vcursor-key-bindings nil | 459 | (defcustom vcursor-key-bindings nil |
| @@ -465,8 +464,7 @@ define any key bindings. | |||
| 465 | 464 | ||
| 466 | Default is nil." | 465 | Default is nil." |
| 467 | :type '(choice (const t) (const nil) (const xterm) (const oemacs)) | 466 | :type '(choice (const t) (const nil) (const xterm) (const oemacs)) |
| 468 | :group 'vcursor | 467 | :set #'vcursor-bind-keys |
| 469 | :set 'vcursor-bind-keys | ||
| 470 | :version "20.3") | 468 | :version "20.3") |
| 471 | 469 | ||
| 472 | (defcustom vcursor-interpret-input nil | 470 | (defcustom vcursor-interpret-input nil |
| @@ -475,13 +473,11 @@ This will cause text insertion to be much slower. Note that no special | |||
| 475 | interpretation of strings is done: \"\C-x\" is a string of four | 473 | interpretation of strings is done: \"\C-x\" is a string of four |
| 476 | characters. The default is simply to copy strings." | 474 | characters. The default is simply to copy strings." |
| 477 | :type 'boolean | 475 | :type 'boolean |
| 478 | :group 'vcursor | ||
| 479 | :version "20.3") | 476 | :version "20.3") |
| 480 | 477 | ||
| 481 | (defcustom vcursor-string "**>" | 478 | (defcustom vcursor-string "**>" |
| 482 | "String used to show the vcursor position on dumb terminals." | 479 | "String used to show the vcursor position on dumb terminals." |
| 483 | :type 'string | 480 | :type 'string |
| 484 | :group 'vcursor | ||
| 485 | :version "20.3") | 481 | :version "20.3") |
| 486 | 482 | ||
| 487 | (defvar vcursor-overlay nil | 483 | (defvar vcursor-overlay nil |
| @@ -501,42 +497,41 @@ scrolling set this. It is used by the `vcursor-auto-disable' code.") | |||
| 501 | 497 | ||
| 502 | (defcustom vcursor-copy-flag nil | 498 | (defcustom vcursor-copy-flag nil |
| 503 | "Non-nil means moving vcursor should copy characters moved over to point." | 499 | "Non-nil means moving vcursor should copy characters moved over to point." |
| 504 | :type 'boolean | 500 | :type 'boolean) |
| 505 | :group 'vcursor) | ||
| 506 | 501 | ||
| 507 | (defvar vcursor-temp-goal-column nil | 502 | (defvar vcursor-temp-goal-column nil |
| 508 | "Keeps track of temporary goal columns for the virtual cursor.") | 503 | "Keeps track of temporary goal columns for the virtual cursor.") |
| 509 | 504 | ||
| 510 | (defvar vcursor-map | 505 | (defvar vcursor-map |
| 511 | (let ((map (make-sparse-keymap))) | 506 | (let ((map (make-sparse-keymap))) |
| 512 | (define-key map "t" 'vcursor-use-vcursor-map) | 507 | (define-key map "t" #'vcursor-use-vcursor-map) |
| 513 | 508 | ||
| 514 | (define-key map "\C-p" 'vcursor-previous-line) | 509 | (define-key map "\C-p" #'vcursor-previous-line) |
| 515 | (define-key map "\C-n" 'vcursor-next-line) | 510 | (define-key map "\C-n" #'vcursor-next-line) |
| 516 | (define-key map "\C-b" 'vcursor-backward-char) | 511 | (define-key map "\C-b" #'vcursor-backward-char) |
| 517 | (define-key map "\C-f" 'vcursor-forward-char) | 512 | (define-key map "\C-f" #'vcursor-forward-char) |
| 518 | 513 | ||
| 519 | (define-key map "\r" 'vcursor-disable) | 514 | (define-key map "\r" #'vcursor-disable) |
| 520 | (define-key map " " 'vcursor-copy) | 515 | (define-key map " " #'vcursor-copy) |
| 521 | (define-key map "\C-y" 'vcursor-copy-word) | 516 | (define-key map "\C-y" #'vcursor-copy-word) |
| 522 | (define-key map "\C-i" 'vcursor-toggle-copy) | 517 | (define-key map "\C-i" #'vcursor-toggle-copy) |
| 523 | (define-key map "<" 'vcursor-beginning-of-buffer) | 518 | (define-key map "<" #'vcursor-beginning-of-buffer) |
| 524 | (define-key map ">" 'vcursor-end-of-buffer) | 519 | (define-key map ">" #'vcursor-end-of-buffer) |
| 525 | (define-key map "\M-v" 'vcursor-scroll-down) | 520 | (define-key map "\M-v" #'vcursor-scroll-down) |
| 526 | (define-key map "\C-v" 'vcursor-scroll-up) | 521 | (define-key map "\C-v" #'vcursor-scroll-up) |
| 527 | (define-key map "o" 'vcursor-other-window) | 522 | (define-key map "o" #'vcursor-other-window) |
| 528 | (define-key map "g" 'vcursor-goto) | 523 | (define-key map "g" #'vcursor-goto) |
| 529 | (define-key map "x" 'vcursor-swap-point) | 524 | (define-key map "x" #'vcursor-swap-point) |
| 530 | (define-key map "\C-s" 'vcursor-isearch-forward) | 525 | (define-key map "\C-s" #'vcursor-isearch-forward) |
| 531 | (define-key map "\C-r" 'vcursor-isearch-backward) | 526 | (define-key map "\C-r" #'vcursor-isearch-backward) |
| 532 | (define-key map "\C-a" 'vcursor-beginning-of-line) | 527 | (define-key map "\C-a" #'vcursor-beginning-of-line) |
| 533 | (define-key map "\C-e" 'vcursor-end-of-line) | 528 | (define-key map "\C-e" #'vcursor-end-of-line) |
| 534 | (define-key map "\M-w" 'vcursor-forward-word) | 529 | (define-key map "\M-w" #'vcursor-forward-word) |
| 535 | (define-key map "\M-b" 'vcursor-backward-word) | 530 | (define-key map "\M-b" #'vcursor-backward-word) |
| 536 | (define-key map "\M-l" 'vcursor-copy-line) | 531 | (define-key map "\M-l" #'vcursor-copy-line) |
| 537 | (define-key map "c" 'vcursor-compare-windows) | 532 | (define-key map "c" #'vcursor-compare-windows) |
| 538 | (define-key map "k" 'vcursor-execute-key) | 533 | (define-key map "k" #'vcursor-execute-key) |
| 539 | (define-key map "\M-x" 'vcursor-execute-command) | 534 | (define-key map "\M-x" #'vcursor-execute-command) |
| 540 | map) | 535 | map) |
| 541 | "Keymap for vcursor command.") | 536 | "Keymap for vcursor command.") |
| 542 | ;; This seems unused, but it was done as part of define-prefix-command, | 537 | ;; This seems unused, but it was done as part of define-prefix-command, |
| @@ -611,7 +606,8 @@ Set `vcursor-window' to the returned value as a side effect." | |||
| 611 | (cond | 606 | (cond |
| 612 | (winok) ; choice 2 | 607 | (winok) ; choice 2 |
| 613 | ((and vcursor-window ; choice 3 | 608 | ((and vcursor-window ; choice 3 |
| 614 | (not (eq thiswin vcursor-window))) vcursor-window) | 609 | (not (eq thiswin vcursor-window))) |
| 610 | vcursor-window) | ||
| 615 | (winbuf) ; choice 4 | 611 | (winbuf) ; choice 4 |
| 616 | (new-win (display-buffer (current-buffer) t)) ; choice 5 | 612 | (new-win (display-buffer (current-buffer) t)) ; choice 5 |
| 617 | (t nil))))))) ; default (choice 6) | 613 | (t nil))))))) ; default (choice 6) |
| @@ -719,16 +715,14 @@ not be visible otherwise, display it in another window." | |||
| 719 | The vcursor will always appear in an unselected window." | 715 | The vcursor will always appear in an unselected window." |
| 720 | 716 | ||
| 721 | (interactive "P") | 717 | (interactive "P") |
| 722 | (vcursor-window-funcall 'scroll-up n) | 718 | (vcursor-window-funcall #'scroll-up n)) |
| 723 | ) | ||
| 724 | 719 | ||
| 725 | (defun vcursor-scroll-down (&optional n) | 720 | (defun vcursor-scroll-down (&optional n) |
| 726 | "Scroll down the vcursor window ARG lines or near full screen if none. | 721 | "Scroll down the vcursor window ARG lines or near full screen if none. |
| 727 | The vcursor will always appear in an unselected window." | 722 | The vcursor will always appear in an unselected window." |
| 728 | 723 | ||
| 729 | (interactive "P") | 724 | (interactive "P") |
| 730 | (vcursor-window-funcall 'scroll-down n) | 725 | (vcursor-window-funcall #'scroll-down n)) |
| 731 | ) | ||
| 732 | 726 | ||
| 733 | (defun vcursor-isearch-forward (&optional rep norecurs) | 727 | (defun vcursor-isearch-forward (&optional rep norecurs) |
| 734 | "Perform forward incremental search in the virtual cursor window. | 728 | "Perform forward incremental search in the virtual cursor window. |
| @@ -736,7 +730,7 @@ The virtual cursor is moved to the resulting point; the ordinary | |||
| 736 | cursor stays where it was." | 730 | cursor stays where it was." |
| 737 | 731 | ||
| 738 | (interactive "P") | 732 | (interactive "P") |
| 739 | (vcursor-window-funcall 'isearch-forward rep norecurs) | 733 | (vcursor-window-funcall #'isearch-forward rep norecurs) |
| 740 | ) | 734 | ) |
| 741 | 735 | ||
| 742 | (defun vcursor-isearch-backward (&optional rep norecurs) | 736 | (defun vcursor-isearch-backward (&optional rep norecurs) |
| @@ -745,7 +739,7 @@ The virtual cursor is moved to the resulting point; the ordinary | |||
| 745 | cursor stays where it was." | 739 | cursor stays where it was." |
| 746 | 740 | ||
| 747 | (interactive "P") | 741 | (interactive "P") |
| 748 | (vcursor-window-funcall 'isearch-backward rep norecurs) | 742 | (vcursor-window-funcall #'isearch-backward rep norecurs) |
| 749 | ) | 743 | ) |
| 750 | 744 | ||
| 751 | (defun vcursor-window-funcall (func &rest args) | 745 | (defun vcursor-window-funcall (func &rest args) |
| @@ -891,7 +885,7 @@ A prefix argument, if any, means ignore changes in whitespace. | |||
| 891 | The variable `compare-windows-whitespace' controls how whitespace is skipped. | 885 | The variable `compare-windows-whitespace' controls how whitespace is skipped. |
| 892 | If `compare-ignore-case' is non-nil, changes in case are also ignored." | 886 | If `compare-ignore-case' is non-nil, changes in case are also ignored." |
| 893 | (interactive "P") | 887 | (interactive "P") |
| 894 | ;; (vcursor-window-funcall 'compare-windows arg) | 888 | ;; (vcursor-window-funcall #'compare-windows arg) |
| 895 | (require 'compare-w) | 889 | (require 'compare-w) |
| 896 | (let* (p1 p2 maxp1 maxp2 b1 b2 w2 | 890 | (let* (p1 p2 maxp1 maxp2 b1 b2 w2 |
| 897 | success | 891 | success |
| @@ -1005,32 +999,32 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored." | |||
| 1005 | (defun vcursor-forward-char (arg) | 999 | (defun vcursor-forward-char (arg) |
| 1006 | "Move the virtual cursor forward ARG characters." | 1000 | "Move the virtual cursor forward ARG characters." |
| 1007 | (interactive "p") | 1001 | (interactive "p") |
| 1008 | (vcursor-relative-move 'forward-char arg) | 1002 | (vcursor-relative-move #'forward-char arg) |
| 1009 | ) | 1003 | ) |
| 1010 | 1004 | ||
| 1011 | (defun vcursor-backward-char (arg) | 1005 | (defun vcursor-backward-char (arg) |
| 1012 | "Move the virtual cursor backward ARG characters." | 1006 | "Move the virtual cursor backward ARG characters." |
| 1013 | (interactive "p") | 1007 | (interactive "p") |
| 1014 | (vcursor-relative-move 'backward-char arg) | 1008 | (vcursor-relative-move #'backward-char arg) |
| 1015 | ) | 1009 | ) |
| 1016 | 1010 | ||
| 1017 | (defun vcursor-forward-word (arg) | 1011 | (defun vcursor-forward-word (arg) |
| 1018 | "Move the virtual cursor forward ARG words." | 1012 | "Move the virtual cursor forward ARG words." |
| 1019 | (interactive "p") | 1013 | (interactive "p") |
| 1020 | (vcursor-relative-move 'forward-word arg) | 1014 | (vcursor-relative-move #'forward-word arg) |
| 1021 | ) | 1015 | ) |
| 1022 | 1016 | ||
| 1023 | (defun vcursor-backward-word (arg) | 1017 | (defun vcursor-backward-word (arg) |
| 1024 | "Move the virtual cursor backward ARG words." | 1018 | "Move the virtual cursor backward ARG words." |
| 1025 | (interactive "p") | 1019 | (interactive "p") |
| 1026 | (vcursor-relative-move 'backward-word arg) | 1020 | (vcursor-relative-move #'backward-word arg) |
| 1027 | ) | 1021 | ) |
| 1028 | 1022 | ||
| 1029 | (defun vcursor-beginning-of-line (arg) | 1023 | (defun vcursor-beginning-of-line (arg) |
| 1030 | "Move the virtual cursor to beginning of its current line. | 1024 | "Move the virtual cursor to beginning of its current line. |
| 1031 | ARG is as for `beginning-of-line'." | 1025 | ARG is as for `beginning-of-line'." |
| 1032 | (interactive "P") | 1026 | (interactive "P") |
| 1033 | (vcursor-relative-move 'beginning-of-line | 1027 | (vcursor-relative-move #'beginning-of-line |
| 1034 | (if arg (prefix-numeric-value arg))) | 1028 | (if arg (prefix-numeric-value arg))) |
| 1035 | ) | 1029 | ) |
| 1036 | 1030 | ||
| @@ -1038,7 +1032,7 @@ ARG is as for `beginning-of-line'." | |||
| 1038 | "Move the virtual cursor to end of its current line. | 1032 | "Move the virtual cursor to end of its current line. |
| 1039 | ARG is as for `end-of-line'." | 1033 | ARG is as for `end-of-line'." |
| 1040 | (interactive "P") | 1034 | (interactive "P") |
| 1041 | (vcursor-relative-move 'end-of-line | 1035 | (vcursor-relative-move #'end-of-line |
| 1042 | (if arg (prefix-numeric-value arg))) | 1036 | (if arg (prefix-numeric-value arg))) |
| 1043 | ) | 1037 | ) |
| 1044 | 1038 | ||
| @@ -1110,7 +1104,7 @@ is called interactively, so prefix argument etc. are usable." | |||
| 1110 | (defun vcursor-copy-word (arg) | 1104 | (defun vcursor-copy-word (arg) |
| 1111 | "Copy ARG words from the virtual cursor position to point." | 1105 | "Copy ARG words from the virtual cursor position to point." |
| 1112 | (interactive "p") | 1106 | (interactive "p") |
| 1113 | (vcursor-copy (vcursor-get-char-count 'forward-word arg)) | 1107 | (vcursor-copy (vcursor-get-char-count #'forward-word arg)) |
| 1114 | ) | 1108 | ) |
| 1115 | 1109 | ||
| 1116 | (defun vcursor-copy-line (arg) | 1110 | (defun vcursor-copy-line (arg) |
| @@ -1123,7 +1117,7 @@ line is treated like ordinary characters." | |||
| 1123 | 1117 | ||
| 1124 | (interactive "P") | 1118 | (interactive "P") |
| 1125 | (let* ((num (prefix-numeric-value arg)) | 1119 | (let* ((num (prefix-numeric-value arg)) |
| 1126 | (count (vcursor-get-char-count 'end-of-line num))) | 1120 | (count (vcursor-get-char-count #'end-of-line num))) |
| 1127 | (vcursor-copy (if (or (= count 0) arg) (1+ count) count))) | 1121 | (vcursor-copy (if (or (= count 0) arg) (1+ count) count))) |
| 1128 | ) | 1122 | ) |
| 1129 | 1123 | ||
| @@ -1136,7 +1130,7 @@ line is treated like ordinary characters." | |||
| 1136 | (setq vcursor-last-command nil) | 1130 | (setq vcursor-last-command nil) |
| 1137 | ) | 1131 | ) |
| 1138 | 1132 | ||
| 1139 | (add-hook 'post-command-hook 'vcursor-post-command) | 1133 | (add-hook 'post-command-hook #'vcursor-post-command) |
| 1140 | 1134 | ||
| 1141 | (provide 'vcursor) | 1135 | (provide 'vcursor) |
| 1142 | 1136 | ||