annotate lisp/delsel.el @ 16241:3c84b8d28902

(rmail-insert-inbox-text): Detect locked RMAIL files at the outset, before copying any files. (rmail-find-all-files): Eliminate recursive scan. Rely on directory-files to do the filtering. (rmail-convert-to-babyl-format): Increase sit-for timeout to 3 seconds. (rmail-get-new-mail): Handle files in multiple batches, in case two inboxes have the same last name component. (rmail-show-message): Bind `end' after clearing the "unseen" attribute. (rmail-show-message): Clear `unseen' even if header is already reformatted--but don't do it if rmail-not-really-seen. (rmail-not-really-seen): New variable.
author Richard M. Stallman <rms@gnu.org>
date Thu, 19 Sep 1996 03:21:11 +0000
parents 83f275dcd93a
children 852464ce5d6a
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
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
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
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
9 ;; This file is part of GNU Emacs.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
14 ;; any later version.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
19 ;; GNU General Public License for more details.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
21 ;; You should have received a copy of the GNU General Public License
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
24 ;; Boston, MA 02111-1307, USA.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
26 ;;; Commentary:
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
28 ;; This file makes the active region be pending delete, meaning that
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
29 ;; text inserted while the region is active will replace the region contents.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13077
diff changeset
30 ;; This is a popular behavior of personal computers text editors.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
32 ;;; Code:
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2074
diff changeset
33
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
34 (defvar delete-selection-mode t
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
35 "*Non-nil means Delete Selection mode is enabled.
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
36 In Delete Selection mode, when a region is highlighted,
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
37 insertion commands first delete the region and then insert.")
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
38
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (defun delete-active-region (&optional killp)
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
40 (if killp
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
41 (kill-region (point) (mark))
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
42 (delete-region (point) (mark)))
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
43 (setq mark-active nil)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
44 (run-hooks 'deactivate-mark-hook)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
45 t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
47 (defun delete-selection-pre-hook ()
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
48 (if (and delete-selection-mode
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
49 (not buffer-read-only)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
50 transient-mark-mode mark-active)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
51 (let ((type (and (symbolp this-command)
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
52 (get this-command 'delete-selection))))
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
53 (cond ((eq type 'kill)
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
54 (delete-active-region t))
12790
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
55 ((eq type 'yank)
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
56 ;; Before a yank command,
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
57 ;; make sure we don't yank the same region
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
58 ;; that we are going to delete.
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
59 ;; That would make yank a no-op.
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
60 (if (string= (buffer-substring (point) (mark))
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
61 (car kill-ring))
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
62 (current-kill 1))
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
63 (delete-active-region nil))
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
64 ((eq type 'supersede)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
65 (if (delete-active-region nil)
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
66 (setq this-command '(lambda () (interactive)))))
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
67 (type
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
68 (delete-active-region nil))))))
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
69
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
70 (add-hook 'pre-command-hook 'delete-selection-pre-hook)
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 '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
73 (put 'self-insert-iso 'delete-selection t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74
12790
afe7f3c735a3 (delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents: 11589
diff changeset
75 (put 'yank 'delete-selection 'yank)
13077
65092cab3f43 (clipboard-yank): Add delete-selection property.
Richard M. Stallman <rms@gnu.org>
parents: 12790
diff changeset
76 (put 'clipboard-yank 'delete-selection 'yank)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
77 (put 'insert-register 'delete-selection t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
79 (put 'delete-backward-char 'delete-selection 'supersede)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
80 (put 'backward-delete-char-untabify 'delete-selection 'supersede)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
81 (put 'delete-char 'delete-selection 'supersede)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
83 (put 'newline-and-indent 'delete-selection 't)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
84 (put 'newline 'delete-selection t)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
85 (put 'open-line 'delete-selection t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
87 ;;;###autoload
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
88 (defalias 'pending-delete-mode 'delete-selection-mode)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
89 ;;;###autoload
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
90 (defun delete-selection-mode (arg)
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
91 "Toggle Delete Selection mode.
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 When ON, typed text replaces the selection if the selection is active.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 When OFF, typed text is just inserted at point."
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
94 (interactive "P")
2903
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
95 (setq delete-selection-mode
fa41174db2fa Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
96 (if (null arg) (not delete-selection-mode)
2074
0196b8bce529 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2073
diff changeset
97 (> (prefix-numeric-value arg) 0)))
11589
ba22258c5916 (delete-selection-mode): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents: 9533
diff changeset
98 (force-mode-line-update))
2073
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 ;; This is very useful for cancelling a selection in the minibuffer without
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;; aborting the minibuffer.
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (defun minibuffer-keyboard-quit ()
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 "Abort recursive edit.
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
104 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
105 then it takes a second C-g to abort the minibuffer."
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (interactive)
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
107 (if (and delete-selection-mode transient-mark-mode mark-active)
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
108 (setq deactivate-mark t)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (abort-recursive-edit)))
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (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
112 (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
113 (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
114 (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
115 (define-key minibuffer-local-isearch-map "\C-g" 'minibuffer-keyboard-quit)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
117 (provide 'delsel)
2073
b4d5c9926d98 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118
2925
902c32c709f7 Provide delsel.
Richard M. Stallman <rms@gnu.org>
parents: 2903
diff changeset
119 ;;; delsel.el ends here