Mercurial > emacs
changeset 3733:c1c105ffdd0c
(parens-dont-require-spaces): New variable.
(insert-parentheses): Obey that variable.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 14 Jun 1993 22:58:54 +0000 |
parents | 60292a8697bc |
children | 5ada670e1fd8 |
files | lisp/emacs-lisp/lisp.el |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp.el Mon Jun 14 21:44:34 1993 +0000 +++ b/lisp/emacs-lisp/lisp.el Mon Jun 14 22:58:54 1993 +0000 @@ -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 @@ (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 ()