#61 Emacs hangs on function definition

closed-works-for-me
Indentation (6)
5
2008-10-17
2008-08-04
Anonymous
No

This might be pesky to try to recreate, but it happens to me at random all the time. I don't know if it's syntax, indentation, or what. It just hangs.

Take code like:

<?php
require(....);
class TestStuff extends UnitTestCase {
function dosomething() {
}
}

Right after I type dosomething() { and hit enter, emacs hangs and cannot recover. I have to kill it in the task manager.

It seems like it happens when you attempt to define a function at the top of the class.

I am using emacs 21 on a windows xp system.

Discussion

  • David House
    David House
    2008-08-19

    Logged In: YES
    user_id=2186258
    Originator: NO

    I've had this happen when I've got the buffer narrowed, could this be the same for you, too?

     
  • Logged In: NO

    I've added a line to my .emacs to automatically maximize the emacs window when I start it up. Then after that I usually split it down the middle (c-x 3), and it's in one of those (half-size) buffers that the issue happens. I guess those buffers are narrowed from the full-sized screen size. I actually can't make this happen today (where's my boss to come stand over my shoulder when I need him?), so it's hard to know whether it will happen on a maximized window that's not split in half.

     
  • David House
    David House
    2008-08-20

    Logged In: YES
    user_id=2186258
    Originator: NO

    Sorry, by "narrowing" a buffer I meant in the sense of C-x n n (narrow-to-region). This "narrows" the buffer so that only the current region is visible, and it seems to all commands like beginning-of-buffer, isearch and so on that the region is the entire buffer. See the manual section on narrowing for more information.

    But I think that the narrowing was a red herring. Instead I think this problem seems to happen when there is no string "<?php" at the beginning of the file. Of course this situation is achieved when narrowing the buffer to a region that doesn't start with "<?php", hence my originally thinking that it was to do with narrowing.

    Could you confirm that's what you observe, too?

     
  • Logged In: NO

    Good observation! It's a bad habit of mine to forget the <?php string at the beginning of class definition files, but I never noticed the correlation between this and breaking php-mode. Thanks for your help.

     
  • Logged In: NO

    Actually, I was wrong. Emacs froze on me again today on the definition of the first function of a class, and I did have an opening php tag at the top of the file. Luckily, this only seems to happen to me on Windows...I've never seen this functionality on Linux.

     
  • Thanks to all for investigating this issue. Unfortunately, its not reproducible. I'm not surprised by your troubles with php-mode on Emacs 21. Php-mode should work on Windows, but starting with version 1.4 of php-mode, there is only support for Emacs 22 and up.

    If you can reliably reproduce the bug, do resubmit.

    Thanks again.

     
    • assigned_to: nobody --> ashawley
    • status: open --> closed-works-for-me