diff options
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index cee2b828b6c..0000b2e1976 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el | |||
| @@ -51,8 +51,9 @@ Should take the same arguments and behave similarly to `forward-sexp'.") | |||
| 51 | (defun forward-sexp (&optional arg) | 51 | (defun forward-sexp (&optional arg) |
| 52 | "Move forward across one balanced expression (sexp). | 52 | "Move forward across one balanced expression (sexp). |
| 53 | With ARG, do it that many times. Negative arg -N means | 53 | With ARG, do it that many times. Negative arg -N means |
| 54 | move backward across N balanced expressions." | 54 | move backward across N balanced expressions. |
| 55 | (interactive "p") | 55 | This command assumes point is not in a string or comment." |
| 56 | (Interactive "p") | ||
| 56 | (or arg (setq arg 1)) | 57 | (or arg (setq arg 1)) |
| 57 | (if forward-sexp-function | 58 | (if forward-sexp-function |
| 58 | (funcall forward-sexp-function arg) | 59 | (funcall forward-sexp-function arg) |
| @@ -62,7 +63,8 @@ move backward across N balanced expressions." | |||
| 62 | (defun backward-sexp (&optional arg) | 63 | (defun backward-sexp (&optional arg) |
| 63 | "Move backward across one balanced expression (sexp). | 64 | "Move backward across one balanced expression (sexp). |
| 64 | With ARG, do it that many times. Negative arg -N means | 65 | With ARG, do it that many times. Negative arg -N means |
| 65 | move forward across N balanced expressions." | 66 | move forward across N balanced expressions. |
| 67 | This command assumes point is not in a string or comment." | ||
| 66 | (interactive "p") | 68 | (interactive "p") |
| 67 | (or arg (setq arg 1)) | 69 | (or arg (setq arg 1)) |
| 68 | (forward-sexp (- arg))) | 70 | (forward-sexp (- arg))) |
| @@ -73,7 +75,8 @@ The place mark goes is the same place \\[forward-sexp] would | |||
| 73 | move to with the same argument. | 75 | move to with the same argument. |
| 74 | Interactively, if this command is repeated | 76 | Interactively, if this command is repeated |
| 75 | or (in Transient Mark mode) if the mark is active, | 77 | or (in Transient Mark mode) if the mark is active, |
| 76 | it marks the next ARG sexps after the ones already marked." | 78 | it marks the next ARG sexps after the ones already marked. |
| 79 | This command assumes point is not in a string or comment." | ||
| 77 | (interactive "P\np") | 80 | (interactive "P\np") |
| 78 | (cond ((and allow-extend | 81 | (cond ((and allow-extend |
| 79 | (or (and (eq last-command this-command) (mark t)) | 82 | (or (and (eq last-command this-command) (mark t)) |
| @@ -95,7 +98,8 @@ it marks the next ARG sexps after the ones already marked." | |||
| 95 | (defun forward-list (&optional arg) | 98 | (defun forward-list (&optional arg) |
| 96 | "Move forward across one balanced group of parentheses. | 99 | "Move forward across one balanced group of parentheses. |
| 97 | With ARG, do it that many times. | 100 | With ARG, do it that many times. |
| 98 | Negative arg -N means move backward across N groups of parentheses." | 101 | Negative arg -N means move backward across N groups of parentheses. |
| 102 | This command assumes point is not in a string or comment." | ||
| 99 | (interactive "p") | 103 | (interactive "p") |
| 100 | (or arg (setq arg 1)) | 104 | (or arg (setq arg 1)) |
| 101 | (goto-char (or (scan-lists (point) arg 0) (buffer-end arg)))) | 105 | (goto-char (or (scan-lists (point) arg 0) (buffer-end arg)))) |
| @@ -103,7 +107,8 @@ Negative arg -N means move backward across N groups of parentheses." | |||
| 103 | (defun backward-list (&optional arg) | 107 | (defun backward-list (&optional arg) |
| 104 | "Move backward across one balanced group of parentheses. | 108 | "Move backward across one balanced group of parentheses. |
| 105 | With ARG, do it that many times. | 109 | With ARG, do it that many times. |
| 106 | Negative arg -N means move forward across N groups of parentheses." | 110 | Negative arg -N means move forward across N groups of parentheses. |
| 111 | This command assumes point is not in a string or comment." | ||
| 107 | (interactive "p") | 112 | (interactive "p") |
| 108 | (or arg (setq arg 1)) | 113 | (or arg (setq arg 1)) |
| 109 | (forward-list (- arg))) | 114 | (forward-list (- arg))) |
| @@ -111,7 +116,8 @@ Negative arg -N means move forward across N groups of parentheses." | |||
| 111 | (defun down-list (&optional arg) | 116 | (defun down-list (&optional arg) |
| 112 | "Move forward down one level of parentheses. | 117 | "Move forward down one level of parentheses. |
| 113 | With ARG, do this that many times. | 118 | With ARG, do this that many times. |
| 114 | A negative argument means move backward but still go down a level." | 119 | A negative argument means move backward but still go down a level. |
| 120 | This command assumes point is not in a string or comment." | ||
| 115 | (interactive "p") | 121 | (interactive "p") |
| 116 | (or arg (setq arg 1)) | 122 | (or arg (setq arg 1)) |
| 117 | (let ((inc (if (> arg 0) 1 -1))) | 123 | (let ((inc (if (> arg 0) 1 -1))) |
| @@ -122,14 +128,16 @@ A negative argument means move backward but still go down a level." | |||
| 122 | (defun backward-up-list (&optional arg) | 128 | (defun backward-up-list (&optional arg) |
| 123 | "Move backward out of one level of parentheses. | 129 | "Move backward out of one level of parentheses. |
| 124 | With ARG, do this that many times. | 130 | With ARG, do this that many times. |
| 125 | A negative argument means move forward but still to a less deep spot." | 131 | A negative argument means move forward but still to a less deep spot. |
| 132 | This command assumes point is not in a string or comment." | ||
| 126 | (interactive "p") | 133 | (interactive "p") |
| 127 | (up-list (- (or arg 1)))) | 134 | (up-list (- (or arg 1)))) |
| 128 | 135 | ||
| 129 | (defun up-list (&optional arg) | 136 | (defun up-list (&optional arg) |
| 130 | "Move forward out of one level of parentheses. | 137 | "Move forward out of one level of parentheses. |
| 131 | With ARG, do this that many times. | 138 | With ARG, do this that many times. |
| 132 | A negative argument means move backward but still to a less deep spot." | 139 | A negative argument means move backward but still to a less deep spot. |
| 140 | This command assumes point is not in a string or comment." | ||
| 133 | (interactive "p") | 141 | (interactive "p") |
| 134 | (or arg (setq arg 1)) | 142 | (or arg (setq arg 1)) |
| 135 | (let ((inc (if (> arg 0) 1 -1))) | 143 | (let ((inc (if (> arg 0) 1 -1))) |
| @@ -140,7 +148,8 @@ A negative argument means move backward but still to a less deep spot." | |||
| 140 | (defun kill-sexp (&optional arg) | 148 | (defun kill-sexp (&optional arg) |
| 141 | "Kill the sexp (balanced expression) following point. | 149 | "Kill the sexp (balanced expression) following point. |
| 142 | With ARG, kill that many sexps after point. | 150 | With ARG, kill that many sexps after point. |
| 143 | Negative arg -N means kill N sexps before point." | 151 | Negative arg -N means kill N sexps before point. |
| 152 | This command assumes point is not in a string or comment." | ||
| 144 | (interactive "p") | 153 | (interactive "p") |
| 145 | (let ((opoint (point))) | 154 | (let ((opoint (point))) |
| 146 | (forward-sexp (or arg 1)) | 155 | (forward-sexp (or arg 1)) |
| @@ -149,7 +158,8 @@ Negative arg -N means kill N sexps before point." | |||
| 149 | (defun backward-kill-sexp (&optional arg) | 158 | (defun backward-kill-sexp (&optional arg) |
| 150 | "Kill the sexp (balanced expression) preceding point. | 159 | "Kill the sexp (balanced expression) preceding point. |
| 151 | With ARG, kill that many sexps before point. | 160 | With ARG, kill that many sexps before point. |
| 152 | Negative arg -N means kill N sexps after point." | 161 | Negative arg -N means kill N sexps after point. |
| 162 | This command assumes point is not in a string or comment." | ||
| 153 | (interactive "p") | 163 | (interactive "p") |
| 154 | (kill-sexp (- (or arg 1)))) | 164 | (kill-sexp (- (or arg 1)))) |
| 155 | 165 | ||
| @@ -157,7 +167,8 @@ Negative arg -N means kill N sexps after point." | |||
| 157 | (defun kill-backward-up-list (&optional arg) | 167 | (defun kill-backward-up-list (&optional arg) |
| 158 | "Kill the form containing the current sexp, leaving the sexp itself. | 168 | "Kill the form containing the current sexp, leaving the sexp itself. |
| 159 | A prefix argument ARG causes the relevant number of surrounding | 169 | A prefix argument ARG causes the relevant number of surrounding |
| 160 | forms to be removed." | 170 | forms to be removed. |
| 171 | This command assumes point is not in a string or comment." | ||
| 161 | (interactive "*p") | 172 | (interactive "*p") |
| 162 | (let ((current-sexp (thing-at-point 'sexp))) | 173 | (let ((current-sexp (thing-at-point 'sexp))) |
| 163 | (if current-sexp | 174 | (if current-sexp |
| @@ -458,7 +469,9 @@ If arguments OPEN and CLOSE are nil, the character pair is found | |||
| 458 | from the variable `insert-pair-alist' according to the last input | 469 | from the variable `insert-pair-alist' according to the last input |
| 459 | character with or without modifiers. If no character pair is | 470 | character with or without modifiers. If no character pair is |
| 460 | found in the variable `insert-pair-alist', then the last input | 471 | found in the variable `insert-pair-alist', then the last input |
| 461 | character is inserted ARG times." | 472 | character is inserted ARG times. |
| 473 | |||
| 474 | This command assumes point is not in a string or comment." | ||
| 462 | (interactive "P") | 475 | (interactive "P") |
| 463 | (if (not (and open close)) | 476 | (if (not (and open close)) |
| 464 | (let ((pair (or (assq last-command-char insert-pair-alist) | 477 | (let ((pair (or (assq last-command-char insert-pair-alist) |
| @@ -499,7 +512,9 @@ A negative ARG encloses the preceding ARG sexps instead. | |||
| 499 | No argument is equivalent to zero: just insert `()' and leave point between. | 512 | No argument is equivalent to zero: just insert `()' and leave point between. |
| 500 | If `parens-require-spaces' is non-nil, this command also inserts a space | 513 | If `parens-require-spaces' is non-nil, this command also inserts a space |
| 501 | before and after, depending on the surrounding characters. | 514 | before and after, depending on the surrounding characters. |
| 502 | If region is active, insert enclosing characters at region boundaries." | 515 | If region is active, insert enclosing characters at region boundaries. |
| 516 | |||
| 517 | This command assumes point is not in a string or comment." | ||
| 503 | (interactive "P") | 518 | (interactive "P") |
| 504 | (insert-pair arg ?\( ?\))) | 519 | (insert-pair arg ?\( ?\))) |
| 505 | 520 | ||