Mercurial > emacs
annotate lisp/delsel.el @ 92870:8f17f65dd575
* textmodes/org.el (org-ctrl-c-star): Implement a missing branch
in the decision tree.
(org-select-remember-template): Cleaned the code.
(org-prepare-dblock): Added the extra :content parameter.
(org-write-agenda): New output type ".ics" files.
(org-write-agenda): Call `org-icalendar-verify-function', both for
time stamps and for TODO entries.
(org-agenda-collect-markers, org-create-marker-find-array)
(org-check-agenda-marker-table): New functions.
(org-agenda-marker-table): New variable.
(org-export-as-html): Revert the change that killed the html
buffer. Side effects first need to be studied carefully.
(org-get-tags-at): Fix the structure of the condition-case
statement.
(org-ts-regexp0, org-repeat-re, org-display-custom-time)
(org-timestamp-change): Fix regulear expressions to swallow the
extra character for repeat-shift control.
(org-auto-repeat-maybe): Implement the new repeater mechanisms.
(org-get-legal-level): Aliased to `org-get-valid-level'.
(org-dblock-write:clocktable): Added a :link parameter, linking
headlines to their location in the Org agenda files.
(org-get-tags-at): Bugfix: prevent `org-back-to-heading' from
throwing an error when getting tags before headlines.
(org-timestamp-change, org-modify-ts-extra)
(org-ts-regexp1): Fix timestamp editing.
(org-agenda-custom-commands-local-options): New constant.
(org-agenda-custom-commands): Use
`org-agenda-custom-commands-local-options' to improve customize
type. "htmlize": Removed hack to fix face problem with htmlize,
it no longer seem necessary.
(org-follow-link-hook): New hook.
(org-agenda-custom-commands): Added "Component" as a tag for each
item in a command serie.
(org-open-at-point): Run `org-follow-link-hook'.
(org-agenda-schedule): Bugfix: don't display marker type when it
is `nil'.
(org-store-link): org-irc required.
(org-set-regexps-and-options): Parse the new logging options.
(org-extract-log-state-settings): New function.
(org-todo): Handle the new ways of recording state change stuff.
(org-local-logging): New function.
(org-columns-open-link): Fixed bug with opening link in column
view.
(org-local-logging): New function
(org-todo): Make sure that LOGGING properties are honoured.
(org-todo-keywords): Improve docstring.
(org-startup-options): Cleanup startup options.
(org-set-regexps-and-options): Process the "!" markers.
(org-todo): Respect the new logging stuff.
(org-log-note-how): New variable.
(org-add-log-maybe): New parameter HOW that defines how logging
should be done and also overrides PURPOSE. Add a docstring.
(org-add-log-note): Check if we really need to ask for a note.
(org-get-current-options): Digest the new keyword.
(org-agenda-reset-markers): Renamed from
`org-agenda-maybe-reset-markers'. FORCE argument removed.
(org-diary, org-agenda-quit, org-prepare-agenda): Call the renamed
function, without force argument.
(org-buffer-property-keys): Bind local variables s and p.
(org-make-tags-matcher): Allow "" to match an empty or
non-existent property value.
(org-export-as-html): Join unsorted lists when they directly
follow each other. Such lists may be created by headlines that
are converted to lists.
(org-nofm-to-completion): New function.
(org-export-as-html): Use :html-extension instead of
org-export-html-extension.
(org-store-link): Support for links from `rmail-summary-mode'.
(org-columns-new, org-complete, org-set-property): Set the
`include-columns' argument in the call to
`org-buffer-property-keys'.
(org-buffer-property-keys): New argument `include-columns', to
include properties expected by any of the COLUMS formats in the
current buffer.
(org-cleaned-string-for-export): Get rid of drawers first, so that
they will be removed also in the text before the first headline.
(org-clock-report): Show the clocktable when found.
(org-refile): Fix positioning bug when `org-reverse-note-order' is
nil.
(org-version): With prefix argument, insert `org-version' at
point.
(org-agenda-goto): Recenter the window after finding the target
location, to make sure the correct position will be displayed.
(org-agenda-get-deadlines): Don't scale priority with the warning
period.
(org-insert-heading): Don't break line in the middle of the line.
(org-agenda-get-deadlines): Allow `org-deadline-warning-days' to
be 0.
(org-update-checkbox-count): Revamped to deal with hierarchical
beckboxes. This was a patch from Miguel A. Figueroa-Villanueva.
(org-remove-timestamp-with-keyword): New function.
(org-schedule, org-deadline): Use
`org-remove-timestamp-with-keyword' to make sure all such time
stamps are removed.
(org-mode): Support for `align'.
(org-agenda-get-deadlines): Make sure priorities increase as the
due date approaches and is passed.
(org-remember-apply-template): Fixed problem with tags that
contain "_" or "@".
(org-make-link-regexps): Improve the regular expression for plain
links.
(org-agenda-get-closed): List each clocking entry.
(org-set-tags): Only tabify before tags if indent-tabs-mode is t.
(org-special-ctrl-k): New option.
(org-kill-line): New function.
(org-archive-all-done): Fixed incorrect number of stars in regexp.
(org-refile-get-location): New function.
(org-refile-goto-last-stored): New function.
(org-global-tags-completion-table): Add the value of org-tag-alist
in each buffer, to make sure that also unused tags will be
available for completion.
(org-columns-edit-value)
(org-columns-next-allowed-value): Only update if not in agenda.
(org-clocktable-steps): New function.
(org-dblock-write:clocktable): Call `org-clocktable-steps'.
(org-archive-subtree): Add the outline tree context as a property.
(org-closest-date): New optional argument `prefer'.
(org-goto-auto-isearch): New option.
(org-goto-map, org-get-location): Implement auto-isearch.
(org-goto-local-auto-isearch-map): New variable.
(org-goto-local-search-forward-headings)
(org-goto-local-auto-isearch): New functions
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Thu, 13 Mar 2008 08:54:11 +0000 |
parents | b3879b6d2e40 |
children | c70e45a7acfd 1e3a407766b9 |
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 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1992, 1997, 1998, 2001, 2002, 2003, 2004, |
79721 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2074
diff
changeset
|
5 |
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2074
diff
changeset
|
6 ;; Author: Matthieu Devin <devin@lucid.com> |
17976 | 7 ;; Maintainer: FSF |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2074
diff
changeset
|
8 ;; Created: 14 Jul 92 |
29156 | 9 ;; Keywords: convenience emulations |
2073 | 10 |
14169 | 11 ;; This file is part of GNU Emacs. |
2073 | 12 |
14169 | 13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
14 ;; it under the terms of the GNU General Public License as published by | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
14169 | 16 ;; any later version. |
2073 | 17 |
14169 | 18 ;; GNU Emacs is distributed in the hope that it will be useful, |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
2073 | 22 |
14169 | 23 ;; You should have received a copy of the GNU General Public License |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64091 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
2073 | 27 |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2074
diff
changeset
|
28 ;;; Commentary: |
2073 | 29 |
14169 | 30 ;; This file makes the active region be pending delete, meaning that |
31 ;; text inserted while the region is active will replace the region contents. | |
32 ;; This is a popular behavior of personal computers text editors. | |
2073 | 33 |
21720
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
34 ;; Interface: |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2074
diff
changeset
|
35 |
21720
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
36 ;; Commands which will delete the selection need a 'delete-selection |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
37 ;; property on their symbols; commands which insert text but don't |
85811
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
38 ;; have this property won't delete the selection. It can be one of |
21720
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
39 ;; the values: |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
40 ;; 'yank |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
41 ;; For commands which do a yank; ensures the region about to be |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
42 ;; deleted isn't yanked. |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
43 ;; 'supersede |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
44 ;; Delete the active region and ignore the current command, |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
45 ;; i.e. the command will just delete the region. |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
46 ;; 'kill |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
47 ;; `kill-region' is used on the selection, rather than |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
48 ;; `delete-region'. (Text selected with the mouse will typically |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
49 ;; be yankable anyhow.) |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
50 ;; non-nil |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
51 ;; The normal case: delete the active region prior to executing |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
52 ;; the command which will insert replacement text. |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
53 |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
54 ;;; Code: |
18785
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
55 |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
56 ;;;###autoload |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
57 (defalias 'pending-delete-mode 'delete-selection-mode) |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
58 |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
59 ;;;###autoload |
32043
63a2ec6dae39
(delete-selection-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30817
diff
changeset
|
60 (define-minor-mode delete-selection-mode |
18785
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
61 "Toggle Delete Selection mode. |
79678
08240fd93b4f
(delete-selection-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
62 With prefix ARG, turn Delete Selection mode on if ARG is |
08240fd93b4f
(delete-selection-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
63 positive, off if ARG is not positive. |
18785
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
64 |
21720
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
65 When Delete Selection mode is enabled, Transient Mark mode is also |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
66 enabled and typed text replaces the selection if the selection is |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
67 active. Otherwise, typed text is just inserted at point regardless of |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
68 any selection." |
33185
7630435cbccd
(delete-selection-mode): Drop unneeded positional args.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32043
diff
changeset
|
69 :global t :group 'editing-basics |
18785
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
70 (if (not delete-selection-mode) |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
71 (remove-hook 'pre-command-hook 'delete-selection-pre-hook) |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
72 (add-hook 'pre-command-hook 'delete-selection-pre-hook) |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
73 (transient-mark-mode t))) |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
74 |
2073 | 75 (defun delete-active-region (&optional killp) |
2074 | 76 (if killp |
77 (kill-region (point) (mark)) | |
78 (delete-region (point) (mark))) | |
79 t) | |
2073 | 80 |
2903
fa41174db2fa
Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents:
2233
diff
changeset
|
81 (defun delete-selection-pre-hook () |
18785
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
82 (when (and delete-selection-mode transient-mark-mode mark-active |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
83 (not buffer-read-only)) |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
84 (let ((type (and (symbolp this-command) |
1a455d8dfa7c
Customise. Don't modify pre-command-hook on file load; do in command.
Simon Marshall <simon@gnu.org>
parents:
18641
diff
changeset
|
85 (get this-command 'delete-selection)))) |
41254
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
86 (condition-case data |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
87 (cond ((eq type 'kill) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
88 (delete-active-region t)) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
89 ((eq type 'yank) |
81894
fb5c5d1a8fe2
(delete-selection-pre-hook): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
75347
diff
changeset
|
90 ;; Before a yank command, make sure we don't yank the |
fb5c5d1a8fe2
(delete-selection-pre-hook): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
75347
diff
changeset
|
91 ;; head of the kill-ring that really comes from the |
82507
9c9e50cbdf1e
(delete-selection-pre-hook): Use `mouse-region-match' instead of checking last-command.
Juri Linkov <juri@jurta.org>
parents:
82140
diff
changeset
|
92 ;; currently active region we are going to delete. |
41254
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
93 ;; That would make yank a no-op. |
81894
fb5c5d1a8fe2
(delete-selection-pre-hook): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
75347
diff
changeset
|
94 (when (and (string= (buffer-substring-no-properties (point) (mark)) |
fb5c5d1a8fe2
(delete-selection-pre-hook): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
75347
diff
changeset
|
95 (car kill-ring)) |
85073
6ae29c2dfff0
(delete-selection-pre-hook): Check if mouse-region-match is fbound
Juri Linkov <juri@jurta.org>
parents:
82507
diff
changeset
|
96 (fboundp 'mouse-region-match) |
82507
9c9e50cbdf1e
(delete-selection-pre-hook): Use `mouse-region-match' instead of checking last-command.
Juri Linkov <juri@jurta.org>
parents:
82140
diff
changeset
|
97 (mouse-region-match)) |
41254
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
98 (current-kill 1)) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
99 (delete-active-region)) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
100 ((eq type 'supersede) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
101 (let ((empty-region (= (point) (mark)))) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
102 (delete-active-region) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
103 (unless empty-region |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
104 (setq this-command 'ignore)))) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
105 (type |
64947
803494c7e4b7
(delete-selection-pre-hook): If overwrite-mode is
Juri Linkov <juri@jurta.org>
parents:
64762
diff
changeset
|
106 (delete-active-region) |
803494c7e4b7
(delete-selection-pre-hook): If overwrite-mode is
Juri Linkov <juri@jurta.org>
parents:
64762
diff
changeset
|
107 (if (and overwrite-mode (eq this-command 'self-insert-command)) |
803494c7e4b7
(delete-selection-pre-hook): If overwrite-mode is
Juri Linkov <juri@jurta.org>
parents:
64762
diff
changeset
|
108 (let ((overwrite-mode nil)) |
803494c7e4b7
(delete-selection-pre-hook): If overwrite-mode is
Juri Linkov <juri@jurta.org>
parents:
64762
diff
changeset
|
109 (self-insert-command (prefix-numeric-value current-prefix-arg)) |
803494c7e4b7
(delete-selection-pre-hook): If overwrite-mode is
Juri Linkov <juri@jurta.org>
parents:
64762
diff
changeset
|
110 (setq this-command 'ignore))))) |
41254
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
111 (file-supersession |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
112 ;; If ask-user-about-supersession-threat signals an error, |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
113 ;; stop safe_run_hooks from clearing out pre-command-hook. |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
114 (and (eq inhibit-quit 'pre-command-hook) |
2538b11fc837
(delete-selection-pre-hook): Handle and resignal
Richard M. Stallman <rms@gnu.org>
parents:
38616
diff
changeset
|
115 (setq inhibit-quit 'delete-selection-dummy)) |
87933
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
116 (signal 'file-supersession (cdr data))) |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
117 (text-read-only |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
118 ;; This signal may come either from `delete-active-region' or |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
119 ;; `self-insert-command' (when `overwrite-mode' is non-nil). |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
120 ;; To avoid clearing out `pre-command-hook' we handle this case |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
121 ;; by issuing a simple message. Note, however, that we do not |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
122 ;; handle all related problems: When read-only text ends before |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
123 ;; the end of the region, the latter is not deleted but any |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
124 ;; subsequent insertion will succeed. We could avoid this case |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
125 ;; by doing a (setq this-command 'ignore) here. This would, |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
126 ;; however, still not handle the case where read-only text ends |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
127 ;; precisely where the region starts: In that case the deletion |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
128 ;; would succeed but the subsequent insertion would fail with a |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
129 ;; text-read-only error. To handle that case we would have to |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
130 ;; investigate text properties at both ends of the region and |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
131 ;; skip the deletion when inserting text is forbidden there. |
1c868d4c8354
(delete-selection-pre-hook): Avoid clearing out
Martin Rudalics <rudalics@gmx.at>
parents:
87649
diff
changeset
|
132 (message "Text is read-only") (ding)))))) |
2073 | 133 |
2903
fa41174db2fa
Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents:
2233
diff
changeset
|
134 (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
|
135 (put 'self-insert-iso 'delete-selection t) |
2073 | 136 |
12790
afe7f3c735a3
(delete-selection-pre-hook): New type value `yank'.
Richard M. Stallman <rms@gnu.org>
parents:
11589
diff
changeset
|
137 (put 'yank 'delete-selection 'yank) |
13077
65092cab3f43
(clipboard-yank): Add delete-selection property.
Richard M. Stallman <rms@gnu.org>
parents:
12790
diff
changeset
|
138 (put 'clipboard-yank 'delete-selection 'yank) |
2925 | 139 (put 'insert-register 'delete-selection t) |
2073 | 140 |
2903
fa41174db2fa
Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents:
2233
diff
changeset
|
141 (put 'delete-backward-char 'delete-selection 'supersede) |
fa41174db2fa
Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents:
2233
diff
changeset
|
142 (put 'backward-delete-char-untabify 'delete-selection 'supersede) |
fa41174db2fa
Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents:
2233
diff
changeset
|
143 (put 'delete-char 'delete-selection 'supersede) |
2073 | 144 |
21720
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
145 (put 'newline-and-indent 'delete-selection t) |
2903
fa41174db2fa
Renamed from pending-del.el.
Richard M. Stallman <rms@gnu.org>
parents:
2233
diff
changeset
|
146 (put 'newline 'delete-selection t) |
21720
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
147 (put 'open-line 'delete-selection 'kill) |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
148 |
30817
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
149 ;; This is very useful for cancelling a selection in the minibuffer without |
2073 | 150 ;; aborting the minibuffer. |
151 (defun minibuffer-keyboard-quit () | |
152 "Abort recursive edit. | |
21720
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
153 In Delete Selection mode, if the mark is active, just deactivate it; |
b1ee274d921b
Don't require cl. Minor doc fixes.
Dave Love <fx@gnu.org>
parents:
19488
diff
changeset
|
154 then it takes a second \\[keyboard-quit] to abort the minibuffer." |
2073 | 155 (interactive) |
2925 | 156 (if (and delete-selection-mode transient-mark-mode mark-active) |
157 (setq deactivate-mark t) | |
2073 | 158 (abort-recursive-edit))) |
159 | |
30817
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
160 (define-key minibuffer-local-map "\C-g" 'minibuffer-keyboard-quit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
161 (define-key minibuffer-local-ns-map "\C-g" 'minibuffer-keyboard-quit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
162 (define-key minibuffer-local-completion-map "\C-g" 'minibuffer-keyboard-quit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
163 (define-key minibuffer-local-must-match-map "\C-g" 'minibuffer-keyboard-quit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
164 (define-key minibuffer-local-isearch-map "\C-g" 'minibuffer-keyboard-quit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
165 |
85811
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
166 (defun delsel-unload-function () |
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
167 "Unload the Delete Selection library." |
30817
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
168 (define-key minibuffer-local-map "\C-g" 'abort-recursive-edit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
169 (define-key minibuffer-local-ns-map "\C-g" 'abort-recursive-edit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
170 (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit) |
fd8b296712e7
(delsel-unload-hook): New function.
Dave Love <fx@gnu.org>
parents:
29156
diff
changeset
|
171 (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit) |
85811
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
172 (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit) |
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
173 (dolist (sym '(self-insert-command self-insert-iso yank clipboard-yank |
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
174 insert-register delete-backward-char backward-delete-char-untabify |
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
175 delete-char newline-and-indent newline open-line)) |
87936
b3879b6d2e40
(delsel-unload-function): Don't use `remprop'; it is not autoloaded,
Juanma Barranquero <lekktu@gmail.com>
parents:
87933
diff
changeset
|
176 (put sym 'delete-selection nil)) |
85811
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
177 ;; continue standard unloading |
cd42bdedadb3
(delsel-unload-hook): Remove function and variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
85073
diff
changeset
|
178 nil) |
57540
8bf58c5521d8
(delsel-unload-hook): Set as a variable.
Richard M. Stallman <rms@gnu.org>
parents:
55278
diff
changeset
|
179 |
2925 | 180 (provide 'delsel) |
2073 | 181 |
52401 | 182 ;;; arch-tag: 1e388890-1b50-4ed0-9347-763b1343b6ed |
2925 | 183 ;;; delsel.el ends here |