emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eval-last-sexp narrows buffer on error


From: Richard Stallman
Subject: Re: eval-last-sexp narrows buffer on error
Date: Sun, 29 Apr 2007 17:41:29 -0400

    It's a problem with `save-restriction'.  Take:

    (with-current-buffer (get-buffer-create "*foo*")
       (delete-region (point-min) (point-max))
       (insert "foo\nbar\nfoo\n")
       (save-restriction
         (narrow-to-region (line-beginning-position -1) (line-end-position -1))
         (error "????")))

    It will leave the buffer narrowed although the doc-string of
    `save-restriction' says:

It did not fail when I tried it.  I tried it in two ways:
using C-M-x, and by putting that code into the body of a function

    (defun foo ()
      (interactive)
      (with-current-buffer (get-buffer-create "*foo*")
        (delete-region (point-min) (point-max))
        (insert "foo\nbar\nfoo\n")
        (save-restriction
          (narrow-to-region (line-beginning-position -1) (line-end-position -1))
          (error "????"))))

and typing M-x foo.  In both cases, the buffer was not narrowed
afterward.

Can anyone else reproduce such a problem?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]