all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Roland Winkler <roland.winkler@physik.uni-erlangen.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 6177@debbugs.gnu.org
Subject: bug#6177: 23.2; emacs crashes when reverting a file
Date: Wed, 12 May 2010 16:13:10 -0500	[thread overview]
Message-ID: <19435.6630.705828.513141@regnitz.physics.niu.edu> (raw)
In-Reply-To: <83ljbpq0pi.fsf@gnu.org>

On Wed May 12 2010 Eli Zaretskii wrote:
> > I've encountered a situation, where reverting a file reproducibly
> > crashes emacs.  I do not know much about debugging emacs on this level.
> > I've reproduced the crash under gdb. 
> > xbacktrace doesn't give any information.
> 
> Can you show the steps to reproduce this, starting with "emacs -Q"?

I got a simpler test case that works with emacs -Q.

The point about the code below is that buffer *bar* depends on what
happens to file foo.txt visited in its own buffer: reverting buffer
*bar* really operates on the buffer visiting foo.txt.

The detailed steps to reprdouce this bug are as follows:

Create file foo.txt

cat > ~/foo.txt <<EOF
Hello world.
EOF

In "emacs -Q" load the code below. Then run my-init, touch file
foo.txt and finally move point in buffer bar which triggers
my-revert-buffer. This crashes emacs.
If the second with-current-buffer is removed from my-revert-buffer
the code runs fine.

Roland



(setq my-buffer "foo.txt")

(defun my-init ()
  (interactive)
  (find-file (concat "~/" my-buffer))
  (my-bar))

(defun my-bar ()
  (with-current-buffer (get-buffer-create "*bar*")
    (erase-buffer)
    (insert "acdef")
    (setq revert-buffer-function 'my-revert-buffer
          mode-line-buffer-identification
          (list 24 (buffer-name) "  "
                '(:eval (format "%d" (my-revert-buffer)))))
    (add-hook 'post-command-hook 'force-mode-line-update nil t)))

(defun my-revert-buffer (&optional ignore-auto noconfirm)
  "My `revert-buffer-function'."
  (when (or noconfirm
            (not (verify-visited-file-modtime (get-buffer my-buffer))))
    (with-current-buffer my-buffer
      (kill-all-local-variables)
      (let (revert-buffer-function)       ; don't loop.
        (revert-buffer ignore-auto t)))
    ;; the following two lines make emacs crash
    (with-current-buffer (get-buffer-create "*bar*")
      (erase-buffer)))
  0)





  parent reply	other threads:[~2010-05-12 21:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11 23:28 bug#6177: 23.2; emacs crashes when reverting a file Roland Winkler
2010-05-12  3:05 ` Eli Zaretskii
2010-05-12 13:13   ` Roland Winkler
2010-05-12 18:13     ` Eli Zaretskii
2010-05-12 21:13   ` Roland Winkler [this message]
2010-05-26  9:18 ` Geoff Gole
2010-05-26 15:01   ` Roland Winkler
2010-05-27 15:46     ` Chong Yidong
2010-06-04  6:29 ` Gilles Pion
2010-06-07  7:04   ` Glenn Morris
2010-06-04  7:44 ` Gilles Pion
2010-06-15 12:44 ` Gilles Pion
2010-06-15 13:32   ` Stefan Monnier
2010-06-15 19:45 ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19435.6630.705828.513141@regnitz.physics.niu.edu \
    --to=roland.winkler@physik.uni-erlangen.de \
    --cc=6177@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.