Re: [O] Force center alignment in LaTeX table export?

2017-03-26 Thread Eric S Fraga
Can you please post an ECM (small example) of the org table with
attributes that you are having problems with?

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.5-385-g72fc2d


signature.asc
Description: PGP signature


[O] Inconsistent behavior in generating file link search strings

2017-03-26 Thread Matt Lundin
I am grabbing a lot of links from plain text files these days and find
that the way in which org generates search strings in file links is
inconsistent. That is, org-capture and org-insert-link behave
differently. 

1. First, org-insert-link truncates the search string. Here are the
steps to reproduce with emacs -Q:

 - Store a link in a plain text file. The value of org-stored-links is:

org-stored-links is a variable defined in ‘org.el’.
Its value is

(("file:~/test.txt::Duis aute irure dolor in\nreprehenderit in voluptate 
velit esse cillum dolore eu fugiat nulla\npariatur." nil))

 - Insert the link in an org buffer using org-insert-link. The resulting
   link looks like this:

   [[file:~/test.txt::Duis%20aute%20irure%20dolor%20in]]

 - This seems to run counter to the advertised behavior in
   org-context-in-file-links, which says the entire region will be
   stored by default.

 - The problem is the regex on line 10333 or org.el:

 (string-match "^file:\\(.+?\\)::\\(.+\\)" link))

2. By contrast, the annotation substitution (%a) in org-capture inserts
the whole search string:

  - Take the following capture template:
   
  (setq org-capture-templates
'(("n" "Note" entry
   (file "~/config/test.org")
   "* Test\n %a\n")))

  - Select the same region in a dummy file as a above and call
org-capture, using the "n" template.

  - The org-capture snippet contains the whole search string, including
new lines:

* Test
 
[[file:~/test.txt::Duis%20aute%20irure%20dolor%20in%0Areprehenderit%20in%20voluptate%20velit%20esse%20cillum%20dolore%20eu%20fugiat%20nulla%0Apariatur.]]
  
I think org-capture (#2) is in keeping with the behavior advertised by
org-context-in-file-links. However, as I will explain in a subsequent
bug report, org-link-search currently fails if the search string
contains new lines, so, in fact, only the one-line search strings
generated by org-insert-link actually work when following links.

Matt



[O] [BUG] org-link-search fails if search string contains new lines

2017-03-26 Thread Matt Lundin
Following links fails to locate the appropriate location in text files
if the search string in the link contains new lines.

Steps to reproduce:

/usr/bin/emacs -Q ~/config/minimal.el

where minimal.el contains...

--8<---cut here---start->8---
(add-to-list 'load-path "~/org-mode/lisp/")
(add-to-list 'load-path "~/org-mode/contrib/lisp/")

(setq org-agenda-files '("~/config/test.org"))

(setq org-capture-templates
  '(("n" "Note" entry
   (file "~/config/test.org")
   "* Test\n %a\n")))
--8<---cut here---end--->8---

Open a file (~/text.txt) containing

--8<---cut here---start->8---
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
--8<---cut here---end--->8---

Create an active region covering the third sentence and select the
org-capture "n" template, which creates the following link:

--8<---cut here---start->8---
* Test
 
[[file:~/test.txt::Duis%20aute%20irure%20dolor%20in%0Areprehenderit%20in%20voluptate%20velit%20esse%20cillum%20dolore%20eu%20fugiat%20nulla%0Apariatur.]]
--8<---cut here---end--->8---

Try to follow the link. It will open test.txt, but it will also give the
message and fail to locate the correct position in the file:

"No match for fuzzy expression: Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur."

For comparison, evaluate (setq org-context-in-file-links 1) and run
capture again. The captured snippet looks like this:

--8<---cut here---start->8---
* Test
 [[file:~/test.txt::Duis%20aute%20irure%20dolor%20in]]
--8<---cut here---end--->8---

Follow the link. The fuzzy search succeeds and finds the correct
position in the text.

Matt



Re: [O] VM for org-based reproducible environment?

2017-03-26 Thread Grant Rettke
On Mon, Jan 23, 2017 at 4:57 PM, Matt Price  wrote:

> Is anyone already doing this? I remember maybe John K. saying something
> along these lines a year or so ago, but can't find the details right away.
>

Not quite yet but it will be Ubuntu, VirtualBox and Packer when I do so it
is easy for every OS that supports vbox.


[O] ox-odt backend use of org-export-async-start

2017-03-26 Thread Mark Meyer
Hi,
I'm presently looking through ox-odt/org-odt-export-to-odt. I uses a
quasiquote to include a parameter in the anonymous function that is then
passed to org-export-async-start. Is there any reason to do this? I
would assume with lexical variables this would be superflouus.

Cheers, Mark
-- 
  Mark Meyer
  m...@ofosos.org



Re: [O] Force center alignment in LaTeX table export?

2017-03-26 Thread Phil Regier
See inline below and attached.  If exporting to PDF the first table gets a
prefix of "ced!10" and the second is the pale red highlight I was wanting.

Here are the important lines in the LaTeX buffer export:

\(\left[\begin{array}{>{\cocumncococ{ced!10}}c|ccc|ccc}

vs.

\(\left[\begin{array}{a|ccc|ccc}

This latter only works because in my header I have

\newcolumntype{a}{>{\columncolor{red!10}}c}




I'm not sure I'm reading the original issue, the patch, or the surrounding
code right, but is it possible the [lr]->c substitution was intended for
the case where no :align was provided by the author and org generated the
alignment automatically?  If so, would it be appropriate to just move the
substitution to the ";; Extract column groups and alignment ..." block in
org-latex--align-string, which is to say the case (if I'm reading
correctly) where the author has not provided an override?

ox-latex.el-3154-(defun org-latex--align-string (table info)
ox-latex.el-3155-  "Return an appropriate LaTeX alignment string.
ox-latex.el-3156-TABLE is the considered table.  INFO is a plist used as
ox-latex.el-3157-a communication channel."
ox-latex.el:3158:  (or (org-export-read-attribute :attr_latex table :align)
ox-latex.el-3159-  (let (align)
ox-latex.el-3160-;; Extract column groups and alignment from first
(non-rule)



Org file to demonstrate problem and workaround:

#+latex_header: \usepackage{xcolor}
#+latex_header: \usepackage{colortbl}

* Non-Working Example
#+ATTR_LaTeX: :mode inline-math :environment array
#+attr_latex: :math-prefix \left[ :math-suffix \right]
#+attr_latex: :align >{\columncolor{red!10}}c|ccc|ccc
| |   | * | * |   |   |
| *   |   |   | * |   |   |
| \hline* |   |   |   | * |   |
| |   |   |   | * | * |


* Working Example
  Just define a column type that doesn't use the characters 'l' or 'r'

#+latex_header: \newcolumntype{a}{>{\columncolor{red!10}}c}

#+ATTR_LaTeX: :mode inline-math :environment array
#+attr_latex: :math-prefix \left[ :math-suffix \right]
#+attr_latex: :align a|ccc|ccc
| |   | * | * |   |   |
| *   |   |   | * |   |   |
| \hline* |   |   |   | * |   |
| |   |   |   | * | * |


On Sun, Mar 26, 2017 at 5:14 AM, Eric S Fraga  wrote:

> Can you please post an ECM (small example) of the org table with
> attributes that you are having problems with?
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.5-385-g72fc2d
>


ecm.org
Description: Lotus Organizer


[O] How to include menu entry in C-x C-e

2017-03-26 Thread Mark Meyer
Hi,
how do I include a menu entry from my module, when people hit C-x C-e?

Cheers, Mark
-- 
  Mark Meyer
  m...@ofosos.org



Re: [O] How to include menu entry in C-x C-e

2017-03-26 Thread John Kitchin
here is an example I have used:

(org-export-define-derived-backend 'cmu-manuscript 'latex
  :menu-entry
  '(?j "Export with ox-manuscript"
   ((?L "As LaTeX buffer" org-latex-export-as-latex)
(?l "As LaTeX file" org-latex-export-to-latex)
(?p "As manuscript PDF file" ox-manuscript-export-and-build)
(?o "As manuscript PDF and open" 
ox-manuscript-export-and-build-and-open)
(?e "As PDF and email" ox-manuscript-export-and-build-and-email)
(?s "As submission manuscript tex"
ox-manuscript-export-submission-manuscript)
(?M "As submission manuscript pdf"
ox-manuscript-build-submission-manuscript)
(?m "As submission manuscript pdf and open"
ox-manuscript-build-submission-manuscript-and-open)
(?c "As manuscript PDF with comments"
ox-manuscript-build-with-comments)
(?a "As submission archive"
  ox-manuscript-make-submission-archive


Mark Meyer writes:

> Hi,
> how do I include a menu entry from my module, when people hit C-x C-e?
>
> Cheers, Mark


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] [BUG] org-link-search fails if search string contains new lines

2017-03-26 Thread Matt Lundin
Matt Lundin  writes:

>
> Create an active region covering the third sentence and select the
> org-capture "n" template, which creates the following link:
>
> * Test
>  
> [[file:~/test.txt::Duis%20aute%20irure%20dolor%20in%0Areprehenderit%20in%20voluptate%20velit%20esse%20cillum%20dolore%20eu%20fugiat%20nulla%0Apariatur.]]
>
> Try to follow the link. It will open test.txt, but it will also give the
> message and fail to locate the correct position in the file:
>
> "No match for fuzzy expression: Duis aute irure dolor in
> reprehenderit in voluptate velit esse cillum dolore eu fugiat
> nulla pariatur."
>

The problem, I think, is the regexp construction in org-link-search.
This was introduced back in August of 2015 with commit
cfe5bc97f8b18ccbf49d0764746c7563ce8d29da.

The problematic line in org.el is 10951:

(s-multi-re (mapconcat #'regexp-quote words "[ \t]+\\(?:\n[ \t]*\\)?"))

The constructed regexp fails because it assumes a newline will be
preceded by whitespace. But often newlines are not preceded by
whitespace.

Is there a reason the following won't work? 

(s-multi-re (mapconcat #'regexp-quote words "[ \t\r\n]+"))

This was the method org-link-search used prior to the commit above. Are
we trying to avoid matching across blank lines? 

Best,
Matt




Re: [O] ox-odt backend use of org-export-async-start

2017-03-26 Thread Nicolas Goaziou
Hello,

Mark Meyer  writes:

> I'm presently looking through ox-odt/org-odt-export-to-odt. I uses a
> quasiquote to include a parameter in the anonymous function that is then
> passed to org-export-async-start. Is there any reason to do this? I
> would assume with lexical variables this would be superflouus.

Simple: `org-export-async-start' was written before lexical binding was
introduced in Org.

Regards,

-- 
Nicolas Goaziou