Re: [O] [PATCH] Better handling labels in source code blocks + A suggestion

2016-08-01 Thread Bernard Hurley
>>>>> "Bernard" == Bernard Hurley <bern...@marcade.biz> writes:

Bernard> #+BEGIN_SRC ruby -f -l "#(ref:%s)"

Sorry that should have been:

#+BEGIN_SRC ruby -r -l "#(ref:%s)"

-- 

Your fortune cookie for today:

Bridge ahead.  Pay troll.

** Fortune cookies are brought to you by GNU/Linux "fortunes" **



[O] [PATCH] Better handling labels in source code blocks + A suggestion

2016-08-01 Thread Bernard Hurley
Hi all,

At present the value of org-coderef-label-format in a source code
editing buffer does not inherit its value from the value in the
corresponding org-mode buffer but instead, if it is not specified by a
-l option, defaults to the global value. Note that it is the value in the
org mode buffer and not the global value that is used for such things as
exporting so this can lead to inconsistent behaviour.

The following patch on org-src.el will fix this, and, as far as I can
tell, it doesn’t break anything else:

(N.B. I’m using org-plus-contrib-20160725 and Emacs 25.1.50.1)

= snip=
*** org-src.old.el  2016-08-01 13:23:35.596041600 +0100
--- org-src.el  2016-08-01 13:34:08.420047376 +0100
***
*** 828,834 
  name of the sub-editing buffer."
(interactive)
(let* ((element (org-element-at-point))
!(type (org-element-type element)))
  (unless (and (memq type '(example-block src-block))
 (org-src--on-datum-p element))
(user-error "Not in a source or example block"))
--- 828,835 
  name of the sub-editing buffer."
(interactive)
(let* ((element (org-element-at-point))
!(type (org-element-type element))
!(local-coderef-label-format org-coderef-label-format))
  (unless (and (memq type '(example-block src-block))
 (org-src--on-datum-p element))
(user-error "Not in a source or example block"))
***
*** 862,868 
;; Finalize buffer.
(org-set-local 'org-coderef-label-format
 (or (org-element-property :label-fmt element)
!org-coderef-label-format))
(when (eq type 'src-block)
(org-set-local 'org-src--babel-info babel-info)
(let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang
--- 863,869 
;; Finalize buffer.
(org-set-local 'org-coderef-label-format
 (or (org-element-property :label-fmt element)
!local-coderef-label-format))
(when (eq type 'src-block)
(org-set-local 'org-src--babel-info babel-info)
(let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang
 snip ===

After this you can do things like the following in an org-mode buffer,
so that the labels are embedded in comments and the code block will
still execute:

# Local Variables:
# org-coderef-label-format: "#(ref:%s)"
# End:

and you could write something like:

#+BEGIN_SRC ruby -r

instead of:

#+BEGIN_SRC ruby -f -l "#(ref:%s)"

which is quite convenient if you have lots of blocks

A Suggestion:


In addition it would be nice if there were some way of giving a default
value for org-coderef-label-format that depends on the language of the
code block it is associated with, but I’m not sure what the best way to
implement this would be.

-- 

Your fortune cookie for today:

To code the impossible code,This is my quest --
To bring up a virgin machine,   To debug that code,
To pop out of endless recursion,No matter how hopeless,
To grok what appears on the screen, No matter the load,
To write those routines
To right the unrightable bug,   Without question or pause,
To endlessly twiddle and thrash,To be willing to hack FORTRAN IV
To mount the unmountable magtape,   For a heavenly cause.
To stop the unstoppable crash!  And I know if I'll only be true
To this glorious quest,
And the queue will be better for this,  That my code will run CUSPy and calm,
That one man, scorned and   When it's put to the test.
destined to lose,
Still strove with his last allocation
To scrap the unscrappable kludge!
-- To "The Impossible Dream", from Man of La Mancha

** Fortune cookies are brought to you by GNU/Linux "fortunes" **



[O] [PATCH] Fix to allow ob-babel-shell-names to be customised.

2016-07-22 Thread Bernard Hurley
Hi all,

At present customisation of the variable ob-babel-shell-names in
ob-shell.el doesn't work properly.  You can actually change its value
and save the customisation, but the org-babel-execute: functions
get created for the hard coded value of the variable not the customised
value.

The following patch should fix it:

---snip
*** ob-shell.el.old 2016-07-22 20:43:43.190100908 +0100
--- ob-shell.el 2016-07-22 22:55:28.730037538 +0100
***
*** 42,60 
  
  (defcustom org-babel-shell-names
'("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")
!   "List of names of shell supported by babel shell code blocks."
:group 'org-babel
!   :type 'string
!   :initialize
(lambda (symbol value)
! (set-default symbol (second value))
  (mapc
   (lambda (name)
 (eval `(defun ,(intern (concat "org-babel-execute:" name)) (body 
params)
,(format "Execute a block of %s commands with Babel." name)
(let ((shell-file-name ,name))
  (org-babel-execute:shell body params)
!  (second value
  
  (defun org-babel-execute:shell (body params)
"Execute a block of Shell commands with Babel.
--- 42,61 
  
  (defcustom org-babel-shell-names
'("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")
!   "List of names of shell supported by babel shell code blocks.
! Changing this variable outside the Customize interface has no effect."
:group 'org-babel
!   :type '(repeat string)
!   :set
(lambda (symbol value)
! (set-default symbol value)
  (mapc
   (lambda (name)
 (eval `(defun ,(intern (concat "org-babel-execute:" name)) (body 
params)
,(format "Execute a block of %s commands with Babel." name)
(let ((shell-file-name ,name))
  (org-babel-execute:shell body params)
!  value)))
  
  (defun org-babel-execute:shell (body params)
"Execute a block of Shell commands with Babel.
---snip--

I am using Org version 8.3.5 in Emacs  25.1.50.1.

Cheers,

Bernard

-- 

Your fortune cookie for today:

Marriage is low down, but you spend the rest of your life paying for it.
-- Baskins

** Fortune cookies are brought to you by GNU/Linux "fortunes" **



Re: [O] resize multiple image within a row or paragraph

2014-09-21 Thread alban bernard
Wow. Thanks for your reply. I will stop googling and worg-ing for a solution. I 
will rather dig into your suggestion. As I understood, there is some hackery 
involved here .. :)

Thanks again.

~Alban Bernard


On Saturday, September 20, 2014 2:08 PM, Nicolas Goaziou 
m...@nicolasgoaziou.fr wrote:
Hello,


alban bernard alban.bern...@yahoo.fr writes:


 My wife and I use the marvelous org-mode to design a complete set
 of student courses. These courses are first written in org-mode then

exported to html to ease distribution to students (and save some paper).

 We wonder what is the correct way to resize multiple images those links
 are within a single paragraph:

 This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
  
 With the following, the only first image is resized (as expected):

  #+ATTR_HTML: :width 50%
  This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
  
 The tutorial about caption in a row shows what is possible while working
 only with
  images
 http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.html#sec-5-2:

  #+HTML_HEAD: style type=text/css
  #+HTML_HEAD:!--/*--![CDATA[/*!--*/
  #+HTML_HEAD: div.figure { float:left; }
  #+HTML_HEAD: /*]]*/--
  #+HTML_HEAD: /style

  #+CAPTION:
  #+ATTR_HTML: :width 10%
  [[./image1.png]]
  #+CAPTION:
  #+ATTR_HTML: :width 10%
  [[./image2.png]]

 Here, image1 and image2 are displayed and resized in a single row. 
 But we don't know how to mix text within this block so that all is 
 displayed as a single paragraph with resized images.


This is not possible out of the box. You might use some Babel code to
generate the needed HTML but I guess it wouldn't be particularly easy.

Nevertheless, there's a solution. `html' back-end can redefine what
a paragraph is, instead of following Org's own definition. More
explicitly, an HTML paragraph can be defined as a cluster of elements
not separated by any blank line and containing at least an Org
paragraph. Hence:

  #+attr_html: :width 10%
  [[./img1.png]]
  Paragraph
  #+attr_html: :width 10%
  [[./img2.png]]

consists of two paragraphs in Org, but would be seen as a single
paragraph by HTML, and exported as such.

Implementation is simple using pseudo-elements. `latex' back-ends does
it already for tables and math snippets. However, I'm no HTML
specialist, so there may be drawbacks I cannot foresee.


Regards,

-- 
Nicolas Goaziou



Re: [O] resize multiple image within a row or paragraph

2014-09-21 Thread alban bernard
I will test this workaround pronto. For other backends, that's not a problem as 
I render pdf from html through phantomjs and I don't use neither latex nor odt 
for the moment. 


Big thanks to you both.
~Alban Bernard.



On Sunday, September 21, 2014 8:07 PM, Christian Moe m...@christianmoe.com 
wrote:

Hi,

Here's a simple CSS workaround that might or might not work well for
you, and won't work for non-HTML backends, but at least requires minimal
hacking: 

Wrap the sentence in a DIV element and define a class for it to force
child paragraphs to display as inline instead of blocks. 

You can set up the style sheets in various ways, but by way of
demonstration, add the style definition with HTML_HEAD export keyword:

#+HTML_HEAD: style.inlineparas p {display: inline;} /style

Then you can do things like  this:

#+html: div class=inlineparas
This is a phrase with
#+ATTR_HTML: :width 50%
[[./image1.png]]
and
#+ATTR_HTML: :width 50%
[[./image2.png]]
inline images.
#+end_inlineparas
#+html: /div

The generic #+begin_{block} syntax lets you do this in a more org-like
and less cluttered way:

#+begin_inlineparas
This is a phrase with
#+ATTR_HTML: :width 50%
[[./image1.png]]
and
#+ATTR_HTML: :width 50%
[[./image2.png]]
inline images.
#+end_inlineparas

Yours,
Christian




alban bernard writes:

 Wow. Thanks for your reply. I will stop googling and worg-ing for a solution. 
 I will rather dig into your suggestion. As I understood, there is some 
 hackery involved here .. :)

 Thanks again.

 ~Alban Bernard


 On Saturday, September 20, 2014 2:08 PM, Nicolas Goaziou 
 m...@nicolasgoaziou.fr wrote:
 Hello,


 alban bernard alban.bern...@yahoo.fr writes:


 (...)
 We wonder what is the correct way to resize multiple images those links
 are within a single paragraph:

 This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
  
 With the following, the only first image is resized (as expected):

  #+ATTR_HTML: :width 50%
  This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
 
 (...) 
 But we don't know how to mix text within this block so that all is 
 displayed as a single paragraph with resized images.


 This is not possible out of the box. You might use some Babel code to
 generate the needed HTML but I guess it wouldn't be particularly easy.

 Nevertheless, there's a solution. `html' back-end can redefine what
 a paragraph is, instead of following Org's own definition. 
 (...)



Re: [O] resize multiple image within a row or paragraph

2014-09-20 Thread alban bernard
Any thought on this?

~Alban.



On Thursday, September 18, 2014 5:14 PM, alban bernard alban.bern...@yahoo.fr 
wrote:
 


Hi Folks,

My wife and I use the marvelous org-mode to design a complete set
of student courses. These courses are first written in org-mode then
exported to html to ease distribution to students (and save some paper).

We wonder what is the correct way to resize multiple images those links
are within a single paragraph:

This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
 
With the following, the only first image is resized (as expected):

 #+ATTR_HTML: :width 50%
 This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
 
The tutorial about caption in a row shows what is possible while working
only with
 images
http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.html#sec-5-2:

 #+HTML_HEAD: style type=text/css
 #+HTML_HEAD:!--/*--![CDATA[/*!--*/
 #+HTML_HEAD: div.figure { float:left; }
 #+HTML_HEAD: /*]]*/--
 #+HTML_HEAD: /style

 #+CAPTION:
 #+ATTR_HTML: :width 10%
 [[./image1.png]]
 #+CAPTION:
 #+ATTR_HTML: :width 10%
 [[./image2.png]]

Here, image1 and image2 are displayed and resized in a single row. 
But we don't know how to mix text within this block so that all is 
displayed as a single paragraph with resized images.

I tested all of this with the following version combos:
Debian Jessie/Emacs 24.3.1/Orgmode 8.2.5h-1 (debian)
Debian Jessie/Emacs 24.3.1/Orgmode latest git

Thanks for any hint that could help.

~Alban.

PS: the Show the source
 button of http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.html
redirects to:
http://orgmode.org/worg/org-tutorials/images-and-xorg.html-export.org.html
rather than:
http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.org.html

[O] resize multiple image within a row or paragraph

2014-09-18 Thread alban bernard
Hi Folks,

My wife and I use the marvelous org-mode to design a complete set
of student courses. These courses are first written in org-mode then
exported to html to ease distribution to students (and save some paper).

We wonder what is the correct way to resize multiple images those links
are within a single paragraph:

This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
 
With the following, the only first image is resized (as expected):

 #+ATTR_HTML: :width 50%
 This is a phrase with [[./image1.png]] and [[./image2.png]] inline images.
 
The tutorial about caption in a row shows what is possible while working
only with images
http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.html#sec-5-2:

 #+HTML_HEAD: style type=text/css
 #+HTML_HEAD:!--/*--![CDATA[/*!--*/
 #+HTML_HEAD: div.figure { float:left; }
 #+HTML_HEAD: /*]]*/--
 #+HTML_HEAD: /style

 #+CAPTION:
 #+ATTR_HTML: :width 10%
 [[./image1.png]]
 #+CAPTION:
 #+ATTR_HTML: :width 10%
 [[./image2.png]]

Here, image1 and image2 are displayed and resized in a single row. 
But we don't know how to mix text within this block so that all is 
displayed as a single paragraph with resized images.

I tested all of this with the following version combos:
Debian Jessie/Emacs 24.3.1/Orgmode 8.2.5h-1 (debian)
Debian Jessie/Emacs 24.3.1/Orgmode latest git

Thanks for any hint that could help.

~Alban.

PS: the Show the source button of 
http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.html
redirects to:
http://orgmode.org/worg/org-tutorials/images-and-xorg.html-export.org.html
rather than:
http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.org.html

[O] rainbow parenthesis with org babel for reveal.js export

2013-11-21 Thread bernard
Dear list,

I am currently very happy to use orgmode and org-reveal [0] to create slide
for my lessons about programming.
I enjoy using src block to have automatic syntax highlighting for the code
fragments.
However, I now have the joy to teach a lisp variant (Clojure) for which I
have some syntactic coloring in HTML.
However, I miss rainbow parenthesis (and my students even more so !).
org-reveal page says : Org-reveal use Org-Babel to highlight source codes.
hence my message here.

Any advice would be greatly appreciated !

Best Regards

Bernard

[0] https://github.com/yjwen/org-reveal




Re: [O] rainbow parenthesis with org babel for reveal.js export

2013-11-21 Thread bernard
Eric Schulte schulte.eric at gmail.com writes:

 Org-mode uses htmlize.el [1] to fontify source code blocks.  Htmlize
 directly converts an Emacs buffer to HTML, so if you are exporting from
 a buffer in which parenthesis are colorized, then the exported HTML
 should be colorized as well.[…]

Thanks for the ultra-fast helpful answer. Pointing me to Htmilze allowed my
search-fu to find
http://yoo2080.wordpress.com/2013/08/26/how-to-make-rainbow-delimiters-mode-work-with-org-mode-export-or-htmlize/.

Cheers,

Bernard





Re: [O] org-e-beamer missing from org-export-dispatch ui

2012-10-09 Thread bernard
Suvayu Ali fatkasuvayu+linux at gmail.com writes:

 
 Hi Nicolas and others,
 
 The option for beamer export seems to have gone missing from the
 org-export-dispatch ui.  This is how I setup org-e-beamer export in a
 minimal emacs instance.
 
   (setq org-e-latex-pdf-process   ; for experimental org-export
 '(xelatex -interaction nonstopmode -output-directory %o %f
   xelatex -interaction nonstopmode -output-directory %o %f
   xelatex -interaction nonstopmode -output-directory %o %f))
 

Thx for sharing.

I have
(setq org-e-latex-pdf-process 
  '(texi2dvi --pdf --clean --verbose --batch %f))
grabbed from 
https://lists.gnu.org/archive/html/emacs-orgmode/2012-09/msg01005.html

Could you (or someone else) explain the differences and tradeoffs involved
between both setups ?

Best Regards,

Bernard





Re: [O] Org-mode workshop: has anyone done this already?

2012-03-09 Thread Bernard H .
Eric Schulte eric.schulte at gmx.com writes:

 Later this month I will be giving a talk on the use of code blocks in
 Org-mode.  I haven't yet begun preparing the slides, but when I do they
 will live at https://github.com/eschulte/babel-presentation.
 
 Cheers,
 

Great !
Where will it take place ? Is it possible to attend ?
Will you be video recording it ?

Best Regards,

Bernard





[Orgmode] Re: storing link doesn't work from Gnus

2006-11-26 Thread Bernard Adrian
Bernard Adrian [EMAIL PROTECTED] a écrit : 

 I guess my emacs-version or my gnus-version is responsible :

 Gnus v5.11
 Emacs 22.0.51.1 (Emacs-multi-tty).

Same problem with emacs-snapshot (Emacs 22.0.91.1)...

For some reasons i have to keep emacs21 on my system too. Maybe this
can disturb...
-- 
Bernard Adrian PGP 031A938D 



pgpoYa3sJLDyP.pgp
Description: PGP signature
___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: storing link doesn't work from Gnus

2006-11-25 Thread Bernard Adrian
Giovanni Ridolfi [EMAIL PROTECTED] a écrit : 

 I suspect that you may have an older version of Org-mode,
 [unfortunately I haven't my GNU/Linux Debian box in hand]

 could you please post

 a) the version information of Emacs (C-h v emacs-version RET) 
 and
 b) Org-mode version (C-h v org-version RET) ?

Hi,

Please, accept i come in your exchange to tell :

I have exactly the same problem. My version of Org-mode was 4.43.
I replaced it by 4.56 and the bug is still present.

I guess my emacs-version or my gnus-version is responsible :

Gnus v5.11
Emacs 22.0.51.1 (Emacs-multi-tty).

Hoping this may help to understand from where can come this bug...
-- 
Bernard Adrian PGP 031A938D 
http://www.bernadrian.net



___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode