aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-12-13 03:09:59 +0000
committerJuri Linkov2004-12-13 03:09:59 +0000
commit967e1a52ad43c7f69a685ec880254d097e417918 (patch)
tree1b3b67b004b8f425297f3e936e0216ffd025f98a
parent705a593394ef51c2dc024cac2a2905ee28d57761 (diff)
downloademacs-967e1a52ad43c7f69a685ec880254d097e417918.tar.gz
emacs-967e1a52ad43c7f69a685ec880254d097e417918.zip
* emacs-lisp/lisp.el (beginning-of-defun, end-of-defun):
Do not push mark when mark is active in transient-mark-mode. * emacs-lisp/lisp.el (mark-sexp, mark-defun): Extend the region when mark is active in transient-mark-mode, regardless of the last command. Doc fix. * emacs-lisp/lisp.el (mark-sexp): Reverse the condition for preserving direction, to mark forward instead of backward when mark is equal to point (e.g. when C-SPC C-M-SPC is typed in t-m-m).
-rw-r--r--lisp/emacs-lisp/lisp.el38
1 files changed, 22 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 87b3fcff96c..090f793c700 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -73,17 +73,18 @@ move forward across N balanced expressions."
73 "Set mark ARG sexps from point. 73 "Set mark ARG sexps from point.
74The place mark goes is the same place \\[forward-sexp] would 74The place mark goes is the same place \\[forward-sexp] would
75move to with the same argument. 75move to with the same argument.
76If this command is repeated, it marks the next ARG sexps after the ones 76If this command is repeated or mark is active in Transient Mark mode,
77already marked." 77it marks the next ARG sexps after the ones already marked."
78 (interactive "P") 78 (interactive "P")
79 (cond ((and (eq last-command this-command) (mark t)) 79 (cond ((or (and (eq last-command this-command) (mark t))
80 (and transient-mark-mode mark-active))
80 (setq arg (if arg (prefix-numeric-value arg) 81 (setq arg (if arg (prefix-numeric-value arg)
81 (if (> (mark) (point)) 1 -1))) 82 (if (< (mark) (point)) -1 1)))
82 (set-mark 83 (set-mark
83 (save-excursion 84 (save-excursion
84 (goto-char (mark)) 85 (goto-char (mark))
85 (forward-sexp arg) 86 (forward-sexp arg)
86 (point)))) 87 (point))))
87 (t 88 (t
88 (push-mark 89 (push-mark
89 (save-excursion 90 (save-excursion
@@ -191,9 +192,11 @@ open-parenthesis, and point ends up at the beginning of the line.
191If variable `beginning-of-defun-function' is non-nil, its value 192If variable `beginning-of-defun-function' is non-nil, its value
192is called as a function to find the defun's beginning." 193is called as a function to find the defun's beginning."
193 (interactive "p") 194 (interactive "p")
194 (and (eq this-command 'beginning-of-defun) 195 (or inhibit-mark-movement
195 (or inhibit-mark-movement (eq last-command 'beginning-of-defun) 196 (not (eq this-command 'beginning-of-defun))
196 (push-mark))) 197 (eq last-command 'beginning-of-defun)
198 (and transient-mark-mode mark-active)
199 (push-mark))
197 (and (beginning-of-defun-raw arg) 200 (and (beginning-of-defun-raw arg)
198 (progn (beginning-of-line) t))) 201 (progn (beginning-of-line) t)))
199 202
@@ -242,9 +245,11 @@ matches the open-parenthesis that starts a defun; see function
242If variable `end-of-defun-function' is non-nil, its value 245If variable `end-of-defun-function' is non-nil, its value
243is called as a function to find the defun's end." 246is called as a function to find the defun's end."
244 (interactive "p") 247 (interactive "p")
245 (and (eq this-command 'end-of-defun) 248 (or inhibit-mark-movement
246 (or inhibit-mark-movement (eq last-command 'end-of-defun) 249 (not (eq this-command 'end-of-defun))
247 (push-mark))) 250 (eq last-command 'end-of-defun)
251 (and transient-mark-mode mark-active)
252 (push-mark))
248 (if (or (null arg) (= arg 0)) (setq arg 1)) 253 (if (or (null arg) (= arg 0)) (setq arg 1))
249 (if end-of-defun-function 254 (if end-of-defun-function
250 (if (> arg 0) 255 (if (> arg 0)
@@ -289,10 +294,11 @@ is called as a function to find the defun's end."
289(defun mark-defun () 294(defun mark-defun ()
290 "Put mark at end of this defun, point at beginning. 295 "Put mark at end of this defun, point at beginning.
291The defun marked is the one that contains point or follows point. 296The defun marked is the one that contains point or follows point.
292If this command is repeated, marks more defuns after the ones 297If this command is repeated or mark is active in Transient Mark mode,
293already marked." 298it marks more defuns after the ones already marked."
294 (interactive) 299 (interactive)
295 (cond ((and (eq last-command this-command) (mark t)) 300 (cond ((or (and (eq last-command this-command) (mark t))
301 (and transient-mark-mode mark-active))
296 (set-mark 302 (set-mark
297 (save-excursion 303 (save-excursion
298 (goto-char (mark)) 304 (goto-char (mark))