From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann)
Subject: Re: Unify mark-foo commands
Date: Wed, 13 Feb 2002 17:52:33 +0100 [thread overview]
Message-ID: <vaf66515nou.fsf@INBOX.auto.emacs.devel.tok.lucy.cs.uni-dortmund.de> (raw)
In-Reply-To: <200202110209.g1B29El06573@aztec.santafe.edu> (Richard Stallman's message of "Sun, 10 Feb 2002 19:09:14 -0700 (MST)")
Richard Stallman <rms@gnu.org> 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?
I have now consed up something. What do people think?
Things I've noticed:
* The extension feature doesn't work if one calls the command via
M-x. I came across this problem because mark-end-of-sentence
doesn't have a keybinding by default. But mark-sexp behaves the
same. (Presumably, this-command or last-command is exit-minibuffer
or the like, rather than mark-end-of-sentence.)
* Doing C-M-SPC multiple times pushes multiple marks on the mark
ring. But maybe the user expects C-M-SPC C-M-SPC to only put one
mark on the mark ring, like C-u 2 C-M-SPC would have done?
* If mark-page is called with an argument, it doesn't mark more pages.
Instead, it marks _other_ pages. I didn't change that command, as
it is not clear to me what should happen:
Should C-x C-p C-x C-p do the same as C-u 2 C-x C-p? That would
make sense, in a way.
Or should C-x C-p C-x C-p mark the current page and the next page,
ie, mark two pages? That would also make sense.
* I kind of expected the prefix arg to be sticky. That is, after
invoking M-- C-M-SPC to mark the _previous_ sexp, I expected further
C-M-SPC (without M--) to continue marking "in the same direction".
(a) (b) -!- (c) (d)
If you put point at the position indicated with "-!-" and do M--
C-M-SPC C-M-SPC, nothing will be marked. If you do, instead, M--
C-M-SPC M-- C-M-SPC, then (a) (b) will be marked.
* The implementation for mark-paragraph looks very different from the
implementation for mark-sexp, mark-end-of-sentence and mark-word.
Not sure if this is a problem.
* The docstring for mark-sexp refers to forward-sexp. Would it be
better to make it stand alone?
* The docstrings for mark-word and mark-end-of-sentence don't mention
what negative arguments do.
Oh boy. I write such trivial extensions and you guys have to spend
so much time on discussing it with me. I wonder whether that means
that I'm a nuisance rather than help. But I don't know what else to
do but ask -- I want to do it right!
I know that the NEWS file needs to be updated. I guess the Emacs
manual also needs to be updated. If I get the go-ahead, I'll do that
as well.
~/work/gnu/emacs $ cvs diff lisp
cvs server: Diffing lisp
Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.3440
diff -u -r1.3440 ChangeLog
--- lisp/ChangeLog 12 Feb 2002 17:38:06 -0000 1.3440
+++ lisp/ChangeLog 13 Feb 2002 16:47:39 -0000
@@ -1,3 +1,9 @@
+2002-02-13 Kai Gro^[,A_^[(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+ * simple.el (mark-word): Mark more if repeated.
+ * textmodes/paragraphs.el (mark-paragraph): Ditto.
+ (mark-end-of-sentence): Ditto.
+
2002-02-12 Eli Zaretskii <eliz@is.elta.co.il>
* progmodes/pascal.el (pascal-imenu-generic-expression): Add
@@ -59,7 +65,7 @@
* cus-start.el: Don't warn about "x-*" symbols when building a
non-GUI version.
-2002-02-11 Pavel Jan^[,Bm^[(Bk <Pavel@Janik.cz>
+2002-02-11 Pavel Jan^[,Am^[(Bk <Pavel@Janik.cz>
* strokes.el (strokes-do-stroke, strokes-do-complex-stroke):
Doc fix.
@@ -85,7 +91,7 @@
(dump-charsets, dump-codings): Deleted (obsolete).
From Dave Love <fx@gnu.org>.
-2002-02-10 Pavel Jan^[,Bm^[(Bk <Pavel@Janik.cz>
+2002-02-10 Pavel Jan^[,Am^[(Bk <Pavel@Janik.cz>
* menu-bar.el (menu-bar-showhide-menu): Rename functions for
toggling.
@@ -109,7 +115,7 @@
* ediff.el: typo in comment.
-2002-02-09 Pavel Jan^[,Bm^[(Bk <Pavel@Janik.cz>
+2002-02-09 Pavel Jan^[,Am^[(Bk <Pavel@Janik.cz>
* menu-bar.el (menu-bar-options-save): Take care of
line-number-mode and column-number-mode variables.
@@ -8533,7 +8539,7 @@
(toplevel): Add completion-list-mode-finish to temp-buffer-show-hook.
* language/european.el ("Polish"): Change sample text.
- From jsbien@mimuw.edu.pl (Janusz S. Bie^[,Bq^[(B).
+ From jsbien@mimuw.edu.pl (Janusz S. Bie^[$,1 d^[(B).
* progmodes/sh-script.el (sh-indent-line): Add optional PREFIX-ARG
parameter.
Index: lisp/simple.el
===================================================================
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 13 Feb 2002 16:47:40 -0000
@@ -2812,10 +2812,14 @@
(forward-word (- arg)))
(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))
cvs server: Diffing lisp/calc
cvs server: Diffing lisp/calendar
cvs server: Diffing lisp/emacs-lisp
cvs server: Diffing lisp/emulation
cvs server: Diffing lisp/eshell
cvs server: Diffing lisp/gnus
cvs server: Diffing lisp/international
cvs server: Diffing lisp/language
cvs server: Diffing lisp/mail
cvs server: Diffing lisp/net
cvs server: Diffing lisp/obsolete
cvs server: Diffing lisp/play
cvs server: Diffing lisp/progmodes
cvs server: Diffing lisp/term
cvs server: Diffing lisp/textmodes
Index: lisp/textmodes/paragraphs.el
===================================================================
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 13 Feb 2002 16:47:40 -0000
@@ -325,14 +325,23 @@
the number of paragraphs marked equals ARG.
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))))
(defun kill-paragraph (arg)
"Kill forward to end of paragraph.
@@ -424,13 +433,17 @@
(kill-region (point) (progn (backward-sentence arg) (point))))
(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))
(defun transpose-sentences (arg)
"Interchange this (next) and previous sentence."
cvs server: Diffing lisp/toolbar
~/work/gnu/emacs $
kai
--
~/.signature is: umop 3p!sdn (Frank Nobis)
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2002-02-13 16:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-09 18:50 Unify mark-foo commands Kai Großjohann
2002-02-11 2:09 ` Richard Stallman
2002-02-13 16:52 ` Kai Großjohann [this message]
2002-02-14 12:46 ` Richard Stallman
2002-02-14 13:15 ` Kai Großjohann
2002-02-14 9:04 ` Kai Großjohann
2002-02-14 10:13 ` Eli Zaretskii
2002-02-15 10:36 ` Richard Stallman
2002-02-15 10:36 ` Richard Stallman
2002-02-15 9:23 ` Kai Großjohann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vaf66515nou.fsf@INBOX.auto.emacs.devel.tok.lucy.cs.uni-dortmund.de \
--to=kai.grossjohann@cs.uni-dortmund.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).