Say I have long debugging session in Perl with perldb on Emacs (M-x perldb). The output piles up, and at some point it becomes difficult to navigate through it.
I can restart the debugger with R, but that doesn't clear up the previous output. Is there a command to clear up the output of the buffer of the Perl debugger without having to kill the debugger and starting a new session?
You can run comint-truncate-buffer. This will remove all but the last 1024 lines from the buffer. The size can be customized by changing comint-buffer-maximum-size.
If you'd like to have the buffer truncated automatically, run this snippet of elisp:
(add-hook 'comint-output-filter-functions 'comint-truncate-buffer)
Debugger input and output is buffer contents like any other — if you want to delete it, just do it. For example, C-x h C-w (mark-whole-buffer followed by kill-region) works in perldb buffers just fine, and is the closest equivalent to a "clear screen" command in a text terminal.
Related
I'm recently started to use emacs gdb debugger but I can't find a way to clear *input/output* buffer for a re-run. emacs simply prints the output after the previous one!
In emacsclient, is there a way to open a file from the command line such that its buffer will remain open on the server after I close the client?
Alternatively, is there a command I can run from in a client to tell it to effectively detach from a buffer, so that the buffer does not get killed when the client exits?
Normally when closing emacsclient either with C-x C-c or C-x #, the buffer(s) associated with that client get killed, which is usually convenient behavior, but sometimes I would like for buffers to stay alive after closing. So far the only way I have found to accomplish this is to run the client without specifying any files, then visit them with C-x C-f, but I'm wondering if there's a better way to do this.
You should be able to do this by using the -n option. That means that it won't wait for you to "finish" the buffer and it'll just stay in the buffer list. I use this with emacsclient myself.
So, one option is to use emacsclient's eval command line option to run a lisp command to find the file you want.
emacsclient -c -e '(find-file "my_file")'
Obviously this is a lot more to type than the command sequence emacsclient -c, C-x C-f, my_file, but it could pretty easily be wrapped in a script that takes an extra argument to tell it whether to just choose the file or use find-file.
Someone more well versed in elisp than I could probably just add the option directly into emacs.
According the info manual, if you never want to kill emacsclient buffers, when you're done with them, you can customise the server-kill-new-buffers variable (more information at C-h v server-kill-new-buffers).
For you use-case, depending on how often you want the buffers killed or not, you could set the above variable to nil and then manually kill the buffers that you do want killed.
Emacs was working fine, a few days ago some basic functions stopped working.
Alt+Ctrl+>, Alt+Ctrl+>
go to start/end buffer used to work but now I get an undefined error.
Alt+g+g goto line. It was worked, now I get an undefined error
I can't paste into the mini buffer on search with Alt+y, instead it paste the character that my cursor is on.
No one touched my .emacs file.
What is going on? I used emacs for along time and never had a problem with basic functions or pasting to the mini buffer.
Update:
Latest update on my problem is that everything is working when I use the Esc key instead of the Alt key. I don't know why or how it changes but it has nothing to do with my .emacs file or CapsLock or key pressing mistakes. Has anybody a clue why it changes and how to change it back?
Some things to check:
Is your .emacs file loading at all? Are any of the settings in your .emacs file taking effect? Alternately, try running emacs --load /path/to/your/.emacs. This will load the lisp code in your emacs file. If your settings get loaded now, then you need to move your .emacs into the right location so Emacs can pick it up.
Is another mode unbinding your keys? To check this, go to (for example) your *scratch* buffer, which should be in lisp-interaction-mode, and try a shortcut.
Is your .emacs file broken somehow? Try opening it, and commenting everything out but one binding. Then restart emacs and see what happens. If it works, keep uncommenting out sections (binary search is the way to go) to see what line breaks loading.
Are you sure you're pressing the right keys? Hit C-h c M-g g to run describe-key-briefly to see what keys you're pressing, and what they're currently bound to.
Is something wrong with the lisp code to bind the keys? I know this isn't likely, since it used to work, but try it anyway. Open up your .emacs and go to the line binding M-g g. Put your cursor after the closing parenthesis, then press C-x C-e to evaluate the s-expression containing the binding. Then, try the keyboard shortcut again. If it works, then something isn't loading your .emacs file correctly.
You can open your dot emacs and Alt-x eval-buffer. See if your dot emacs file works, or if there are any bugs.
I learn to use emacs. When I enter M-x shell , I enter the shell mode, but I don't know how to exit shell mode. I want to be back to fundamental mode to continue to my editing work. I search this question Emacs switching out of terminal, but when I press C-c o , the input will be treated as a command, so how to exit ?
The shell will be running in a buffer. You can switch back to the buffer where you were doing your work using C-x b.
You can try shell-toggle.el for quick jump back and forth between your current buffer and a shell buffer.
You can also try my hacked version of shell-toggle, which let you open a shell in the path of your current buffer (file). See the following link:
http://zhangda.wordpress.com/2009/04/08/my-hack-on-shell-toggle/
I have some processes that run from functions, i.e.:
M-x run-proc1
M-x run-proc2
I would like to know what command to issue from the command line to run emacs with run-proc1 running in the upper window and run-proc2 running in the lower window.
Thanks!
You might get better answers later, but appending this to your ~/.emacs.d/init.el might work.
(split-window-vertically)
(run-proc1)
(other-window)
(run-proc2)
(other-window)
Alternatively (for another approach), see this link.