[O] ox-md: Export links to equations for use with MathJax

2018-02-10 Thread Thibault Marin

Hi list,

Similar to a change introduced recently to ox-html (ba6c0f1ea9), I'd
like to be able to export (in markdown, using ox-md.el) links to LaTeX
equations with "\eqref{org000}" and rely on MathJax for rendering
instead of the default markdown format ("[description][#org000]").

The attached patch is my first attempt at this.  It is almost identical
to the ox-html version.  I have added an option to select which mode to
use (markdown or MathJax).

Could this patch be considered for a merge?  Please let know if there
are any suggestions or comments.

Thanks,

thibault

>From bf03749fe18726f43684d0818a75a2affbe3e546 Mon Sep 17 00:00:00 2001
From: thibault 
Date: Sat, 10 Feb 2018 22:58:35 -0600
Subject: [PATCH] ox-md.el: Add option to export equation links to "\eqref"
 (MathJax)

* lisp/ox-md.el (org-md-link): Export link to LateX equation as
"\eqref" (for use with MathJax) when the new option `:md-link-mathjax'
is non-nil.
(org-export-define-derived-backend 'md): Add new option
`:md-link-mathjax' to control the export of equation links.  Its value
is set to that of the new customization variable `org-md-link-mathjax'.
(org-md-link-mathjax): Add customization variable to enable export to
MathJax "\eqref" (disabled by default).
---
 lisp/ox-md.el | 45 +
 1 file changed, 33 insertions(+), 12 deletions(-)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index e2a000bd0..575499072 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -70,6 +70,17 @@ The %s will be replaced by the footnote reference itself."
   :version "26.1"
   :package-version '(Org . "9.0"))
 
+ Links
+
+(defcustom org-md-link-mathjax nil
+  "Non-nil means process LaTeX equation links for MathJax.
+
+When non-nil, links to LaTeX equations will be exported to \"\\eqref\"."
+
+  :group 'org-export-md
+  :package-version '(Org . "9.2")
+  :type 'boolean)
+
 
 ;;; Define Back-End
 
@@ -111,7 +122,8 @@ The %s will be replaced by the footnote reference itself."
   :options-alist
   '((:md-footnote-format nil nil org-md-footnote-format)
 (:md-footnotes-section nil nil org-md-footnotes-section)
-(:md-headline-style nil nil org-md-headline-style)))
+(:md-headline-style nil nil org-md-headline-style)
+(:md-link-mathjax nil nil org-md-link-mathjax)))
 
 
 ;;; Filters
@@ -419,17 +431,26 @@ a communication channel."
 	(or (org-element-property :CUSTOM_ID destination)
 		(org-export-get-reference destination info
 	  (_
-	   (let ((description
-		  (or (org-string-nw-p contents)
-		  (let ((number (org-export-get-ordinal destination info)))
-			(cond
-			 ((not number) nil)
-			 ((atom number) (number-to-string number))
-			 (t (mapconcat #'number-to-string number ".")))
-	 (when description
-	   (format "[%s](#%s)"
-		   description
-		   (org-export-get-reference destination info
+   (if (and destination
+(plist-get info :md-link-mathjax)
+(eq 'latex-environment (org-element-type destination))
+(eq 'math (org-latex--environment-type destination)))
+   ;; Caption and labels are introduced within LaTeX
+   ;; environment.  Use "eqref" macro to refer to those in
+   ;; the document.
+   (format "\\eqref{%s}"
+   (org-export-get-reference destination info))
+ (let ((description
+(or (org-string-nw-p contents)
+(let ((number (org-export-get-ordinal destination info)))
+  (cond
+   ((not number) nil)
+   ((atom number) (number-to-string number))
+   (t (mapconcat #'number-to-string number ".")))
+   (when description
+ (format "[%s](#%s)"
+ description
+ (org-export-get-reference destination info)
  ((org-export-inline-image-p link org-html-inline-image-rules)
   (let ((path (let ((raw-path (org-element-property :path link)))
 		(cond ((not (equal "file" type)) (concat type ":" raw-path))
-- 
2.15.1



[O] Two ob-lua versions

2018-02-10 Thread Thibault Marin

Hi maintainers,

I noticed that a recent change added an ob-lua.el file to contrib/lisp/.
Since there is already an ob-lua.el in lisp/, I was wondering if the new
version was adding functionality not supported by the one in lisp/ (it
does not seem to be the case on casual inspection) and if so, whether
they could/should be merged.

Thanks,

thibault



Re: [O] Smart archiving of subtrees with parent headlines

2018-02-10 Thread Eric S Fraga
On Friday,  9 Feb 2018 at 11:42, Mark Edgington wrote:

[...]

> So the basic operation I'm seeking is the ability to archive a subtree
> to whatever target location is specified with #+ARCHIVE (or
> org-archive-location) where (1) the full path of the archived subtree
> is mirrored beneath that target location, and (2) the subtree will be
> merged into an existing path under the target if an appropriate path
> already exists (e.g. a path consisting of all of the subtree's parent
> headlines, regardless of the content of the bodies of these
> headlines).

+1

I've wanted this (specifically (1)) like forever...

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-118-g134243


signature.asc
Description: PGP signature


Re: [O] [Bug] M-S Ret keybinding translated to M-Ret

2018-02-10 Thread Nicolas Goaziou
Hello,

Matt Lundin  writes:

> Attached please find a more limited patch that fixes the issue in the
> GUI without affecting TTY use. I have only changed bindings for the
> M-S-RET or S-RET combinations. These combinations cannot be used in the
> TTY anyway and Org Mode already defines alternative TTY bindings for
> these combinations.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] Fix alphabetic sorting for headlines, tags

2018-02-10 Thread Nicolas Goaziou
Hello,

Sebastian Reuße  writes:

> * org.el (org-sort-entries): Use collated sorting.
> (org-tags-sort-function): Use collated sorting.
> (org-string-collate-greaterp): Add helper-function to use as defcustom
> option, since there is no ‘string-collate-greaterp’ in Emacs.

Thank you.

However, Org 9.X still supports Emacs 24, so we cannot use
`string-collate-lessp without degrading gracefully to `string-lessp' in
these Emacsen.

We could add `org-string-collate-lessp' to "org-compat.el", which would
be an alias for `string-collate-lessp' on Emacs 25+ and to
`string-lessp' otherwise.

> +(defun org-string-collate-greaterp (s1 s2  locale ignore-case)
> +  "Return t if S1 is greater than S2 in collation order.

Return non-nil if...

We would also need tests for that feature.

WDYT?

Regards,

-- 
Nicolas Goaziou



Re: [O] Column View of logbook data

2018-02-10 Thread Nicolas Goaziou
Hello,

Russell Adams  writes:

> I'm tinkering with using column view to store invoice data.
>
> I have an example where a heading is used for an invoice, and I have several
> todo states: TODO, SENT, PAID.
>
> I have logbook enabled, so I record when the transition occurred from TODO to
> SENT to PAID.
>
> In column view, is there a way I can see that logbook data?

You may want to tweak `org-columns-summary-types', in particular COLLECT
part. This is in master only.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Broken orgmode.org links in doc/misc/org.texi and lisp/org

2018-02-10 Thread Nicolas Goaziou
Hello,

Tim Landscheidt  writes:

> I may be biased here because I did not find that :-), but
> that page is referenced in the org-mode repository only in
> README_maintainer with the context:

[...]

> Especially, it is not linked to from README_contribute :-).

Would you want to provide a patch to README_contribute?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] is ascii link format canonical? can it be made more linkifiable?

2018-02-10 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> recent maint.
>
> org-ascii-links-to-notes is t.
>
> i am exporting bare links that look in the source like
>
>   http://whatever.com
>
> 1] seemingly, notes are not created.

This is expected. You wouldn't want to create an empty note, would you?

> actually i don't mind this, because i don't want notes in this case.
>
> 2] the links get exported like
>
>   [http://whatever.com]
>
> i get the same result if i export source that looks like
>
>   
>
> or
>
>   [[http://whatever.com]]
>
> i do not know the standard, but i think that some email clients will
> not linkify this because of the brackets.  are we sure that [] are
> canonical?  not <>?  is it the clients that are wrong?
>
> can this be customized so that the link can be exported totally bare
> without any bracket-like characters for maximum client linkification?

I changed it in master. Now, external links are wrapped within angle
brackets. Please let me know if it fixes the issue.

Regards,

-- 
Nicolas Goaziou



Re: [O] What's the canonical way to pass information within an Org exporter?

2018-02-10 Thread Kaushal Modi
On Thu, Feb 8, 2018, 11:45 PM Yasushi SHOJI  wrote:

>
> Some exporter does `plist-put`.
> Is that what you are looking for?


Hello Yashi,

I have used plist-put before, but I am not sure it if it sets the plist
values by reference.  What I want is to set a plist value in one function,
and retrieve it in another.

That said, I haven't tried plist put/get across functions.. I'll try that
out.


-- 

Kaushal Modi


Re: [O] is ascii link format canonical? can it be made more linkifiable?

2018-02-10 Thread Samuel Wales
On 2/10/18, Nicolas Goaziou  wrote:
>> 1] seemingly, notes are not created.
>
> This is expected. You wouldn't want to create an empty note, would you?

i think it is ok to not make notes.  you could in principle make numbered notes.

>> can this be customized so that the link can be exported totally bare
>> without any bracket-like characters for maximum client linkification?
>
> I changed it in master. Now, external links are wrapped within angle
> brackets. Please let me know if it fixes the issue.

after i posted, i remembered that some sites, including blogger or
wordpress, will not linkify  in their comments, but will
linkify bare links [and who knows what else].

so i'm thinking the ability to specify the brackets would be useful.

what i would do, in fact, is specify them as spaces.  i'd rather have
ugly clickability than beautiful non-clickability.  especially for
non-technical users.

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