diff options
| author | Richard M. Stallman | 1993-06-14 22:58:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-14 22:58:54 +0000 |
| commit | 44a53673e892ac18cfbf6298a2a4983f402880b8 (patch) | |
| tree | 7a0e935ca7ec2d45f291e3d6cac0ba3560440704 | |
| parent | 4a6e3980e26fda95587bff36c3a0efc0779f0202 (diff) | |
| download | emacs-44a53673e892ac18cfbf6298a2a4983f402880b8.tar.gz emacs-44a53673e892ac18cfbf6298a2a4983f402880b8.zip | |
(parens-dont-require-spaces): New variable.
(insert-parentheses): Obey that variable.
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 854afdddbf0..57e397df663 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el | |||
| @@ -30,6 +30,9 @@ | |||
| 30 | (defvar defun-prompt-regexp nil | 30 | (defvar defun-prompt-regexp nil |
| 31 | "Non-nil => regexp to ignore, before the `(' that starts a defun.") | 31 | "Non-nil => regexp to ignore, before the `(' that starts a defun.") |
| 32 | 32 | ||
| 33 | (defvar parens-dont-require-spaces nil | ||
| 34 | "Non-nil => `insert-parentheses' should not insert whitespace.") | ||
| 35 | |||
| 33 | (defun forward-sexp (&optional arg) | 36 | (defun forward-sexp (&optional arg) |
| 34 | "Move forward across one balanced expression (sexp). | 37 | "Move forward across one balanced expression (sexp). |
| 35 | With argument, do it that many times. Negative arg -N means | 38 | With argument, do it that many times. Negative arg -N means |
| @@ -195,18 +198,22 @@ The defun marked is the one that contains point or follows point." | |||
| 195 | 198 | ||
| 196 | (defun insert-parentheses (arg) | 199 | (defun insert-parentheses (arg) |
| 197 | "Put parentheses around next ARG sexps. Leave point after open-paren. | 200 | "Put parentheses around next ARG sexps. Leave point after open-paren. |
| 198 | No argument is equivalent to zero: just insert () and leave point between." | 201 | No argument is equivalent to zero: just insert `()' and leave point between. |
| 202 | This command also sometimes inserts a space before and after, | ||
| 203 | depending on the surrounding characters." | ||
| 199 | (interactive "P") | 204 | (interactive "P") |
| 200 | (if arg (setq arg (prefix-numeric-value arg)) | 205 | (if arg (setq arg (prefix-numeric-value arg)) |
| 201 | (setq arg 0)) | 206 | (setq arg 0)) |
| 202 | (or (eq arg 0) (skip-chars-forward " \t")) | 207 | (or (eq arg 0) (skip-chars-forward " \t")) |
| 203 | (and (memq (char-syntax (preceding-char)) '(?w ?_ ?\) )) | 208 | (and (not parens-dont-require-spaces) |
| 209 | (memq (char-syntax (preceding-char)) '(?w ?_ ?\) )) | ||
| 204 | (insert " ")) | 210 | (insert " ")) |
| 205 | (insert ?\() | 211 | (insert ?\() |
| 206 | (save-excursion | 212 | (save-excursion |
| 207 | (or (eq arg 0) (forward-sexp arg)) | 213 | (or (eq arg 0) (forward-sexp arg)) |
| 208 | (insert ?\)) | 214 | (insert ?\)) |
| 209 | (and (memq (char-syntax (following-char)) '(?w ?_ ?\( )) | 215 | (and (not parens-dont-require-spaces) |
| 216 | (memq (char-syntax (following-char)) '(?w ?_ ?\( )) | ||
| 210 | (insert " ")))) | 217 | (insert " ")))) |
| 211 | 218 | ||
| 212 | (defun move-past-close-and-reindent () | 219 | (defun move-past-close-and-reindent () |