annotate lisp/delsel.el @ 12279:de2a82180af0

Adapt to the changes in vc-hooks.el, namely, the new 'none-value of vc-locking-user, and the consistent caching of all properties. Especially, make the properties survive check-ins and check-outs. Various minor bug fixes. (vc-file-clear-masterprops): New function. (vc-backend-checkin, vc-backend-revert): Set vc-locking-user to 'none if the file is unlocked. (vc-backend-checkin, vc-backend-revert, vc-backend-checkout): Use vc-file-clear-masterprops, and adjust those properties that are not cleared. (vc-resynch-window): Temporarily remove vc-find-file-hook, so that we don't lose the file properties during check-in/out. (vc-resynch-window): Do not try to delete the current window if `vc-keep-workfiles' is nil (doesn't make sense; killing the buffer is enough.) (vc-backend-checkin): Rewrote the code that adjusts the default branch and removes any locks that might remain after check-in. (vc-cancel-version): Abort with error message in the CVS case. (The error used to be signalled in vc-backend-uncheck, which is a little too late.) (vc-minor-revision): Function removed.
author Richard M. Stallman <rms@gnu.org>
date Fri, 16 Jun 1995 18:02:51 +0000
parents ba22258c5916
children afe7f3c735a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
1 ;;; delsel.el --- delete selection if you insert
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
2
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;;; Copyright (C) 1992 Free Software Foundation, Inc.
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
4
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
5 ;; Author: Matthieu Devin <devin@lucid.com>
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
6 ;; Created: 14 Jul 92
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
7 ;; Last change 18-Feb-93, devin.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;;; This file is part of GNU Emacs.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;;; GNU Emacs is free software; you can redistribute it and/or modify
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;;; it under the terms of the GNU General Public License as published by
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;;; the Free Software Foundation; either version 2, or (at your option)
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;;; any later version.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;;; GNU Emacs is distributed in the hope that it will be useful,
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;;; GNU General Public License for more details.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;;; You should have received a copy of the GNU General Public License
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;;; along with GNU Emacs; see the file COPYING. If not, write to
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
25 ;;; Commentary:
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
27 ;;; This file makes the active region be pending delete, meaning that
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; text inserted while the region is active will replace the region contents.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;; This is a popular behavior of personal computers text editors.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
31 ;;; Code:
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
32
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
33 (defvar delete-selection-mode t
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
34 "*Non-nil means Delete Selection mode is enabled.
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
35 In Delete Selection mode, when a region is highlighted,
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
36 insertion commands first delete the region and then insert.")
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
37
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (defun delete-active-region (&optional killp)
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
39 (if killp
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
40 (kill-region (point) (mark))
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
41 (delete-region (point) (mark)))
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
42 (setq mark-active nil)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
43 (run-hooks 'deactivate-mark-hook)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
44 t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
46 (defun delete-selection-pre-hook ()
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
47 (if (and delete-selection-mode
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
48 (not buffer-read-only)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
49 transient-mark-mode mark-active)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
50 (let ((type (and (symbolp this-command)
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
51 (get this-command 'delete-selection))))
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
52 (cond ((eq type 'kill)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
53 (delete-active-region t))
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
54 ((eq type 'supersede)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
55 (if (delete-active-region nil)
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
56 (setq this-command '(lambda () (interactive)))))
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
57 (type
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
58 (delete-active-region nil))))))
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
59
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
60 (add-hook 'pre-command-hook 'delete-selection-pre-hook)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
62 (put 'self-insert-command 'delete-selection t)
9533
b589ba0d8960 (self-insert-iso): Add delete-selection property.
Richard M. Stallman <rms@gnu.org>
parents: 2925
diff changeset
63 (put 'self-insert-iso 'delete-selection t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
65 (put 'yank 'delete-selection t)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
66 (put 'insert-register 'delete-selection t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
68 (put 'delete-backward-char 'delete-selection 'supersede)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
69 (put 'backward-delete-char-untabify 'delete-selection 'supersede)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
70 (put 'delete-char 'delete-selection 'supersede)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
72 (put 'newline-and-indent 'delete-selection 't)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
73 (put 'newline 'delete-selection t)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
74 (put 'open-line 'delete-selection t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
76 ;;;###autoload
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
77 (defalias 'pending-delete-mode 'delete-selection-mode)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
78 ;;;###autoload
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
79 (defun delete-selection-mode (arg)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
80 "Toggle Delete Selection mode.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 When ON, typed text replaces the selection if the selection is active.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 When OFF, typed text is just inserted at point."
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
83 (interactive "P")
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
84 (setq delete-selection-mode
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
85 (if (null arg) (not delete-selection-mode)
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
86 (> (prefix-numeric-value arg) 0)))
11589
ba22258c5916 (delete-selection-mode): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents: 9533
diff changeset
87 (force-mode-line-update))
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;; This is very useful for cancelling a selection in the minibuffer without
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; aborting the minibuffer.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (defun minibuffer-keyboard-quit ()
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 "Abort recursive edit.
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
93 In Delete Selection mode mode, if the mark is active, just deactivate it;
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
94 then it takes a second C-g to abort the minibuffer."
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (interactive)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
96 (if (and delete-selection-mode transient-mark-mode mark-active)
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
97 (setq deactivate-mark t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (abort-recursive-edit)))
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (define-key minibuffer-local-map "\C-g" 'minibuffer-keyboard-quit)
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
101 (define-key minibuffer-local-ns-map "\C-g" 'minibuffer-keyboard-quit)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
102 (define-key minibuffer-local-completion-map "\C-g" 'minibuffer-keyboard-quit)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
103 (define-key minibuffer-local-must-match-map "\C-g" 'minibuffer-keyboard-quit)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
104 (define-key minibuffer-local-isearch-map "\C-g" 'minibuffer-keyboard-quit)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
106 (provide 'delsel)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
108 ;;; delsel.el ends here