aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-12-29 01:32:06 +0000
committerRichard M. Stallman2004-12-29 01:32:06 +0000
commitafb62fddcf8a30e757fcf87b7424a5552cfc9e78 (patch)
tree23c07a747c1815659f72b5dd9f84f445f3995460
parenta28e0218716025133871b17bd2417156898d37e0 (diff)
downloademacs-afb62fddcf8a30e757fcf87b7424a5552cfc9e78.tar.gz
emacs-afb62fddcf8a30e757fcf87b7424a5552cfc9e78.zip
(mark-sexp, mark-defun): New arg ALLOW-EXTEND
enables the feature to extend the existing region.
-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 82882d6c2b7..69938255112 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -69,15 +69,17 @@ move forward across N balanced expressions."
69 (or arg (setq arg 1)) 69 (or arg (setq arg 1))
70 (forward-sexp (- arg))) 70 (forward-sexp (- arg)))
71 71
72(defun mark-sexp (&optional arg) 72(defun mark-sexp (&optional arg allow-extend)
73 "Set mark ARG sexps from point. 73 "Set mark ARG sexps from point.
74The place mark goes is the same place \\[forward-sexp] would 74The place mark goes is the same place \\[forward-sexp] would
75move to with the same argument. 75move to with the same argument.
76If this command is repeated or mark is active in Transient Mark mode, 76Interactively, if this command is repeated
77or (in Transient Mark mode) if the mark is active,
77it marks the next ARG sexps after the ones already marked." 78it marks the next ARG sexps after the ones already marked."
78 (interactive "P") 79 (interactive "P\np")
79 (cond ((or (and (eq last-command this-command) (mark t)) 80 (cond ((and allow-extend
80 (and transient-mark-mode mark-active)) 81 (or (and (eq last-command this-command) (mark t))
82 (and transient-mark-mode mark-active)))
81 (setq arg (if arg (prefix-numeric-value arg) 83 (setq arg (if arg (prefix-numeric-value arg)
82 (if (< (mark) (point)) -1 1))) 84 (if (< (mark) (point)) -1 1)))
83 (set-mark 85 (set-mark
@@ -289,14 +291,17 @@ is called as a function to find the defun's end."
289 (goto-char (point-min))))) 291 (goto-char (point-min)))))
290 (setq arg (1+ arg)))))) 292 (setq arg (1+ arg))))))
291 293
292(defun mark-defun () 294(defun mark-defun (&optional allow-extend)
293 "Put mark at end of this defun, point at beginning. 295 "Put mark at end of this defun, point at beginning.
294The defun marked is the one that contains point or follows point. 296The defun marked is the one that contains point or follows point.
295If this command is repeated or mark is active in Transient Mark mode, 297
296it marks more defuns after the ones already marked." 298Interactively, if this command is repeated
297 (interactive) 299or (in Transient Mark mode) if the mark is active,
298 (cond ((or (and (eq last-command this-command) (mark t)) 300it marks the next defun after the ones already marked."
299 (and transient-mark-mode mark-active)) 301 (interactive "p")
302 (cond ((and allow-extend
303 (or (and (eq last-command this-command) (mark t))
304 (and transient-mark-mode mark-active)))
300 (set-mark 305 (set-mark
301 (save-excursion 306 (save-excursion
302 (goto-char (mark)) 307 (goto-char (mark))