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 /lisp | |
| parent | 55d77548e7e8cb10ca1690259f82ba541f7d9bd3 (diff) | |
| download | emacs-d03b9b3108cc27e5c8058788ffcb32068ec0d953.tar.gz emacs-d03b9b3108cc27e5c8058788ffcb32068ec0d953.zip | |
(region-active-p): New function.
(use-empty-active-region): New variable.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/simple.el | 22 |
2 files changed, 25 insertions, 0 deletions
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) |