summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/chart.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/chart.el')
-rw-r--r--lisp/emacs-lisp/chart.el75
1 files changed, 36 insertions, 39 deletions
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 84bfd706afc..b2696425ff7 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -1,7 +1,7 @@
;;; chart.el --- Draw charts (bar charts, etc)
;; Copyright (C) 1996, 1998, 1999, 2001, 2004, 2005, 2007, 2008, 2009,
-;; 2010 Free Software Foundation, Inc.
+;; 2010, 2011 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Version: 0.2
@@ -62,17 +62,13 @@
(require 'eieio)
;;; Code:
-(defvar chart-map (make-sparse-keymap) "Keymap used in chart mode.")
+(defvar chart-mode-map (make-sparse-keymap) "Keymap used in chart mode.")
+(define-obsolete-variable-alias 'chart-map 'chart-mode-map "24.1")
(defvar chart-local-object nil
"Local variable containing the locally displayed chart object.")
(make-variable-buffer-local 'chart-local-object)
-(defvar chart-face-list nil
- "Faces used to colorize charts.
-List is limited currently, which is ok since you really can't display
-too much in text characters anyways.")
-
(defvar chart-face-color-list '("red" "green" "blue"
"cyan" "yellow" "purple")
"Colors to use when generating `chart-face-list'.
@@ -90,41 +86,42 @@ Useful if new Emacs is used on B&W display.")
:group 'eieio
:type 'boolean)
-(if (and (if (fboundp 'display-color-p)
- (display-color-p)
- window-system)
- (not chart-face-list))
- (let ((cl chart-face-color-list)
- (pl chart-face-pixmap-list)
- nf)
- (while cl
- (setq nf (make-face (intern (concat "chart-" (car cl) "-" (car pl)))))
- (if (condition-case nil
- (> (x-display-color-cells) 4)
- (error t))
- (set-face-background nf (car cl))
- (set-face-background nf "white"))
- (set-face-foreground nf "black")
- (if (and chart-face-use-pixmaps
- pl
- (fboundp 'set-face-background-pixmap))
- (condition-case nil
- (set-face-background-pixmap nf (car pl))
- (error (message "Cannot set background pixmap %s" (car pl)))))
- (setq chart-face-list (cons nf chart-face-list))
- (setq cl (cdr cl)
- pl (cdr pl)))))
-
-(defun chart-mode ()
+(defvar chart-face-list
+ (if (if (fboundp 'display-color-p)
+ (display-color-p)
+ window-system)
+ (let ((cl chart-face-color-list)
+ (pl chart-face-pixmap-list)
+ (faces ())
+ nf)
+ (while cl
+ (setq nf (make-face
+ (intern (concat "chart-" (car cl) "-" (car pl)))))
+ (set-face-background nf (if (condition-case nil
+ (> (x-display-color-cells) 4)
+ (error t))
+ (car cl)
+ "white"))
+ (set-face-foreground nf "black")
+ (if (and chart-face-use-pixmaps
+ pl
+ (fboundp 'set-face-background-pixmap))
+ (condition-case nil
+ (set-face-background-pixmap nf (car pl))
+ (error (message "Cannot set background pixmap %s" (car pl)))))
+ (push nf faces)
+ (setq cl (cdr cl)
+ pl (cdr pl)))
+ faces))
+ "Faces used to colorize charts.
+List is limited currently, which is ok since you really can't display
+too much in text characters anyways.")
+
+(define-derived-mode chart-mode fundamental-mode "CHART"
"Define a mode in Emacs for displaying a chart."
- (kill-all-local-variables)
- (use-local-map chart-map)
- (setq major-mode 'chart-mode
- mode-name "CHART")
(buffer-disable-undo)
(set (make-local-variable 'font-lock-global-modes) nil)
- (font-lock-mode -1)
- (run-hooks 'chart-mode-hook)
+ (font-lock-mode -1) ;Isn't it off already? --Stef
)
(defun chart-new-buffer (obj)