diff options
| author | Richard M. Stallman | 2007-12-23 21:46:25 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-12-23 21:46:25 +0000 |
| commit | d03b9b3108cc27e5c8058788ffcb32068ec0d953 (patch) | |
| tree | 5d3f1150f6263fe455a2fc0af82332536ad01d0b | |
| parent | 55d77548e7e8cb10ca1690259f82ba541f7d9bd3 (diff) | |
| download | emacs-d03b9b3108cc27e5c8058788ffcb32068ec0d953.tar.gz emacs-d03b9b3108cc27e5c8058788ffcb32068ec0d953.zip | |
(region-active-p): New function.
(use-empty-active-region): New variable.
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/simple.el | 22 |
3 files changed, 31 insertions, 0 deletions
| @@ -149,6 +149,9 @@ word at point. | |||
| 149 | ** TAB now indents the region if the region is active and | 149 | ** TAB now indents the region if the region is active and |
| 150 | `transient-mark-mode' is turned on. | 150 | `transient-mark-mode' is turned on. |
| 151 | 151 | ||
| 152 | ** `use-empty-active-region' controls whether an empty active region | ||
| 153 | in Transient Mark mode should make commands operate on that empty region. | ||
| 154 | |||
| 152 | ** C-z now invokes `suspend-frame', C-x C-c now invokes | 155 | ** C-z now invokes `suspend-frame', C-x C-c now invokes |
| 153 | `save-buffers-kill-terminal'. | 156 | `save-buffers-kill-terminal'. |
| 154 | 157 | ||
| @@ -439,6 +442,9 @@ variable as having been made within Custom. | |||
| 439 | ** `frame-inherited-parameters' lets new frames inherit parameters from | 442 | ** `frame-inherited-parameters' lets new frames inherit parameters from |
| 440 | the selected frame. | 443 | the selected frame. |
| 441 | 444 | ||
| 445 | ** Commands should use `region-active-p' to test whether there is | ||
| 446 | an active region that they should operate on. | ||
| 447 | |||
| 442 | ** New keymap `input-decode-map' overrides like key-translation-map, but | 448 | ** New keymap `input-decode-map' overrides like key-translation-map, but |
| 443 | applies before function-key-map. Also it is terminal-local contrary to | 449 | applies before function-key-map. Also it is terminal-local contrary to |
| 444 | key-translation-map. Terminal-specific key-sequences are generally added to | 450 | key-translation-map. Terminal-specific key-sequences are generally added to |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9fb73a60a1c..76dfeb27f05 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2007-12-23 Richard Stallman <rms@gnu.org> | 1 | 2007-12-23 Richard Stallman <rms@gnu.org> |
| 2 | 2 | ||
| 3 | * simple.el (region-active-p): New function. | ||
| 4 | (use-empty-active-region): New variable. | ||
| 5 | |||
| 3 | * dired-aux.el (dired): Load dired.el at run time too. | 6 | * dired-aux.el (dired): Load dired.el at run time too. |
| 4 | 7 | ||
| 5 | 2007-12-23 Juri Linkov <juri@jurta.org> | 8 | 2007-12-23 Juri Linkov <juri@jurta.org> |
diff --git a/lisp/simple.el b/lisp/simple.el index 22f29ab0464..2750fc85777 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3329,6 +3329,28 @@ store it in a Lisp variable. Example: | |||
| 3329 | (run-hooks 'deactivate-mark-hook) | 3329 | (run-hooks 'deactivate-mark-hook) |
| 3330 | (set-marker (mark-marker) nil))) | 3330 | (set-marker (mark-marker) nil))) |
| 3331 | 3331 | ||
| 3332 | (defcustom use-empty-active-region nil | ||
| 3333 | "If non-nil, an active region takes control even if empty. | ||
| 3334 | This applies to certain commands which, in Transient Mark mode, | ||
| 3335 | apply to the active region if there is one. If the setting is t, | ||
| 3336 | these commands apply to an empty active region if there is one. | ||
| 3337 | If the setting is nil, these commands treat an empty active | ||
| 3338 | region as if it were not active." | ||
| 3339 | :type 'boolean | ||
| 3340 | :version "23.1" | ||
| 3341 | :group 'editing-basics) | ||
| 3342 | |||
| 3343 | (defun region-active-p () | ||
| 3344 | "Return t if certain commands should apply to the region. | ||
| 3345 | Certain commands normally apply to text near point, | ||
| 3346 | but in Transient Mark mode when the mark is active they apply | ||
| 3347 | to the region instead. Such commands should use this subroutine to | ||
| 3348 | test whether to do that. | ||
| 3349 | |||
| 3350 | This function also obeys `use-empty-active-region'." | ||
| 3351 | (and transient-mark-mode mark-active | ||
| 3352 | (or use-empty-active-region (> (region-end) (region-beginning))))) | ||
| 3353 | |||
| 3332 | (defvar mark-ring nil | 3354 | (defvar mark-ring nil |
| 3333 | "The list of former marks of the current buffer, most recent first.") | 3355 | "The list of former marks of the current buffer, most recent first.") |
| 3334 | (make-variable-buffer-local 'mark-ring) | 3356 | (make-variable-buffer-local 'mark-ring) |