emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] make orgtbl-ascii-plot easier to install


From: Nicolas Goaziou
Subject: Re: [O] make orgtbl-ascii-plot easier to install
Date: Thu, 28 Aug 2014 01:28:40 +0200

Thierry Banel <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]