emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Thierry Banel <tbanelwebmin@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: make orgtbl-ascii-plot easier to install
Date: Thu, 28 Aug 2014 01:28:40 +0200	[thread overview]
Message-ID: <871ts1h5qv.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <53FE4F09.5080408@free.fr> (Thierry Banel's message of "Wed, 27 Aug 2014 23:35:05 +0200")

Thierry Banel <tbanelwebmin@free.fr> 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	other threads:[~2014-08-27 23:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-13 16:02 make orgtbl-ascii-plot easier to install Thierry Banel
2014-07-28 14:40 ` Bastien
2014-08-10 22:22   ` Thierry Banel
2014-08-26  8:29     ` Nicolas Goaziou
2014-08-26 19:52       ` Thierry Banel
2014-08-26 20:27         ` Nicolas Goaziou
2014-08-26 21:42           ` Thierry Banel
2014-08-26 22:09             ` Nicolas Goaziou
2014-08-26 22:21               ` Thierry Banel
2014-08-27 21:35               ` Thierry Banel
2014-08-27 23:28                 ` Nicolas Goaziou [this message]
2014-08-28 20:46                   ` Thierry Banel
2014-08-29  9:54                     ` Nicolas Goaziou
2014-08-29 17:20                       ` Thierry Banel
2014-09-02 21:53                       ` [PATCH] " Thierry Banel
2014-09-03 18:22                         ` Nicolas Goaziou
2014-09-03 20:10                           ` A key-binding for plotting Thierry Banel
2014-09-06 14:35                           ` [PATCH] remap orgtbl-ascii-plot to C-c # Thierry Banel
2014-09-08 16:30                             ` Nicolas Goaziou
2014-09-13 17:06                               ` key-binding for all plotting styles Thierry Banel
2014-10-07 14:15                                 ` Nicolas Goaziou
2014-10-07 21:40                                   ` Thierry Banel
2014-10-11 17:46                                   ` [PATCH] " Thierry Banel
2014-10-12  9:28                                     ` Nicolas Goaziou
2014-10-12 10:00                                       ` Thierry Banel
2014-10-12 14:05                                       ` Thierry Banel
2014-10-13 16:24                                         ` Nicolas Goaziou
2014-10-13 21:16                                           ` Thierry Banel
2014-10-14 20:48                                           ` Thierry Banel
2014-10-14 21:08                                             ` Nicolas Goaziou
2014-10-14 21:26                                               ` Thierry Banel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ts1h5qv.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=tbanelwebmin@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).