summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Arroyo Menéndez <davidam@gmail.com>2014-10-15 15:08:54 +0200
committerDavid Arroyo Menéndez <davidam@gmail.com>2014-10-15 15:08:54 +0200
commit307cc6d6aa7c3d1d44a7cc352b3c8ea5a0895412 (patch)
tree4b59b36a138372efe1c479c75360fc1bb70d9df5
parent03c0ab007954be7ecd22dba11575c66795b9f905 (diff)
parent5963b0345513398fd553c4fd5d11832243b6e49a (diff)
downloadorg-mode-307cc6d6aa7c3d1d44a7cc352b3c8ea5a0895412.tar.gz
Merge branch 'master' of orgmode.org:org-mode
-rw-r--r--contrib/lisp/org-mac-link.el27
-rw-r--r--doc/org.texi60
-rw-r--r--etc/ORG-NEWS2
-rw-r--r--lisp/org-capture.el32
4 files changed, 82 insertions, 39 deletions
diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el
index e1ab56d..e0636a5 100644
--- a/contrib/lisp/org-mac-link.el
+++ b/contrib/lisp/org-mac-link.el
@@ -402,28 +402,19 @@ The links are of the form <link>::split::<name>."
;; Grab the frontmost url from Safari.
(defun org-as-mac-safari-get-frontmost-url ()
- (let ((result
- (do-applescript
- (concat
- "tell application \"Safari\"\n"
- " set theUrl to URL of document 1\n"
- " set theName to the name of the document 1\n"
- " return theUrl & \"::split::\" & theName & \"\n\"\n"
- "end tell\n"))))
- (car (split-string result "[\r\n]+" t))))
+ (do-applescript
+ (concat
+ "tell application \"Safari\"\n"
+ " set theUrl to URL of document 1\n"
+ " set theName to the name of the document 1\n"
+ " return theUrl & \"::split::\" & theName & \"\n\"\n"
+ "end tell\n")))
(defun org-mac-safari-get-frontmost-url ()
(interactive)
(message "Applescript: Getting Safari url...")
- (let* ((url-and-title (org-as-mac-safari-get-frontmost-url))
- (split-link (split-string url-and-title "::split::"))
- (URL (car split-link))
- (description (cadr split-link))
- (org-link))
- (when (not (string= URL ""))
- (setq org-link (org-make-link-string URL description)))
- (kill-new org-link)
- org-link))
+ (org-mac-paste-applescript-links
+ (org-as-mac-safari-get-frontmost-url)))
(defun org-mac-safari-insert-frontmost-url ()
(interactive)
diff --git a/doc/org.texi b/doc/org.texi
index ad872a8..767fa1a 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3258,11 +3258,17 @@ functions.
@cindex plot tables using Gnuplot
@cindex #+PLOT
-Org-Plot can produce 2D and 3D graphs of information stored in org tables
-using @file{Gnuplot} @uref{http://www.gnuplot.info/} and @file{gnuplot-mode}
+Org-Plot can produce graphs of information stored in org tables, either
+graphically or in ASCII-art.
+
+@subheading Graphical plots using @file{Gnuplot}
+
+Org-Plot produces 2D and 3D graphs using @file{Gnuplot}
+@uref{http://www.gnuplot.info/} and @file{gnuplot-mode}
@uref{http://xafs.org/BruceRavel/GnuplotMode}. To see this in action, ensure
that you have both Gnuplot and Gnuplot mode installed on your system, then
-call @code{org-plot/gnuplot} on the following table.
+call @kbd{C-c " g} or @kbd{M-x org-plot/gnuplot @key{RET}} on the following
+table.
@example
@group
@@ -3280,8 +3286,8 @@ call @code{org-plot/gnuplot} on the following table.
Notice that Org Plot is smart enough to apply the table's headers as labels.
Further control over the labels, type, content, and appearance of plots can
be exercised through the @code{#+PLOT:} lines preceding a table. See below
-for a complete list of Org-plot options. For more information and examples
-see the Org-plot tutorial at
+for a complete list of Org-plot options. The @code{#+PLOT:} lines are
+optional. For more information and examples see the Org-plot tutorial at
@uref{http://orgmode.org/worg/org-tutorials/org-plot.html}.
@subsubheading Plot Options
@@ -3337,6 +3343,47 @@ may still want to specify the plot type, as that can impact the content of
the data file.
@end table
+@subheading ASCII bar plots
+
+While the cursor is on a column, typing @kbd{C-c \" a} or
+@kbd{M-x orgtbl-ascii-plot @key{RET}} create a new column containing an
+ASCII-art bars plot. The plot is implemented through a regular column
+formula. When the source column changes, the bar plot may be updated by
+refreshing the table, for example typing @kbd{C-u C-c *}.
+
+@example
+@group
+| Sede | Max cites | |
+|---------------+-----------+--------------|
+| Chile | 257.72 | WWWWWWWWWWWW |
+| Leeds | 165.77 | WWWWWWWh |
+| Sao Paolo | 71.00 | WWW; |
+| Stockholm | 134.19 | WWWWWW: |
+| Morelia | 257.56 | WWWWWWWWWWWH |
+| Rochefourchat | 0.00 | |
+#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
+@end group
+@end example
+
+The formula is an elisp call:
+@lisp
+(orgtbl-ascii-draw COLUMN MIN MAX WIDTH)
+@end lisp
+
+@table @code
+@item COLUMN
+ is a reference to the source column.
+
+@item MIN MAX
+ are the minimal and maximal values displayed. Sources values
+ outside this range are displayed as @samp{too small}
+ or @samp{too large}.
+
+@item WIDTH
+ is the width in characters of the bar-plot. It defaults to @samp{12}.
+
+@end table
+
@node Hyperlinks
@chapter Hyperlinks
@cindex hyperlinks
@@ -13224,7 +13271,8 @@ length, using @code{:columns} attribute.
@node An example
@subsection An example
-Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}.
+Here is a thorough example. @inforef{GNU Sample Texts,,texinfo} for an
+equivalent Texinfo code.
@smallexample
#+MACRO: version 2.0
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 0a5af68..e94dec6 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -96,6 +96,8 @@ would throw an error. A new variable
~org-table-formula-create-columns~ was added to adjust this
behavior. It is now possible to silently add new columns, to do so
with a warning or to explicitly ask the user each time.
+*** ASCII plot
+Ability to plot values in a column through ASCII-art bars.
** Miscellaneous
*** File names in links accept are now compatible with URI syntax
Absolute file names can now start with =///= in addition to =/=. E.g.,
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9e33d25..9f8107e 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1075,21 +1075,18 @@ may have been stored before."
(t
(setq beg (1+ (point-at-eol))
end (save-excursion (outline-next-heading) (point)))))
+ (setq ind nil)
(if (org-capture-get :prepend)
(progn
(goto-char beg)
- (if (org-list-search-forward (org-item-beginning-re) end t)
- (progn
- (goto-char (match-beginning 0))
- (setq ind (org-get-indentation)))
- (goto-char end)
- (setq ind 0)))
+ (when (org-list-search-forward (org-item-beginning-re) end t)
+ (goto-char (match-beginning 0))
+ (setq ind (org-get-indentation))))
(goto-char end)
- (if (org-list-search-backward (org-item-beginning-re) beg t)
- (progn
- (setq ind (org-get-indentation))
- (org-end-of-item))
- (setq ind 0))))
+ (when (org-list-search-backward (org-item-beginning-re) beg t)
+ (setq ind (org-get-indentation))
+ (org-end-of-item)))
+ (unless ind (goto-char end)))
;; Remove common indentation
(setq txt (org-remove-indentation txt))
;; Make sure this is indeed an item
@@ -1097,17 +1094,22 @@ may have been stored before."
(setq txt (concat "- "
(mapconcat 'identity (split-string txt "\n")
"\n "))))
+ ;; Prepare surrounding empty lines.
+ (org-capture-empty-lines-before)
+ (setq beg (point))
+ (unless (eolp) (save-excursion (insert "\n")))
+ (unless ind
+ (org-indent-line)
+ (setq ind (org-get-indentation))
+ (delete-region beg (point)))
;; Set the correct indentation, depending on context
(setq ind (make-string ind ?\ ))
(setq txt (concat ind
(mapconcat 'identity (split-string txt "\n")
(concat "\n" ind))
"\n"))
- ;; Insert, with surrounding empty lines
- (org-capture-empty-lines-before)
- (setq beg (point))
+ ;; Insert item.
(insert txt)
- (or (bolp) (insert "\n"))
(org-capture-empty-lines-after 1)
(org-capture-position-for-last-stored beg)
(forward-char 1)