| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 |
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
(defgroup cua nil |
|---|
| 265 |
"Emulate CUA key bindings including C-x and C-c." |
|---|
| 266 |
:prefix "cua" |
|---|
| 267 |
:group 'editing-basics |
|---|
| 268 |
:group 'convenience |
|---|
| 269 |
:group 'emulations |
|---|
| 270 |
:version "22.1" |
|---|
| 271 |
:link '(emacs-commentary-link :tag "Commentary" "cua-base.el") |
|---|
| 272 |
:link '(emacs-library-link :tag "Lisp File" "cua-base.el")) |
|---|
| 273 |
|
|---|
| 274 |
(defcustom cua-enable-cua-keys t |
|---|
| 275 |
"*Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste. |
|---|
| 276 |
If the value is t, these mappings are always enabled. If the value is |
|---|
| 277 |
`shift', these keys are only enabled if the last region was marked with |
|---|
| 278 |
a shifted movement key. If the value is nil, these keys are never |
|---|
| 279 |
enabled." |
|---|
| 280 |
:type '(choice (const :tag "Disabled" nil) |
|---|
| 281 |
(const :tag "Shift region only" shift) |
|---|
| 282 |
(other :tag "Enabled" t)) |
|---|
| 283 |
:group 'cua) |
|---|
| 284 |
|
|---|
| 285 |
(defcustom cua-highlight-region-shift-only nil |
|---|
| 286 |
"*If non-nil, only highlight region if marked with S-<move>. |
|---|
| 287 |
When this is non-nil, CUA toggles `transient-mark-mode' on when the region |
|---|
| 288 |
is marked using shifted movement keys, and off when the mark is cleared. |
|---|
| 289 |
But when the mark was set using \\[cua-set-mark], Transient Mark mode |
|---|
| 290 |
is not turned on." |
|---|
| 291 |
:type 'boolean |
|---|
| 292 |
:group 'cua) |
|---|
| 293 |
|
|---|
| 294 |
(defcustom cua-prefix-override-inhibit-delay |
|---|
| 295 |
(if (featurep 'lisp-float-type) (/ (float 1) (float 5)) nil) |
|---|
| 296 |
"*If non-nil, time in seconds to delay before overriding prefix key. |
|---|
| 297 |
If there is additional input within this time, the prefix key is |
|---|
| 298 |
used as a normal prefix key. So typing a key sequence quickly will |
|---|
| 299 |
inhibit overriding the prefix key. |
|---|
| 300 |
As a special case, if the prefix keys repeated within this time, the |
|---|
| 301 |
first prefix key is discarded, so typing a prefix key twice in quick |
|---|
| 302 |
succession will also inhibit overriding the prefix key. |
|---|
| 303 |
If the value is nil, use a shifted prefix key to inhibit the override." |
|---|
| 304 |
:type '(choice (number :tag "Inhibit delay") |
|---|
| 305 |
(const :tag "No delay" nil)) |
|---|
| 306 |
:group 'cua) |
|---|
| 307 |
|
|---|
| 308 |
(defcustom cua-delete-selection t |
|---|
| 309 |
"*If non-nil, typed text replaces text in the active selection." |
|---|
| 310 |
:type '(choice (const :tag "Disabled" nil) |
|---|
| 311 |
(other :tag "Enabled" t)) |
|---|
| 312 |
:group 'cua) |
|---|
| 313 |
|
|---|
| 314 |
(defcustom cua-keep-region-after-copy nil |
|---|
| 315 |
"If non-nil, don't deselect the region after copying." |
|---|
| 316 |
:type 'boolean |
|---|
| 317 |
:group 'cua) |
|---|
| 318 |
|
|---|
| 319 |
(defcustom cua-toggle-set-mark t |
|---|
| 320 |
"*If non-nil, the `cua-set-mark' command toggles the mark." |
|---|
| 321 |
:type '(choice (const :tag "Disabled" nil) |
|---|
| 322 |
(other :tag "Enabled" t)) |
|---|
| 323 |
:group 'cua) |
|---|
| 324 |
|
|---|
| 325 |
(defcustom cua-auto-mark-last-change nil |
|---|
| 326 |
"*If non-nil, set implicit mark at position of last buffer change. |
|---|
| 327 |
This means that \\[universal-argument] \\[cua-set-mark] will jump to the position |
|---|
| 328 |
of the last buffer change before jumping to the explicit marks on the mark ring. |
|---|
| 329 |
See `cua-set-mark' for details." |
|---|
| 330 |
:type 'boolean |
|---|
| 331 |
:group 'cua) |
|---|
| 332 |
|
|---|
| 333 |
(defcustom cua-enable-register-prefix 'not-ctrl-u |
|---|
| 334 |
"*If non-nil, registers are supported via numeric prefix arg. |
|---|
| 335 |
If the value is t, any numeric prefix arg in the range 0 to 9 will be |
|---|
| 336 |
interpreted as a register number. |
|---|
| 337 |
If the value is `not-ctrl-u', using C-u to enter a numeric prefix is not |
|---|
| 338 |
interpreted as a register number. |
|---|
| 339 |
If the value is `ctrl-u-only', only numeric prefix entered with C-u is |
|---|
| 340 |
interpreted as a register number." |
|---|
| 341 |
:type '(choice (const :tag "Disabled" nil) |
|---|
| 342 |
(const :tag "Enabled, but C-u arg is not a register" not-ctrl-u) |
|---|
| 343 |
(const :tag "Enabled, but only for C-u arg" ctrl-u-only) |
|---|
| 344 |
(other :tag "Enabled" t)) |
|---|
| 345 |
:group 'cua) |
|---|
| 346 |
|
|---|
| 347 |
(defcustom cua-delete-copy-to-register-0 t |
|---|
| 348 |
"*If non-nil, save last deleted region or rectangle to register 0." |
|---|
| 349 |
:type 'boolean |
|---|
| 350 |
:group 'cua) |
|---|
| 351 |
|
|---|
| 352 |
(defcustom cua-enable-region-auto-help nil |
|---|
| 353 |
"*If non-nil, automatically show help for active region." |
|---|
| 354 |
:type 'boolean |
|---|
| 355 |
:group 'cua) |
|---|
| 356 |
|
|---|
| 357 |
(defcustom cua-enable-modeline-indications nil |
|---|
| 358 |
"*If non-nil, use minor-mode hook to show status in mode line." |
|---|
| 359 |
:type 'boolean |
|---|
| 360 |
:group 'cua) |
|---|
| 361 |
|
|---|
| 362 |
(defcustom cua-check-pending-input t |
|---|
| 363 |
"*If non-nil, don't override prefix key if input pending. |
|---|
| 364 |
It is rumoured that `input-pending-p' is unreliable under some window |
|---|
| 365 |
managers, so try setting this to nil, if prefix override doesn't work." |
|---|
| 366 |
:type 'boolean |
|---|
| 367 |
:group 'cua) |
|---|
| 368 |
|
|---|
| 369 |
(defcustom cua-paste-pop-rotate-temporarily nil |
|---|
| 370 |
"*If non-nil, \\[cua-paste-pop] only rotates the kill-ring temporarily. |
|---|
| 371 |
This means that both \\[yank] and the first \\[yank-pop] in a sequence always insert |
|---|
| 372 |
the most recently killed text. Each immediately following \\[cua-paste-pop] replaces |
|---|
| 373 |
the previous text with the next older element on the `kill-ring'. |
|---|
| 374 |
With prefix arg, \\[universal-argument] \\[yank-pop] inserts the same text as the most |
|---|
| 375 |
recent \\[yank-pop] (or \\[yank]) command." |
|---|
| 376 |
:type 'boolean |
|---|
| 377 |
:group 'cua) |
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
(defcustom cua-virtual-rectangle-edges t |
|---|
| 382 |
"*If non-nil, rectangles have virtual straight edges. |
|---|
| 383 |
Note that although rectangles are always DISPLAYED with straight edges, the |
|---|
| 384 |
buffer is NOT modified, until you execute a command that actually modifies it. |
|---|
| 385 |
M-p toggles this feature when a rectangle is active." |
|---|
| 386 |
:type 'boolean |
|---|
| 387 |
:group 'cua) |
|---|
| 388 |
|
|---|
| 389 |
(defcustom cua-auto-tabify-rectangles 1000 |
|---|
| 390 |
"*If non-nil, automatically tabify after rectangle commands. |
|---|
| 391 |
This basically means that `tabify' is applied to all lines that |
|---|
| 392 |
are modified by inserting or deleting a rectangle. If value is |
|---|
| 393 |
an integer, CUA will look for existing tabs in a region around |
|---|
| 394 |
the rectangle, and only do the conversion if any tabs are already |
|---|
| 395 |
present. The number specifies then number of characters before |
|---|
| 396 |
and after the region marked by the rectangle to search." |
|---|
| 397 |
:type '(choice (number :tag "Auto detect (limit)") |
|---|
| 398 |
(const :tag "Disabled" nil) |
|---|
| 399 |
(other :tag "Enabled" t)) |
|---|
| 400 |
:group 'cua) |
|---|
| 401 |
|
|---|
| 402 |
(defvar cua-global-keymap) |
|---|
| 403 |
(defvar cua--region-keymap) |
|---|
| 404 |
|
|---|
| 405 |
(defcustom cua-rectangle-mark-key [(control return)] |
|---|
| 406 |
"Global key used to toggle the cua rectangle mark." |
|---|
| 407 |
:set #'(lambda (symbol value) |
|---|
| 408 |
(set symbol value) |
|---|
| 409 |
(when (and (boundp 'cua--keymaps-initalized) |
|---|
| 410 |
cua--keymaps-initalized) |
|---|
| 411 |
(define-key cua-global-keymap value |
|---|
| 412 |
'cua-set-rectangle-mark) |
|---|
| 413 |
(when (boundp 'cua--rectangle-keymap) |
|---|
| 414 |
(define-key cua--rectangle-keymap value |
|---|
| 415 |
'cua-clear-rectangle-mark) |
|---|
| 416 |
(define-key cua--region-keymap value |
|---|
| 417 |
'cua-toggle-rectangle-mark)))) |
|---|
| 418 |
:type 'key-sequence |
|---|
| 419 |
:group 'cua) |
|---|
| 420 |
|
|---|
| 421 |
(defcustom cua-rectangle-modifier-key 'meta |
|---|
| 422 |
"*Modifier key used for rectangle commands bindings. |
|---|
| 423 |
On non-window systems, always use the meta modifier. |
|---|
| 424 |
Must be set prior to enabling CUA." |
|---|
| 425 |
:type '(choice (const :tag "Meta key" meta) |
|---|
| 426 |
(const :tag "Alt key" alt) |
|---|
| 427 |
(const :tag "Hyper key" hyper) |
|---|
| 428 |
(const :tag "Super key" super)) |
|---|
| 429 |
:group 'cua) |
|---|
| 430 |
|
|---|
| 431 |
(defcustom cua-enable-rectangle-auto-help t |
|---|
| 432 |
"*If non-nil, automatically show help for region, rectangle and global mark." |
|---|
| 433 |
:type 'boolean |
|---|
| 434 |
:group 'cua) |
|---|
| 435 |
|
|---|
| 436 |
(defface cua-rectangle |
|---|
| 437 |
'((default :inherit region) |
|---|
| 438 |
(((class color)) :foreground "white" :background "maroon")) |
|---|
| 439 |
"*Font used by CUA for highlighting the rectangle." |
|---|
| 440 |
:group 'cua) |
|---|
| 441 |
|
|---|
| 442 |
(defface cua-rectangle-noselect |
|---|
| 443 |
'((default :inherit region) |
|---|
| 444 |
(((class color)) :foreground "white" :background "dimgray")) |
|---|
| 445 |
"*Font used by CUA for highlighting the non-selected rectangle lines." |
|---|
| 446 |
:group 'cua) |
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
(defcustom cua-global-mark-keep-visible t |
|---|
| 452 |
"*If non-nil, always keep global mark visible in other window." |
|---|
| 453 |
:type 'boolean |
|---|
| 454 |
:group 'cua) |
|---|
| 455 |
|
|---|
| 456 |
(defface cua-global-mark |
|---|
| 457 |
'((((min-colors 88)(class color)) :foreground "black" :background "yellow1") |
|---|
| 458 |
(((class color)) :foreground "black" :background "yellow") |
|---|
| 459 |
(t :bold t)) |
|---|
| 460 |
"*Font used by CUA for highlighting the global mark." |
|---|
| 461 |
:group 'cua) |
|---|
| 462 |
|
|---|
| 463 |
(defcustom cua-global-mark-blink-cursor-interval 0.20 |
|---|
| 464 |
"*Blink cursor at this interval when global mark is active." |
|---|
| 465 |
:type '(choice (number :tag "Blink interval") |
|---|
| 466 |
(const :tag "No blink" nil)) |
|---|
| 467 |
:group 'cua) |
|---|
| 468 |
|
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
|
|---|
| 472 |
(defcustom cua-enable-cursor-indications nil |
|---|
| 473 |
"*If non-nil, use different cursor colors for indications." |
|---|
| 474 |
:type 'boolean |
|---|
| 475 |
:group 'cua) |
|---|
| 476 |
|
|---|
| 477 |
(defcustom cua-normal-cursor-color (or (and (boundp 'initial-cursor-color) initial-cursor-color) |
|---|
| 478 |
(and (boundp 'initial-frame-alist) |
|---|
| 479 |
(assoc 'cursor-color initial-frame-alist) |
|---|
| 480 |
(cdr (assoc 'cursor-color initial-frame-alist))) |
|---|
| 481 |
(and (boundp 'default-frame-alist) |
|---|
| 482 |
(assoc 'cursor-color default-frame-alist) |
|---|
| 483 |
(cdr (assoc 'cursor-color default-frame-alist))) |
|---|
| 484 |
(frame-parameter nil 'cursor-color) |
|---|
| 485 |
"red") |
|---|
| 486 |
"Normal (non-overwrite) cursor color. |
|---|
| 487 |
Default is to load cursor color from initial or default frame parameters. |
|---|
| 488 |
|
|---|
| 489 |
If the value is a COLOR name, then only the `cursor-color' attribute will be |
|---|
| 490 |
affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
|---|
| 491 |
then only the `cursor-type' property will be affected. If the value is |
|---|
| 492 |
a cons (TYPE . COLOR), then both properties are affected." |
|---|
| 493 |
:initialize 'custom-initialize-default |
|---|
| 494 |
:type '(choice |
|---|
| 495 |
(color :tag "Color") |
|---|
| 496 |
(choice :tag "Type" |
|---|
| 497 |
(const :tag "Filled box" box) |
|---|
| 498 |
(const :tag "Vertical bar" bar) |
|---|
| 499 |
(const :tag "Horizontal bar" hbar) |
|---|
| 500 |
(const :tag "Hollow box" hollow)) |
|---|
| 501 |
(cons :tag "Color and Type" |
|---|
| 502 |
(choice :tag "Type" |
|---|
| 503 |
(const :tag "Filled box" box) |
|---|
| 504 |
(const :tag "Vertical bar" bar) |
|---|
| 505 |
(const :tag "Horizontal bar" hbar) |
|---|
| 506 |
(const :tag "Hollow box" hollow)) |
|---|
| 507 |
(color :tag "Color"))) |
|---|
| 508 |
:group 'cua) |
|---|
| 509 |
|
|---|
| 510 |
(defcustom cua-read-only-cursor-color "darkgreen" |
|---|
| 511 |
"*Cursor color used in read-only buffers, if non-nil. |
|---|
| 512 |
Only used when `cua-enable-cursor-indications' is non-nil. |
|---|
| 513 |
|
|---|
| 514 |
If the value is a COLOR name, then only the `cursor-color' attribute will be |
|---|
| 515 |
affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
|---|
| 516 |
then only the `cursor-type' property will be affected. If the value is |
|---|
| 517 |
a cons (TYPE . COLOR), then both properties are affected." |
|---|
| 518 |
:type '(choice |
|---|
| 519 |
(color :tag "Color") |
|---|
| 520 |
(choice :tag "Type" |
|---|
| 521 |
(const :tag "Filled box" box) |
|---|
| 522 |
(const :tag "Vertical bar" bar) |
|---|
| 523 |
(const :tag "Horizontal bar" hbar) |
|---|
| 524 |
(const :tag "Hollow box" hollow)) |
|---|
| 525 |
(cons :tag "Color and Type" |
|---|
| 526 |
(choice :tag "Type" |
|---|
| 527 |
(const :tag "Filled box" box) |
|---|
| 528 |
(const :tag "Vertical bar" bar) |
|---|
| 529 |
(const :tag "Horizontal bar" hbar) |
|---|
| 530 |
(const :tag "Hollow box" hollow)) |
|---|
| 531 |
(color :tag "Color"))) |
|---|
| 532 |
:group 'cua) |
|---|
| 533 |
|
|---|
| 534 |
(defcustom cua-overwrite-cursor-color "yellow" |
|---|
| 535 |
"*Cursor color used when overwrite mode is set, if non-nil. |
|---|
| 536 |
Only used when `cua-enable-cursor-indications' is non-nil. |
|---|
| 537 |
|
|---|
| 538 |
If the value is a COLOR name, then only the `cursor-color' attribute will be |
|---|
| 539 |
affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
|---|
| 540 |
then only the `cursor-type' property will be affected. If the value is |
|---|
| 541 |
a cons (TYPE . COLOR), then both properties are affected." |
|---|
| 542 |
:type '(choice |
|---|
| 543 |
(color :tag "Color") |
|---|
| 544 |
(choice :tag "Type" |
|---|
| 545 |
(const :tag "Filled box" box) |
|---|
| 546 |
(const :tag "Vertical bar" bar) |
|---|
| 547 |
(const :tag "Horizontal bar" hbar) |
|---|
| 548 |
(const :tag "Hollow box" hollow)) |
|---|
| 549 |
(cons :tag "Color and Type" |
|---|
| 550 |
(choice :tag "Type" |
|---|
| 551 |
(const :tag "Filled box" box) |
|---|
| 552 |
(const :tag "Vertical bar" bar) |
|---|
| 553 |
(const :tag "Horizontal bar" hbar) |
|---|
| 554 |
(const :tag "Hollow box" hollow)) |
|---|
| 555 |
(color :tag "Color"))) |
|---|
| 556 |
:group 'cua) |
|---|
| 557 |
|
|---|
| 558 |
(defcustom cua-global-mark-cursor-color "cyan" |
|---|
| 559 |
"*Indication for active global mark. |
|---|
| 560 |
Will change cursor color to specified color if string. |
|---|
| 561 |
Only used when `cua-enable-cursor-indications' is non-nil. |
|---|
| 562 |
|
|---|
| 563 |
If the value is a COLOR name, then only the `cursor-color' attribute will be |
|---|
| 564 |
affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
|---|
| 565 |
then only the `cursor-type' property will be affected. If the value is |
|---|
| 566 |
a cons (TYPE . COLOR), then both properties are affected." |
|---|
| 567 |
:type '(choice |
|---|
| 568 |
(color :tag "Color") |
|---|
| 569 |
(choice :tag "Type" |
|---|
| 570 |
(const :tag "Filled box" box) |
|---|
| 571 |
(const :tag "Vertical bar" bar) |
|---|
| 572 |
(const :tag "Horizontal bar" hbar) |
|---|
| 573 |
(const :tag "Hollow box" hollow)) |
|---|
| 574 |
(cons :tag "Color and Type" |
|---|
| 575 |
(choice :tag "Type" |
|---|
| 576 |
(const :tag "Filled box" box) |
|---|
| 577 |
(const :tag "Vertical bar" bar) |
|---|
| 578 |
(const :tag "Horizontal bar" hbar) |
|---|
| 579 |
(const :tag "Hollow box" hollow)) |
|---|
| 580 |
(color :tag "Color"))) |
|---|
| 581 |
:group 'cua) |
|---|
| 582 |
|
|---|
| 583 |
|
|---|
| 584 |
|
|---|
| 585 |
|
|---|
| 586 |
(autoload 'cua-set-rectangle-mark "cua-rect" nil t nil) |
|---|
| 587 |
|
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 |
(when (not (featurep 'cua-rect)) |
|---|
| 591 |
(defvar cua--rectangle) |
|---|
| 592 |
(setq cua--rectangle nil) |
|---|
| 593 |
(defvar cua--last-killed-rectangle) |
|---|
| 594 |
(setq cua--last-killed-rectangle nil)) |
|---|
| 595 |
|
|---|
| 596 |
|
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 |
(autoload 'cua-toggle-global-mark "cua-gmrk" nil t nil) |
|---|
| 601 |
|
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 |
(when (not (featurep 'cua-gmrk)) |
|---|
| 605 |
(defvar cua--global-mark-active) |
|---|
| 606 |
(setq cua--global-mark-active nil)) |
|---|
| 607 |
|
|---|
| 608 |
|
|---|
| 609 |
(provide 'cua-base) |
|---|
| 610 |
|
|---|
| 611 |
(eval-when-compile |
|---|
| 612 |
(require 'cua-rect) |
|---|
| 613 |
(require 'cua-gmrk) |
|---|
| 614 |
) |
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 |
(defvar cua-inhibit-cua-keys nil |
|---|
| 620 |
"Buffer-local variable that may disable the CUA keymappings.") |
|---|
| 621 |
(make-variable-buffer-local 'cua-inhibit-cua-keys) |
|---|
| 622 |
|
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 |
(defvar cua--explicit-region-start nil) |
|---|
| 627 |
(make-variable-buffer-local 'cua--explicit-region-start) |
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 |
(defvar cua--last-region-shifted nil) |
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
(defvar cua--buffer-and-point-before-command nil) |
|---|
| 635 |
|
|---|
| 636 |
|
|---|
| 637 |
(defvar cua--status-string nil) |
|---|
| 638 |
(make-variable-buffer-local 'cua--status-string) |
|---|
| 639 |
|
|---|
| 640 |
(defvar cua--debug nil) |
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 |
|
|---|
| 644 |
|
|---|
| 645 |
|
|---|
| 646 |
|
|---|
| 647 |
|
|---|
| 648 |
|
|---|
| 649 |
|
|---|
| 650 |
|
|---|
| 651 |
|
|---|
| 652 |
|
|---|
| 653 |
|
|---|
| 654 |
|
|---|
| 655 |
|
|---|
| 656 |
|
|---|
| 657 |
|
|---|
| 658 |
|
|---|
| 659 |
|
|---|
| 660 |
|
|---|
| 661 |
|
|---|
| 662 |
|
|---|
| 663 |
|
|---|
| 664 |
|
|---|
| 665 |
|
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
|
|---|
| 670 |
|
|---|
| 671 |
|
|---|
| 672 |
|
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 |
|
|---|
| 676 |
|
|---|
| 677 |
|
|---|
| 678 |
|
|---|
| 679 |
|
|---|
| 680 |
|
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 |
|
|---|
| 684 |
|
|---|
| 685 |
(defvar cua--prefix-override-timer nil) |
|---|
| 686 |
(defvar cua--prefix-override-length nil) |
|---|
| 687 |
|
|---|
| 688 |
(defun cua--prefix-override-replay (arg repeat) |
|---|
| 689 |
(let* ((keys (this-command-keys)) |
|---|
| 690 |
(i (length keys)) |
|---|
| 691 |
(key (aref keys (1- i)))) |
|---|
| 692 |
(setq cua--prefix-override-length (- i repeat)) |
|---|
| 693 |
(setq cua--prefix-override-timer |
|---|
| 694 |
(or |
|---|
| 695 |
|
|---|
| 696 |
(> repeat 0) |
|---|
| 697 |
|
|---|
| 698 |
(and cua-check-pending-input (input-pending-p)) |
|---|
| 699 |
|
|---|
| 700 |
(not (numberp cua-prefix-override-inhibit-delay)) |
|---|
| 701 |
(<= cua-prefix-override-inhibit-delay 0) |
|---|
| 702 |
|
|---|
| 703 |
(run-with-timer cua-prefix-override-inhibit-delay nil |
|---|
| 704 |
'cua--prefix-override-timeout))) |
|---|
| 705 |
|
|---|
| 706 |
(setq this-command last-command) |
|---|
| 707 |
|
|---|
| 708 |
(setq prefix-arg arg) |
|---|
| 709 |
(reset-this-command-lengths) |
|---|
| 710 |
|
|---|
| 711 |
(setq unread-command-events (cons key unread-command-events)))) |
|---|
| 712 |
|
|---|
| 713 |
(defun cua--prefix-override-handler (arg) |
|---|
| 714 |
"Start timer waiting for prefix key to be followed by another key. |
|---|
| 715 |
Repeating prefix key when region is active works as a single prefix key." |
|---|
| 716 |
(interactive "P") |
|---|
| 717 |
(cua--prefix-override-replay arg 0)) |
|---|
| 718 |
|
|---|
| 719 |
(defun cua--prefix-repeat-handler (arg) |
|---|
| 720 |
"Repeating prefix key when region is active works as a single prefix key." |
|---|
| 721 |
(interactive "P") |
|---|
| 722 |
(cua--prefix-override-replay arg 1)) |
|---|
| 723 |
|
|---|
| 724 |
(defun cua--prefix-copy-handler (arg) |
|---|
| 725 |
"Copy region/rectangle, then replay last key." |
|---|
| 726 |
(interactive "P") |
|---|
| 727 |
(if cua--rectangle |
|---|
| 728 |
(cua-copy-rectangle arg) |
|---|
| 729 |
(cua-copy-region arg)) |
|---|
| 730 |
(let ((keys (this-single-command-keys))) |
|---|
| 731 |
(setq unread-command-events |
|---|
| 732 |
(cons (aref keys (1- (length keys))) unread-command-events)))) |
|---|
| 733 |
|
|---|
| 734 |
(defun cua--prefix-cut-handler (arg) |
|---|
| 735 |
"Cut region/rectangle, then replay last key." |
|---|
| 736 |
(interactive "P") |
|---|
| 737 |
(if cua--rectangle |
|---|
| 738 |
(cua-cut-rectangle arg) |
|---|
| 739 |
(cua-cut-region arg)) |
|---|
| 740 |
(let ((keys (this-single-command-keys))) |
|---|
| 741 |
(setq unread-command-events |
|---|
| 742 |
(cons (aref keys (1- (length keys))) unread-command-events)))) |
|---|
| 743 |
|
|---|
| 744 |
(defun cua--prefix-override-timeout () |
|---|
| 745 |
(setq cua--prefix-override-timer t) |
|---|
| 746 |
(when (= (length (this-command-keys)) cua--prefix-override-length) |
|---|
| 747 |
(setq unread-command-events (cons 'timeout unread-command-events)) |
|---|
| 748 |
(if prefix-arg |
|---|
| 749 |
(reset-this-command-lengths) |
|---|
| 750 |
(setq overriding-terminal-local-map nil)) |
|---|
| 751 |
(cua--select-keymaps))) |
|---|
| 752 |
|
|---|
| 753 |
|
|---|
| 754 |
|
|---|
| 755 |
|
|---|
| 756 |
(defun cua--fallback () |
|---|
| 757 |
|
|---|
| 758 |
(setq this-command this-original-command) |
|---|
| 759 |
(call-interactively this-command)) |
|---|
| 760 |
|
|---|
| 761 |
(defun |
|---|