diff options
| author | Erik Naggum | 1996-10-08 23:13:39 +0000 |
|---|---|---|
| committer | Erik Naggum | 1996-10-08 23:13:39 +0000 |
| commit | e3ac26cbb8f0bbc87bb3074f840001426d8b4a74 (patch) | |
| tree | bea72e148e1583926280a9042d8048062b785679 | |
| parent | dc81e1664f0d89beb046242a896912b3fc9bee37 (diff) | |
| download | emacs-e3ac26cbb8f0bbc87bb3074f840001426d8b4a74.tar.gz emacs-e3ac26cbb8f0bbc87bb3074f840001426d8b4a74.zip | |
(narrow-to-defun): Narrow to the same defun that `mark-defun' would make
the region.
(insert-parentheses): Let a negative argument enclose preceding sexps.
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index a62fe926e8b..fb9443e0788 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el | |||
| @@ -215,18 +215,22 @@ The defun visible is the one that contains point or follows point." | |||
| 215 | (interactive) | 215 | (interactive) |
| 216 | (save-excursion | 216 | (save-excursion |
| 217 | (widen) | 217 | (widen) |
| 218 | (beginning-of-defun) | 218 | (end-of-defun) |
| 219 | (narrow-to-region (point) (progn (end-of-defun) (point))))) | 219 | (let ((end (point))) |
| 220 | (beginning-of-defun) | ||
| 221 | (narrow-to-region (point) end)))) | ||
| 220 | 222 | ||
| 221 | (defun insert-parentheses (arg) | 223 | (defun insert-parentheses (arg) |
| 222 | "Put parentheses around next ARG sexps. Leave point after open-paren. | 224 | "Enclose following ARG sexps in parentheses. Leave point after open-paren. |
| 225 | A negative ARG encloses the preceding ARG sexps instead. | ||
| 223 | No argument is equivalent to zero: just insert `()' and leave point between. | 226 | No argument is equivalent to zero: just insert `()' and leave point between. |
| 224 | If `parens-require-spaces' is non-nil, this command also inserts a space | 227 | If `parens-require-spaces' is non-nil, this command also inserts a space |
| 225 | before and after, depending on the surrounding characters." | 228 | before and after, depending on the surrounding characters." |
| 226 | (interactive "P") | 229 | (interactive "P") |
| 227 | (if arg (setq arg (prefix-numeric-value arg)) | 230 | (if arg (setq arg (prefix-numeric-value arg)) |
| 228 | (setq arg 0)) | 231 | (setq arg 0)) |
| 229 | (or (eq arg 0) (skip-chars-forward " \t")) | 232 | (cond ((> arg 0) (skip-chars-forward " \t")) |
| 233 | ((< arg 0) (forward-sexp arg) (setq arg (- arg)))) | ||
| 230 | (and parens-require-spaces | 234 | (and parens-require-spaces |
| 231 | (not (bobp)) | 235 | (not (bobp)) |
| 232 | (memq (char-syntax (preceding-char)) '(?w ?_ ?\) )) | 236 | (memq (char-syntax (preceding-char)) '(?w ?_ ?\) )) |