]> git.eshelyaron.com Git - emacs.git/commitdiff
(mark-sexp): Preserve direction when repeating.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 12 Oct 2004 16:05:55 +0000 (16:05 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 12 Oct 2004 16:05:55 +0000 (16:05 +0000)
lisp/emacs-lisp/lisp.el

index 63d9f759cebbfd6e2e7a8cc30ddcc009474fa913..87b3fcff96c262ec02a9a6367d82f371a639a1c9 100644 (file)
@@ -75,17 +75,19 @@ The place mark goes is the same place \\[forward-sexp] would
 move to with the same argument.
 If this command is repeated, it marks the next ARG sexps after the ones
 already marked."
-  (interactive "p")
+  (interactive "P")
   (cond ((and (eq last-command this-command) (mark t))
+        (setq arg (if arg (prefix-numeric-value arg)
+                    (if (> (mark) (point)) 1 -1)))
         (set-mark
          (save-excursion
           (goto-char (mark))
-          (forward-sexp (or arg 1))
+          (forward-sexp arg)
           (point))))
        (t
         (push-mark
          (save-excursion
-           (forward-sexp (or arg 1))
+           (forward-sexp (prefix-numeric-value arg))
            (point))
          nil t))))