aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2007-12-23 21:46:25 +0000
committerRichard M. Stallman2007-12-23 21:46:25 +0000
commitd03b9b3108cc27e5c8058788ffcb32068ec0d953 (patch)
tree5d3f1150f6263fe455a2fc0af82332536ad01d0b
parent55d77548e7e8cb10ca1690259f82ba541f7d9bd3 (diff)
downloademacs-d03b9b3108cc27e5c8058788ffcb32068ec0d953.tar.gz
emacs-d03b9b3108cc27e5c8058788ffcb32068ec0d953.zip
(region-active-p): New function.
(use-empty-active-region): New variable.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/simple.el22
3 files changed, 31 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index fb51744bab6..d7e7f0f93c6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
153in 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
440the selected frame. 443the selected frame.
441 444
445** Commands should use `region-active-p' to test whether there is
446an 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
443applies before function-key-map. Also it is terminal-local contrary to 449applies before function-key-map. Also it is terminal-local contrary to
444key-translation-map. Terminal-specific key-sequences are generally added to 450key-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 @@
12007-12-23 Richard Stallman <rms@gnu.org> 12007-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
52007-12-23 Juri Linkov <juri@jurta.org> 82007-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.
3334This applies to certain commands which, in Transient Mark mode,
3335apply to the active region if there is one. If the setting is t,
3336these commands apply to an empty active region if there is one.
3337If the setting is nil, these commands treat an empty active
3338region 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.
3345Certain commands normally apply to text near point,
3346but in Transient Mark mode when the mark is active they apply
3347to the region instead. Such commands should use this subroutine to
3348test whether to do that.
3349
3350This 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)