Reputation: 83
As the title, how can I clear gdb command screen in Emacs. I tried with shell clear but It only work with gdb in terminal.
Have anyone here give me an ideal?
Thank in advance!
Upvotes: 1
Views: 539
Reputation: 9410
You can bind this defun to a key of your choice:
(defun clean-comint-buffer()
(interactive)
(delete-region (point-min)
(save-excursion
(goto-char (point-max))
(forward-line 0)
(point))))
It works for gdb and other comint-based modes (shell, interactive sql, etc...) that sometimes tend to grow with lines no longer useful.
EDIT
For binding this function to all comint buffers (gdb buffer is one of those), you may use (assuming you want C-c g):
(add-hook 'comint-mode-hook
(lambda ()
(local-set-key "\C-cg" 'clean-comint-buffer)))
Upvotes: 1
Reputation: 17422
Type C-l C-l. This will scroll the buffer so that the current line is at the top of the window.
Upvotes: 0