unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bozhidar Batsov <bozhidar@batsov.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: [PATCH] Add comint-clear-buffer
Date: Sun, 22 Feb 2015 08:06:01 +0200	[thread overview]
Message-ID: <CAM9Zgm2DJ3apJ1L4=PRf=bGucOcJYRECdpv9zoziWZKgv+Nqwg@mail.gmail.com> (raw)


[-- 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


             reply	other threads:[~2015-02-22  6:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-22  6:06 Bozhidar Batsov [this message]
2015-02-22 21:23 ` [PATCH] Add comint-clear-buffer Stefan Monnier
2015-02-22 22:08   ` Bozhidar Batsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM9Zgm2DJ3apJ1L4=PRf=bGucOcJYRECdpv9zoziWZKgv+Nqwg@mail.gmail.com' \
    --to=bozhidar@batsov.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).