App-Chart
view release on metacpan or search on metacpan
emacs/chartprog.el view on Meta::CPAN
;;; chartprog.el --- stock quotes using Chart.
;; Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin Ryde
;; Author: Kevin Ryde <user42_kevin@yahoo.com.au>
;; Keywords: comm, finance
;; URL: http://user42.tuxfamily.org/chart/index.html
;; This file is part of Chart.
;;
;; Chart 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, or (at your option) any later
;; version.
;;
;; Chart 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 Chart. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; See section "Emacs" in the Chart manual for usage.
;;; Code:
(require 'timer) ;; for xemacs21
(eval-when-compile ;; for macros in emacs20
(unless (and (fboundp 'declare)
(fboundp 'dolist)
(fboundp 'push))
(require 'cl)))
(defvar bookmark-make-record-function) ;; in bookmark.el
;;-----------------------------------------------------------------------------
;; customizations
;;;###autoload
(defgroup chartprog nil
"Chart program interface."
:prefix "chartprog-"
:group 'applications
:link '(custom-manual "(chart)Emacs"))
(defface chartprog-up
`(;; plain "green" is too light to see against a white background
(((class color) (background light))
(:foreground "green4"))
(((class color))
(:foreground "green")))
"Face for a Chart quote which is up."
:group 'chartprog)
(defface chartprog-down
`((((class color))
(:foreground "red")))
"Face for a Chart quote which is down."
:group 'chartprog)
(defface chartprog-in-progress
`((((class color) (background dark))
(:foreground "cyan"))
(((class color) (background light))
(:foreground "blue")))
"Face for Chart quote fetch in progress."
:group 'chartprog)
(defcustom chartprog-watchlist-hook nil
"*Hook called by `chart-watchlist'."
:type 'hook
:group 'chartprog)
;;-----------------------------------------------------------------------------
(defvar chartprog-debug nil)
(defun chartprog-debug-message (&rest args)
(when chartprog-debug
(let ((buffer (get-buffer-create "*chartprog-debug*")))
(save-selected-window
(let ((window (get-buffer-window buffer)))
(if window (select-window window)))
(with-current-buffer buffer
(let ((orig-point (if (eobp) nil (point))))
(dolist (arg args)
(goto-char (point-max))
(if (stringp arg)
(insert arg)
(pp arg (current-buffer))))
(goto-char (point-max))
(unless (bolp) (insert "\n"))
(goto-char (or orig-point (point-max)))
(goto-char (point-max))))))))
;;-----------------------------------------------------------------------------
;; xemacs compatibility
;; Some past versions didn't have propertize did they? Forget when or what.
;; xemacs 21.4 has propertize.
;; (unless (fboundp 'propertize)
;; (defun chartprog-propertize (str &rest properties)
;; "Return a copy of STR with PROPERTIES added.
;; PROPERTIES is successive arguments PROPERTY VALUE PROPERTY VALUE ..."
;; (setq str (copy-sequence str))
;; (add-text-properties 0 (length str) properties str)
;; str))))
;;----------------------------------------------------------------------------
;; emacs22 new stuff
(if (eval-when-compile (fboundp 'complete-with-action))
;; emacs22 (and in emacs23 recognising the "boundaries" thing)
(eval-and-compile
(defalias 'chartprog--complete-with-action
'complete-with-action))
;; emacs21,xemacs21
(defun chartprog--complete-with-action (action table string pred)
"An internal part of chartprog.el.
( run in 0.508 second using v1.01-cache-2.11-cpan-f56aa216473 )