[O] source block name contains "call"

2017-03-17 Thread Skip Collins
I am editing some Perl. When I export any source block that includes
the word "call" in the name, it causes the verbatim formatting to be
dropped. This happens with both html and latex exports. The problem
does not seem to be limited to Perl. A minimal example:

* foo
#+name: call_foo
#+begin_src perl
##  This is a comment
#+end_src

* bar
#+name: bar
#+begin_src perl
##  This is a comment
#+end_src

The code under the first heading is exported as normal org text,
omitting the #+name and #+begin_src lines, but including the #+end_src
line. The second heading is exported as expected, with the source
block properly formatted verbatim. The word "call" seems to be the
trigger for the bad behavior.



Re: [O] parsing of emphasis versus links

2017-03-17 Thread John Kitchin
I can not reproduce all the things you report.

I think part of the problem is [calc:]. I have to have at least two
characters of path to get a link that is colored.

Eric S Fraga writes:

> Hello,
>
> I have been playing with using embedded calc equations in org mode.  I
> have tried filters and with org emphasis markers but finally have come
> around to using the new org link capabilities.  Thank you John for
> these!
>
> I've defined the following:
>
> #+begin_src emacs-lisp
>   (org-link-set-parameters
>"calc"
>:export (lambda (path desc backend)
>  (cond
>   ((eq 'latex backend)
>(format "\\texttt{%s}" desc
>:face '(:foreground "chartreuse"))
> #+end_src
>
> which I then use like this:
>
> #+begin_src org
>   [[calc:][Pv := 10^(6.886 - 1175.817 / (100 + 224.867)) => 1847.653]]
> #+end_src
>
> and with appropriate settings for calc [1], calc can manipulate and
> evaluate the expressions.  So far, so good.
>
> Two minor issues:
>
> 1. the fontification doesn't colour the links in the colour I would like
>(chartreuse, #7fff00).

I get partial chartreuse, but there are some fontlock that can go on
top, e.g. if it looks like a latex fragment.

>
> 2. if I have two expressions close enough, both with := and =>
>operators, org seems to get confused and interprets two of the =
>symbols, each from one expression, as emphasis markers, as in this
>example:
>
>#+begin_src org
>  [[calc:][y := 3 x - 5 => 55]] [[calc:][z := sqrt(y) => 7.416]]
>#+end_src

I can reproduce the issue above, but I have no way to help improve it.
This particular case looks like emphasis from a simple regexp pov.
Fixing it might require checking that the start/end are in the
same org-element maybe.

>
> Screenshot attached showing both problems: colour and second = sign
> disappearing in first link and first = sign in second link.
>
> Any suggestions on how to improve/fix these aspects?  Both are minor
> presentation issues and everything else is working very well.  Calc
> allows me to work with these expressions easily in org now!
>
> Many thanks,
> eric
>
>
> Footnotes:
> [1]  Settings using calc: links:
>
>  #+begin_src emacs-lisp
>(defun esf/org-mode-calc-settings ()
>  (setq calc-embedded-open-formula "\\[\\[calc:]\\["
>calc-embedded-open-new-formula "[[calc:]["
>calc-embedded-close-formula "]]"
>calc-embedded-close-new-formula "]]"))
>(add-hook 'org-mode-hook #'esf/org-mode-calc-settings)
>  #+end_src


--
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] Viewing pdf images

2017-03-17 Thread Doyley, Marvin M.
Doesn’t work. Emacs just Hangs :(
> On Mar 17, 2017, at 8:43 AM, Norwid Behrnd  wrote:
> 
> 
> To include and display pdf files, perhaps the setup outlined here is
> still working (dates back 2014...)
> 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__emacs.stackexchange.com_questions_390_display-2Dpdf-2Dimages-2Din-2Dorg-2Dmode&d=DwIC-g&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=cQ2XAFEKpHWcRH33Hvyanl-V2rE3v-7glys69pwm8CY&s=rmvwv-l1KvLkkUN0iG1d7bT6-MNbzQOFpz5U4-fLPt0&e=
> 
> Cheers.
> 
> 
> 
> On 03/17/2017 01:27 PM, Doyley, Marvin M. wrote:
>> Hi there,
>> 
>> For manuscripts, my research group and I typically save images in pdf
>> format, much better resolution. It would be nice to view pdf  images
>> when working in org-mode. Does anybody know how to view pdf images in
>> org-mode.
>> 
>> Thanks, M
>> 
>> PS We also work with svg images too, that would also love to view in
>> org-mode
>> 



signature.asc
Description: Message signed with OpenPGP using GPGMail


[O] Viewing pdf images

2017-03-17 Thread Doyley, Marvin M.
Hi there,

For manuscripts, my research group and I typically save images in pdf format, 
much better resolution. It would be nice to view pdf  images when working in 
org-mode.
Does anybody know how to view pdf images in org-mode.

Thanks,
M

PS We also work with svg images too, that would also love to view in org-mode


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] ox-epub

2017-03-17 Thread Rasmus
Hi,

Nicolas Goaziou  writes:

> Nowadays, moving a package to contrib/ only makes sense if it is meant
> to ultimately be included in core. Otherwise, GNU ELPA is just as fine.

An exporter is core is much more useful IMO, but I’m a big fan of
batteries included.

> As Rasmus pointed out, documentation is mandatory for inclusion in core.
>
> Also, you need write access on Org repository so as to be able to
> maintain "ox-epub.el" from there.


>>> Are there any technical barriers to continuing development on ox-epub to
>>> me? The legal stuff is not an issue to me.
>>
>> I think you wrote that you are already in the process of assigning
>> copyright for this work to FSF, right?
>>
>>> Do you find the addition worthwile?
>>
>> I do.  Nicloas will probably chim in.
>
> I have not looked at the code, but the idea sounds nice.


At the moment, ox-epub.el still needs to mature a bit, as it behaves a bit
differently from other exporters.  However, Mark seems to have a good
domain knowledge of what an epub is, so hopefully we could make it work.

I think Alan Tyree has agreed to help test it with "real-world" books
later, if necessary.

> However, IIRC, Bastien (Cc'ed) was reluctant to add more export
> back-ends, back when I wanted to move ox-koma-letter to core. He might
> want to have his word on the subject.

AFAIR there's also some issues with the copyright status of
ox-koma-letter.  (I could ping Viktor to hear if anything happened re
this).

Rasmus

-- 
A page of history is worth a volume of logic




Re: [O] [patch, ox-latex] captions and latex-environments

2017-03-17 Thread Rasmus
Hi,

Thanks for the feedback.

Nicolas Goaziou  writes:

>> +(defun org-latex-environment--type (latex-environment)
>
> It should be `org-latex--environment-type'.

Yes.

> I'd rather avoid using `org-latex-regexps', which predates the parser.
> A hard-coded regexp is better.

OK.


>> + (env (progn (string-match latex-begin-re value)
>> + (match-string 2 value
>
> Since environments do not necessary start with \begin{...}, I think the
> following is better
>
>   (and (string-match ...)
>(match-string ...))

Don't the element `latex-environment' always start \begin{.}?
Cf. org-element--latex-begin-environment.

Another danger is that someone writes something like,

\begin{center}
\begin{table}
...

I wouldn’t worry too much about this, though.

>> +(cond
>> + ((string-match org-latex-math-environments-re value) 'math)
>> + ((string-match-p "tab\\(le\\|ular\\)" env) 'table)
>
> This is a bit sloppy. In particular, it doesn't match all table
> environments supported out of the box, e.g., "longtabu". Also, a list of
> strings, compiler into a regexp with `regexp-opt' may be better.

Longtable in an omission, but would have been matched.  For some reason I
thought tabu was no longer supported.  Browsing the tabu CTAN page there’s
links to all sorts of exotic table packages, like "stabular",
"bigtabular", and "supertabular".  I wonder if it’s enough to match the
ones supported by Org by default, or whether it would be better to have it
as a defvar that could be hacked if necessary?

>> +;; is not a math environment.
>>  (with-temp-buffer
>>(insert value)
>> -  (goto-char (point-min))
>> -  (forward-line)
>> -  (insert (org-latex--label latex-environment info nil t))
>> +  (if caption-above-p
>> +  (progn
>> +(goto-char (point-min))
>> +(forward-line)
>> +(insert caption))
>> +(goto-char (point-max))
>> +(forward-line -1)
>> +(insert caption))
>
> Nitpick: you can move (insert caption) outside the (if ...) and
> de-duplicate it.

Good point.  Thanks.

I have attached the patch with the changes again and added a changelog
entry.  I am not sure this needs to be documented, but I’m happy to
include a couple lines somewhere.

Thanks,
Rasmus

-- 
It was you, Jezebel, it was you
>From a3e7dd757a4bcba7dfdd5f54e2e703c1b37ce09a Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Thu, 16 Mar 2017 12:45:10 +0100
Subject: [PATCH] ox-latex: Support caption for latex-environment

* lisp/ox-latex.el (org-latex--environment-type): New function
  determining type of a latex-environment.
  (org-latex-latex-environment): Add support for caption.
  (org-latex--caption/label-string): Use correct type for non-floating
  latex-environments.
* etc/ORG-NEWS: Add entry.
---
 etc/ORG-NEWS |  2 +-
 lisp/ox-latex.el | 77 
 2 files changed, 62 insertions(+), 17 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index f9c1196e5..c3bc60efa 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -183,7 +183,7 @@ user to specify the name of the output file upon exporting the
 document.  This also has an effect on publishing.
  Horizontal rules are no longer ignored in LaTeX table math mode
  Use ~compilation-mode~ for compilation output
-
+ ~latex-environment~ elements support ~caption~ keywords for LaTeX export
 *** ~org-edit-special~ can edit LaTeX environments
 
 Using ~C-c '~ on a LaTeX environment opens a sub-editing buffer.  By
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 2727359cb..0d492e421 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1312,14 +1312,19 @@ For non-floats, see `org-latex--wrap-label'."
  (t
   (format (if nonfloat "\\captionof{%s}%s{%s%s}\n"
 		"\\caption%s%s{%s%s}\n")
-	  (if nonfloat
-		  (cl-case type
-		(paragraph "figure")
-		(src-block (if (plist-get info :latex-listings)
-   "listing"
- "figure"))
-		(t (symbol-name type)))
-		"")
+	  (let ((type* (if (eq type 'latex-environment)
+			   (org-latex--environment-type element)
+			 type)))
+		(if nonfloat
+		(cl-case type*
+		  (paragraph "figure")
+		  (image "figure")
+		  (special-block "figure")
+		  (src-block (if (plist-get info :latex-listings)
+ "listing"
+   "figure"))
+		  (t (symbol-name type*)))
+		  ""))
 	  (if short (format "[%s]" (org-export-data short info)) "")
 	  label
 	  (org-export-data main info))
@@ -2250,24 +2255,64 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 
  Latex Environment
 
+(defun org-latex--environment-type (latex-environment)
+  "Return the TYPE of LATEX-ENVIRONMENT.
+
+The TYPE is determined from the actual latex environment, and
+could be a member of `org-latex-caption-above' or `math'."
+  (let* ((value (org-remove-indentation
+		 (org-element-property :value latex-enviro

Re: [O] query about past scheduled events display in agenda

2017-03-17 Thread Eric S Fraga
On Thursday, 16 Mar 2017 at 20:08, Nicolas Goaziou wrote:
> However, isn't the current behaviour the right one? I meant, in the
> given example, it was scheduled once "yesterday", so it is really the
> second time it is scheduled today, hence the "2x". 
>
> Another way to look at it is by some sloppy analogy to algebra: you
> write "2 \times{} x" but scarcely "1 \times{} x".

Ah, okay, I see the rationale.  For me, it looks strange because I have
changed the leader to say "Overdue %4d d:" and so the number presented
is 1 more than I would expect.

No worries!  At least I understand why it is the way it is.

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.5-378-gf6f02e.dirty


signature.asc
Description: PGP signature


Re: [O] query about past scheduled events display in agenda

2017-03-17 Thread Eric S Fraga
On Friday, 17 Mar 2017 at 07:42, Nicolas Goaziou wrote:
> Hello,
>
> Detlef Steuer  writes:
>
>> Sure, if you read it as 2x scheduled it is correct.
>>
>> I read it as 1x re-scheduled or 1x overdue.
>> But: Just cosmetics. For me the second way looks more natural.
>
> Fair enough. This is now fixed. Thank you.

Thank you!

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.5-378-gf6f02e.dirty


signature.asc
Description: PGP signature


Re: [O] How do you store web pages for reference?

2017-03-17 Thread Alan Schmitt
On 2017-03-16 09:04, Bob Newell  writes:

> Scott Otterson  writes:
>
>> I use Evernote, which has handy annotation, tagging, and search
>
> I use this also, but I wanted something working within Emacs similar to
> the Evernote web-clipper. Org-board is very powerful but requires an
> intermediate step of creating a headline with a URL property.

I have this automated with org-capture and a hook:

#+BEGIN_SRC emacs-lisp
  (setq org-board-capture-file "my-org-board.org")

  (setq org-capture-templates
`(...
  ("c" "capture through org protocol" entry
   (file+headline ,org-board-capture-file "Unsorted")
   "* %?%:description\n:PROPERTIES:\n:URL: %:link\n:END:\n\n Added %U")
  ...))

  (defun do-org-board-dl-hook ()
(when (equal (buffer-name)
 (concat "CAPTURE-" org-board-capture-file))
  (org-board-archive)))

  (add-hook 'org-capture-before-finalize-hook 'do-org-board-dl-hook)
#+END_SRC

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-02: 406.42, 2016-02: 404.04


signature.asc
Description: PGP signature


Re: [O] [ANN] New Org duration library

2017-03-17 Thread Nicolas Goaziou
Hello,

Malcolm Purvis  writes:

>> "Nicolas" == Nicolas Goaziou  writes:
>
> Nicolas> The documentation lists what is allowed. Strings are not. Where
> Nicolas> did you read that they might be? For the record, here are the
> Nicolas> first paragraphs of the docstring:
>
> Nicolas>   The value can be set to, respectively, ‘h:mm:ss’ or ‘h:mm’,
> Nicolas> which means a duration is expressed as, respectively, a
> Nicolas> "H:MM:SS" or "H:MM" string.
>
> I too was confused by this and took the quotes around ‘h:mm:ss’ and
> ‘h:mm’ to mean that they are strings.  Changing the working to be:
>
>The value can be set to, respectively, the symbols ‘h:mm:ss’ or ‘h:mm’,
>
> would clarify the situation.

I made that change. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] org-publish issue

2017-03-17 Thread Nicolas Goaziou
Hello,

Bob Newell  writes:

> Okay, solved, but it does point to a problem. I had misspellings in the
> project names. So this happens:
>
> ("generalweb" :components ("generalimages" "generalother" "generalorg"))
>
> "generalimages" is processed. "generalother" isn't found because of a
> misspelling. But there is no error message and processing stops
> silently, with "generalorg" being skipped.
>
> Perhaps there should at least be an error or warning here?

In master, an error in now raised.

Thank you.


Regards,

-- 
Nicolas Goaziou



Re: [O] query about past scheduled events display in agenda

2017-03-17 Thread Nicolas Goaziou
Hello,

Detlef Steuer  writes:

> Sure, if you read it as 2x scheduled it is correct.
>
> I read it as 1x re-scheduled or 1x overdue.
> But: Just cosmetics. For me the second way looks more natural.

Fair enough. This is now fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] org-bbdb-anniversaries-future

2017-03-17 Thread Nicolas Goaziou
Hello,

Michael Welle  writes:

> *** More specific anniversary descriptions
>
> Anniversary descriptions (used in the agenda view, for instance)
> include the point in time, when the anniversary appears.  This is,
> in its most general form, just the date of the anniversary.  Or
> more specific terms, like "today", "tomorrow" or "in n days" are
> used to describe the time span.
>
> This feature allows to automatically change the description of an
> anniversary, depending on if it occurs in the next few days or
> far away in the future.

Added. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [patch, ox-latex] captions and latex-environments

2017-03-17 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> The patch looks a bit dodgy, maybe because I used magit, which I don’t
> really understand, instead of the shell. I have attached it anew.

Thank you. Some comments follow.

> +(defun org-latex-environment--type (latex-environment)

It should be `org-latex--environment-type'.

> +  "Return the TYPE of LATEX-ENVIRONMENT.
> +
> +The TYPE is determined from the actual latex environment, and
> +could be a member of `org-latex-caption-above' or `math'."
> +  (let* ((value (org-remove-indentation
> +  (org-element-property :value latex-environment)))
> +  (latex-begin-re (cadr (assoc "begin" org-latex-regexps)))

I'd rather avoid using `org-latex-regexps', which predates the parser.
A hard-coded regexp is better.

> +  (env (progn (string-match latex-begin-re value)
> +  (match-string 2 value

Since environments do not necessary start with \begin{...}, I think the
following is better

  (and (string-match ...)
   (match-string ...))

> +(cond
> + ((string-match org-latex-math-environments-re value) 'math)
> + ((string-match-p "tab\\(le\\|ular\\)" env) 'table)

This is a bit sloppy. In particular, it doesn't match all table
environments supported out of the box, e.g., "longtabu". Also, a list of
strings, compiler into a regexp with `regexp-opt' may be better.

>   ;; Environment is labeled: label must be within the environment
>   ;; (otherwise, a reference pointing to that element will count
> - ;; the section instead).
> + ;; the section instead). Also insert caption if `latex-environment'

Missing space after the full stop.

> + ;; is not a math environment.
>   (with-temp-buffer
> (insert value)
> -   (goto-char (point-min))
> -   (forward-line)
> -   (insert (org-latex--label latex-environment info nil t))
> +   (if caption-above-p
> +   (progn
> + (goto-char (point-min))
> + (forward-line)
> + (insert caption))
> + (goto-char (point-max))
> + (forward-line -1)
> + (insert caption))

Nitpick: you can move (insert caption) outside the (if ...) and
de-duplicate it.

Regards,

-- 
Nicolas Goaziou