aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/lisp.el43
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).
53With ARG, do it that many times. Negative arg -N means 53With ARG, do it that many times. Negative arg -N means
54move backward across N balanced expressions." 54move backward across N balanced expressions.
55 (interactive "p") 55This 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).
64With ARG, do it that many times. Negative arg -N means 65With ARG, do it that many times. Negative arg -N means
65move forward across N balanced expressions." 66move forward across N balanced expressions.
67This 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
73move to with the same argument. 75move to with the same argument.
74Interactively, if this command is repeated 76Interactively, if this command is repeated
75or (in Transient Mark mode) if the mark is active, 77or (in Transient Mark mode) if the mark is active,
76it marks the next ARG sexps after the ones already marked." 78it marks the next ARG sexps after the ones already marked.
79This 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.
97With ARG, do it that many times. 100With ARG, do it that many times.
98Negative arg -N means move backward across N groups of parentheses." 101Negative arg -N means move backward across N groups of parentheses.
102This 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.
105With ARG, do it that many times. 109With ARG, do it that many times.
106Negative arg -N means move forward across N groups of parentheses." 110Negative arg -N means move forward across N groups of parentheses.
111This 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.
113With ARG, do this that many times. 118With ARG, do this that many times.
114A negative argument means move backward but still go down a level." 119A negative argument means move backward but still go down a level.
120This 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.
124With ARG, do this that many times. 130With ARG, do this that many times.
125A negative argument means move forward but still to a less deep spot." 131A negative argument means move forward but still to a less deep spot.
132This 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.
131With ARG, do this that many times. 138With ARG, do this that many times.
132A negative argument means move backward but still to a less deep spot." 139A negative argument means move backward but still to a less deep spot.
140This 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.
142With ARG, kill that many sexps after point. 150With ARG, kill that many sexps after point.
143Negative arg -N means kill N sexps before point." 151Negative arg -N means kill N sexps before point.
152This 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.
151With ARG, kill that many sexps before point. 160With ARG, kill that many sexps before point.
152Negative arg -N means kill N sexps after point." 161Negative arg -N means kill N sexps after point.
162This 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.
159A prefix argument ARG causes the relevant number of surrounding 169A prefix argument ARG causes the relevant number of surrounding
160forms to be removed." 170forms to be removed.
171This 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
458from the variable `insert-pair-alist' according to the last input 469from the variable `insert-pair-alist' according to the last input
459character with or without modifiers. If no character pair is 470character with or without modifiers. If no character pair is
460found in the variable `insert-pair-alist', then the last input 471found in the variable `insert-pair-alist', then the last input
461character is inserted ARG times." 472character is inserted ARG times.
473
474This 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.
499No argument is equivalent to zero: just insert `()' and leave point between. 512No argument is equivalent to zero: just insert `()' and leave point between.
500If `parens-require-spaces' is non-nil, this command also inserts a space 513If `parens-require-spaces' is non-nil, this command also inserts a space
501before and after, depending on the surrounding characters. 514before and after, depending on the surrounding characters.
502If region is active, insert enclosing characters at region boundaries." 515If region is active, insert enclosing characters at region boundaries.
516
517This 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