How to prevent messy windows after error in emac-live - emacs

I'm trying to get familiar with emacs and Clojure and its working out pretty well..
It's just that everytime I get a Clojure error, it will close any emacs-window except the one where the error occured and instead show me a giant empty window of "popwin-dummy".
I can't quite see how that's supposed to help me fixing any bug... Can you tell me how to disable this behaviour?
Have a nice day!

As a general protection against "Emacs messed up my window configuration" occurrences, add the following to your init file:
(winner-mode 1)
You can also toggle it for the current session with M-x winner-mode
Then whenever your window configuration is unexpectedly changed, use C-c<left> to call winner-undo (which you can do repeatedly if necessary).
C-c<right> takes you back to the most recent configuration (immediately, rather than step-by-step).

Related

What are keyboard shortcuts to find next and previous error in Netbeans 8.2 editor?

EDITED (see bottom)
Is there really, after so many years of unanswered questions such as mine, no keyboard shortcut to jump to the next or the previous error in Netbears 8.2?
This page says that the shortcuts are
Ctrl+./, Next/previous usage/compile error
Note the inclusion of the word usage. In no other "Next/Previous" shortcut is usage used. I wonder why it's here and if it points to the problem. It's not exactly a typo. What might it mean? Yeah, probably nothing.
Whatever, absolutely nothing that I have found shows how to accomplish this very important pair of tasks.
Using Tools > Options > Keymap shows that Ctrl+PERIOD and Ctrl+COMMA are how to do it. But it doesn't work.
Once Ctrl+PERIOD took me SOMEwhere, and doing it again took me to the next occurrence of it, etc., but those lines of code had no errors and it doesn't happen now.
I've clicked on the ellipsis on the line for Next Error and Previous Error and edited them to be Ctrl+BACKQUOTE and Alt+BACKQUOTE and I clicked on the ellipsis and defined alternative shortcuts to be Ctrl+CLOSE_BRACKET and Alt+CLOSE_BRACKET and I could NOT define Next error in Editor to ANYTHING.
NOTHING works.
So my question is WHY NOT? I use F2 and shift+F2 in Android Studio with every error I get! How can this NOT be possible in Netbeans 8.2?
I am reluctant to upgrade to Netbeans 11 for just this, especially not knowing if this problem persists.
======================
EDIT
After looking at what #Dmitry_M submitted, I took another whack at it with the above definitions, which cause:
Alt+1 to take me to Next Error, but ONLY after a fresh Build or Clean and Build Project, and it takes me to other lines (in xml, for one) that have no errors (that I know of; they're not flagged).
Alt+2 to take me to Previous Error unless I fixed it, in which case it takes me to that same line that HAD the previous error, just as Alt+1takes me to where the next errors USED to be and to the other places, too.
Next Error in Editor to do nothing.
This makes me wonder what Category actually means since Next Error in Editor says Source while the others that DO work say System.
My source files have more than a few "yellow warning" indicators, but unike Dmitry, the definitions don't find them.
If it finds the errors among other things, that's better than it was. But it only finds errors already listed in Output, and it requires build, and it finds other extraneous "errors". So I'll just look at Output. Keymap fails.
I'm discouraged with Netbeans 8.2.
I am using NetBeans 8.1
Next Error in Editor
The keymap moves a cursor to any hint or error that the editor shows. They are sometimes not compiler's errors. See it in action.
For example, the cursor moves to int i = 0; but there is no error there. There is just a hint that variable i is not used anywhere. And in the import statement: it's just a hint.
If you want to define a keymap for Next Error in Editor action try different key combinations. I use alt+1.
Previous Error/Next Error
The keymap only works for clean and build or build actions.
Probably, when just editing and saving NetBeans doesn't refresh errors list somewhere in the cache. It explains the behavior you experience: the cursor moves to a line where there are no errors. It simply moves to the line where an error was during the last build or clean and build action.
Se it in action just after clean and build. It works:
The cursor indeed moves only between "real" compilers' errors. But it only works after clean and build or build action. Probably it's a bug. There is a relevant bug but it was not resolved.
Also, in my case, Ctrl+PERIOD and Ctrl+COMMA were not working completely. Changed my keymaps to this one:

How can I prevent an emacs error message window from stealing focus and requiring extra steps to dismiss?

I use plain emacs in a terminal and like it that way (no spacemacs or gui emacs for me). In the gui versions, error messages pop up in a floating window, I think, and can be batted away. In my setup they open in a new split window and steal focus. To get rid of it I have to move the pointer back to my code window and then, if I want my code window full width, maximize the code window by deleting the other error window with a binding (which keeps the error window in the buffer list for reference). It's a lot of keystrokes for a simple error message. Ideally, I would like to not lose the focus from my code when they appear, and banish the error message window with a single binding (but keep it in the buffer list for reference... ideally being able to recall it in the way it initially appeared [in a split, without stealing focus] with another binding?
It is possible to dismiss an error window with C-x 0 (delete-window) if it has focus, but if previously you had two windows open in, say, a horizontal split, the error appears in the other window, and dismissing the error window removes your previous split. I create lots of unpredictable configurations so using a window arranger will not work for me to restore some preconfigured window arrangement.
How could I achieve this?
you can disable this behavior by setting two cider config vars to nil:
cider-show-error-buffer and cider-auto-select-error-buffer,
this would prevent the default behavior, still allowing you to manually select error buffer when needed with cider-selector.
Still i find it more convenient to use the popwin package for that, showing the error buffer as a popup, without breaking your windows layout.
(push "*cider-error*" popwin:special-display-config)
Not sure exactly if the errors you mention are compilation errors when developing Clojure/script but, in my experience (I also use Emacs in a terminal), you can dismiss the error message just by pressing q and it will close the frame and move the cursor back to the original frame.
Here's a short video of my experience: https://imgur.com/a/9jzr4yb
I also tried it having more than one frame, and it works as expected: it splits only the code editor frame to show the error; if you dismiss the error it removes the new frame and will keep your existing layout.
One option is to enable winner-mode and just bind winner-undo/winner-redo to keys you want to cycle between window configurations. After an error pops up a new frame, it is just one call to winner-undo to restore the prior configuration. This also gives you the desired behaviour for recalling the error configuration with winner-redo.

emacs shell tab file name completion never close and multiply - after gdb locking in windows fix

See further below for the original question.
I've used gdb for over a couple of decades, and after an update gdb started defeating c-x-b and preventing windows from being used to view things I wanted to see, while forcing bindings to buffers I didn't care to see. The fix seems to have broken tab completion for shells.
Ah, so how can I to stop gdb from taking control of the buffers/windows/frames layout without breaking something else?
;; fix 'feature' of broken gdb where it takes control of an
;; emacs window, and locks the user out from switching from it
;;
(defun set-window-undedicated-p (window flag)
"Never set window dedicated."
flag)
(advice-add 'set-window-dedicated-p :override #'set-window-undedicated-p)
--- problem in the original post --->
about a year back, after an update, file name completion windows in the shell stopped closing after the completion. I figured this behavior would go away on the next release .. but it never has.
hitting tab -- all good
after completion, then another ls with tab
I can repeat this process until my shell panel is all but crowded out, and emacs fills with completion panels that all contain additional views of the shell.
Is this some kind of new feature that can be turned off? Or is it, as seems more likely, a bug? (How can it have lived for so long!?). Is there a simple way without taking one's hands off the keyboard to, in general, close the completion window so that the screen looks like it did before hitting tab?
[I had to take out the more detailed descriptions of the images because with them, stack exchange complained of unformatted code and wouldn't take the post... there was not even a hint of code in them. Anyway, this should be good enough.]

Emacs ECB methods window not updating

So I do have Emacs 24.3.1 installed, and from 24 onwards it comes with CEDET. I installed ECB through list-packages and everything seems to work - except methods window refreshing.
When I open a file, all methods are displayed and I can jump to them no problem. But the issue is that they never refresh without restarting Emacs. I have experimented with almost every related variable I could find and nothing works.
I am desperately looking for solution, sice it pretty much nullifies methods window usability when I'm expanding the project.
I have these variables added, no Emacs errors, but it still won't refresh - neither after saving, nor after some idle time.
(setq auto-update-methods-after-save 1)
(global-semantic-idle-scheduler-mode 1)
(global-semanticdb-minor-mode 1)
I am new to this, so I may be missing some obvious solution. Could anyone help me? I can provide any configuration file or info you'll need.
EDIT: Of course tried C-c . r , no results.
I've just had same problem. The methods list got updated after I do:
1) revert-buffer
2) ecb-rebuild-methods-buffer (C-c . r)
The fact that just p.2 is not enough seems to be a bug though.

emacs delete-selection-mode disables itself

In my .emacs file I have (delete-selection-mode t) to enable the delete-selection-mode globally. Currently I'm working on a TeX file with AUXTeX, so it might be related to AUCTeX, but I don't know.
At first, after visiting a file foo.tex everything works fine, and typing over a marked text replaces the marked text with the one I type. However, after some time, during which I compile the document, add TeX macros, etc. the functionality of the delete-selection-mode doesn't work any more.
I don't know which action of mine is the one which causes the problem - it would be hard to trace it.
Note that although the functionality of the delete-selection-mode fails, when I try to enable it (M-x delete-selection-mode) I get a message that the mode was disabled! That is it was not disabled before - it just didn't work... I I then enable it (M-x delete-selection-mode again), then it is enabled and working again. Till the next fail...
Under the hood, the mode use pre-command-hook, which allows commands to run things right before every command. Emacs is known to clear this variable in the event of an error (just to make sure that Emacs don't hang). This mean that the function used by delete-selection-mode, or any other mode that use this hook, triggered an error.
How to fix it? Find what caused the error, wrap the function in a ignore-errors block, or run a timer re-adding the function every ten seconds or so.