summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-08-29 04:42:40 +0000
committerRichard M. Stallman <rms@gnu.org>1996-08-29 04:42:40 +0000
commit3f7e952d9a2c795595d1de392a42e527a31c4872 (patch)
tree1695793cbba13341853a5a4baf743f3e33c73d8e /lisp/emacs-lisp/lisp.el
parent484de1186a69f49c9e61632e3251deeaab84cb84 (diff)
downloademacs-3f7e952d9a2c795595d1de392a42e527a31c4872.tar.gz
emacs-3f7e952d9a2c795595d1de392a42e527a31c4872.tar.bz2
emacs-3f7e952d9a2c795595d1de392a42e527a31c4872.zip
(narrow-to-defun): New function.
Diffstat (limited to 'lisp/emacs-lisp/lisp.el')
-rw-r--r--lisp/emacs-lisp/lisp.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 650c0aa31fc..a62fe926e8b 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -209,6 +209,15 @@ The defun marked is the one that contains point or follows point."
(beginning-of-defun)
(re-search-backward "^\n" (- (point) 1) t))
+(defun narrow-to-defun (&optional arg)
+ "Make text outside current defun invisible.
+The defun visible is the one that contains point or follows point."
+ (interactive)
+ (save-excursion
+ (widen)
+ (beginning-of-defun)
+ (narrow-to-region (point) (progn (end-of-defun) (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.