unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add comint-clear-buffer
@ 2015-02-22  6:06 Bozhidar Batsov
  2015-02-22 21:23 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Bozhidar Batsov @ 2015-02-22  6:06 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 178 bytes --]

Any objections to the attached patched?

Clearing the entire comint buffer is a pretty common functionality often
added in modes based on comint and I'd like to see it built-in.

[-- Attachment #1.2: Type: text/html, Size: 227 bytes --]

[-- Attachment #2: 0001-Add-comint-clear-buffer.patch --]
[-- Type: application/octet-stream, Size: 1268 bytes --]

From 042030b2b71377d15ef71f41e7a443967319bf8c Mon Sep 17 00:00:00 2001
From: Bozhidar Batsov <bozhidar@batsov.com>
Date: Sun, 22 Feb 2015 08:01:08 +0200
Subject: [PATCH] Add comint-clear-buffer

---
 lisp/comint.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/comint.el b/lisp/comint.el
index 30c4dda..30aece1 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -472,6 +472,7 @@ executed once when the buffer is created."
     (define-key map "\C-c\C-\\"   'comint-quit-subjob)
     (define-key map "\C-c\C-m" 	  'comint-copy-old-input)
     (define-key map "\C-c\C-o" 	  'comint-delete-output)
+    (defile-key map "\C-c\M-o"    'comint-clear-buffer)
     (define-key map "\C-c\C-r" 	  'comint-show-output)
     (define-key map "\C-c\C-e" 	  'comint-show-maximum-output)
     (define-key map "\C-c\C-l" 	  'comint-dynamic-list-input-ring)
@@ -2428,6 +2429,11 @@ Sets mark to the value of point when this command is run."
 	   (goto-char (field-beginning pos))
 	   (set-window-start (selected-window) (point))))))
 
+(defun comint-clear-buffer ()
+  "Clear the comint buffer."
+  (interactive)
+  (let ((comint-buffer-maximum-size 0))
+    (comint-truncate-buffer)))
 
 (defun comint-interrupt-subjob ()
   "Interrupt the current subjob.
-- 
2.2.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add comint-clear-buffer
  2015-02-22  6:06 [PATCH] Add comint-clear-buffer Bozhidar Batsov
@ 2015-02-22 21:23 ` Stefan Monnier
  2015-02-22 22:08   ` Bozhidar Batsov
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2015-02-22 21:23 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: emacs-devel

> Any objections to the attached patched?
> Clearing the entire comint buffer is a pretty common functionality often
> added in modes based on comint and I'd like to see it built-in.

I haven't noticed it being added to derived modes, but it sounds like
useful functionality: I typically use M-x erase-buffer, but keeping this
loses the current input&prompt, so a dedicated command sounds better.

IOW: go ahead (as for the chosen key-binding, it sounds completely
arbitrary, but I don't have a better suggestion).


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add comint-clear-buffer
  2015-02-22 21:23 ` Stefan Monnier
@ 2015-02-22 22:08   ` Bozhidar Batsov
  0 siblings, 0 replies; 3+ messages in thread
From: Bozhidar Batsov @ 2015-02-22 22:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

Thanks!

Regarding the keybinding - it was chosen because of `C-c C-o` and a similar
command in SLIME and CIDER bound to `C-c M-o`.

On 22 February 2015 at 23:23, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > Any objections to the attached patched?
> > Clearing the entire comint buffer is a pretty common functionality often
> > added in modes based on comint and I'd like to see it built-in.
>
> I haven't noticed it being added to derived modes, but it sounds like
> useful functionality: I typically use M-x erase-buffer, but keeping this
> loses the current input&prompt, so a dedicated command sounds better.
>
> IOW: go ahead (as for the chosen key-binding, it sounds completely
> arbitrary, but I don't have a better suggestion).
>
>
>         Stefan
>

[-- Attachment #2: Type: text/html, Size: 1241 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-22 22:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-22  6:06 [PATCH] Add comint-clear-buffer Bozhidar Batsov
2015-02-22 21:23 ` Stefan Monnier
2015-02-22 22:08   ` Bozhidar Batsov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).