Re: [O] %( in capture template

2017-03-16 Thread Samuel Wales
On 3/14/17, Nicolas Goaziou  wrote:
> Thank you. I think it is fixed, now. Could you test maint branch and
> report your result?

it seems to work so far.  thank you.

btw, the org-capture firefox extension is behaving more reliably also,
with recent firefox-esr.  it has been many years since i tried to get
protocol to work.

this matters because i very often only use the mouse.

-- 
The Kafka Pandemic: 

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

The NIH, FDA, and CDC are not there for you.  Not without activism.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
.



[O] parsing of emphasis versus links

2017-03-16 Thread Eric S Fraga
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).

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

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 

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org 
release_9.0.5-370-g9f3a02.dirty


signature.asc
Description: PGP signature


[O] doneifying with repeat-to but without a timestamp

2017-03-16 Thread Samuel Wales
this is probably a silly idea, but i keep doneifying a task meant for
clocking, instead of clocking out.

it occurred to me that the feature of "return todo kw to its state"
could in principle be independent of timestamps.

thus, you could doneify to log, or to clock out.  this would use a
doneify-to property.

-- 
The Kafka Pandemic: 

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
.



Re: [O] Subject: Use of date trees in Capture has been modified

2017-03-16 Thread Eric S Fraga
On Thursday, 16 Mar 2017 at 10:10, Carsten Dominik wrote:
> Hi Eric,

[...]

> This case turns into
>
> ("d" "diary" entry
>(file+olp+datetree "~/s/notes/diary.org")
>"* %^{Appointment} %^G\n%^{Date + time}T"
>:immediate-finish t)
>
> so you only need to change the symbol from file+datetree to file+olp+datetree

Thanks!  Nice and simple.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org 
release_9.0.5-370-g9f3a02.dirty


signature.asc
Description: PGP signature


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

2017-03-16 Thread Samuel Wales
i think in terms of days since the date that would be its most recent
appearance.

thus, if yesterday would be its most recent appearance, then it would be 1.

this is consistent with code i have that marks timestamps with the
number of days since the timestamp, with 0 being today.

but yeah, borderline bikeshedding or cosmetic.  :]

-- 
The Kafka Pandemic: 

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

The NIH, FDA, and CDC are not there for you.  Not without activism.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
.



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

2017-03-16 Thread Detlef Steuer
Am Thu, 16 Mar 2017 21:08:43 +0100
schrieb Nicolas Goaziou :

> Hello,
> 
> Eric S Fraga  writes:
> 
> > On Thursday, 16 Mar 2017 at 13:45, Detlef Steuer wrote:
> >
> > [...]
> >  
> >> I have a +2 for "something" scheduled for yesterday.
> >> Org git from the morning.  
> >
> > Thanks for confirming.  Mine was with yesterday's version of org.
> >
> > Nicolas, I think you may have been thinking of a different issue
> > entirely.  
> 
> Indeed. 
> 
> 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".
>

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.

Regards
Detlef


> Regards,
> 






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

2017-03-16 Thread Eric Abrahamsen
Nicolas Goaziou  writes:

> Hello,
>
> Eric S Fraga  writes:
>
>> On Thursday, 16 Mar 2017 at 13:45, Detlef Steuer wrote:
>>
>> [...]
>>
>>> I have a +2 for "something" scheduled for yesterday.
>>> Org git from the morning.
>>
>> Thanks for confirming.  Mine was with yesterday's version of org.
>>
>> Nicolas, I think you may have been thinking of a different issue
>> entirely.
>
> Indeed. 
>
> 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".

I think people are thinking of it as "number of days I've failed to
complete my scheduled item".




Re: [O] Writing exams

2017-03-16 Thread Uwe Brauer
>>> "Thomas" == Thomas Hunter  writes:

   > Funnilly enough, I am grading an exam written in org-mode right now.  I use
   > the exam class from the ctan archives and set org-latex-classes to have an
   > entry that looks like this:
   > [...]

   > I can send a copy of the orgfile or the produced pdf to any interested
   > parties.  (It seems like maybe attaching files of any size to an email to
   > this list is maybe not good etiquette, but I am a first time poster, so
   > what do I know?)

Could you please send me also, privately, your org file? I use the exam
class in latex but would like to give it a try using orgmode.

Thanks

Uwe Brauer 




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

2017-03-16 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> On Thursday, 16 Mar 2017 at 13:45, Detlef Steuer wrote:
>
> [...]
>
>> I have a +2 for "something" scheduled for yesterday.
>> Org git from the morning.
>
> Thanks for confirming.  Mine was with yesterday's version of org.
>
> Nicolas, I think you may have been thinking of a different issue
> entirely.

Indeed. 

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".

Regards,

-- 
Nicolas Goaziou



Re: [O] ox-epub

2017-03-16 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> Mark Meyer  writes:
>
>> I'm the author of ox-epub, which is a very recent extension to org-mode
>> to author EPUB files directly via the org export layer.
>
> Thanks.  People have asked about direct epub exporting in the past.
>
>> Pank (Rasmus) asked on Github, whether this could be part of org-mode.
>> I'm all for it. I gather this would be added to the lisp/contrib directory?
>
> Perhaps it could start in "contrib" until you, and others, are comfortable
> with the quality of the code.  On the other hand, it might get more
> testing if added directly to "lisp".
>
> One thing that’d need to add in due course in documentation in the
> manual.

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.

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.

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.

Thank you for sharing your work.


Regards,

-- 
Nicolas Goaziou



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

2017-03-16 Thread Eric S Fraga
On Thursday, 16 Mar 2017 at 13:45, Detlef Steuer wrote:

[...]

> I have a +2 for "something" scheduled for yesterday.
> Org git from the morning.

Thanks for confirming.  Mine was with yesterday's version of org.

Nicolas, I think you may have been thinking of a different issue
entirely.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org 
release_9.0.5-370-g9f3a02.dirty


signature.asc
Description: PGP signature


Re: [O] [BUG] Inserting new heading

2017-03-16 Thread Rick Frankel
On Thu, Mar 16, 2017 at 01:03:18PM +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Rick Frankel  writes:
> 
> > There is a bug w/ inserting new headings after a collapsed heading (w/
> > C-return, org-insert-heading-respect-content) if the last content under the
> > heading (or a subhead) is a RESULTS: block. This occurs w/ the value of
> > org-blank-before-new-entry as either '(heading . auto) or '(heading . nil).
> >
> > This started a few months ago, but I just figured out what actually causes 
> > the
> > behavior.

> Fixed. I couldn't reproduce it on maint tho, so the commit landed on
> master branch.

Confirmed in master. Not suprised it wasn't in maint, it's a fairly recent bug.

thanx,
rick



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

2017-03-16 Thread Bob Newell
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 wanted something fast, so I wrote an org-mode web clipper. It works
with both w3m and eww, making use of an org-capture template and a
little custom code. Images are captured if you've set up w3m or eww to
display them. CSS, etc, is obviously not captured.

I've put it here if it's of any interest to anyone. It's pretty much a
prototype but I use it daily. Emacs 25 required.

http://www.bobnewell.net/publish/35years/webclipper.html

-- 
Bob Newell
Honolulu, Hawai`i
* Via Gnus/BBDB/Org/Emacs/Linux *



Re: [O] ORG-NEWS

2017-03-16 Thread Colin Baxter
Dear Eduardo

On Thu, Mar 16 2017, Eduardo Bellani wrote:

> Are you running linum-mode? It is a source of slowness
> Colin Baxter writes:
>
>> At present, etc/ORG-NEWS is over 4000 lines long and "org-intensive". I
>> find navigating the file to be slow and cumbersome. I suggest it be slit
>> in two, or even in to org versions.  What do others think?

Exactly! Thank you very much for the answer. I should have realised that
linum was the issue since I had the same problem with docview a while
back.

Best wishes,

Colin.



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

2017-03-16 Thread Detlef Steuer
Am Thu, 16 Mar 2017 13:05:42 +0100
schrieb Nicolas Goaziou :

> Hello,
> 
> Eric S Fraga  writes:
> 
> > Something has been bothering me (in an æsthetic way) for some
> > time.  When an event scheduled for the day before is displayed in
> > the default agenda view, it displays the days overdue as "2" which
> > seems wrong to me.  I wonder if somebody can give me the
> > justification for this?
> >
> > The code in question, with my own change to fix this to display "1"
> > day overdue in such cases, is:
> >
> > @@ -6214,7 +6214,7 @@ scheduled items with an hour specification
> > like [h]h:mm." (pcase-let ((`(,first ,past)
> > org-agenda-scheduled-leaders)) ;; Show a reminder of a past
> > scheduled today. (if (and todayp pastschedp)
> > -  (format past (1+ diff))
> > +  (format past diff)
> >  first))
> >  head level category tags time nil habitp))
> >(face (cond ((and (not habitp) pastschedp)  
> 
> I cannot reproduce it on maint nor on master. Wasn't that fixed some
> time ago?

I have a +2 for "something" scheduled for yesterday.
Org git from the morning.

Org mode version 9.0.5 (release_9.0.5-370-g9f3a02

--snippet from *Org Agenda*
WMA:Sched. 2x:  TODO something
--

--snippet from my org-file
 TODO something
 SCHEDULED: <2017-03-15 Mi>
--

Just as a data point. 

And a +1 to change this to 1x :-)

Detlef


> 
> Regards,
> 



-- 

"Wisely and slow. Those stumble that run fast."
Shakespeare -- Romeo and Juliet

Dr. Detlef Steuer
Helmut-Schmidt-Universität
Fakultät WiSo
Holstenhofweg 85
22043 Hamburg

Tel:  040/6541-2819
mail: ste...@hsu-hh.de





[O] ORG-NEWS

2017-03-16 Thread Colin Baxter

At present, etc/ORG-NEWS is over 4000 lines long and "org-intensive". I
find navigating the file to be slow and cumbersome. I suggest it be slit
in two, or even in to org versions.  What do others think?




Re: [O] ORG-NEWS

2017-03-16 Thread Eduardo Bellani
Are you running linum-mode? It is a source of slowness
Colin Baxter writes:

> At present, etc/ORG-NEWS is over 4000 lines long and "org-intensive". I
> find navigating the file to be slow and cumbersome. I suggest it be slit
> in two, or even in to org versions.  What do others think?



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

2017-03-16 Thread Rasmus
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.

-- 
This message is brought to you by the department of redundant departments
>From 4304552a0c8a72c6aeb2805a8cf703eddb5da123 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.
---
 lisp/ox-latex.el | 78 
 1 file changed, 62 insertions(+), 16 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 2727359cb..f226dc7ae 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,65 @@ 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-environment)))
+	 (latex-begin-re (cadr (assoc "begin" org-latex-regexps)))
+	 (env (progn (string-match latex-begin-re value)
+		 (match-string 2 value
+(cond
+ ((string-match org-latex-math-environments-re value) 'math)
+ ((string-match-p "tab\\(le\\|ular\\)" env) 'table)
+ ((string-match-p "figure" env) 'image)
+ ;; Default coding environments
+ ((or (string-match-p "\\(\\(lst\\)?listing\\|verbatim\\|minted\\)" env)
+	  (string-match-p
+	   (regexp-opt
+	(mapcar (lambda (str)
+		  (let ((s (cadr str)))
+			(if (string-match latex-begin-re s)
+			(match-string 2 s)
+			  s)))
+		org-latex-custom-lang-environments))
+	   env))
+  'src-block)
+ (t 'special-block
+
 (defun org-latex-latex-environment (latex-environment _contents info)
   "Transcode a LATEX-ENVIRONMENT element from Org to LaTeX.
 CONTENTS is nil.  INFO is a plist holding contextual information."
   (when (plist-get info :with-latex)
-(let ((value (org-remove-indentation
-		  (org-element-property :value latex-environment
-  (if (not (org-element-property :name latex-environment)) value
+(let* ((value (org-remove-indentation
+		   (org-element-property :value latex-environment)))
+	   (type (org-latex-environment--type latex-environment))
+	   (caption (if (eq type 'math)
+			(org-latex--label latex-environment info nil t)
+		  (org-latex--caption/label-string latex-environment info)))
+	   (caption-above-p
+	(memq type (append (plist-get info :latex-caption-above) '(math)
+  (if (not (or (org-element-property :name latex-environment)
+		   (org-element-property :caption latex-environment)))
+	  value
 	;; 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'
+	;; 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))
 	  (buffer-string))
 
-
  Latex Fragment
 
 (defun org-latex-latex-fragment (latex-fragment _contents _info)
-- 
2.12.0



Re: [O] [PATCH] Fix custom timestamps during export (ox-groff)

2017-03-16 Thread Nicolas Goaziou
Hello,

Robert Klein  writes:

> this patch updates ox-groff.el in contrig to use the
> org-timestamp-translate function instead of the non-existing
> org-translate-time.
>
> Best regards
> Robert
>
> From 632764856ecbc0f6a733d3d919f4904c6465605c Mon Sep 17 00:00:00 2001
> From: Robert Klein 
> Date: Mon, 13 Mar 2017 07:29:27 +0100
> Subject: [PATCH] Fix custom timestamps during export (ox-groff)
>
> * contrib/lisp/ox-groff.el (org-groff-clock, org-groff-planning): Use
>   org-translate-time'.
>
> (propagate changes introduced to other export backends in commit
> e1adb17ba509a43e9a03a5b367a98b8bc8de8b02.)

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou



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

2017-03-16 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> Something has been bothering me (in an æsthetic way) for some
> time.  When an event scheduled for the day before is displayed in the
> default agenda view, it displays the days overdue as "2" which seems
> wrong to me.  I wonder if somebody can give me the justification for
> this?
>
> The code in question, with my own change to fix this to display "1" day
> overdue in such cases, is:
>
> @@ -6214,7 +6214,7 @@ scheduled items with an hour specification like 
> [h]h:mm."
>(pcase-let ((`(,first ,past) org-agenda-scheduled-leaders))
>  ;; Show a reminder of a past scheduled today.
>  (if (and todayp pastschedp)
> -(format past (1+ diff))
> +(format past diff)
>first))
>head level category tags time nil habitp))
>  (face (cond ((and (not habitp) pastschedp)

I cannot reproduce it on maint nor on master. Wasn't that fixed some
time ago?

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: http://orgmode.org/worg/org-configs/org-hooks.php 404 [9.0.5 (release_9.0.5-347-g2f4860 @ /Users/xcy/src/org-mode/lisp/)]

2017-03-16 Thread Nicolas Goaziou
Hello,

Chunyang Xu  writes:

> The URL  is mentioned
> at (info "(org) Hooks"), when I open it in web browser, it says "404 Not
> Found"

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] Inserting new heading

2017-03-16 Thread Nicolas Goaziou
Hello,

Rick Frankel  writes:

> There is a bug w/ inserting new headings after a collapsed heading (w/
> C-return, org-insert-heading-respect-content) if the last content under the
> heading (or a subhead) is a RESULTS: block. This occurs w/ the value of
> org-blank-before-new-entry as either '(heading . auto) or '(heading . nil).
>
> This started a few months ago, but I just figured out what actually causes the
> behavior.
>
>
> Given the following org file:
>
> --
> * C-return tests
> ** Results w/ ending blank line removed
>
> #+BEGIN_SRC sh
> echo 'foo'
> #+END_SRC
>
>
> #+RESULTS: : foo ** Results w/ ending blank line
>
> #+BEGIN_SRC sh
> echo 'foo'
> #+END_SRC
>
> #+RESULTS:
> : foo
>
> ** A heading
> --
>
> Steps to reproduce:
>
>   For "Correct" (expected) results:
> 1. Collapse all the headings.
> 2. Place the cursor On the line "Results w/ ending blank line removed".
> 3. Hit  (org-insert-heading-respect-content)
>
> A new heading is inserted just before the following heading.
>
>   For "Incorrect" results:
> 1. Collapse all the headings.
> 2. Place the cursor On the line "Results w/ ending blank line".
> 3. Hit  (org-insert-heading-respect-content)
>
> The new heading characters ('**') are appended to the end of the result
> block (the end of the heading line after the '...')
>
> BTW, if the heading containing the source block is expanded it works
> correctly.

Fixed. I couldn't reproduce it on maint tho, so the commit landed on
master branch.

Thank you.

Regards,

-- 
Nicolas Goaziou



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

2017-03-16 Thread Rasmus
Hi,

I often generate tables directly from R.  At the moment, I have to do
something like the following because org-latex-latex-environment doesn’t
support captions.

#+name: tbl:1
#+caption: cap
#+begin_table
#+begin_center
#+include: "tbl.tex"
#+end_center
#+end_table

This is a bit too verbose IMO.
With the attached patch this can be cut down to,

#+name: tbl:1
#+caption: cap
#+include: "tbl.tex"

It should respect ‘org-latex-custom-lang-environments’ and
‘org-latex-caption-above’...

Would this be an appropriate change or is it too hackish?  I have not
looked at other backends, but I suspect this is mostly a latex thing.

Thanks,
Rasmus

-- 
When in doubt, do it!
>From 4304552a0c8a72c6aeb2805a8cf703eddb5da123 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.
---
 lisp/ox-latex.el | 78 
 1 file changed, 62 insertions(+), 16 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 2727359cb..f226dc7ae 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,65 @@ 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-environment)))
+	 (latex-begin-re (cadr (assoc "begin" org-latex-regexps)))
+	 (env (progn (string-match latex-begin-re value)
+		 (match-string 2 value
+(cond
+ ((string-match org-latex-math-environments-re value) 'math)
+ ((string-match-p "tab\\(le\\|ular\\)" env) 'table)
+ ((string-match-p "figure" env) 'image)
+ ;; Default coding environments
+ ((or (string-match-p "\\(\\(lst\\)?listing\\|verbatim\\|minted\\)" env)
+	  (string-match-p
+	   (regexp-opt
+	(mapcar (lambda (str)
+		  (let ((s (cadr str)))
+			(if (string-match latex-begin-re s)
+			(match-string 2 s)
+			  s)))
+		org-latex-custom-lang-environments))
+	   env))
+  'src-block)
+ (t 'special-block
+
 (defun org-latex-latex-environment (latex-environment _contents info)
   "Transcode a LATEX-ENVIRONMENT element from Org to LaTeX.
 CONTENTS is nil.  INFO is a plist holding contextual information."
   (when (plist-get info :with-latex)
-(let ((value (org-remove-indentation
-		  (org-element-property :value latex-environment
-  (if (not (org-element-property :name latex-environment)) value
+(let* ((value (org-remove-indentation
+		   (org-element-property :value latex-environment)))
+	   (type (org-latex-environment--type latex-environment))
+	   (caption (if (eq type 'math)
+			(org-latex--label latex-environment info nil t)
+		  (org-latex--caption/label-string latex-environment info)))
+	   (caption-above-p
+	(memq type (append (plist-get info :latex-caption-above) '(math)
+  (if (not (or (org-element-property :name latex-environment)
+		   (org-element-property :caption latex-environment)))
+	  value
 	;; 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'
+	;; 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 

Re: [O] ORG-NEWS

2017-03-16 Thread Nicolas Goaziou
Hello,

Colin Baxter  writes:

> At present, etc/ORG-NEWS is over 4000 lines long and "org-intensive". I
> find navigating the file to be slow and cumbersome. I suggest it be slit
> in two, or even in to org versions.  What do others think?

I think we should first try to find the slow parts and fix them.

Could you send a profiler report?

Regards,

-- 
Nicolas Goaziou



Re: [O] Subject: Use of date trees in Capture has been modified

2017-03-16 Thread Carsten Dominik
Hi Alan,

the change is not formally a breaking change, because everything will
continue to work as before.

But yes, such changes are usually documented.

Carsten

On Thu, Mar 16, 2017 at 9:34 AM, Alan Schmitt <
alan.schm...@polytechnique.org> wrote:

> Hello Carsten,
>
> On 2017-03-16 08:55, Carsten Dominik  writes:
>
> > I have just pushed (to master) a patch that modifies the use
> > of date trees in capture templates. If you don't use them,
> > no need to read on.
>
> I can't update till this reaches maint (which I use), but I'll probably
> forget by then. I assume this change will be in NEWS, but is there a
> place where breaking changes are summarized for each release ?
>
> Thanks,
>
> Alan
>
> --
> OpenPGP Key ID : 040D0A3B4ED2E5C7
> Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-02: 406.42, 2016-02: 404.04
>


Re: [O] Subject: Use of date trees in Capture has been modified

2017-03-16 Thread Carsten Dominik
Hi Eric,



On Thu, Mar 16, 2017 at 10:39 AM, Eric S Fraga  wrote:

> On Thursday, 16 Mar 2017 at 07:55, Carsten Dominik wrote:
> > Dear all,
> >
> > I have just pushed (to master) a patch that modifies the use
> > of date trees in capture templates.
>
> [...]
>
> > For the time being, the old targets will be automatically translated
> > and used correctly. When you use customize to change
> > org-capture-templates, things will automatically be updated next time
> > you change the variable.  The recommendation is to go and update your
> > templates, in case at some time in the future, we might remove the
> > compatibility layer.
>
> Carsten,
>
> would you please post an example of the new format for those that don't
> use customize for capture templates?  An example equivalent to the
> current behaviour would be welcome.
>
> For instance, my current diary appointment capture entry looks like this:
>
>  ("d" "diary" entry
>(file+datetree "~/s/notes/diary.org")
>"* %^{Appointment} %^G\n%^{Date + time}T"
>:immediate-finish t)
>

This case turns into

("d" "diary" entry
   (file+olp+datetree "~/s/notes/diary.org")
   "* %^{Appointment} %^G\n%^{Date + time}T"
   :immediate-finish t)

so you only need to change the symbol from file+datetree to
file+olp+datetree

If you were using a week tree, the symbol you'd still use file+olp+datetree
but also set the property

:tree-type week

If you are using one of the +prompt version, you would instead set the
property

   :time-prompt t

That is all.

If you want to specify an outline path, these are just additional strings
after the file name, for example

("d" "diary" entry
   (file+olp+datetree "~/s/notes/diary.org" "Heading 1" "Subheading"
"subsubheading")
   "* %^{Appointment} %^G\n%^{Date + time}T"
   :immediate-finish t)

Does that answer your question?

Carsten


Re: [O] Subject: Use of date trees in Capture has been modified

2017-03-16 Thread Eric S Fraga
On Thursday, 16 Mar 2017 at 07:55, Carsten Dominik wrote:
> Dear all,
>
> I have just pushed (to master) a patch that modifies the use
> of date trees in capture templates.  

[...]

> For the time being, the old targets will be automatically translated
> and used correctly. When you use customize to change
> org-capture-templates, things will automatically be updated next time
> you change the variable.  The recommendation is to go and update your
> templates, in case at some time in the future, we might remove the
> compatibility layer.

Carsten,

would you please post an example of the new format for those that don't
use customize for capture templates?  An example equivalent to the
current behaviour would be welcome.

For instance, my current diary appointment capture entry looks like this:

 ("d" "diary" entry
   (file+datetree "~/s/notes/diary.org")
   "* %^{Appointment} %^G\n%^{Date + time}T"
   :immediate-finish t)

Thanks,
eric

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


signature.asc
Description: PGP signature


[O] query about past scheduled events display in agenda

2017-03-16 Thread Eric S Fraga
Something has been bothering me (in an æsthetic way) for some
time.  When an event scheduled for the day before is displayed in the
default agenda view, it displays the days overdue as "2" which seems
wrong to me.  I wonder if somebody can give me the justification for
this?

The code in question, with my own change to fix this to display "1" day
overdue in such cases, is:

--8<---cut here---start->8---
@@ -6214,7 +6214,7 @@ scheduled items with an hour specification like [h]h:mm."
 (pcase-let ((`(,first ,past) org-agenda-scheduled-leaders))
   ;; Show a reminder of a past scheduled today.
   (if (and todayp pastschedp)
-  (format past (1+ diff))
+  (format past diff)
 first))
 head level category tags time nil habitp))
   (face (cond ((and (not habitp) pastschedp)
--8<---cut here---end--->8---

thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org 
release_9.0.5-370-g9f3a02.dirty


signature.asc
Description: PGP signature


Re: [O] Subject: Use of date trees in Capture has been modified

2017-03-16 Thread Alan Schmitt
Hello Carsten,

On 2017-03-16 08:55, Carsten Dominik  writes:

> I have just pushed (to master) a patch that modifies the use 
> of date trees in capture templates. If you don't use them,
> no need to read on.

I can't update till this reaches maint (which I use), but I'll probably
forget by then. I assume this change will be in NEWS, but is there a
place where breaking changes are summarized for each release ?

Thanks,

Alan

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


signature.asc
Description: PGP signature


[O] Subject: Use of date trees in Capture has been modified

2017-03-16 Thread Carsten Dominik
Dear all,

I have just pushed (to master) a patch that modifies the use
of date trees in capture templates.  If you don't use them,
no need to read on.

We used to have 4 different capture targets that work with date trees:
file+datetree, file+datetree+prompt, file+weektree,
file+weektree+promt.
All these are now consolidated to a single new target,
file+olp+datetree, which also allows for the optional specification of
an outline-path to build the tree under a specific headline instead of
at top level in the target file.  In this way, you can have several
date trees in a file.  The type of tree (month or iso-week) is now
controlled with a property :tree-type, the option to force a
date/time prompt is controlled by the property :time-prompt.

For the time being, the old targets will be automatically translated
and used correctly. When you use customize to change
org-capture-templates, things will automatically be updated next time
you change the variable.  The recommendation is to go and update your
templates, in case at some time in the future, we might remove the
compatibility layer.

Let me know if any issues arise.

Carsten