GNU bug report logs - #4954
23.1; Emacs hangs when two run-at-time calls in effect

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Sullivan Beck <sulbeck@HIDDEN>; dated Wed, 18 Nov 2009 15:50:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 4954@HIDDEN:


Received: (at 4954) by emacsbugs.donarmstrong.com; 19 Nov 2009 01:34:05 +0000
From lennart.borgman@HIDDEN Wed Nov 18 17:34:05 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.3 required=4.0 tests=AWL,HAS_BUG_NUMBER
	autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from mail-yx0-f190.google.com (mail-yx0-f190.google.com [209.85.210.190])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAJ1Y3SR026917
	for <4954@HIDDEN>; Wed, 18 Nov 2009 17:34:05 -0800
Received: by yxe28 with SMTP id 28so1592305yxe.19
        for <4954@HIDDEN>; Wed, 18 Nov 2009 17:33:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :from:date:message-id:subject:to:cc:content-type;
        bh=huLEp/HaKOuBaxPzsnreGwNGftxclQQWCEbYQFbzk+k=;
        b=ag8LurO/Zw+X1E7Jps3aiYFzEla5mabBgkfhzHmLGX2s7lNoDS6Sa0Xu1QBz8+Vf+S
         QiF2avYpUqBxd9zK8eI5YBBcUIBUcHDgJFfvPSjjB9XEpDDC/CBR7nTyxMpHXMeWNqkR
         BitUlQM5HjH0IZZ1WjT7lIgvvYzc4pPfLoS7o=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:content-type;
        b=bqdMQric5sHa3t9bxXYxl25CA8kAFI/zBJapD5Jv7Xg0U2hsKw9qdPclWF3XO30LMr
         koIspLHU0CgSIZJnbGR/8SMaqby24aIKbl6fKYYHJJFbBFnJxEe7M93RmDOb+E+bMBTV
         l2dbnu/9uZSq/zE7FNnv1PKDJ9CjoM2eHsaU4=
MIME-Version: 1.0
Received: by 10.101.189.3 with SMTP id r3mr3182245anp.105.1258594438095; Wed, 
	18 Nov 2009 17:33:58 -0800 (PST)
In-Reply-To: <4B049F66.2020104@HIDDEN>
References: <4B0415BC.9010400@HIDDEN> <e01d8a50911181536w53ddb3cfv96a2747e856525fd@HIDDEN> 
	<4B049F66.2020104@HIDDEN>
From: Lennart Borgman <lennart.borgman@HIDDEN>
Date: Thu, 19 Nov 2009 02:33:38 +0100
Message-ID: <e01d8a50911181733s7a27ae39p11a8c6ea3769aa6@HIDDEN>
Subject: Re: bug#4954: 23.1; Emacs hangs when two run-at-time calls in effect
To: Sullivan Beck <sulbeck@HIDDEN>
Cc: 4954 <at> debbugs.gnu.org
Content-Type: text/plain; charset=UTF-8

On Thu, Nov 19, 2009 at 2:29 AM, Sullivan Beck <sulbeck@HIDDEN> wrote:
>
> It could be... and I certainly considered the fact that perhaps both were
> trying to do something at the same time and were blocking each other
> somehow.
>
> My problem with this is that the slowness doesn't go away once it's started.
> If the two saves are EXACTLY in sync with each other (and it's possible... I
> gave them both a 5 minute interval, and they were initialized right after
> each other), I wouldn't be surprised to see emacs become sluggish for a few
> seconds every 5 minutes.
>
> The problem is that once the sluggishness starts, it persists for several
> minutes. I've never tried to outwait it for too long of a time, but I've
> certainly given it 2-3 minutes, and the sluggishness persists. If the two
> operations can't figure out in that time how to get their writes done, I'd
> say that it has to be a bug in that code.
>
> I'll bet that your suggestion of starting up a run-with-idle-timer would be
> a good workaround (and I may or may not do it... probably not since the
> workaround I've already got is good enough for me).
>
> I mainly submitted the bug so that whoever is in charge of the code that
> runs the timer may look at it. I'm probably at a point where I'm satisfied
> with what I've got, at least for the time being.
>
> Anyway, thanks for the reply.


Thanks for your good description. I do not understand what is going on
so someone who knows more than me about this must jump in. All I can
say is that reading your description above it sounds like something is
seriously wrong.



Acknowledgement sent to Lennart Borgman <lennart.borgman@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4954; Package emacs. Full text available.

Message received at 4954@HIDDEN:


Received: (at 4954) by emacsbugs.donarmstrong.com; 19 Nov 2009 01:29:12 +0000
From sulbeck@HIDDEN Wed Nov 18 17:29:12 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-3.0 required=4.0 tests=HAS_BUG_NUMBER autolearn=ham
	version=3.2.5-bugs.debian.org_2005_01_02
Received: from smtp.ufl.edu (smtp03.osg.ufl.edu [128.227.74.70])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAJ1TAOX026482
	for <4954@HIDDEN>; Wed, 18 Nov 2009 17:29:11 -0800
Received: from [192.168.0.100] (ip24-136-37-175.ga.at.cox.net [24.136.37.175])
	(authenticated bits=0)
	by smtp.ufl.edu (8.14.0/8.14.0/3.0.0) with ESMTP id nAJ1T6bb019167
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Wed, 18 Nov 2009 20:29:09 -0500
Message-ID: <4B049F66.2020104@HIDDEN>
Date: Wed, 18 Nov 2009 20:29:10 -0500
From: Sullivan Beck <sulbeck@HIDDEN>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4pre) Gecko/20090915 Thunderbird/3.0b4
MIME-Version: 1.0
To: Lennart Borgman <lennart.borgman@HIDDEN>
CC: 4954 <at> debbugs.gnu.org
Subject: Re: bug#4954: 23.1; Emacs hangs when two run-at-time calls in effect
References: <4B0415BC.9010400@HIDDEN> <e01d8a50911181536w53ddb3cfv96a2747e856525fd@HIDDEN>
In-Reply-To: <e01d8a50911181536w53ddb3cfv96a2747e856525fd@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5,1.2.40,4.0.166 definitions=2009-11-18_09:2009-11-16,2009-11-18,2009-11-18 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-0908210000 definitions=main-0911180260
X-UFL-Spam-Level: *

On 11/18/2009 6:36 PM, Lennart Borgman wrote:
> On Wed, Nov 18, 2009 at 4:41 PM, Sullivan Beck<sulbeck@HIDDEN>  wrote:
>    
>> I wrote two simple emacs extensions, both of which use the run-at-time
>> function periodically write some information to a file. When one or the
>> other is loaded, emacs works fine. When both are loaded, emacs will work
>> fine for a while, and then suddently start behaving very sluggishly.
>> Keyboard input will not be printed on the screen for 2-4 seconds. It
>> never seems to recover (though the periodic work should only take a
>> fraction of a second) and eventually, I have to kill emacs and restart.
>>
>> I'll include both extensions below, though I don't believe that either
>> of them are directly related to the cause of the problem... it just
>> happened that they both use run-at-time.
>>      
> Hi Sullivan,
>
> I do not know what causes the hang, but I can guess. In both your
> extensions you are saving data to a file. I wonder if that operation
> is syncronous? If it is then all Emacs can do is to wait there. (File
> operations can be both async and sync and I do not know what Emacs is
> doing.)
>
>    
It could be... and I certainly considered the fact that perhaps both 
were trying to do something at the same time and were blocking each 
other somehow.

My problem with this is that the slowness doesn't go away once it's 
started. If the two saves are EXACTLY in sync with each other (and it's 
possible... I gave them both a 5 minute interval, and they were 
initialized right after each other), I wouldn't be surprised to see 
emacs become sluggish for a few seconds every 5 minutes.

The problem is that once the sluggishness starts, it persists for 
several minutes. I've never tried to outwait it for too long of a time, 
but I've certainly given it 2-3 minutes, and the sluggishness persists. 
If the two operations can't figure out in that time how to get their 
writes done, I'd say that it has to be a bug in that code.

I'll bet that your suggestion of starting up a run-with-idle-timer would 
be a good workaround (and I may or may not do it... probably not since 
the workaround I've already got is good enough for me).

I mainly submitted the bug so that whoever is in charge of the code that 
runs the timer may look at it. I'm probably at a point where I'm 
satisfied with what I've got, at least for the time being.

Anyway, thanks for the reply.


> A way to work around the trouble is perhaps to rewrite your scheduling
> of the saving operations. Here is one suggestion:
>
> - Instead of saving immediately in the timer start a second timer with
> run-with-idle-timer.
> - In that timer do the saving.
>
> This makes the chance that the saving will occur while you are typing
> a bit smaller, but it does not avoid the trouble totally.
>
>    




Acknowledgement sent to Sullivan Beck <sulbeck@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4954; Package emacs. Full text available.

Message received at 4954@HIDDEN:


Received: (at 4954) by emacsbugs.donarmstrong.com; 18 Nov 2009 23:37:01 +0000
From lennart.borgman@HIDDEN Wed Nov 18 15:37:01 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.3 required=4.0 tests=AWL,HAS_BUG_NUMBER
	autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from mail-yw0-f179.google.com (mail-yw0-f179.google.com [209.85.211.179])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAINaxgW010417
	for <4954@HIDDEN>; Wed, 18 Nov 2009 15:37:00 -0800
Received: by ywh9 with SMTP id 9so1556358ywh.19
        for <4954@HIDDEN>; Wed, 18 Nov 2009 15:36:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :from:date:message-id:subject:to:content-type;
        bh=gKKtgtkYXHjiFffDcXQVdrp2nvtZZcf84+ePn0yynQY=;
        b=FCgtyJv0cLb1legEdcdblDHD4N7skjLxPV/eE7qXdHDdwmOFvzE/doUVl2d7kWcyq9
         CAv+Sz9NfALM2KwgbBWuYLTw+nU1/6rwEFw1DZFbx4/N0BOXESqaWgN8rYBepOW4Xf5H
         vAB/EGu4mqEwdcfzbQrNktFZUkv2Fp46fBMZA=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :content-type;
        b=Tu+1xcTHbvPTc64hryCv66QR471hnnl0eqaeGyghbMLpDjIf4VSRuK+VVAIDVDBmq9
         /T56XzqEkqMO19+DGWo6urXWH6YO8oGGe10l2ogdbkSp15HTB3ZzIo7QVkJRO5FceWRa
         ISossiyQiqJRXOfDXOPVgx18ALbj0zWWRqGmM=
MIME-Version: 1.0
Received: by 10.101.179.23 with SMTP id g23mr3418999anp.171.1258587414163; 
	Wed, 18 Nov 2009 15:36:54 -0800 (PST)
In-Reply-To: <4B0415BC.9010400@HIDDEN>
References: <4B0415BC.9010400@HIDDEN>
From: Lennart Borgman <lennart.borgman@HIDDEN>
Date: Thu, 19 Nov 2009 00:36:34 +0100
Message-ID: <e01d8a50911181536w53ddb3cfv96a2747e856525fd@HIDDEN>
Subject: Re: bug#4954: 23.1; Emacs hangs when two run-at-time calls in effect
To: Sullivan Beck <sulbeck@HIDDEN>, 4954 <at> debbugs.gnu.org
Content-Type: text/plain; charset=UTF-8

On Wed, Nov 18, 2009 at 4:41 PM, Sullivan Beck <sulbeck@HIDDEN> wrote:
> I wrote two simple emacs extensions, both of which use the run-at-time
> function periodically write some information to a file. When one or the
> other is loaded, emacs works fine. When both are loaded, emacs will work
> fine for a while, and then suddently start behaving very sluggishly.
> Keyboard input will not be printed on the screen for 2-4 seconds. It
> never seems to recover (though the periodic work should only take a
> fraction of a second) and eventually, I have to kill emacs and restart.
>
> I'll include both extensions below, though I don't believe that either
> of them are directly related to the cause of the problem... it just
> happened that they both use run-at-time.

Hi Sullivan,

I do not know what causes the hang, but I can guess. In both your
extensions you are saving data to a file. I wonder if that operation
is syncronous? If it is then all Emacs can do is to wait there. (File
operations can be both async and sync and I do not know what Emacs is
doing.)

A way to work around the trouble is perhaps to rewrite your scheduling
of the saving operations. Here is one suggestion:

- Instead of saving immediately in the timer start a second timer with
run-with-idle-timer.
- In that timer do the saving.

This makes the chance that the saving will occur while you are typing
a bit smaller, but it does not avoid the trouble totally.



Acknowledgement sent to Lennart Borgman <lennart.borgman@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4954; Package emacs. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 18 Nov 2009 15:41:41 +0000
From sulbeck@HIDDEN Wed Nov 18 07:41:41 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA,FVGT_m_MULTI_ODD
	autolearn=no version=3.2.5-bugs.debian.org_2005_01_02
Received: from lists.gnu.org (lists.gnu.org [199.232.76.165])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAIFfdDJ030842
	for <submit@HIDDEN>; Wed, 18 Nov 2009 07:41:41 -0800
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NAmf5-0008DA-Ap
	for bug-gnu-emacs@HIDDEN; Wed, 18 Nov 2009 10:41:39 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1NAmf0-0007zU-4y
	for bug-gnu-emacs@HIDDEN; Wed, 18 Nov 2009 10:41:38 -0500
Received: from [199.232.76.173] (port=40269 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1NAmez-0007z5-WA
	for bug-gnu-emacs@HIDDEN; Wed, 18 Nov 2009 10:41:34 -0500
Received: from smtp04.osg.ufl.edu ([128.227.74.71]:35294 helo=smtp.ufl.edu)
	by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60)
	(envelope-from <sulbeck@HIDDEN>)
	id 1NAmez-0004DS-B7
	for bug-gnu-emacs@HIDDEN; Wed, 18 Nov 2009 10:41:33 -0500
Received: from [128.227.212.53] (heather.osg.ufl.edu [128.227.212.53])
	(authenticated bits=0)
	by smtp.ufl.edu (8.14.0/8.14.0/3.0.0) with ESMTP id nAIFfRln023882
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <bug-gnu-emacs@HIDDEN>; Wed, 18 Nov 2009 10:41:30 -0500
Message-ID: <4B0415BC.9010400@HIDDEN>
Date: Wed, 18 Nov 2009 10:41:48 -0500
From: Sullivan Beck <sulbeck@HIDDEN>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090915 SUSE/3.0b4-3.6 Thunderbird/3.0b4
MIME-Version: 1.0
To: bug-gnu-emacs@HIDDEN
Subject: 23.1; Emacs hangs when two run-at-time calls in effect
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5,1.2.40,4.0.166 definitions=2009-11-18_07:2009-11-16,2009-11-18,2009-11-18 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-0908210000 definitions=main-0911180108
X-UFL-Spam-Level: *
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)

I wrote two simple emacs extensions, both of which use the run-at-time
function periodically write some information to a file. When one or the
other is loaded, emacs works fine. When both are loaded, emacs will work
fine for a while, and then suddently start behaving very sluggishly.
Keyboard input will not be printed on the screen for 2-4 seconds. It
never seems to recover (though the periodic work should only take a
fraction of a second) and eventually, I have to kill emacs and restart.

I'll include both extensions below, though I don't believe that either
of them are directly related to the cause of the problem... it just
happened that they both use run-at-time.

The first is to make the scratch buffer persistent. I (perhaps
unwisely... but it's a habit I've gotten into) use the scratch buffer
almost like a post-it note where I just jot things down and I don't want
to lose it if my emacs gets shut down (either due to a system crash,
power outage, or whatever). For safety, I save the buffer to a file
every 5 minutes.

##### scratch.el ####################################
;; This makes the scratch buffer persistent. It will preserve the
;; contents of the buffer in a file stored in the variable scratch-file.
;; Whenever the scratch buffer is killed, it will automatically be
;; recreated with the old contents. If emacs is killed, the contents
;; will be placed in the scratch buffer the next time it is started.

;; The name of the file to preserve the scratch buffer in.
(if (not (boundp 'scratch-file))
    (setq scratch-file "~/.emacs.scratch"))

(if (not (boundp 'scratch-autosave-interval))
    (setq scratch-autosave-interval 300))

;; If the *scratch* buffer is killed, recreate it automatically and
;; preserve the contents.

(add-hook 'after-init-hook 'init-scratch-buffer)
(add-hook 'after-init-hook 'init-scratch-autosave)
(add-hook 'kill-emacs-hook 'kill-scratch-buffer)

(defun init-scratch-buffer ()
  (set-buffer (get-buffer-create "*scratch*"))
  (if (file-exists-p scratch-file)
      (insert-file-contents scratch-file))
  (lisp-interaction-mode)
  (make-local-variable 'kill-buffer-query-functions)
  (add-hook 'kill-buffer-query-functions 'restart-scratch-buffer))

;; This is called when we kill emacs.
;; Save *scratch*, kill *scratch*, don't restart it
;;
(defun kill-scratch-buffer ()
  (save-scratch-buffer)

  (save-current-buffer
    (set-buffer "*scratch*")
    (remove-hook 'kill-buffer-query-functions 'restart-scratch-buffer))

  (kill-buffer "*scratch*"))

;; This saves the scratch buffer.
;;
(defun save-scratch-buffer ()
  (save-current-buffer
    (set-buffer "*scratch*")
    (write-region nil nil scratch-file)))

;; This restarts the scratch buffer. If we're currently in the scratch
;; buffer, come back to it. Otherwise, preserve the current buffer.
;;
(defun restart-scratch-buffer ()
  (setq currbuf (buffer-name))

  (save-current-buffer

    ;; Kill the current (*scratch*) buffer
    (kill-scratch-buffer)

    ;; Make a brand new *scratch* buffer
    (init-scratch-buffer))

  (if (string= currbuf "*scratch*")
      (switch-to-buffer "*scratch*"))

  ;; Since we killed it, don't let caller do that.
  nil)

(defun init-scratch-autosave ()
  (run-at-time t scratch-autosave-interval 'save-scratch-buffer))
##### scratch.el ####################################

The second, which is much less important (and it may be that there is
an extension for doing this already) is that when I start up emacs, I
like to automatically load the buffers that were loaded when emacs
stopped. For safety, I also periodically saved the buffer list.

Because I wanted the functionality of both, but couldn't deal with the
hangs, I added an option to disable the periodic save of the buffer
list (so it only gets saved when emacs is shut down nicely) and after
that change was made, emacs worked fine.

##### bufferlist.el ####################################
;; This will store the list of open files when emacs is closed. When it
;; is restarted, it will attempt to reopen them.

;; The name of the file to preserve the buffer list in.
(if (not (boundp 'bufferlist-file))
    (setq bufferlist-file "~/.emacs.bufferlist"))

(if (not (boundp 'bufferlist-autosave-interval))
    (setq bufferlist-autosave-interval 300))

(add-hook 'after-init-hook 'init-bufferlist)

(if (> bufferlist-autosave-interval 0)
  (add-hook 'after-init-hook 'init-bufferlist-autosave))

(add-hook 'kill-emacs-hook 'save-bufferlist)

;; This reads in the given buffer from the point to the end
;; of the line AND moves the point to the start of the next line.
(defun read-text-line (buffer)
  ;; Switch to the buffer, and start a line at the current point.
  (setq line "")
  (save-current-buffer
    (set-buffer buffer)

    ;; Read characters until we get to EOL or EOB
    (while (and (not (eobp))
                (not (eolp)))
      (setq c (following-char))
      (setq line (concat line (char-to-string c)))
      (forward-char))

    ;; If we're at EOL, move to the start of the next line
    (if (not (eobp))
        (forward-char)))

  ;; Return line
  line)

(defun eobp-buffer (buffer)
  (save-current-buffer
    (set-buffer buffer)
    (eobp)))

(defun eolp-buffer (buffer)
  (save-current-buffer
    (set-buffer buffer)
    (eolp)))

(defun save-bufferlist ()
  ;; Create the bufferlist buffer
  (setq buflist "")
  (setq buflistbuf (generate-new-buffer "*bufferlist*"))

  ;; Insert the buffername and filename for all open files into this buffer
  (dolist (buffer (buffer-list))
    (setq bufname (buffer-name buffer))
    (save-current-buffer
      (set-buffer buffer)
      (setq filname buffer-file-name)
      (if buffer-file-name
          (progn
            (set-buffer buflistbuf)
            (insert bufname)
            (insert "\C-j")
            (insert filname)
            (insert "\C-j")))))

  ;; Save the buffer to the file
  (save-current-buffer
    (set-buffer buflistbuf)
    (write-file bufferlist-file))
  (kill-buffer buflistbuf))

(defun init-bufferlist ()
  ;; Create the bufferlist buffer and insert the file into it.
  (save-current-buffer
    (setq buflistbuf (generate-new-buffer "*bufferlist*"))
    (set-buffer buflistbuf)
    (insert-file-contents-literally bufferlist-file))

  ;; Load each buffer/file name
  (while (not (eobp-buffer buflistbuf))
    (setq bufname (read-text-line buflistbuf))
    (setq filname (read-text-line buflistbuf))

    ;; Create the buffer. If it's different then it used to be,
    ;; rename it.
    (if (file-readable-p filname)
        (save-current-buffer
          (switch-to-buffer (find-file-noselect filname t nil nil))
          (setq name (buffer-name))
          (if (not (string= bufname name))
              (rename-buffer bufname)))))

  ;; Clean up
  (kill-buffer buflistbuf))

(defun init-bufferlist-autosave ()
  (run-at-time t bufferlist-autosave-interval 'save-bufferlist))
##### bufferlist.el ####################################

I'm sure there are other options available for both options... but
these work for me, and I believe both should work without causing
emacs to hang.

They are loaded from my init.el file as:

##### init.el ####################################
(setq scratch-file "~/..emacs/.scratch.")
(load "scratch.elc" t t t)

(setq bufferlist-autosave-interval 0)
(setq bufferlist-file "~/..emacs/.bufferlist.")
(load "bufferlist.elc" t t t)
##### init.el ####################################

If I don't set bufferlist-autosave-interval to 0 (and use the
default 5 minutes), emacs will hang. If I set it to 0 (which
disables the autosave functionaity), everything works fine.

Emacs doesn't crash, and I'm able to continue using it (though
painfully).

Thanks


In GNU Emacs 23.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.18.1)
 of 2009-10-24 on build24
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--with-pop' '--without-hesiod'
'--with-kerberos' '--with-kerberos5' '--with-xim' '--prefix=/usr'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--datadir=/usr/share' '--localstatedir=/var'
'--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--with-x'
'--with-sound' '--with-sync-input' '--with-xpm' '--with-jpeg'
'--with-tiff' '--with-gif' '--with-png' '--with-rsvg' '--with-dbus'
'--without-gpm' '--with-x-toolkit=gtk' '--x-includes=/usr/include'
'--x-libraries=/usr/lib64:/usr/share/X11' '--with-xft' '--with-libotf'
'--with-m17n-flt' '--build=x86_64-suse-linux'
'build_alias=x86_64-suse-linux' 'CC=gcc' 'CFLAGS=-fmessage-length=0 -O2
-Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -D_GNU_SOURCE -std=gnu89 -pipe
-Wno-pointer-sign -Wno-unused-variable -Wno-unused-label
-Wno-unprototyped-calls -DSYSTEM_PURESIZE_EXTRA=55000 	
-DSITELOAD_PURESIZE_EXTRA=10000 ' 'LDFLAGS=-Wl,-O2 -Wl,--hash-size=65521''

Important settings:
  value of $LC_ALL: C
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: CSS

Minor modes in effect:
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> C-y
<up> <right> <right> <right> <right> <right> C-x r
k <up> <up> <up> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<down-mouse-1> <mouse-1> C-SPC <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <escape> w <down-mouse-1> <mouse-1>
C-y <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> C-SPC
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> C-w C-x C-s <down-mouse-1>
<mouse-1> <down-mouse-1> <mouse-1> C-a C-SPC <down>
<down> <down> <down> <down> <down> <down> <down> <up>
C-w C-x C-s <down-mouse-1> <mouse-1> C-a C-SPC <down>
<down> <down> <down> C-w C-x C-s <switch-frame> C-x
C-f ~ / p e r s / p a s s w d <return> C-s m o z i
l l a C-s C-s C-s <switch-frame> <switch-frame> <down-mouse-1>
<mouse-movement> <mouse-movement> <drag-mouse-1> <switch-frame>
<down-mouse-1> <drag-mouse-1> <switch-frame> <down-mouse-1>
<drag-mouse-1> <switch-frame> <down-mouse-1> <drag-mouse-1>
<switch-frame> <down-mouse-1> <drag-mouse-1> <switch-frame>
<down-mouse-1> <drag-mouse-1> <switch-frame> <up> <switch-frame>
<up> <up> C-e <return> g e t s a t i s f a c t i o
n . c o m C-x C-s <switch-frame> <down-mouse-4> <mouse-4>
<double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4>
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4>
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1>
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1>
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1>
<down-mouse-1> <mouse-1> <switch-frame> C-x k <return>
<switch-frame> <switch-frame> <switch-frame> <escape>
x r e p o r t SPC e m <tab> <return>

Recent messages:
Saving file
/home/sulbeck/.thunderbird/3crazqn6.default/chrome/userChrome.css...
Wrote /home/sulbeck/.thunderbird/3crazqn6.default/chrome/userChrome.css
Mark set
Saving file
/home/sulbeck/.thunderbird/3crazqn6.default/chrome/userChrome.css...
Wrote /home/sulbeck/.thunderbird/3crazqn6.default/chrome/userChrome.css
Wrote /home/sulbeck/..emacs/.scratch. [12 times]
Mark saved where search started
Saving file /home/sulbeck/pers/passwd...
Wrote /home/sulbeck/pers/passwd
Wrote /home/sulbeck/..emacs/.scratch. [18 times]

-- 
--------------------------|  Sullivan Beck  |---------------------------
Email      : sulbeck@HIDDEN     |                 University of Florida
Work Phone : (352) 273-1367      |     Computing and Networking Services
                                 |                              301 SSRB
                                 |                Gainesville, FL  32611
------------------------------------------------------------------------
 For non-work related matters, please contact by email instead of phone
------------------------------------------------------------------------





Acknowledgement sent to Sullivan Beck <sulbeck@HIDDEN>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Report forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4954; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.