[O] Bug: Inaccurate doc-string for org-image-actual-width [9.2.3 (9.2.3-17-g4df705-elpaplus @ /home/yantar92/.emacs.d/elpa/org-plus-contrib-20190513/)]

2019-06-05 Thread 'Ihor Radchenko'


The doc-string for org-image-actual-width states that image width can
be set using #+ATTR.* keyword (note that it is all capital letters).
However, org-display-inline-images only looks for lower-case #+attr_:

(re-search-forward "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"
 (org-element-property :post-affiliated paragraph)
 t)

If case-fold-search is set to 't, and the value of
org-image-actual-width is set to a list, #+ATTR_ORG: :width
specifications are always ignored, while they should not.

Best,
Ihor



Emacs  : GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit)
 of 2019-04-29
Package: Org mode version 9.2.3 (9.2.3-17-g4df705-elpaplus @ 
/home/yantar92/.emacs.d/elpa/org-plus-contrib-20190513/)
-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg




[O] Output result of source block to a file

2019-06-05 Thread Roger Mason
Hello,

I want to output the result of the evaluation of a (python) source block
to a (graphics) file and have a link to the file inserted in the buffer.

Here is the code:

#+begin_src python :results value file :file scaleplot02.pdf :exports results 
:var data=test
  import matplotlib.pyplot as plt
  import csv

  scale = []
  lescale = []
  cdscale = []

  energy = []
  leenergy = []
  cdenergy = []

  for row in data:
  scale.append(float(row[0]))
  energy.append(float(row[1]))
  if int(row[2]) != 0:
 lescale.append(float(row[0]))
 leenergy.append(float(row[1]))
  if int(row[3]) != 0:
 cdscale.append(float(row[0]))
 cdenergy.append(float(row[1]))

  plt.plot(scale,energy, 'r+')
  plt.plot(lescale,leenergy, 'go')
  plt.plot(cdscale,cdenergy, 'bo')
  plt.xlabel('scale')
  plt.ylabel('energy (Ha)')
  plt.title('Energy vs scale')
  plt.legend()
  plt.savefig(file)
  print ("[[./%s]]" % file)
#+end_src

This is the error:

NameError: name 'file' is not defined

Obviously the syntax on the begin_src line is wrong, but what should it
be instead?

Thanks,
Roger



Re: [O] Output result of source block to a file

2019-06-05 Thread stardiviner


Roger Mason  writes:

> Hello,
>
> I want to output the result of the evaluation of a (python) source block
> to a (graphics) file and have a link to the file inserted in the buffer.

For this, you should try updated header arguments like ":results graphics link"
or ":results file link".

>
> Here is the code:
>
> #+begin_src python :results value file :file scaleplot02.pdf :exports results 
> :var data=test
>   import matplotlib.pyplot as plt
>   import csv
>
>   scale = []
>   lescale = []
>   cdscale = []
>
>   energy = []
>   leenergy = []
>   cdenergy = []
>
>   for row in data:
>   scale.append(float(row[0]))
>   energy.append(float(row[1]))
>   if int(row[2]) != 0:
>lescale.append(float(row[0]))
>leenergy.append(float(row[1]))
>   if int(row[3]) != 0:
>cdscale.append(float(row[0]))
>cdenergy.append(float(row[1]))
>
>   plt.plot(scale,energy, 'r+')
>   plt.plot(lescale,leenergy, 'go')
>   plt.plot(cdscale,cdenergy, 'bo')
>   plt.xlabel('scale')
>   plt.ylabel('energy (Ha)')
>   plt.title('Energy vs scale')
>   plt.legend()
>   plt.savefig(file)
>   print ("[[./%s]]" % file)
> #+end_src
>
> This is the error:
>
> NameError: name 'file' is not defined
>
> Obviously the syntax on the begin_src line is wrong, but what should it
> be instead?
>
> Thanks,
> Roger


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Output result of source block to a file

2019-06-05 Thread Ken Mankoff


On 2019-06-05 at 12:41 +02, Roger Mason  wrote...
> I want to output the result of the evaluation of a (python) source
> block to a (graphics) file and have a link to the file inserted in the
> buffer.
>
> Here is the code:
>
> #+begin_src python :results value file :file scaleplot02.pdf :exports results 
> :var data=test
>   print ("[[./%s]]" % file)
> #+end_src

What about :var file="scaleplot02.pdf".

  -k.




Re: [O] [PATCH] Add :target option for the TOC keyword

2019-06-05 Thread Sacha Chua
Whoops, I'm so sorry - I accidentally used org-make-link-string instead of
org-link-make-string. Tiny patch fixing it attached.

Sacha Chua - sa...@sachachua.com - Blog: sachachua.com - Mobile: +1 416 823
2669


On Fri, May 31, 2019 at 12:30 PM Nicolas Goaziou 
wrote:

> Hello,
>
> Sacha Chua  writes:
>
> > - catch the signal raised by org-export-resolve-fuzzy-link and then
> check for the
> > special case of "local"
> > - always handle :target "local" as a local TOC
> > - or just leave the behaviour as it is. What would you recommend?
>
> The latter is fine.
>
> I applied you patch. Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>
From 265886aedf202cce3cc7ab4f88bab318dd69ca86 Mon Sep 17 00:00:00 2001
From: Sacha Chua 
Date: Wed, 5 Jun 2019 15:17:57 -0400
Subject: [PATCH] org-export-resolve-link: Use org-link-make-string

* lisp/ox.el (org-export-resolve-link): Use org-link-make-string
  instead of org-make-link-string.
---
 lisp/ox.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index e989b37c6..05c8daebc 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4478,7 +4478,7 @@ Return value can be an object or an element:
   (when (stringp link)
 (setq link (with-temp-buffer
 		 (save-excursion
-		   (insert (org-make-link-string link)))
+		   (insert (org-link-make-string link)))
 		 (org-element-link-parser
   (pcase (org-element-property :type link)
 ((or "custom-id" "id") (org-export-resolve-id-link link info))
-- 
2.17.1



Re: [O] Bug: Inaccurate doc-string for org-image-actual-width [9.2.3 (9.2.3-17-g4df705-elpaplus @ /home/yantar92/.emacs.d/elpa/org-plus-contrib-20190513/)]

2019-06-05 Thread Nicolas Goaziou
Hello,

'Ihor Radchenko'  writes:

> The doc-string for org-image-actual-width states that image width can
> be set using #+ATTR.* keyword (note that it is all capital letters).
> However, org-display-inline-images only looks for lower-case #+attr_:
>
> (re-search-forward "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"
>  (org-element-property :post-affiliated paragraph)
>  t)
>
> If case-fold-search is set to 't, and the value of
> org-image-actual-width is set to a list, #+ATTR_ORG: :width
> specifications are always ignored, while they should not.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug report: The link in the CDLaTeX section of the manual (11.5.3) is dead

2019-06-05 Thread Nicolas Goaziou
Hello,

Qqwy/Wiebe-Marten  writes:

> I think the link should be changed to one of:
>
> - https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/ , which seems to be
> the location that the original link was moved to.
>
> - https://github.com/cdominik/cdlatex , which is a repository containing
> the latest version of the library

I chose the former. Thank you.

Regards,

-- 
Nicolas Goaziou