Mercurial > emacs
comparison lisp/emacs-lisp/lisp.el @ 59177:5188f5b11d56
(mark-sexp, mark-defun): New arg ALLOW-EXTEND
enables the feature to extend the existing region.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 29 Dec 2004 01:32:06 +0000 |
parents | eb752b1a84b1 |
children | 99bf07f49031 95879cc1ed20 |
comparison
equal
deleted
inserted
replaced
59176:25f94004470f | 59177:5188f5b11d56 |
---|---|
67 move forward across N balanced expressions." | 67 move forward across N balanced expressions." |
68 (interactive "p") | 68 (interactive "p") |
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 |
84 (save-excursion | 86 (save-excursion |
85 (goto-char (mark)) | 87 (goto-char (mark)) |
287 (if (looking-at "\\s<\\|\n") | 289 (if (looking-at "\\s<\\|\n") |
288 (forward-line 1))) | 290 (forward-line 1))) |
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)) |
303 (end-of-defun) | 308 (end-of-defun) |
304 (point)))) | 309 (point)))) |