emacs-ipython-notebook/ein-pager.el

52 lines
1.3 KiB
EmacsLisp
Raw Normal View History

2012-05-07 14:41:15 +02:00
;;; ein-pager.el --- Pager module
;; Copyright (C) 2012- Takafumi Arakaki
;; Author: Takafumi Arakaki
;; This file is NOT part of GNU Emacs.
;; ein-pager.el is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; ein-pager.el is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with ein-pager.el. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'ansi-color)
2012-05-14 03:06:55 +02:00
(require 'ein-utils)
2012-05-07 14:41:15 +02:00
(defun ein:pager-new (name)
2012-05-14 03:08:32 +02:00
name)
2012-05-07 14:41:15 +02:00
(defun ein:pager-clear (pager)
2012-05-14 03:08:32 +02:00
(ein:with-read-only-buffer (get-buffer-create pager)
(erase-buffer)))
2012-05-07 14:41:15 +02:00
(defun ein:pager-expand (pager)
2012-05-14 03:08:32 +02:00
(pop-to-buffer (get-buffer-create pager))
(goto-char (point-min))
(unless font-lock-mode
(font-lock-mode)))
2012-05-07 14:41:15 +02:00
(defun ein:pager-append-text (pager text)
2012-05-14 03:08:32 +02:00
(ein:with-read-only-buffer (get-buffer-create pager)
2012-05-14 03:06:55 +02:00
(insert (ansi-color-apply text))))
2012-05-07 14:41:15 +02:00
(provide 'ein-pager)
;;; ein-pager.el ends here