aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2004-12-29 01:32:06 +0000
committerRichard M. Stallman <[email protected]>2004-12-29 01:32:06 +0000
commitafb62fddcf8a30e757fcf87b7424a5552cfc9e78 (patch)
tree23c07a747c1815659f72b5dd9f84f445f3995460 /lisp
parenta28e0218716025133871b17bd2417156898d37e0 (diff)
(mark-sexp, mark-defun): New arg ALLOW-EXTEND
enables the feature to extend the existing region.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/lisp.el27
1 files changed, 16 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 82882d6c2b..6993825511 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -69,15 +69,17 @@ move forward across N balanced expressions."
(or arg (setq arg 1))
(forward-sexp (- arg)))
-(defun mark-sexp (&optional arg)
+(defun mark-sexp (&optional arg allow-extend)
"Set mark ARG sexps from point.
The place mark goes is the same place \\[forward-sexp] would
move to with the same argument.
-If this command is repeated or mark is active in Transient Mark mode,
+Interactively, if this command is repeated
+or (in Transient Mark mode) if the mark is active,
it marks the next ARG sexps after the ones already marked."
- (interactive "P")
- (cond ((or (and (eq last-command this-command) (mark t))
- (and transient-mark-mode mark-active))
+ (interactive "P\np")
+ (cond ((and allow-extend
+ (or (and (eq last-command this-command) (mark t))
+ (and transient-mark-mode mark-active)))
(setq arg (if arg (prefix-numeric-value arg)
(if (< (mark) (point)) -1 1)))
(set-mark
@@ -289,14 +291,17 @@ is called as a function to find the defun's end."
(goto-char (point-min)))))
(setq arg (1+ arg))))))
-(defun mark-defun ()
+(defun mark-defun (&optional allow-extend)
"Put mark at end of this defun, point at beginning.
The defun marked is the one that contains point or follows point.
-If this command is repeated or mark is active in Transient Mark mode,
-it marks more defuns after the ones already marked."
- (interactive)
- (cond ((or (and (eq last-command this-command) (mark t))
- (and transient-mark-mode mark-active))
+
+Interactively, if this command is repeated
+or (in Transient Mark mode) if the mark is active,
+it marks the next defun after the ones already marked."
+ (interactive "p")
+ (cond ((and allow-extend
+ (or (and (eq last-command this-command) (mark t))
+ (and transient-mark-mode mark-active)))
(set-mark
(save-excursion
(goto-char (mark))