Re: [O] Tangling the same file in v8.2 and v.8.5 produces different results?

2016-08-04 Thread Michael Welle
Hello,

Grant Rettke  writes:

> On Thu, Aug 4, 2016 at 1:48 PM, Charles C. Berry  wrote:
>> On Wed, 3 Aug 2016, Grant Rettke wrote:
>>
>>> Good evening,
>>>
>>> I'm tangling this example in a file named test3.org
>>>
>>> --snip--
>>> #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
another thing I want to point out is that 'sh' has become 'shell' in
recent org versions. That seems to be tricky, because on a system with a
user installed newer org mode using 'sh' sometimes fails resp. sometimes
works unexpected . The trouble is that there is an ob-sh.el delivered
with the Emacs installation, which is sometimes loaded. I haven't tried
to find out why it only failed sometimes, but that is how I find out
about the change sh -> shell ;).

Regards
hmw



Re: [O] seeking good practices for writing about org using org

2016-08-04 Thread Charles C. Berry

On Thu, 4 Aug 2016, Cook, Malcolm wrote:


Hi Charles,

On Wed, 3 Aug 2016, Cook, Malcolm wrote:


> > Thanks.  Much closer.  Still some issues.  Mind taking another

gander  (hoping the attached jpeg of the webpage rendered comes
through as an attachment)
If my emacs buffer holds...
--
#+BEGIN_SRC org :exports both :results value ascii





> ...^>>
> what is the `ascii' doing?



> Can you provide a link to documentation in the manual or a

docstring describing its function?


I cannot!  I learned this from reading the code.  In ob-org.el we
find provision for this as well as `html' and `latex'


(defun org-babel-execute:org (body params)
 "Execute a block of Org code with.
This function is called by `org-babel-execute-src-block'."
 (let ((result-params (split-string (or (cdr (assoc :results params)) "")))
   (body (org-babel-expand-body:org
  (replace-regexp-in-string "^," "" body) params)))
   (cond
((member "latex" result-params)
 (org-export-string-as (concat "#+Title: \n" body) 'latex t))
((member "html" result-params) (org-export-string-as  body 'html t))
((member "ascii" result-params) (org-export-string-as body 'ascii t))
(t body)
)))


This is all undocumented.  I think it is a 'nod in the direction' of
what I am trying to accomplish, allowing to see as "results" the org
markup transcoded into the markup of a backend.  See below for my
hack extension on this idea.


Argh! Not even a mention in the docstring!

I think there was a plea a while back for updates for the
missing entries in

./worg/org-contrib/babel/languages.org

but I see `org' has nothing. Sigh!






> Why don't you have 'replace' in the :results args?

Oops.  Of course.  While trying to understand all this, I had done this to 
similar effect instead:

(setq  org-babel-default-header-args:org nil) ; fix bug? NOT silent


If this is set as a default, it is deliberate. But you can just set
it as a property in the buffer.

[stuff deleted]


I played with extending org-babel-execute:org to allow including
 MULTIPLE transcoded markdown results using screwy variant syntax of
 `:results +ascii +html +latex` with some success.


[Malcolm's extension of `org-babel-execute:org' deleted]

Writing a custom org-babel-execute:org is one way to go.

Or slurp the code into another babel block, format it there, and wrap
the results accordingly. This might be best for your purposes. You can
write a block to format the original code, one to format it as latex,
one as html, one as markdown, etc. Put them in your personal
library-of-babel and ingest them. Then #+CALL lines will create the
markup you need for any src block (which you will mark `:exports none'
so all formatting is done by #+CALL's).

HTH,

Chuck



Re: [O] [BUG] Noweb reference eval syntax does not work

2016-08-04 Thread Charles C. Berry

On Thu, 4 Aug 2016, Karsten Schmidt wrote:


Hi all,

sorry for coming in super late to this thread, but I'd like to make a
plea to *not* deprecate the :noweb-ref header arg.

On 12 May 2016 at 19:35:15, Aaron Ecay wrote:


To put it another way: it seems to me that the functionality of
:noweb-ref can be reimplemented in terms of other primitives.



Maybe you should respond to Nicolas' last posting in this thread:

https://lists.gnu.org/archive/html/emacs-orgmode/2016-05/msg00263.html

However, it doesn't look like :noweb-ref functionality is going away, but 
it may be shifted to require a noweb reference *evaluation* of a src block 
or lob block or maybe an idiom that looks like such (with the reference 
name as an argument) to invoke it. When that change occurs, I expect that 
a replace-regexp would be enough to update a file that uses :noweb-ref.


If you want to get ahead of that change, you can probably assume that 
:noweb-ref headers will continue to exist and roll your own src block to 
handle the invocation. `(org-babel-map-src-blocks nil BODY)' with a 
suitably tooled BODY seems like it would be enough. See the docstring.


If you require chained *evaluation* (including the _results_ of chained 
src blocks rather than just the src block bodies), you might show an 
example. So far, there hasn't been much concern that chained *evaluation* 
is useful. But it can be supported via the lob/src block gambit and you 
might get some tips on how to implement that or maybe convince someone to 
create a lob block that handles your case.


HTH,

Chuck




Re: [O] [BUG] Noweb reference eval syntax does not work

2016-08-04 Thread Karsten Schmidt
Hi all,

sorry for coming in super late to this thread, but I'd like to make a
plea to *not* deprecate the :noweb-ref header arg.

On 12 May 2016 at 19:35:15, Aaron Ecay wrote:

> To put it another way: it seems to me that the functionality of
> :noweb-ref can be reimplemented in terms of other primitives.  And given
> Nicolas’s comments about the complications and bugs it introduces, I’d
> be in favor of deprecating and eventually removing it.

I've been investing thousands of hours over the past years to author
several largish opensource projects (~40,000 SLOC total) exclusively
in org-mode, using hundreds of code blocks with :noweb-ref headers,
all of which would have to be replaced, re-tangled and the resulting
code re-tested, often manually... Maybe some of this could be
automated, but in any way it'll be a pretty large undertaking, which
I'd like to avoid, if possible...

I also think, having a feature deprecation like this should require a
major version change (depending how one interprets semantic
versioning) of org-mode (e.g v9.0.0). Already, I often struggle
convincing users of my libs that authoring libraries in org-mode is
better than in plain vanilla source code, but I think it'd be wrong to
not just force a non-standard tool, but then also specific versions of
that tool in order for people to help contributing.

Finally, and in summary, I never ever had a single issue w/
:noweb-refs and they're by far in my top 3 favourite org-mode
features... Please don't kill 'em!

Just my two pence...

K.
-- 
Karsten Schmidt
http://thi.ng | http://postspectacular.com | http://toxiclibs.org



Re: [O] seeking good practices for writing about org using org

2016-08-04 Thread Cook, Malcolm
Hi Charles,



> On Wed, 3 Aug 2016, Cook, Malcolm wrote:

>

 > > Thanks.  Much closer.  Still some issues.  Mind taking another

> > gander  (hoping the attached jpeg of the webpage rendered comes

> > through as an attachment)

> >

> > If my emacs buffer holds...

> > --

> > #+BEGIN_SRC org :exports both :results value ascii

>

 > ...^

>

 > what is the `ascii' doing?

>

 > Can you provide a link to documentation in the manual or a

> docstring describing its function?



I cannot!  I learned this from reading the code.  In ob-org.el we find 
provision for this  as well as `html' and `latex'



(defun org-babel-execute:org (body params)

  "Execute a block of Org code with.

This function is called by `org-babel-execute-src-block'."

  (let ((result-params (split-string (or (cdr (assoc :results params)) "")))

(body (org-babel-expand-body:org

   (replace-regexp-in-string "^," "" body) params)))

(cond

 ((member "latex" result-params)

  (org-export-string-as (concat "#+Title: \n" body) 'latex t))

 ((member "html" result-params) (org-export-string-as  body 'html t))

 ((member "ascii" result-params) (org-export-string-as body 'ascii t))

 (t body)

 )))





This is all undocumented.  I think it is a 'nod in the direction' of what I am 
trying to accomplish, allowing to see as "results" the org markup transcoded 
into the markup of a backend.  See below for my hack extension on this idea.



>

 > Why don't you have 'replace' in the :results args?



Oops.  Of course.  While trying to understand all this, I had done this to 
similar effect instead:



(setq  org-babel-default-header-args:org nil) ; fix bug? NOT silent





> >

> > ,* Acknowledgments

>

 > This bit behaves as you might expect in plain text export, markdown, and

> latex export:

>

 > >  [[mailto:myw...@example.com][my wife]]

>

 > but in html it does create `  T O C  "

>

 > should create??



I though (apparently incorrectly) it was the same as `#+TOC: headlines 2' which 
does contrive to relocate a Table of Contents to that location.



> ---

>

 > Re your next post, I suggest spending some time reading

>

 > (info "(org) results")

>

 > to grasp what the various options actually do. It is probably a good idea

> to execute src blocks to see the RESULTS before you try to export them.

>

 > Reading

>

 > (info "(org) wrap")

>

 > might also help and certainly a quick breeze thru

>

 > (info "(org) Specific header arguments")

>

 > to remind yourself of what all the possibilities are is something I have

> to do from time to time.



Thanks for these suggestions.  I have had better results after doing so.



I played with extending org-babel-execute:org to allow including MULTIPLE 
transcoded markdown results using screwy variant syntax of `:results  +ascii 
+html +latex` with some success.



For example, `:results +ascii +latex' exported html which renders as:

[cid:image001.png@01D1EE68.BBAEA750]





I now think perhaps I want additional options on a source block allowing to be 
included in the exported RESULTS:

  1) transcoded markdown, appropriately escaped for the current backend

  1) the source block itself (including the #+BEGIN/END directives)  (as 
distinct from :results code, which omits the directives)



Injecting this kind of logic into org-babel-execute:org  as I did is 
mis-placing the logic and only muddles further my thinking about this.



FWIW - here is the re-definition, if you care to play with or critique it.



(defun org-babel-execute:org (body params)

  "Execute a block of Org code with.

This function is called by `org-babel-execute-src-block'."

  (let* ((result-params (split-string (or (cdr (assoc :results params)) "")))

(body (org-babel-expand-body:org

(replace-regexp-in-string "^," "" body) params))

(val (cond

   ((member "latex" result-params)

(org-export-string-as (concat "#+Title: \n" 
body) 'latex t))

   ((member "html" result-params) (org-export-string-as  
body 'html t))

   ((member "ascii" result-params) (org-export-string-as 
body 'ascii t))

   (t body)

   )))

;; HACK: output protected versions of each of latex,html,ascii,md 
transcoded markup as requested with +{latex,html,ascii,md} in header-args

(when (member "+latex" result-params)

  (setq val (format "#+BEGIN_EXAMPLE\n%s\n#+END_EXAMPLE\n%s" 
(org-export-string-as  body 'latex t) val)))

(when (member "+html" result-params)

  (setq val (format "#+BEGIN_EXAMPLE\n%s\n#+END_EXAMPLE\n%s" 
(org-export-string-as  body 'html t) val)))

(when (member "+ascii" result-params)

  (setq val (format "#+BEGIN_EXAMPLE\n%s\n#+END_EXAMPLE\n%s" 

Re: [O] Tangling the same file in v8.2 and v.8.5 produces different results?

2016-08-04 Thread Grant Rettke
On Thu, Aug 4, 2016 at 1:48 PM, Charles C. Berry  wrote:
> On Wed, 3 Aug 2016, Grant Rettke wrote:
>
>> Good evening,
>>
>> I'm tangling this example in a file named test3.org
>>
>> --snip--
>> #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
>> <>
>> #+END_SRC
>> * the mount point of the fullest disk
>>  :PROPERTIES:
>>  :noweb-ref: fullest-disk
>>  :END:
>
>
> First, see
>
> ./org-mode/etc/ORG-NEWS::*Old Babel header properties are no longer
> supported

That is exactly it.

It needs to be.

  :PROPERTIES:
  :header-args: :noweb-ref fullest-disk
  :END:

Sorry I forgot to check ORG-NEWS; I will remember now!



Re: [O] Agenda and Relocated Files

2016-08-04 Thread Philip Hudson
On 4 August 2016 at 20:49, Bo Grimes  wrote:
> Design directory structure --> Move Files Accordingly--> Change Agenda List

Yes.

> Or is there a C-c C-? razzle-dazzle that does it?

No.


-- 
Phil Hudson   http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63



[O] Agenda and Relocated Files

2016-08-04 Thread Bo Grimes
I am just getting into both Emacs and Org Mode, and I tried to find the 
answer in the manual and archive.  If it's in the manual I don't yet 
understand enough to have recognized it and the mailing list archive is 
returning: 


I only have about 10-12 org files so far, but I just realized for my 
productivity and workflow I really need to redesign my folder system.  I 
currently only have 5-6 of them in the agenda list.  I suspect I will 
need to add and remove them from the agenda list after I change their 
location.


Is that correct? Emacs won't automatically detect such a move will it? 
I've heard there's a mode for causing butterfly wing-flapping to cause 
radiation to change bits (or some such), so I'm thinking maybe.


It won't be much trouble at this point, but I figure this may be 
something that comes up again. I realize I could just add an entire 
folder to the agenda list, but I anticipate really only having about 10 
org files that need to be added to the agenda, so I am thinking:


Design directory structure --> Move Files Accordingly--> Change Agenda List

Or is there a C-c C-? razzle-dazzle that does it?


Re: [O] Tangling the same file in v8.2 and v.8.5 produces different results?

2016-08-04 Thread Charles C. Berry

On Wed, 3 Aug 2016, Grant Rettke wrote:


Good evening,

I'm tangling this example in a file named test3.org

--snip--
#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
<>
#+END_SRC
* the mount point of the fullest disk
 :PROPERTIES:
 :noweb-ref: fullest-disk
 :END:


First, see

./org-mode/etc/ORG-NEWS::*Old Babel header properties are no longer supported

*if* that doesn't solve it, possibly this is relevant:

https://lists.gnu.org/archive/html/emacs-orgmode/2016-05/msg00056.html

HTH,

Chuck




Re: [O] Scaling of image previews in org-mode

2016-08-04 Thread Giri Prashanth
The following attribute worked for me to scale image:
#+attr_html: :width 100px

But I had to build emacs25 in OS X  with ImageMagick support.

On Thu, Aug 4, 2016 at 1:26 AM, Johannes Brauer 
wrote:

> I think my Aquamacs 3.2 GNU Emacs 24.4.51.2 has got ImageMagick support.
>
> Am 04.08.2016 um 00:09 schrieb Giri Prashanth :
>
> I think you need to build emacs with ImageMagick support for image
> scaling to work.
>
>
> On Wed, Aug 3, 2016 at 12:20 PM, Johannes Brauer 
> wrote:
>
>> Hi!
>>
>> If I insert a jpg in my org-mode document, I can preview it but not scale
>> its width, like so:
>>
>> Add the following code to my init.el file:
>> (setq org-image-actual-width nil)
>>
>> Then insert this code in my document, where I want the image to appear:
>> #+ATTR_ORG: :width 20
>> [[./test.jpg]]
>>
>> No matter which value I give for the width argument the image appears in
>> the buffer always in its original size.
>>
>> However, scaling for html export with #+attr_html works fine.
>>
>> What is going wrong?
>>
>> (Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @ 
>> /Users/johannes/Library/Preferences/Aquamacs
>> Emacs/Packages/elpa/org-20160704/)
>>
>> Johannes
>>
>
>
>
> --
> -giri
>
>
>


-- 
-giri


Re: [O] seeking good practices for writing about org using org

2016-08-04 Thread Charles C. Berry

On Wed, 3 Aug 2016, Cook, Malcolm wrote:

Thanks.  Much closer.  Still some issues.  Mind taking another 
gander  (hoping the attached jpeg of the webpage rendered comes 
through as an attachment)


If my emacs buffer holds...
--
#+BEGIN_SRC org :exports both :results value ascii


...^

what is the `ascii' doing?

Can you provide a link to documentation in the manual or a 
docstring describing its function?


Why don't you have 'replace' in the :results args?



,* Acknowledgments


This bit behaves as you might expect in plain text export, markdown, and 
latex export:



 [[mailto:myw...@example.com][my wife]]


but in html it does create `




,* Chapter one

Fa la la ls

,* Chapter two

La di di

,* Finally, here is a table of contents!

,#+TOC:


What does this idiom do?

Precisely, where does the documentation say what

#+TOC:

read as "  T O C  "

should create??

---

Re your next post, I suggest spending some time reading

(info "(org) results")

to grasp what the various options actually do. It is probably a good idea 
to execute src blocks to see the RESULTS before you try to export them.


Reading

(info "(org) wrap")

might also help and certainly a quick breeze thru

(info "(org) Specific header arguments")

to remind yourself of what all the possibilities are is something I have 
to do from time to time.


HTH,

Chuck



Re: [O] Scaling of image previews in org-mode

2016-08-04 Thread Johannes Brauer
I think my Aquamacs 3.2 GNU Emacs 24.4.51.2 has got ImageMagick support.

Am 04.08.2016 um 00:09 schrieb Giri Prashanth 
>:

I think you need to build emacs with ImageMagick support for image scaling to 
work.


On Wed, Aug 3, 2016 at 12:20 PM, Johannes Brauer 
> wrote:
Hi!

If I insert a jpg in my org-mode document, I can preview it but not scale its 
width, like so:

Add the following code to my init.el file:
(setq org-image-actual-width nil)

Then insert this code in my document, where I want the image to appear:
#+ATTR_ORG: :width 20
[[./test.jpg]]

No matter which value I give for the width argument the image appears in the 
buffer always in its original size.

However, scaling for html export with #+attr_html works fine.

What is going wrong?

(Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @ 
/Users/johannes/Library/Preferences/Aquamacs Emacs/Packages/elpa/org-20160704/)

Johannes



--
-giri



Re: [O] How to use symbolic names to refer to spreadsheet fields containing irregular values

2016-08-04 Thread Michael Brand
Hi Christoph

On Wed, Aug 3, 2016 at 11:31 PM, Christoph LANGE
 wrote:

> I would like to make the following work (with Org 8.3.5):
>
> |---+--++---|
> |   |13:13 | -  | 1 |
> | ^ |h | s  | n |
> |---+--++---|
> |   | 13:13:00 | #ERROR | 1 |
> |---+--++---|
> #+TBLFM: @3$2=$h;T::@3$3=$s::@3$4=$n
>
> I can give the field @1$2 the symbolic name $h, I can give the field
> @1$4 the symbolic name $n, and I can successfully refer to both of them
> in @3.
>
> However I didn't manage to refer to @1$3 using the symbolic name $s.
> The reason must be the value "-".  If I use an alphabetic string value,
> it works.
>
> Any ideas?  Or is this a bug?
>
> Thank you very much in advance,

"-" is not a valid Calc expression. To copy literally one needs a Lisp
formula:

|---+--+---+---|
|   |13:13 | - | 1 |
| ^ |h | s | n |
|---+--+---+---|
|   | 13:13:00 | - | 1 |
|---+--+---+---|
#+TBLFM: @3$2 = $h; T :: @3$3 = '(identity "$s") :: @3$4 = $n

Michael