summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-06-14 22:58:54 +0000
committerRichard M. Stallman <rms@gnu.org>1993-06-14 22:58:54 +0000
commit44a53673e892ac18cfbf6298a2a4983f402880b8 (patch)
tree7a0e935ca7ec2d45f291e3d6cac0ba3560440704 /lisp/emacs-lisp
parent4a6e3980e26fda95587bff36c3a0efc0779f0202 (diff)
downloademacs-44a53673e892ac18cfbf6298a2a4983f402880b8.tar.gz
emacs-44a53673e892ac18cfbf6298a2a4983f402880b8.tar.bz2
emacs-44a53673e892ac18cfbf6298a2a4983f402880b8.zip
(parens-dont-require-spaces): New variable.
(insert-parentheses): Obey that variable.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/lisp.el13
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 @@
(defvar defun-prompt-regexp nil
"Non-nil => regexp to ignore, before the `(' that starts a defun.")
+(defvar parens-dont-require-spaces nil
+ "Non-nil => `insert-parentheses' should not insert whitespace.")
+
(defun forward-sexp (&optional arg)
"Move forward across one balanced expression (sexp).
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."
(defun insert-parentheses (arg)
"Put parentheses around next ARG sexps. Leave point after open-paren.
-No argument is equivalent to zero: just insert () and leave point between."
+No argument is equivalent to zero: just insert `()' and leave point between.
+This command also sometimes inserts a space before and after,
+depending on the surrounding characters."
(interactive "P")
(if arg (setq arg (prefix-numeric-value arg))
(setq arg 0))
(or (eq arg 0) (skip-chars-forward " \t"))
- (and (memq (char-syntax (preceding-char)) '(?w ?_ ?\) ))
+ (and (not parens-dont-require-spaces)
+ (memq (char-syntax (preceding-char)) '(?w ?_ ?\) ))
(insert " "))
(insert ?\()
(save-excursion
(or (eq arg 0) (forward-sexp arg))
(insert ?\))
- (and (memq (char-syntax (following-char)) '(?w ?_ ?\( ))
+ (and (not parens-dont-require-spaces)
+ (memq (char-syntax (following-char)) '(?w ?_ ?\( ))
(insert " "))))
(defun move-past-close-and-reindent ()