diff options
| author | Richard M. Stallman | 2004-12-29 01:32:06 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-12-29 01:32:06 +0000 |
| commit | afb62fddcf8a30e757fcf87b7424a5552cfc9e78 (patch) | |
| tree | 23c07a747c1815659f72b5dd9f84f445f3995460 | |
| parent | a28e0218716025133871b17bd2417156898d37e0 (diff) | |
| download | emacs-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.el | 27 |
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. |
| 74 | The place mark goes is the same place \\[forward-sexp] would | 74 | The place mark goes is the same place \\[forward-sexp] would |
| 75 | move to with the same argument. | 75 | move to with the same argument. |
| 76 | If this command is repeated or mark is active in Transient Mark mode, | 76 | Interactively, if this command is repeated |
| 77 | or (in Transient Mark mode) if the mark is active, | ||
| 77 | it marks the next ARG sexps after the ones already marked." | 78 | it 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. |
| 294 | The defun marked is the one that contains point or follows point. | 296 | The defun marked is the one that contains point or follows point. |
| 295 | If this command is repeated or mark is active in Transient Mark mode, | 297 | |
| 296 | it marks more defuns after the ones already marked." | 298 | Interactively, if this command is repeated |
| 297 | (interactive) | 299 | or (in Transient Mark mode) if the mark is active, |
| 298 | (cond ((or (and (eq last-command this-command) (mark t)) | 300 | it 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)) |