Re: org-babel-load-file support elisp

2020-02-12 Thread Troy Hinckley
Wow. Thanks for the quick resolution!
On Feb 12, 2020, 2:42 PM -0700, Bastien , wrote:
> Hi Troy,
>
> Troy Hinckley  writes:
>
> > I tracked down an issue trying to load a literate config file.
> > org-babel-load-file calls org-babel-tangle-file with lang set to
> > "emacs-lisp". This means that it won't tangle any blocks with
> > language set to "elisp", which is equivalent.
>
> This is now fixed in master, will be in Org 9.4.
>
> --
> Bastien


Re: org-babel-load-file support elisp

2020-02-12 Thread Bastien
Hi Troy,

Troy Hinckley  writes:

> I tracked down an issue trying to load a literate config file.
> org-babel-load-file calls org-babel-tangle-file with lang set to
> "emacs-lisp". This means that it won't tangle any blocks with
> language set to "elisp", which is equivalent.

This is now fixed in master, will be in Org 9.4.

-- 
 Bastien



Re: org-babel-load-file support elisp

2020-02-10 Thread Norman Tovey-Walsh
>> The problem now is that removing support for 'elisp' would break too
>> much.
>
> What I suggest for this particular issue is this: first be liberal
> while staying consistent (thus allowing "elisp" as Troy suggest),
> then be strict when a major release is issued (thus removing aliases
> that are problematic, not just "elisp" but others.)
>
> WDYT?  Troy, would you be able to prepare a patch for this?

My 2¢ from the peanut gallery.

Generally speaking, I’m in favor of consistency. A couple of months ago,
I stumbled over the fact that ‘elisp’ seemed to do syntax highlighting
correctly but didn’t tangle. I didn’t, at the time, work out the cause
of the problem, I just learned to use ‘emacs-lisp’ as the language name.

Looking at this thread, it seems like there are a bunch of exceptions to
the rule that the language is be the name of the mode without ‘-mode’.

Just off the top of my head, I can think of several languages supported
by multiple modes. If the rule is that the language is the mode name,
then if I use ‘extra-special-language-mode’ to edit ‘language’, do I
have to use ‘extra-special-language’ as the language name? Is that going
to seem natural? What burden does that put on the developer of
‘extra-special-language-mode’ to make tangle and other Org-mode features
work like they would for ‘language-mode’?

I wonder if it makes more sense to invent a mechanism for assigning
language synonyms that can be used throughout Org?

Be seeing you,
  norm

P.S. Just to prove I can play devil’s advocate, I’m very conscious of
the fact that a few days ago, I invented an ‘xproc-mode’ as a vacuous
extension to ‘xml-mode’ precisely *because* I wanted to define different
org-babel-execute behavior.

--
Norman Tovey-Walsh  | Some disguised deceits
https://nwalsh.com/ | counterfeit truth so perfectly
| that not to be taken in by them
| would be an error of
| judgment.--La Rochefoucauld


signature.asc
Description: PGP signature


Re: org-babel-load-file support elisp

2020-02-09 Thread Bastien
Hi Tim and Troy,

Tim Cross  writes:

> I came across this inconsistency a while back. I think the problem is
> that you should *not* be able to use elisp as a language specifier in
> source blocks.
>
> All other language specifiers comply to the pattern of source block
> languages being the language major mode name without the '-mode', but
> there is no elisp-mode.
>
> The problem now is that removing support for 'elisp' would break too
> much.

What I suggest for this particular issue is this: first be liberal
while staying consistent (thus allowing "elisp" as Troy suggest),
then be strict when a major release is issued (thus removing aliases
that are problematic, not just "elisp" but others.)

WDYT?  Troy, would you be able to prepare a patch for this?

Thanks,

-- 
 Bastien



Re: org-babel-load-file support elisp

2020-02-04 Thread Berry, Charles



> On Feb 3, 2020, at 10:03 PM, Jack Kamm  wrote:
> 
> Tim Cross  writes:
> 
>> All other language specifiers comply to the pattern of source block
>> languages being the language major mode name without the '-mode', but
>> there is no elisp-mode.
> 
> Sorry to be pedantic, but I think shell source blocks are another
> exception here. 

[snip]

FWIW, so are R and julia (ess-r-mode, ess-julia-mode) and c++ (cc-mode).

I suspect more examples are "out there".

Chuck




Re: org-babel-load-file support elisp

2020-02-03 Thread Tim Cross


Well there are exceptions to all rules aren't there?

Yes, strictly speaking, for shell scripts, only 'sh' fits with the
-mode rule. However, that mode is also slightly different from
other language modes in that it supports many shell 'dialects'.

The thing is, the more 'liberal' we are with what we allow as the name
of the source block language, the more complex any additional
functionality becomes - I think your original issue is an example of
this. Allowing 'elisp' seem reasonable, but then other functions which
work with source blocks now also need to know that 'elisp' is an alias
for 'emacs-lisp'.

There are probably other inconsistencies which will 'fail' in some
situations. For example, I wonder about 'javascript' and 'js2'.
Jack Kamm  writes:

> Tim Cross  writes:
>
>> All other language specifiers comply to the pattern of source block
>> languages being the language major mode name without the '-mode', but
>> there is no elisp-mode.
>
> Sorry to be pedantic, but I think shell source blocks are another
> exception here. They can use various synonyms for the source language,
> such as "shell", "sh", or any other name in org-babel-shell-names. Also,
> while "shell-mode" is a major-mode, it is not the mode used by the
> source buffer -- it is the mode used for the interactive shell created
> by the `shell' command.


--
Tim Cross



Re: org-babel-load-file support elisp

2020-02-03 Thread Jack Kamm
Tim Cross  writes:

> All other language specifiers comply to the pattern of source block
> languages being the language major mode name without the '-mode', but
> there is no elisp-mode.

Sorry to be pedantic, but I think shell source blocks are another
exception here. They can use various synonyms for the source language,
such as "shell", "sh", or any other name in org-babel-shell-names. Also,
while "shell-mode" is a major-mode, it is not the mode used by the
source buffer -- it is the mode used for the interactive shell created
by the `shell' command.



Re: org-babel-load-file support elisp

2020-02-03 Thread Tim Cross


I came across this inconsistency a while back. I think the problem is
that you should *not* be able to use elisp as a language specifier in
source blocks.

All other language specifiers comply to the pattern of source block
languages being the language major mode name without the '-mode', but
there is no elisp-mode.

The problem now is that removing support for 'elisp' would break too
much. So the question becomes 'Do we want to continue down this road and
if so, does it make sense to support 'elisp' as a synonym for emacs-lisp
in all places where specifying the language is used?'.


Troy Hinckley  writes:

>  > I think supporting "#+begin_src elisp" would be confusing
>
> elisp is already supported in all other babel
> functions. org-babel-load-file is the only function that makes a
> distinction as far as I can tell. And since that function is outlier it
> makes sense to document this limitation in its docstring.
>
> Or even better would be to detect if the user had elisp blocks and throw
> and error. Though I am not sure how to do that outside of seeing if
> tangling elisp is successful.
>
> -Troy Hinckley
>
> On Feb 3, 2020, 12:23 PM -0700, Bastien , wrote:
>
> Hi Troy,
>
> I tracked down an issue trying to load a literate config file.
> org-babel-load-file calls org-babel-tangle-file with lang set to
> "emacs-lisp". This means that it won't tangle any blocks with
> language set to "elisp", which is equivalent. I can't think of an
> easy way to fix this since you would need to target both languages.
> Maybe at very least we could add something to the doc string to draw
> attention to this limitation.
>
>
> I think supporting "#+begin_src elisp" would be confusing but I agree
> we could give a hint somewhere about this.
>
> Can you suggest which docstring should be updated and how?
>
> Thanks,


--
Tim Cross



Re: org-babel-load-file support elisp

2020-02-03 Thread Troy Hinckley
 > I think supporting "#+begin_src elisp" would be confusing

elisp is already supported in all other babel
functions. org-babel-load-file is the only function that makes a
distinction as far as I can tell. And since that function is outlier it
makes sense to document this limitation in its docstring.

Or even better would be to detect if the user had elisp blocks and throw
and error. Though I am not sure how to do that outside of seeing if
tangling elisp is successful.

-Troy Hinckley

On Feb 3, 2020, 12:23 PM -0700, Bastien , wrote:

Hi Troy,

I tracked down an issue trying to load a literate config file.
org-babel-load-file calls org-babel-tangle-file with lang set to
"emacs-lisp". This means that it won't tangle any blocks with
language set to "elisp", which is equivalent. I can't think of an
easy way to fix this since you would need to target both languages.
Maybe at very least we could add something to the doc string to draw
attention to this limitation.


I think supporting "#+begin_src elisp" would be confusing but I agree
we could give a hint somewhere about this.

Can you suggest which docstring should be updated and how?

Thanks,

--
Bastien


Re: org-babel-load-file support elisp

2020-02-03 Thread Bastien
Hi Troy,

> I tracked down an issue trying to load a literate config file.
> org-babel-load-file calls org-babel-tangle-file with lang set to
> "emacs-lisp". This means that it won't tangle any blocks with
> language set to "elisp", which is equivalent. I can't think of an
> easy way to fix this since you would need to target both languages.
> Maybe at very least we could add something to the doc string to draw
> attention to this limitation. 

I think supporting "#+begin_src elisp" would be confusing but I agree
we could give a hint somewhere about this.

Can you suggest which docstring should be updated and how?

Thanks,

-- 
 Bastien



org-babel-load-file support elisp

2020-02-03 Thread Troy Hinckley
I tracked down an issue trying to load a literate config file.
org-babel-load-file calls org-babel-tangle-file with lang set to
"emacs-lisp". This means that it won't tangle any blocks with language set
to "elisp", which is equivalent. I can't think of an easy way to fix this
since you would need to target both languages. Maybe at very least we could
add something to the doc string to draw attention to this limitation.