From 43cc6264deb89fcc665d123b06c7c2aebb35ab3a Mon Sep 17 00:00:00 2001 From: Mario Frasca <mario@anche.no> Date: Tue, 2 Jun 2020 16:22:07 +0000 Subject: [PATCH] docstrings to match the code, and minor cosmetics. --- lisp/org-plot.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index a23195d2a..3a95c72d6 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -85,14 +85,18 @@ Returns the resulting property list." p) (defun org-plot/goto-nearest-table () - "Move the point forward to the beginning of nearest table. -Return value is the point at the beginning of the table." - (interactive) (move-beginning-of-line 1) + "Move the point to the beginning of table. +Moves back if the point is inside a table, otherwise looks for next table. +If there is no table to be found, moves to end of buffer. +Return value is the point." + (interactive) + (move-beginning-of-line 1) (while (not (or (org-at-table-p) (< 0 (forward-line 1))))) (goto-char (org-table-begin))) (defun org-plot/collect-options (&optional params) "Collect options from an org-plot `#+Plot:' line. +Examines the line at point. Accepts an optional property list PARAMS, to which the options will be added. Returns the resulting property list." (interactive) @@ -143,7 +147,8 @@ and dependent variables." (counter 0) row-vals) (when (>= ind 0) ;; collect values of ind col - (setf row-vals (mapcar (lambda (row) (setf counter (+ 1 counter)) + (setf row-vals (mapcar (lambda (row) + (setf counter (+ 1 counter)) (cons counter (nth ind row))) table))) (when (or deps (>= ind 0)) ;; remove non-plotting columns @@ -156,7 +161,8 @@ and dependent variables." table))) ;; write table to gnuplot grid datafile format (with-temp-file data-file - (let ((num-rows (length table)) (num-cols (length (nth 0 table))) + (let ((num-rows (length table)) + (num-cols (length (nth 0 table))) (gnuplot-row (lambda (col row value) (setf col (+ 1 col)) (setf row (+ 1 row)) (format "%f %f %f\n%f %f %f\n" @@ -180,7 +186,8 @@ and dependent variables." row-vals)) (defun org-plot/gnuplot-script (data-file num-cols params &optional preface) - "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS. + "Return gnuplot script respecting the options set in PARAMS. +DATA-FILE is the name of the data containing file. NUM-COLS controls the number of columns plotted in a 2-d plot. Optional argument PREFACE returns only option parameters in a manner suitable for prepending to a user-specified script." @@ -274,7 +281,7 @@ manner suitable for prepending to a user-specified script." (defun org-plot/gnuplot (&optional params) "Plot table using gnuplot. Gnuplot options can be specified with PARAMS. If not given options will be taken from the +PLOT -line directly before or after the table." +line(s) directly before the table." (interactive) (require 'gnuplot) (save-window-excursion -- 2.20.1