This is my first time using gdb mode on emacs.
As you can see in the minibuffer, M-n for next doesn't work.
What might be the problem here?
EDIT: this is definitely not due to byobu, as mentioned in the comments.
Related
I've been opening emacs from the terminal but every time I want to compile my c program, i have to quit emacs first, compile it on terminal, then re-open emacs afterward again to edit some more.
Is there a simpler way to do this so I can keep emacs open while also compiling stuff on terminal?
I know this has something to do with entering shell mode but I'm not too familiar with that or editing the init file as im really new to emacs and still trying to get the hang of it
Any help is appreciated, thanks!
To compile your program while inside Emacs, type M-x compile and enter the compilation command. As a bonus, any errors or warnings in the output become links to the corresponding line in the source code.
Once your program is compiled, there are a few different ways to run it. If it's a non-interactive program, you may find that M-! (for running a shell command, waiting for it to finish, and displaying its output in a buffer) is sufficient. Otherwise, you may want to run a shell inside Emacs. You can do that with M-x eshell. (Some people prefer M-x shell; try both and see what you like.)
Alternatively, if you want to temporarily leave Emacs and go back to the terminal, you can type C-z to put Emacs in the background. To go back from the shell to Emacs, type % or fg (for "foreground"). To check whether Emacs is currently running in the background, type jobs.
Alternatively, it's straight-forward to run M-x ansi-term to have a functioning terminal inside of an Emacs buffer. It's nice having a working, interactive terminal in Emacs but also to be able to navigate that terminal output using your normal Emacs key bindings.
I use this this package to make sure all my environment variables are loaded.
Some operational notes:
When I'm editing something in Emacs and in need of a terminal, my usual procedure is to split vertically 'C-x 2' or horizontally 'C-x 3' in order to be able to open a terminal emulator (either 'M-x eshell' or 'M-x shell') side by side with the actual window. From here it is possible go forward and backward with 'C-x o' or 'C-u C-x o' as needed. This allows to continue editing while something is running visibly on the near window.
In rare cases where these emulators dont work exactly as the real OS terminal, we can split and use the native thing without layer or emulation 'C-x term RET RET' . Unfortunatly, in the later case, it is not possible to cycle between the framed windows (with 'C-x o') . Here, the exit command is required to be able to operate normally with emacs.
When I toggle global debug mode for the first time in an emacs session and attempt to execute a piece of invalid lisp the backtrace window pops up. However if I close this window and delete the backtrace buffer and then try and execute another piece of invalid elisp the backtrace buffer no longer gets created and no window pops up. I have looked through the manual to try and figure out why this is happening to no avail, any help would be much apprecaited.
The problem is that killing the *Backtrace* buffer doesn't actually make you leave the debugger (contrary to hitting c or q), so you're still in the recursive edit where further debugging is disabled (so as to avoid jumping further into the debugger ad-nauseam).
I recommend you use C-] to get out of this situation. But I also recommend that you file this with M-x report-emacs-bug since it would make sense to exit the debugger when the backtrace buffer gets killed.
I am not able to set the mark at the current point by C-SPC (both when emacs loads the init file and when it doesn't). However, when I do M-x set-mark-command, the mark is well set and I am able to select the region by moving the cursor. When I do M-x apropos set-mark-command, it shows two bindings C-# and C-SPC, but only the first one works. Any suggestions will be appreciated.
I am running emacs 24.3 on a GUI on Kubuntu 14.04.
Ubuntu 14.04 has an open bug affecting some desktop environments (at least KDE, LXDE and i3, but not Unity).
The default IBus key binding for "next input method" is Ctrl+Space, which prevents this key combination from reaching Emacs (or any other userspace program). To resolve the issue, run ibus-setup and change the key binding for "next input method" to something else (or delete it entirely by clicking the "..." button and then the "Delete" button).
Note that running ibus-setup from Unity, where C-SPC works already, shows a preferences window that does not include the key binding option that needs to be changed.
The "next input method" command cycles through your configured inputs, e.g. perhaps from English to French.
So I tracked down a similar issue to this on macOS. It seems that at some point C-SPC became bound to "Select the previous input source":
I just had the same issue today which I never had before. I am on Windows 7. As it turns out the Ctrl+SPC is bound to the OS's language switch. So the keystrokes are not sent to emacs at all.
But one thing that is even more weird is that I have never installed new languages/keyboards, yet the 'CH PRC' shows up in my language bar as a language/keyboard today. It turns out to be a Windows 7 bug and all I had to do to fix was:
Add 'CH PRC' in the language bar then Save.
Remove the language then Save again.
I know you are not on Windows, so the fix may not be the same as mine, but it is very likely Ctrl+SPC is bound to your OS's language switch as well.
I'm running Emacs 24 on Ubuntu 10.04, coding c++ in the default c++ environment. Periodically after a while coding, my indentation engine seems to break -- pressing "tab" to indent places places any line at the beginning of the line. Selecting the entire buffer result in the entire buffer being un-indented. This problem effects all buffers, current or later opened. So far the only way I have found to repair it is the (highly inconvenient) step of restarting emacs. Is there another way to reboot my indentation engine? Attempting to load different indentation styles does not fix the problem.
Have you read this thread?
http://lists.gnu.org/archive/html/help-gnu-emacs/2012-09/msg00216.html
It sounds like you can fix your problem by updating cc-mode.
I see the same with 24.3 but I found that closing and re-opening the affected buffer also solves the issue.
This is a recurring issue on my system (Emacs 24.3 x86_64 Red Hat Linux) and could possibly be a bug introduced in Emacs 24 judging from the link posted by event_jr.
I encounter the issue fairly often and usually resolve it by reloading whatever buffer I'm working in:
M-x revert-buffer RET yes RET
This way you don't have to close neither buffer nor Emacs.
I found unbalanced preprocessor directives (#ifdef etc) can throw it into this sort of behaviour
Every time I use emacs, I can use the arrow keys just fine to move the cursor around. But when I'm running emacs within screen, and I push emacs to the background (ctrl-Z) then return it to the foreground, my arrow keys no longer work, e.g.
M-[ a is undefined
This behavior doesn't happen when I'm running emacs outside of screen.
Any ideas? Is this some screen setting?
For what it's worth, this just happened to me, and I was able to correct it by disconnecting from screen and then reconnecting:
Ctrl+A, d
screen -R
The vt100 terminal that Screen (and just about every other terminal emulator) emulates has two modes, normal mode and application mode. Normal mode is used for line-by-line applications and application mode for full-screen applications. Amongst the differences between the modes is that the arrow keys send different control sequences (I don't know why): e.g. ESC O A in full screen mode and ESC [ A in normal mode. It seems that when you press Ctrl+Z, Emacs switches the terminal back to normal mode, but when you return it to the foreground, it doesn't switch to full screen mode again, or Screen does not react to Emacs's commands properly.
One possible workaround is to bind the same character sequences in both modes in your .screenrc, e.g.
bindkey -k ku stuff ^[OA
bindkey -k kd stuff ^[OB
bindkey -k kr stuff ^[OC
bindkey -k kl stuff ^[OD
Another possible workaround is to tell Emacs to interpret both key sequences regardless of what the terminal says. Although this is in principle a bad idea since some terminals might use these key sequences for different keys, I've never encountered such an incompatible terminal, and I suspect none have been made in the last 20 years or more.
(define-key function-key-map "\eOA" [up])
(define-key function-key-map "\e[A" [up])
(define-key function-key-map "\eOB" [down])
(define-key function-key-map "\e[B" [down])
(define-key function-key-map "\eOC" [right])
(define-key function-key-map "\e[C" [right])
(define-key function-key-map "\eOD" [left])
(define-key function-key-map "\e[D" [left])
A true solution would involve finding what's causing the problem. It could be a bug in Screen, a bug in Emacs, a bug in the terminal (emulator) that Screen is running in, a bug or misconfiguration in your termcap or terminfo database. If you want to investigate this, start by mentioning your operating system, what terminal (emulator)(s) Screen is running in, where you obtained Screen (or how you compiled it, if that's what you did) and what version, ditto for Emacs, whether you've observed the same problem outside Screen, the output of echo $TERM and echo -E "$TERMCAP" inside Screen.
I had my xterm window full screen and was in screen and this happened.
I double clicked the xterm border to go out of full screen. Ctrl-z to background emacs. Then fg to bring it back and then the arrow keys worked. I could go into full screen without any issues.
I should proly learn all the emacs navigation commands but my old habits of migrating to the arrow keys die hard :/
First, push emacs to background.
Ctrl+z
and bring to forefront again.
fg
Not an answer, but worth noting that the described behaviour also occurs when running GNU emacs on tmux on Ubuntu's Terminal or xterm
Quick work around is to not run emacs in tmux.
Versions
Emacs: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu) of 2014-06-06 on brownie, modified by Debian)
tmux: 1.9
Ubuntu: 14.10
We're having the same problem here, a workaround we found, (but we still need to find the origin of the problem) is to set the "application sequence" manually from within emacs:
Navigate to your *scratch* buffer
Paste: (send-string-to-terminal "\e[?1h")
M-x eval-buffer
and voilà.
Also, a simple C-z fg may be enough, and is faster to type þ
Here's a solution that worked for me to unbreak it once broken (ubuntu 14.04, emacs 24.1). Without detaching from the screen try the following:
1) Ctrl-z to stop emacs.
2) Start another emacs: emacs -nw
3) Ctrl-z in second emacs, and voila!, first emacs will work again. (I then reopen the second emacs and close it Ctrl-x Ctrl-c).