aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorKaroly Lorentey2005-12-11 22:42:40 +0000
committerKaroly Lorentey2005-12-11 22:42:40 +0000
commitbe3d2d66d2dff979604134c5dc5fb506ded4aa54 (patch)
tree683fc7324392d0023e995b593a627c294375aba1 /lisp/emulation
parent16986fcfcca94e88e620c38775e15f758aa44935 (diff)
parentac8fcf0f17ab5d81f3b30db5599337d000ad12d9 (diff)
downloademacs-be3d2d66d2dff979604134c5dc5fb506ded4aa54.tar.gz
emacs-be3d2d66d2dff979604134c5dc5fb506ded4aa54.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-667 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-669 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-670 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-157 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-158 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-159 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-160 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-161 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-162 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-163 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-164 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-165 Update from CVS: texi/message.texi: Fix default values. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-166 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-167 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-168 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-448
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/cua-base.el71
-rw-r--r--lisp/emulation/cua-rect.el16
2 files changed, 60 insertions, 27 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index bcfdeef4501..26d94e99e88 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -329,15 +329,6 @@ interpreted as a register number."
329 :type 'boolean 329 :type 'boolean
330 :group 'cua) 330 :group 'cua)
331 331
332(defcustom cua-use-hyper-key nil
333 "*If non-nil, bind rectangle commands to H-... instead of M-....
334If set to `also', toggle region command is also on C-return.
335Must be set prior to enabling CUA."
336 :type '(choice (const :tag "Meta key and C-return" nil)
337 (const :tag "Hyper key only" only)
338 (const :tag "Hyper key and C-return" also))
339 :group 'cua)
340
341(defcustom cua-enable-region-auto-help nil 332(defcustom cua-enable-region-auto-help nil
342 "*If non-nil, automatically show help for active region." 333 "*If non-nil, automatically show help for active region."
343 :type 'boolean 334 :type 'boolean
@@ -379,6 +370,15 @@ and after the region marked by the rectangle to search."
379 (other :tag "Enabled" t)) 370 (other :tag "Enabled" t))
380 :group 'cua) 371 :group 'cua)
381 372
373(defcustom cua-rectangle-modifier-key 'meta
374 "*Modifier key used for rectangle commands bindings.
375On non-window systems, always use the meta modifier.
376Must be set prior to enabling CUA."
377 :type '(choice (const :tag "Meta key" meta)
378 (const :tag "Hyper key" hyper )
379 (const :tag "Super key" super))
380 :group 'cua)
381
382(defcustom cua-enable-rectangle-auto-help t 382(defcustom cua-enable-rectangle-auto-help t
383 "*If non-nil, automatically show help for region, rectangle and global mark." 383 "*If non-nil, automatically show help for region, rectangle and global mark."
384 :type 'boolean 384 :type 'boolean
@@ -1180,11 +1180,13 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1180 1180
1181;;; Keymaps 1181;;; Keymaps
1182 1182
1183;; Cached value of actual cua-rectangle-modifier-key
1184(defvar cua--rectangle-modifier-key 'meta)
1185
1183(defun cua--M/H-key (map key fct) 1186(defun cua--M/H-key (map key fct)
1184 ;; bind H-KEY or M-KEY to FCT in MAP 1187 ;; bind H-KEY or M-KEY to FCT in MAP
1185 (if (eq key 'space) (setq key ?\s))
1186 (unless (listp key) (setq key (list key))) 1188 (unless (listp key) (setq key (list key)))
1187 (define-key map (vector (cons (if cua-use-hyper-key 'hyper 'meta) key)) fct)) 1189 (define-key map (vector (cons cua--rectangle-modifier-key key)) fct))
1188 1190
1189(defun cua--self-insert-char-p (def) 1191(defun cua--self-insert-char-p (def)
1190 ;; Return DEF if current key sequence is self-inserting in 1192 ;; Return DEF if current key sequence is self-inserting in
@@ -1232,7 +1234,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1232 (not cua--prefix-override-timer))) 1234 (not cua--prefix-override-timer)))
1233 (setq cua--ena-prefix-repeat-keymap 1235 (setq cua--ena-prefix-repeat-keymap
1234 (and cua--ena-region-keymap 1236 (and cua--ena-region-keymap
1235 (timerp cua--prefix-override-timer))) 1237 (or (timerp cua--prefix-override-timer)
1238 (eq cua--prefix-override-timer 'shift))))
1236 (setq cua--ena-cua-keys-keymap 1239 (setq cua--ena-cua-keys-keymap
1237 (and cua-enable-cua-keys 1240 (and cua-enable-cua-keys
1238 (not cua-inhibit-cua-keys) 1241 (not cua-inhibit-cua-keys)
@@ -1244,12 +1247,39 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1244 1247
1245(defvar cua--keymaps-initalized nil) 1248(defvar cua--keymaps-initalized nil)
1246 1249
1250(defun cua--shift-control-prefix (prefix arg)
1251 ;; handle S-C-x and S-C-c by emulating the fast double prefix function.
1252 ;; Don't record this command
1253 (setq this-command last-command)
1254 ;; Restore the prefix arg
1255 (setq prefix-arg arg)
1256 (reset-this-command-lengths)
1257 ;; Activate the cua--prefix-repeat-keymap
1258 (setq cua--prefix-override-timer 'shift)
1259 ;; Push duplicate keys back on the event queue
1260 (setq unread-command-events (cons prefix (cons prefix unread-command-events))))
1261
1262(defun cua--shift-control-c-prefix (arg)
1263 (interactive "P")
1264 (cua--shift-control-prefix ?\C-c arg))
1265
1266(defun cua--shift-control-x-prefix (arg)
1267 (interactive "P")
1268 (cua--shift-control-prefix ?\C-x arg))
1269
1247(defun cua--init-keymaps () 1270(defun cua--init-keymaps ()
1248 (unless (eq cua-use-hyper-key 'only) 1271 ;; Cache actual rectangle modifier key.
1249 (define-key cua-global-keymap [(control return)] 'cua-set-rectangle-mark)) 1272 (setq cua--rectangle-modifier-key
1250 (when cua-use-hyper-key 1273 (if (and cua-rectangle-modifier-key
1251 (cua--M/H-key cua-global-keymap 'space 'cua-set-rectangle-mark) 1274 (memq window-system '(x)))
1252 (define-key cua-global-keymap [(hyper mouse-1)] 'cua-mouse-set-rectangle-mark)) 1275 cua-rectangle-modifier-key
1276 'meta))
1277 ;; C-return always toggles rectangle mark
1278 (define-key cua-global-keymap [(control return)] 'cua-set-rectangle-mark)
1279 (unless (eq cua--rectangle-modifier-key 'meta)
1280 (cua--M/H-key cua-global-keymap ?\s 'cua-set-rectangle-mark)
1281 (define-key cua-global-keymap
1282 (vector (list cua--rectangle-modifier-key 'mouse-1)) 'cua-mouse-set-rectangle-mark))
1253 1283
1254 (define-key cua-global-keymap [(shift control ?\s)] 'cua-toggle-global-mark) 1284 (define-key cua-global-keymap [(shift control ?\s)] 'cua-toggle-global-mark)
1255 1285
@@ -1287,8 +1317,9 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1287 (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler) 1317 (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler)
1288 1318
1289 ;; Enable shifted fallbacks for C-x and C-c when region is active 1319 ;; Enable shifted fallbacks for C-x and C-c when region is active
1290 (define-key cua--region-keymap [(shift control x)] 'Control-X-prefix) 1320 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
1291 (define-key cua--region-keymap [(shift control c)] 'mode-specific-command-prefix) 1321 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix)
1322
1292 ;; replace current region 1323 ;; replace current region
1293 (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) 1324 (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region)
1294 (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) 1325 (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region)
@@ -1365,7 +1396,7 @@ CUA bindings, or `cua-prefix-override-inhibit-delay' to change
1365the prefix fallback behavior." 1396the prefix fallback behavior."
1366 :global t 1397 :global t
1367 :group 'cua 1398 :group 'cua
1368 :set-after '(cua-enable-modeline-indications cua-use-hyper-key) 1399 :set-after '(cua-enable-modeline-indications cua-rectangle-modifier-key)
1369 :require 'cua-base 1400 :require 'cua-base
1370 :link '(emacs-commentary-link "cua-base.el") 1401 :link '(emacs-commentary-link "cua-base.el")
1371 (setq mark-even-if-inactive t) 1402 (setq mark-even-if-inactive t)
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 0590af50249..aa82e148aff 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -1242,6 +1242,7 @@ The numbers are formatted according to the FORMAT string."
1242 (setq z (cdr z))) 1242 (setq z (cdr z)))
1243 (if cua--debug 1243 (if cua--debug
1244 (print (list (current-column) cc) auxbuf)) 1244 (print (list (current-column) cc) auxbuf))
1245 (just-one-space 0)
1245 (indent-to cc)))) 1246 (indent-to cc))))
1246 (if (> tr 0) 1247 (if (> tr 0)
1247 (message "Warning: Truncated %d row%s" tr (if (> tr 1) "s" ""))) 1248 (message "Warning: Truncated %d row%s" tr (if (> tr 1) "s" "")))
@@ -1358,7 +1359,9 @@ With prefix arg, indent to that column."
1358 1359
1359(defun cua-help-for-rectangle (&optional help) 1360(defun cua-help-for-rectangle (&optional help)
1360 (interactive) 1361 (interactive)
1361 (let ((M (if cua-use-hyper-key " H-" " M-"))) 1362 (let ((M (cond ((eq cua--rectangle-modifier-key 'hyper) " H-")
1363 ((eq cua--rectangle-modifier-key 'super) " s-")
1364 (t " M-"))))
1362 (message 1365 (message
1363 (concat (if help "C-?:help" "") 1366 (concat (if help "C-?:help" "")
1364 M "p:pad" M "o:open" M "c:close" M "b:blank" 1367 M "p:pad" M "o:open" M "c:close" M "b:blank"
@@ -1410,12 +1413,11 @@ With prefix arg, indent to that column."
1410 (cua--M/H-key cua--rectangle-keymap key cmd)) 1413 (cua--M/H-key cua--rectangle-keymap key cmd))
1411 1414
1412(defun cua--init-rectangles () 1415(defun cua--init-rectangles ()
1413 (unless (eq cua-use-hyper-key 'only) 1416 (define-key cua--rectangle-keymap [(control return)] 'cua-clear-rectangle-mark)
1414 (define-key cua--rectangle-keymap [(control return)] 'cua-clear-rectangle-mark) 1417 (define-key cua--region-keymap [(control return)] 'cua-toggle-rectangle-mark)
1415 (define-key cua--region-keymap [(control return)] 'cua-toggle-rectangle-mark)) 1418 (unless (eq cua--rectangle-modifier-key 'meta)
1416 (when cua-use-hyper-key 1419 (cua--rect-M/H-key ?\s 'cua-clear-rectangle-mark)
1417 (cua--rect-M/H-key 'space 'cua-clear-rectangle-mark) 1420 (cua--M/H-key cua--region-keymap ?\s 'cua-toggle-rectangle-mark))
1418 (cua--M/H-key cua--region-keymap 'space 'cua-toggle-rectangle-mark))
1419 1421
1420 (define-key cua--rectangle-keymap [remap copy-region-as-kill] 'cua-copy-rectangle) 1422 (define-key cua--rectangle-keymap [remap copy-region-as-kill] 'cua-copy-rectangle)
1421 (define-key cua--rectangle-keymap [remap kill-ring-save] 'cua-copy-rectangle) 1423 (define-key cua--rectangle-keymap [remap kill-ring-save] 'cua-copy-rectangle)