aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-19 19:08:12 +0000
committerRichard M. Stallman1993-05-19 19:08:12 +0000
commit28d3ed91adb431470f8ee9b84941779709df9b8b (patch)
tree3a69066e4de9210a6e07f67b80d49cfce0c67172
parent1de2ada0f75fd5905991153eb4d2569bb946a6d1 (diff)
downloademacs-28d3ed91adb431470f8ee9b84941779709df9b8b.tar.gz
emacs-28d3ed91adb431470f8ee9b84941779709df9b8b.zip
Renamed from pending-del.el.
Functions and variables renamed to ...delete-selection... from ...pending-delete... Bind all minibuffer keymaps alike.
-rw-r--r--lisp/delsel.el49
1 files changed, 27 insertions, 22 deletions
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 0c07d0783d1..57caba59eef 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -1,4 +1,4 @@
1;;; pending-del.el --- pending delete selection 1;;; delsel.el --- delete selection if you insert
2 2
3;;; Copyright (C) 1992 Free Software Foundation, Inc. 3;;; Copyright (C) 1992 Free Software Foundation, Inc.
4 4
@@ -30,9 +30,9 @@
30 30
31;;; Code: 31;;; Code:
32 32
33(defvar pending-delete-mode t 33(defvar delete-selection-mode t
34 "*Non-nil means Pending Delete mode is enabled. 34 "*Non-nil means Delete Selection mode is enabled.
35In Pending Delete mode, when a region is highlighted, 35In Delete Selection mode, when a region is highlighted,
36insertion commands first delete the region and then insert.") 36insertion commands first delete the region and then insert.")
37 37
38(defun delete-active-region (&optional killp) 38(defun delete-active-region (&optional killp)
@@ -43,12 +43,12 @@ insertion commands first delete the region and then insert.")
43 (run-hooks 'deactivate-mark-hook) 43 (run-hooks 'deactivate-mark-hook)
44 t) 44 t)
45 45
46(defun pending-delete-pre-hook () 46(defun delete-selection-pre-hook ()
47 (if (and pending-delete-mode 47 (if (and delete-selection-mode
48 (not buffer-read-only) 48 (not buffer-read-only)
49 transient-mark-mode mark-active) 49 transient-mark-mode mark-active)
50 (let ((type (and (symbolp this-command) 50 (let ((type (and (symbolp this-command)
51 (get this-command 'pending-delete)))) 51 (get this-command 'delete-selection))))
52 (cond ((eq type 'kill) 52 (cond ((eq type 'kill)
53 (delete-active-region t)) 53 (delete-active-region t))
54 ((eq type 'supersede) 54 ((eq type 'supersede)
@@ -57,28 +57,29 @@ insertion commands first delete the region and then insert.")
57 (type 57 (type
58 (delete-active-region ())))))) 58 (delete-active-region ()))))))
59 59
60(add-hook 'pre-command-hook 'pending-delete-pre-hook) 60(add-hook 'pre-command-hook 'delete-selection-pre-hook)
61 61
62(put 'self-insert-command 'pending-delete t) 62(put 'self-insert-command 'delete-selection t)
63 63
64(put 'yank 'pending-delete t) 64(put 'yank 'delete-selection t)
65(put 'x-yank-clipboard-selection 'pending-delete t) 65(put 'x-yank-clipboard-selection 'delete-selection t)
66 66
67(put 'delete-backward-char 'pending-delete 'supersede) 67(put 'delete-backward-char 'delete-selection 'supersede)
68(put 'backward-delete-char-untabify 'pending-delete 'supersede) 68(put 'backward-delete-char-untabify 'delete-selection 'supersede)
69(put 'delete-char 'pending-delete 'supersede) 69(put 'delete-char 'delete-selection 'supersede)
70 70
71(put 'newline-and-indent 'pending-delete 't) 71(put 'newline-and-indent 'delete-selection 't)
72(put 'newline 'pending-delete t) 72(put 'newline 'delete-selection t)
73(put 'open-line 'pending-delete t) 73(put 'open-line 'delete-selection t)
74 74
75(defun pending-delete-mode (arg) 75(defalias 'pending-delete-mode 'delete-selection-mode)
76 "Toggle the state of pending-delete mode. 76(defun delete-selection-mode (arg)
77 "Toggle Delete Selection mode.
77When ON, typed text replaces the selection if the selection is active. 78When ON, typed text replaces the selection if the selection is active.
78When OFF, typed text is just inserted at point." 79When OFF, typed text is just inserted at point."
79 (interactive "P") 80 (interactive "P")
80 (setq pending-delete-mode 81 (setq delete-selection-mode
81 (if (null arg) (not pending-delete-mode) 82 (if (null arg) (not delete-selection-mode)
82 (> (prefix-numeric-value arg) 0))) 83 (> (prefix-numeric-value arg) 0)))
83 (set-buffer-modified-p (buffer-modified-p))) ;No-op, but updates mode line. 84 (set-buffer-modified-p (buffer-modified-p))) ;No-op, but updates mode line.
84 85
@@ -86,7 +87,7 @@ When OFF, typed text is just inserted at point."
86;; selection and the second one signal a QUIT. 87;; selection and the second one signal a QUIT.
87;; This is very useful for cancelling a selection in the minibuffer without 88;; This is very useful for cancelling a selection in the minibuffer without
88;; aborting the minibuffer. 89;; aborting the minibuffer.
89;; It has actually nothing to do with pending-delete but its more necessary 90;; It has actually nothing to do with delete-selection but its more necessary
90;; with pending delete because pending delete users use the selection more. 91;; with pending delete because pending delete users use the selection more.
91(defun keyboard-quit () 92(defun keyboard-quit ()
92 "Signal a `quit' condition. 93 "Signal a `quit' condition.
@@ -113,6 +114,10 @@ In Transient Mark mode, if the mark is active, just deactivate it."
113 (abort-recursive-edit))) 114 (abort-recursive-edit)))
114 115
115(define-key minibuffer-local-map "\C-g" 'minibuffer-keyboard-quit) 116(define-key minibuffer-local-map "\C-g" 'minibuffer-keyboard-quit)
117(define-key minibuffer-local-ns-map "\C-g" 'minibuffer-keyboard-quit)
118(define-key minibuffer-local-completion-map "\C-g" 'minibuffer-keyboard-quit)
119(define-key minibuffer-local-must-match-map "\C-g" 'minibuffer-keyboard-quit)
120(define-key minibuffer-local-isearch-map "\C-g" 'minibuffer-keyboard-quit)
116 121
117(provide 'pending-del) 122(provide 'pending-del)
118 123