aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1995-06-07 18:58:06 +0000
committerKarl Heuer1995-06-07 18:58:06 +0000
commit573228ae6c50007b3fbacc3ff97a94d1754347f3 (patch)
tree48b246c7926e45e0453804c0d0aa4702a5d75218
parent76a8bf4c1f1192be6f4589e0205df0b0f7115c03 (diff)
downloademacs-573228ae6c50007b3fbacc3ff97a94d1754347f3.tar.gz
emacs-573228ae6c50007b3fbacc3ff97a94d1754347f3.zip
Delete version number.
(s-region-bind): Doc fix. (s-region-move): Split into s-region-move and s-region-move-p1. (s-region-move-p2): New function. (s-region-move): Bind this-command. Bind keys to s-region-move-p1 or s-region-move-p2 as appropriate.
-rw-r--r--lisp/s-region.el51
1 files changed, 33 insertions, 18 deletions
diff --git a/lisp/s-region.el b/lisp/s-region.el
index 354495318bc..fa2f855b711 100644
--- a/lisp/s-region.el
+++ b/lisp/s-region.el
@@ -1,8 +1,7 @@
1;;; s-region.el --- set region using shift key. 1;;; s-region.el --- set region using shift key.
2;;; Copyright (C) 1994 Free Software Foundation, Inc. 2;;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
3 3
4;; Author: Morten Welinder (terra@diku.dk) 4;; Author: Morten Welinder (terra@diku.dk)
5;; Version: 1.00
6;; Keywords: terminals 5;; Keywords: terminals
7;; Favourite-brand-of-beer: None, I hate beer. 6;; Favourite-brand-of-beer: None, I hate beer.
8 7
@@ -61,32 +60,48 @@
61 (error "Key does not end in a symbol: %S" key))) 60 (error "Key does not end in a symbol: %S" key)))
62 (error "Non-vector key: %S" key))) 61 (error "Non-vector key: %S" key)))
63 62
64(defun s-region-move (&rest arg) 63(defun s-region-move-p1 (&rest arg)
65 "This is an overlay function to point-moving keys." 64 "This is an overlay function to point-moving keys that are interactive \"p\""
66 (interactive "p") 65 (interactive "p")
66 (apply (function s-region-move) arg))
67
68(defun s-region-move-p2 (&rest arg)
69 "This is an overlay function to point-moving keys that are interactive \"P\""
70 (interactive "P")
71 (apply (function s-region-move) arg))
72
73(defun s-region-move (&rest arg)
67 (if (if mark-active (not (equal last-command 's-region-move)) t) 74 (if (if mark-active (not (equal last-command 's-region-move)) t)
68 (set-mark-command nil) 75 (set-mark-command nil)
69 (message "")) ; delete the "Mark set" message 76 (message "")) ; delete the "Mark set" message
77 (setq this-command 's-region-move)
70 (apply (key-binding (s-region-unshift (this-command-keys))) arg) 78 (apply (key-binding (s-region-unshift (this-command-keys))) arg)
71 (move-overlay s-region-overlay (mark) (point) (current-buffer)) 79 (move-overlay s-region-overlay (mark) (point) (current-buffer))
72 (sit-for 1) 80 (sit-for 1)
73 (delete-overlay s-region-overlay)) 81 (delete-overlay s-region-overlay))
74 82
75(defun s-region-bind (keylist &optional map) 83(defun s-region-bind (keylist &optional map)
76 "Bind keys in KEYLIST to `s-region-move'. 84 "Bind shifted keys in KEYLIST to s-region-move-p1 or s-region-move-p2.
77Each key in KEYLIST is bound to `s-region-move' 85Each key in KEYLIST is shifted and bound to one of the s-region-move
78provided it is already bound to some command or other. 86functions provided it is already bound to some command or other.
79Optional second argument MAP specifies keymap to 87Optional third argument MAP specifies keymap to add binding to, defaulting
80add binding to, defaulting to global keymap." 88to global keymap."
81 (or map (setq map global-map)) 89 (let ((p2 (list 'scroll-up 'scroll-down
82 (while keylist 90 'beginning-of-buffer 'end-of-buffer)))
83 (if (commandp (key-binding (car keylist))) 91 (or map (setq map global-map))
84 (define-key 92 (while keylist
85 map 93 (let* ((key (car keylist))
86 (vector (intern (concat "S-" (symbol-name (aref (car keylist) 0))))) 94 (binding (key-binding key)))
87 's-region-move)) 95 (if (commandp binding)
88 (setq keylist (cdr keylist)))) 96 (define-key
89 97 map
98 (vector (intern (concat "S-" (symbol-name (aref key 0)))))
99 (cond ((memq binding p2)
100 's-region-move-p2)
101 (t 's-region-move-p1)))))
102 (setq keylist (cdr keylist)))))
103
104;; Single keys (plus modifiers) only!
90(s-region-bind 105(s-region-bind
91 (list [right] [left] [up] [down] 106 (list [right] [left] [up] [down]
92 [C-left] [C-right] [C-up] [C-down] 107 [C-left] [C-right] [C-up] [C-down]