From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: make orgtbl-ascii-plot easier to install Date: Thu, 28 Aug 2014 01:28:40 +0200 Message-ID: <871ts1h5qv.fsf@nicolasgoaziou.fr> References: <53C2ADB0.2010404@free.fr> <87oaw9wg3s.fsf@bzg.ath.cx> <53E7F088.8010401@free.fr> <87tx4zhcvs.fsf@nicolasgoaziou.fr> <53FCE574.3010307@free.fr> <87vbpfnghj.fsf@nicolasgoaziou.fr> <53FCFF47.4060805@free.fr> <87r402oqce.fsf@nicolasgoaziou.fr> <53FE4F09.5080408@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMmdJ-0005cy-Ub for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 19:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMmd9-0001KO-Oh for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 19:28:05 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:44493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMmd9-0001KK-It for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 19:27:55 -0400 In-Reply-To: <53FE4F09.5080408@free.fr> (Thierry Banel's message of "Wed, 27 Aug 2014 23:35:05 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Thierry Banel Cc: emacs-orgmode@gnu.org Thierry Banel writes: > Hereafter is an enhanced version of orgtbl-ascii-plot. > > Thanks, Nicolas, for your feedback. Enhancements you suggested include: > - let-binding (instead of setq) > - better support for table headers (correct parsing of 'hline) > - no dependency on cl-lib (hopefully achieving Emacs 23 support) > - use dolist (instead of mapc) > - clean up doc-strings Thank you. > +(defun orgtbl-ascii-plot (&optional ask) > + "Draws an ascii bars plot in a column. > +With cursor in a column containing numerical values, this > +function will draw a plot in a new column. ASK, if given, is a You forgot a space at the end of the sentence. Actually, this is the case in all your docstrings. > +numeric prefix to override the default 12 characters width of the > +plot. ASK may also be the C-u prefix, which will prompt for the > +width." Use "\\[universal-argument]" instead of "C-u". > + (dolist (x > + (let ((t1 ;; skip table header > + (if (eq (car table) 'hline) > + (cdr table) > + table))) Just to be sure to catch the following (odd) table |--------| |--------| | header | |--------| | values | I suggest the following (while (eq (car table) 'hline) (setq table (cdr table))) (dolist (x (or (cdr (memq 'hline table)) table)) (when (consp x) (setq x (nth (1- col) x)) (when (string-match "^[-+]?\\([0-9]*[.]\\)?[0-9]*\\([eE][+-]?[0-9]+\\)?$" x) (setq x (string-to-number x)) (when (> min x) (setq min x)) (when (< max x) (setq max x))))) > +(defun orgtbl-uc-draw-grid (value min max &optional width) > + "Draws an ascii bar in a table. It is a variant of The second sentence should start a new line. > +(defun orgtbl-uc-draw-cont (value min max &optional width) > + "Draws an ascii bar in a table. It is a variant of Ditto. Regards, -- Nicolas Goaziou