From mboxrd@z Thu Jan 1 00:00:00 1970 Path: quimby.gnus.org!not-for-mail From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.devel Subject: Re: Unify mark-foo commands Date: Thu, 14 Feb 2002 10:04:54 +0100 Message-ID: References: <200202110209.g1B29El06573@aztec.santafe.edu> NNTP-Posting-Host: quimby2.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: quimby2.netfonds.no 1013678267 26745 195.204.10.66 (14 Feb 2002 09:17:47 GMT) X-Complaints-To: usenet@quimby2.netfonds.no NNTP-Posting-Date: 14 Feb 2002 09:17:47 GMT Cc: emacs-devel@gnu.org Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby2.netfonds.no with esmtp (Exim 3.12 #1 (Debian)) id 16bI1S-0006xH-00 for ; Thu, 14 Feb 2002 10:17:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16bHqI-0008Qc-00; Thu, 14 Feb 2002 04:06:14 -0500 Original-Received: from waldorf.cs.uni-dortmund.de ([129.217.4.42]) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16bHp7-0008LG-00; Thu, 14 Feb 2002 04:05:01 -0500 Original-Received: from lothlorien.cs.uni-dortmund.de (lothlorien [129.217.19.67]) by waldorf.cs.uni-dortmund.de with ESMTP id g1E94xb24573; Thu, 14 Feb 2002 10:04:59 +0100 (MET) Original-Received: from lucy.cs.uni-dortmund.de (lucy [129.217.19.80]) by lothlorien.cs.uni-dortmund.de id KAA04554; Thu, 14 Feb 2002 10:04:54 +0100 (MET) Original-Received: by lucy.cs.uni-dortmund.de (Postfix, from userid 6104) id 70F9F3B1EF; Thu, 14 Feb 2002 10:04:54 +0100 (CET) Original-To: rms@gnu.org In-Reply-To: <200202110209.g1B29El06573@aztec.santafe.edu> (Richard Stallman's message of "Sun, 10 Feb 2002 19:09:14 -0700 (MST)") Original-Lines: 23 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: quimby.gnus.org gmane.emacs.devel:1115 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1115 --=-=-= Richard Stallman writes: > The mark-sexp command recently acquired the (very nifty) feature that > repeating the command extends the selection (so C-M-SPC C-M-SPC marks > two sexps). > > WIBNI the other mark-foo commands behaved similarly? > > That would be consistent. Want to write it? Here is another version. This version also does mark-defun, and modifies etc/NEWS and the emacs manual. Sorry, Pavel, for munging your name in the ChangeLog file. Okay to commit? (With the right ChangeLog file.) kai -- ~/.signature is: umop 3p!sdn (Frank Nobis) --=-=-= Content-Type: text/x-patch; charset=iso-8859-2 Content-Disposition: attachment; filename=core Content-Transfer-Encoding: quoted-printable Index: etc/NEWS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/etc/NEWS,v retrieving revision 1.597 diff -u -r1.597 NEWS --- etc/NEWS 12 Feb 2002 18:58:21 -0000 1.597 +++ etc/NEWS 14 Feb 2002 09:02:28 -0000 @@ -240,9 +240,12 @@ example, if you set `jit-lock-defer-time' to 0.25, fontification will only happen after 0.25s of idle time. =20 -** If you hit M-C-SPC (mark-sexp) repeatedly, the marked region -will now be extended each time, so you can mark the next two sexps with -M-C-SPC M-C-SPC, for example. +** Marking commands extend the region when invoked multiple times. If +you hit M-C-SPC (mark-sexp), M-@ (mark-word), M-h (mark-paragraph), or +C-M-h (mark-defun) repeatedly, the marked region will now be extended +each time, so you can mark the next two sexps with M-C-SPC M-C-SPC, +for example. This feature also works for mark-end-of-sentence, if you +bind that to a key. =20 ** In the *Occur* buffer, `o' switches to it in another window, and C-o displays the current line's occurrence in another window without Index: lisp/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.3444 diff -u -r1.3444 ChangeLog --- lisp/ChangeLog 14 Feb 2002 01:55:43 -0000 1.3444 +++ lisp/ChangeLog 14 Feb 2002 09:02:29 -0000 @@ -1,3 +1,9 @@ +2002-02-13 Kai Gro=DFjohann + + * simple.el (mark-word): Mark more if repeated. + * textmodes/paragraphs.el (mark-paragraph): Ditto. + (mark-end-of-sentence): Ditto. + 2002-02-13 Kim F. Storm =20 * cus-start.el (mode-line-in-non-selected-windows): @@ -90,7 +96,7 @@ * cus-start.el: Don't warn about "x-*" symbols when building a non-GUI version. =20 -2002-02-11 Pavel Jan=EDk +2002-02-11 Pavel Jan=EDk =20 * strokes.el (strokes-do-stroke, strokes-do-complex-stroke): Doc fix. @@ -116,7 +122,7 @@ (dump-charsets, dump-codings): Deleted (obsolete). From Dave Love . =20 -2002-02-10 Pavel Jan=EDk +2002-02-10 Pavel Jan=EDk =20 * menu-bar.el (menu-bar-showhide-menu): Rename functions for toggling. @@ -140,7 +146,7 @@ =20=09 * ediff.el: typo in comment. =20=09 -2002-02-09 Pavel Jan=EDk +2002-02-09 Pavel Jan=EDk =20 * menu-bar.el (menu-bar-options-save): Take care of line-number-mode and column-number-mode variables. @@ -8564,7 +8570,7 @@ (toplevel): Add completion-list-mode-finish to temp-buffer-show-hook. =20 * language/european.el ("Polish"): Change sample text. - From jsbien@mimuw.edu.pl (Janusz S. Bie=F1). + From jsbien@mimuw.edu.pl (Janusz S. Bie=F1). =20 * progmodes/sh-script.el (sh-indent-line): Add optional PREFIX-ARG parameter. Index: lisp/simple.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v retrieving revision 1.520 diff -u -r1.520 simple.el --- lisp/simple.el 6 Feb 2002 15:08:45 -0000 1.520 +++ lisp/simple.el 14 Feb 2002 09:02:29 -0000 @@ -2812,10 +2812,14 @@ (forward-word (- arg))) =20 (defun mark-word (arg) - "Set mark arg words away from point." + "Set mark arg words away from point. +If this command is repeated, it marks the next ARG words after the ones +already marked." (interactive "p") (push-mark - (save-excursion + (save-excursion + (if (and (eq last-command this-command) (mark t)) + (goto-char (mark))) (forward-word arg) (point)) nil t)) Index: lisp/emacs-lisp/lisp.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp.el,v retrieving revision 1.44 diff -u -r1.44 lisp.el --- lisp/emacs-lisp/lisp.el 11 Jan 2002 21:22:28 -0000 1.44 +++ lisp/emacs-lisp/lisp.el 14 Feb 2002 09:02:29 -0000 @@ -250,13 +250,21 @@ =20 (defun mark-defun () "Put mark at end of this defun, point at beginning. -The defun marked is the one that contains point or follows point." +The defun marked is the one that contains point or follows point. +If this command is repeated, marks more defuns after the ones +already marked." (interactive) - (push-mark (point)) - (end-of-defun) - (push-mark (point) nil t) - (beginning-of-defun) - (re-search-backward "^\n" (- (point) 1) t)) + (let (here) + (when (and (eq last-command this-command) (mark t)) + (setq here (point)) + (goto-char (mark))) + (push-mark (point)) + (end-of-defun) + (push-mark (point) nil t) + (if here + (goto-char here) + (beginning-of-defun) + (re-search-backward "^\n" (- (point) 1) t)))) =20 (defun narrow-to-defun (&optional arg) "Make text outside current defun invisible. Index: lisp/textmodes/paragraphs.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/lisp/textmodes/paragraphs.el,v retrieving revision 1.58 diff -u -r1.58 paragraphs.el --- lisp/textmodes/paragraphs.el 30 Nov 2001 17:18:26 -0000 1.58 +++ lisp/textmodes/paragraphs.el 14 Feb 2002 09:02:29 -0000 @@ -325,14 +325,23 @@ the number of paragraphs marked equals ARG. =20 If ARG is negative, point is put at end of this paragraph, mark is put -at beginning of this or a previous paragraph." +at beginning of this or a previous paragraph. + +If this command is repeated, it marks the next ARG paragraphs after (or +before, if arg is negative) the ones already marked." (interactive "p") - (unless arg (setq arg 1)) - (when (zerop arg) - (error "Cannot mark zero paragraphs")) - (forward-paragraph arg) - (push-mark nil t t) - (backward-paragraph arg)) + (let (here) + (unless arg (setq arg 1)) + (when (zerop arg) + (error "Cannot mark zero paragraphs")) + (when (and (eq last-command this-command) (mark t)) + (setq here (point)) + (goto-char (mark))) + (forward-paragraph arg) + (push-mark nil t t) + (if here + (goto-char here) + (backward-paragraph arg)))) =20 (defun kill-paragraph (arg) "Kill forward to end of paragraph. @@ -424,13 +433,17 @@ (kill-region (point) (progn (backward-sentence arg) (point)))) =20 (defun mark-end-of-sentence (arg) - "Put mark at end of sentence. Arg works as in `forward-sentence'." + "Put mark at end of sentence. Arg works as in `forward-sentence'. +If this command is repeated, it marks the next ARG sentences after the +ones already marked." (interactive "p") (push-mark - (save-excursion - (forward-sentence arg) - (point)) - nil t)) + (save-excursion + (if (and (eq last-command this-command) (mark t)) + (goto-char (mark))) + (forward-sentence arg) + (point)) + nil t)) =20 (defun transpose-sentences (arg) "Interchange this (next) and previous sentence." Index: man/mark.texi =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/man/mark.texi,v retrieving revision 1.18 diff -u -r1.18 mark.texi --- man/mark.texi 3 Dec 2001 00:04:41 -0000 1.18 +++ man/mark.texi 14 Feb 2002 09:02:29 -0000 @@ -278,7 +278,9 @@ @kbd{M-@@} (@code{mark-word}) puts the mark at the end of the next word, while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the next balanced expression (@pxref{Expressions}). These commands handle -arguments just like @kbd{M-f} and @kbd{C-M-f}. +arguments just like @kbd{M-f} and @kbd{C-M-f}. If you repeat these +commands, the region is extended. For example, you can type either +@kbd{C-u 2 M-@@} or @kbd{M-@@ M-@@} to mark the next two words. =20 @kindex C-x h @findex mark-whole-buffer @@ -292,17 +294,20 @@ point. If the prefix argument is @minus{}@var{n}, @kbd{M-h} also marks @var{n} paragraphs, running back form the one surrounding point. In that last case, point moves forward to the end of that paragraph, -and the mark goes at the start of the region. +and the mark goes at the start of the region. The @kbd{M-h} command +also supports the extension of the region, similar to @kbd{M-@} and +@kbd{C-M-@@}. =20 @kbd{C-M-h} (@code{mark-defun}) similarly puts point before, and the mark after, the current (or following) major top-level definition, or -defun (@pxref{Moving by Defuns}). (Currently it only marks one -defun.) @kbd{C-x C-p} (@code{mark-page}) puts point before the -current page, and mark at the end (@pxref{Pages}). The mark goes -after the terminating page delimiter (to include it in the region), -while point goes after the preceding page delimiter (to exclude it). -A numeric argument specifies a later page (if positive) or an earlier -page (if negative) instead of the current page. +defun (@pxref{Moving by Defuns}). (Currently it only marks one defun, +but repeating it marks more defuns, like for @kbd{M-@@}.) @kbd{C-x +C-p} (@code{mark-page}) puts point before the current page, and mark +at the end (@pxref{Pages}). The mark goes after the terminating page +delimiter (to include it in the region), while point goes after the +preceding page delimiter (to exclude it). A numeric argument +specifies a later page (if positive) or an earlier page (if negative) +instead of the current page. =20 Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire buffer as the region, by putting point at the beginning and the mark at --=-=-=-- _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel