# HG changeset patch # User Alan Mackenzie # Date 1227695453 0 # Node ID 42c2049ff2f6d03cc874323a2f6b7415e4d9d7d4 # Parent c419b54d9ae6dc4ec67ca2f161671dc67a86597f (forward-sexp, backward-sexp, mark-sexp) (forward-list, backward-list, down-list, backward-up-list) (up-list, kill-sexp, backward-kill-sexp, kill-backward-up-list) (insert-pair, insert-parentheses): State that the command assumes that point is not in a string or comment. diff -r c419b54d9ae6 -r 42c2049ff2f6 lisp/emacs-lisp/lisp.el --- a/lisp/emacs-lisp/lisp.el Wed Nov 26 10:27:42 2008 +0000 +++ b/lisp/emacs-lisp/lisp.el Wed Nov 26 10:30:53 2008 +0000 @@ -51,8 +51,9 @@ (defun forward-sexp (&optional arg) "Move forward across one balanced expression (sexp). With ARG, do it that many times. Negative arg -N means -move backward across N balanced expressions." - (interactive "p") +move backward across N balanced expressions. +This command assumes point is not in a string or comment." + (Interactive "p") (or arg (setq arg 1)) (if forward-sexp-function (funcall forward-sexp-function arg) @@ -62,7 +63,8 @@ (defun backward-sexp (&optional arg) "Move backward across one balanced expression (sexp). With ARG, do it that many times. Negative arg -N means -move forward across N balanced expressions." +move forward across N balanced expressions. +This command assumes point is not in a string or comment." (interactive "p") (or arg (setq arg 1)) (forward-sexp (- arg))) @@ -73,7 +75,8 @@ move to with the same argument. Interactively, if this command is repeated or (in Transient Mark mode) if the mark is active, -it marks the next ARG sexps after the ones already marked." +it marks the next ARG sexps after the ones already marked. +This command assumes point is not in a string or comment." (interactive "P\np") (cond ((and allow-extend (or (and (eq last-command this-command) (mark t)) @@ -95,7 +98,8 @@ (defun forward-list (&optional arg) "Move forward across one balanced group of parentheses. With ARG, do it that many times. -Negative arg -N means move backward across N groups of parentheses." +Negative arg -N means move backward across N groups of parentheses. +This command assumes point is not in a string or comment." (interactive "p") (or arg (setq arg 1)) (goto-char (or (scan-lists (point) arg 0) (buffer-end arg)))) @@ -103,7 +107,8 @@ (defun backward-list (&optional arg) "Move backward across one balanced group of parentheses. With ARG, do it that many times. -Negative arg -N means move forward across N groups of parentheses." +Negative arg -N means move forward across N groups of parentheses. +This command assumes point is not in a string or comment." (interactive "p") (or arg (setq arg 1)) (forward-list (- arg))) @@ -111,7 +116,8 @@ (defun down-list (&optional arg) "Move forward down one level of parentheses. With ARG, do this that many times. -A negative argument means move backward but still go down a level." +A negative argument means move backward but still go down a level. +This command assumes point is not in a string or comment." (interactive "p") (or arg (setq arg 1)) (let ((inc (if (> arg 0) 1 -1))) @@ -122,14 +128,16 @@ (defun backward-up-list (&optional arg) "Move backward out of one level of parentheses. With ARG, do this that many times. -A negative argument means move forward but still to a less deep spot." +A negative argument means move forward but still to a less deep spot. +This command assumes point is not in a string or comment." (interactive "p") (up-list (- (or arg 1)))) (defun up-list (&optional arg) "Move forward out of one level of parentheses. With ARG, do this that many times. -A negative argument means move backward but still to a less deep spot." +A negative argument means move backward but still to a less deep spot. +This command assumes point is not in a string or comment." (interactive "p") (or arg (setq arg 1)) (let ((inc (if (> arg 0) 1 -1))) @@ -140,7 +148,8 @@ (defun kill-sexp (&optional arg) "Kill the sexp (balanced expression) following point. With ARG, kill that many sexps after point. -Negative arg -N means kill N sexps before point." +Negative arg -N means kill N sexps before point. +This command assumes point is not in a string or comment." (interactive "p") (let ((opoint (point))) (forward-sexp (or arg 1)) @@ -149,7 +158,8 @@ (defun backward-kill-sexp (&optional arg) "Kill the sexp (balanced expression) preceding point. With ARG, kill that many sexps before point. -Negative arg -N means kill N sexps after point." +Negative arg -N means kill N sexps after point. +This command assumes point is not in a string or comment." (interactive "p") (kill-sexp (- (or arg 1)))) @@ -157,7 +167,8 @@ (defun kill-backward-up-list (&optional arg) "Kill the form containing the current sexp, leaving the sexp itself. A prefix argument ARG causes the relevant number of surrounding -forms to be removed." +forms to be removed. +This command assumes point is not in a string or comment." (interactive "*p") (let ((current-sexp (thing-at-point 'sexp))) (if current-sexp @@ -458,7 +469,9 @@ from the variable `insert-pair-alist' according to the last input character with or without modifiers. If no character pair is found in the variable `insert-pair-alist', then the last input -character is inserted ARG times." +character is inserted ARG times. + +This command assumes point is not in a string or comment." (interactive "P") (if (not (and open close)) (let ((pair (or (assq last-command-char insert-pair-alist) @@ -499,7 +512,9 @@ No argument is equivalent to zero: just insert `()' and leave point between. If `parens-require-spaces' is non-nil, this command also inserts a space before and after, depending on the surrounding characters. -If region is active, insert enclosing characters at region boundaries." +If region is active, insert enclosing characters at region boundaries. + +This command assumes point is not in a string or comment." (interactive "P") (insert-pair arg ?\( ?\)))