Annoying delay when killing a buffer containing an executing process - emacs

Every time I kill a buffer containing an executing process in Emacs I get an annoying ~2 second delay before my interaction continues. And when that happens I get the message
error in process sentinel: Selecting deleted buffer
The tricky problem is that it only happens in my Emacs configuration and not in Vanilla Emacs. I'm guessing the delay happens because of an extra hook or advice activated in one or some of my modules loaded.
Does anybody recognize the error message and know which hook or advice that might be causing this problem? I've tried searching the web without any luck.

Related

Mysterious blank space randomly appears in Powershell console buffer

I am plagued by a very strange phenomenon. I tend to write fairly esoteric Powershell modules for stuff I do at work. Often, after running one of these, and the module has ended I will move onto some other tasks, and when I happen to bring up my Powershell console window again, several blank lines (or just blank "space") will have appeared in the buffer. It never appears right away, which is the most confounding part.
Afterwards, the blinking cursor exists at the end of this blank space, and the blank space cannot be "backspaced" (so it's not something inadvertently entering spaces or newlines). It's just there, as part of the buffer. I usually just clear the screen with cls to keep it from annoying me.
I used to just chalk this up to the buggy Windows Powershell 5.1 buffering. However now that I've begun using Powershell 7 (and Windows Terminal), I see that the issue still exists.
Here is a screenshot of a v7 Windows Terminal tab an hour or so after my module finished running:
Sometimes it seems the longer I wait the more blank space has appeared. Here is a screenshot of the same console tab about 20 hours later:
I'm sorry I don't have a better way of explaining this. I realize that without any code or pattern to analyze, that this is a very poor question, by SO standards, but I am just as confused as you are. The only pattern I've noticed is that this only seems to happen after I run my various custom modules. However this accounts for the majority of my Powershell usage, so it might be a red herring.
Usually my modules simply do some processing (talking to computers, AD, etc) and just output some information via Write-Host, and occasionally output a [PSCustomObject], which I always capture in a variable. Even if I was accidentally outputting some blank lines or something to the pipeline, I can't see how that would manifest as blank buffer space that grows over time. I thought maybe I was incorrectly killing async jobs or something and that was somehow causing this, but this happens even in purely synchronous code.
To be clear, in the screenshots above there is no code actually running. That module was the only thing I had run in this particular console tab/session, and it doesn't run any background processes. So I can't understand why the buffer is changing all on its own. In both screenshots, the tab/window is the same size as it was when the module first completed, so it's not just a bunch of spaces in the buffer that are being dynamically resized. And as noted, when the module fist completed there were NO rogue characters in the buffer at all.
One other thing about my usage is that it's all done on a remote VM, accessed through RDP, which I use daily. The only other thing I can think of is that maybe something about the console window being minimized/maximized/resized, the resolution changing, or the login session being connected/reconnected has something to do with it.
Does this sound familiar to anyone? Any ideas for what could be causing this or what I can try to understand the behavior better are much appreciated.
I've confirmed that this actually happens as a direct result of simply "restoring" and "maximizing" the Powershell console window and/or Windows Terminal window. When the issue is "present", doing this will often add another "set" of blank space to the buffer before the cursor. Minimizing seems to have no effect, only going from maximized to "restored" and back to maximized.
I've also confirmed that this has nothing to do with my custom modules. I can replicate the issue by simply opening a fresh, maximized console window/tab, running get-process and then "restoring" and maximizing. It doesn't happen every time though.
It also has nothing to do with my custom profile script, as it happens even on a freshly-imaged computer with no profile.
At this point I'm going back to blaming it on buffer/rendering/window manager implementation bugs in powershell and moving on with my life.

Is it possible to continue to debug from the previous position after modifying my code without restarting the debug session?

I use Komodo as the IDE to develop my Perl programs.But every time I start to debug, the debugger takes nearly 15 seconds to start. It is frustrating to wait, so I wonder if it is possible to continue the debug without restarting the session? That is to say, if I step to line 99 in my previous debug, and then modify some code after line 99, is it possible to continue debugging from line 99?
The entire program has to be recompiled after you modify your code, so no, it isn't possible to edit the program and then continue your debug session. You have to restart.
Note that in Komodo the breakpoints are persistent, so you can place a breakpoint before you restart the program, and then run to the breakpoint before you continue working. I wouldn't have thought fifteen seconds was too bad unless you are making tiny changes and restarting every minute or two. You should fix as much as you can at one time.
The only IDE I know that has this facility is Microsoft's Visual C, and it doesn't always work then. There are probably others, but Perl isn't one of them.
You can use `R' to restart the program while debugging with `-d' option, like perl -d test.pl, but I don't know if Komodo has a solution.
It's better to figure out why it takes so much time to start debugging.

Emacs hangs when typing in haskell-mode

I have been using haskell-mode for some time now with no problems.
Recently emacs has started to hang for quite a while whenever I type in something in haskell-mode, say 10-15 seconds, and then returns to "normal". I can navigate around and switch buffers normally, but typing (in the haskell buffer) somehow halts emacs completely.
I don't recall changing anything, haskell- or emacs-wise, before this started occuring.
Moreover, it seems very difficult to track down. I have the following error message, but I'm not even sure that it related to this issue:
Error during redisplay: (jit-lock-function 1285) signaled (error
"Error in syntax_table logic for to-the-end intervals")
The freezes/hangs only occur in haskell-mode, everything else seems to act normally.
Is there a way I can find out what is blocking, and from there probably get closer to figuring it out?
I think it could be the same as this bug. It has been fixed (in this commit) but I don't think any released versions have the fix, so you'll have to either download the latest source from git or apply the patch manually.

AutoHotKey Doesn't Respond

When I enter a hotkey [any hotkey], AutoHotKey doesn't respond. However, it will respond if I edit, save, and reload it. After which, it will respond three or four times then I must go through the same process of editing, saving, and reloading it again.
I have uninstalled and reinstalled the program 10 or more times.
Before it began to not respond, it would leave a space after each string. [I'm not sure if that is related to my problem or not.]
I am using Windows 7 and IE 10. I reinstalled IE 8 and IE 9 to see if either would correct the problem. The problem remained.
Thanks for whatever help you may provide.
Me too
I have encountered this same type of problem. AutoHotKey loads my script and responds for a while, then after X number of times the script simply stops responding.
Resolution
To resolve these types of problems I found that opening the debug screen (double click the AutoHotKey icon in the task bar) generally shows that my script is busy running, and doing something. From there it's a simple matter to identify why it's still running.
Since the script is currently busy satisfying a previous request, then a new request can not be initiated.
In my case the problem is some runaway loop that is processing more data than I had expected or it's stuck in some infinite loop.
If you leave the script running while it's stuck, you might also want to open the task manager to see if it's consuming any CPU time or if it's gradually eating more and more memory.

How to prevent all hooks running before exit from being executed?

I'm talking specifically about Pymacs, but this would be useful to know if anything like that happens in other circumstances.
The problem: when something goes wrong in Pymacs, it will no matter what try to restart itself, and especially so when it fails to start at all. But somehow it is adding a hook to run before any file (not necessary in Python mode) should be saved or closed. So, what happens - it becomes impossible to shut down Emacs in a "nice" way - I can only terminate the process from shell, because Pymacs would enter an infinite loop: when saving a file - it would try to restart itself, fail and prevent the file from being saved - since it failed, it'll prompt to restart - no matter if I answer yes or no to restarting it, it will fail and ask again to restart itself.
M-x unload-feature doesn't help because it can't unload it (because .emacs loads it). I'm not sure at all by the way if the unload-feature can ever do anything meaningful :| I was trying to evaluate (setq kill-buffer-hook nil) but this didn't seem to help either. Perhaps there are some other hooks? Is there a way to force unload-feature to actually do something? In this situation I'd prefer save file and crash, then infinite loop and no crash, but file not saved situation.