Summary: Rückgängig gemacht auf den Stand vom 2013-08-24 11:21 UTC
< (re-WikiModes-forward (concat (regexp-quote ticker) "\",\\(.+\\)"))
> (re-search-forward (concat (regexp-quote ticker) "\",\\(.+\\)"))
or if that page is down then from the wayback machine
The author considers it obsolete, but the code may still be of interest for ideas on showing a quote in the mode line, updating periodically, and optional price change triggers.
The web sites used by the two builtin retrieval methods have changed. Money Quick Quotes has gone away, and Quicken now merely redirects to Yahoo Finance.
If you want to give the code a try, the following adds a Yahoo Finance retrieval (http://finance.yahoo.com),
(defun my-stock-quote-yahoo (ticker) "Download a stock price using Yahoo Finance (CSV format)." (require 'url) (with-temp-buffer (let (url-show-status) ;; url prior to about 2002 leaves some headers as invisible ;; text when reading http/1.1 chunked, workaround that by ;; retrieving and matching the stock code (url-insert-file-contents ;; s=FOO is the stock, f=sl1 asks for stock and last price (concat "http://quote.yahoo.com/d?f=sl1&s=" ticker)) (set-buffer-modified-p nil)) ;; yahoo gives "N/A" for an unknown ticker, which comes out as 0 ;; from string-to-number, maybe throwing an error would be better (goto-char (point-min)) (re-search-forward (concat (regexp-quote ticker) "\",\\(.+\\)")) (string-to-number (match-string 1)))) (custom-add-option 'stock-quote-data-functions 'my-stock-quote-yahoo)
(setq stock-quote-data-functions '(my-stock-quote-yahoo))
global-mode-string setup doesn’t seem quite right if that variable is
nil. If you’re using
customize-variable stock-quote-in-modeline then you might need
(setq global-mode-string (list ""))