comparison lisp/emacs-lisp/lisp.el @ 57457:8c6dae33cdc3

(mark-sexp): Preserve direction when repeating.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 12 Oct 2004 16:05:55 +0000
parents bca93997a4d7
children 2ee970dcd072 ff0e824afa37
comparison
equal deleted inserted replaced
57456:cadf61c7f4eb 57457:8c6dae33cdc3
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, it marks the next ARG sexps after the ones 76 If this command is repeated, it marks the next ARG sexps after the ones
77 already marked." 77 already marked."
78 (interactive "p") 78 (interactive "P")
79 (cond ((and (eq last-command this-command) (mark t)) 79 (cond ((and (eq last-command this-command) (mark t))
80 (setq arg (if arg (prefix-numeric-value arg)
81 (if (> (mark) (point)) 1 -1)))
80 (set-mark 82 (set-mark
81 (save-excursion 83 (save-excursion
82 (goto-char (mark)) 84 (goto-char (mark))
83 (forward-sexp (or arg 1)) 85 (forward-sexp arg)
84 (point)))) 86 (point))))
85 (t 87 (t
86 (push-mark 88 (push-mark
87 (save-excursion 89 (save-excursion
88 (forward-sexp (or arg 1)) 90 (forward-sexp (prefix-numeric-value arg))
89 (point)) 91 (point))
90 nil t)))) 92 nil t))))
91 93
92 (defun forward-list (&optional arg) 94 (defun forward-list (&optional arg)
93 "Move forward across one balanced group of parentheses. 95 "Move forward across one balanced group of parentheses.