Re: [O] Multi-layer ergonomic keyboard and org-mode

2017-10-26 Thread Grant Rettke
On Thu, Oct 26, 2017 at 6:33 AM, Roland Everaert  wrote:
> This organization depends on your workflow, but their is surely some standard 
> key arrangement to improve our typing with our favorite editor an module.

A keyboard like that easily provides more keybinding "namespaces", for
keys where c=control, m=meta, s=super, h=hyper.

For one you get a hyper key. So you go from 6 namespaces (c, m, s, cm,
cs, ms) to 24 (if you are willing to use all of the combinations).

You can easily configure a single key to be any of those 24
combinations so you don't need to worry about finger strain. For
example you can have a single key that is C-M-s-H. That namespace is
wide open. You can also add Shift to double things.

Another valuable feature is the ability to configure a key for
"strike" versus "hold". For example strike the enter key and send
enter. Hold the enter key and make it the Control modifier.

Configuring the keyboard can become a hobby in itself.



Re: [O] Ediff org files starts folded

2017-10-26 Thread edgar
Yeah, it would be nice to have something that folds the tree back to its 
original state after the ediff! (excitement)


-

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



Re: [O] Multi-layer ergonomic keyboard and org-mode

2017-10-26 Thread Russell Adams
On Thu, Oct 26, 2017 at 01:33:20PM +0200, Roland Everaert wrote:
> Hi,
>
> I am considering buying this quite expensive ergonomic keyboard.
>
> https://ergodox-ez.com/
>
> This device can manage up to 32 layers and I wonder how a regular emacs and
> org-mode user would organize the layers.
>
> This organization depends on your workflow, but their is surely some standard
> key arrangement to improve our typing with our favorite editor an module.

Let me share my experience with you regarding Ergodox. It's incredibly cool! To 
be able to create your own programmable
keyboard is awesome. I built one with a custom case and mechanical switches, 
and it's great. Custom key layouts in the
firmware are awesome!

Until I discovered my hands don't fit it. I don't regret building it, but I 
can't use my lovely device I spent quite a
bit to make. Learn from my experience and test one hands on first.

On that note, I've been using a Kinesis Freestyle with a long binding cable for 
many years, and they just released a
mechanical switch version (Freestyle Edge? It's gaming branded) that also 
includes updates like layers. It's perfect and
exactly what I wanted.

Perhaps you should consider one of them. I'm very impressed with it.

Thanks.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: [O] `fill-paragraph' on headings

2017-10-26 Thread Alan E. Davis
I don't know anything about this, but there are certain times when I have
liked to use \paragraph{   } in generating a document.  The first part of
the paragraph is emboldened, but it's still a paragraph.  I stumbled over
this idea when I first encountered Org-Mode, and never was satisfied with
the answer that it's not possible to wrap a headline.  On the other hand, I
do understand that concept and a little bit about why it isn't ordinarily a
great idea.  We are not talking about exporting though, and it's entirely
possible that this is possible to do when exporting.

FWIW.

Alan Davis

On Thu, Oct 26, 2017 at 1:50 AM, Eric S Fraga  wrote:

> On Wednesday, 25 Oct 2017 at 14:03, Tor wrote:
> > this is a feature request for having the ability to use
> > `fill-paragraph' on headings.  An example from Emacs news:
>
> Semantically, this makes no sense?  How would org know that the line
> that follows a headline is part of the headline or not part of the
> headline?
>
> I appreciate that your example from Emacs news in that it mis-uses
> (abuses) outline headlines...
>
> --
> : Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-117-g5b2b8f
>



-- 
[Fill in the blanks]

The use of corrupt manipulations and blatant rhetorical ploys ...---
outright lying, flagwaving, personal attacks, setting up phony
alternatives, misdirection, jargon-mongering, evading key issues, feigning
disinterested objectivity, willful misunderstanding of other points of
view---suggests that ... lacks both credibility and evidence.

  Edward Tufte (in context of making presentations)


[O] matlab+org+write code executing in the buffer, matlab-shell

2017-10-26 Thread Uwe Brauer


Hi

Actually I am using two different approaches to execute matlab code in a
orgmode buffer.

* Chumur Erkut suggestion:

Don't change the definition of 

 org-babel-execute:matlab
 but do
 

(setq org-babel-default-header-args:matlab
  '((:session . "*MATLAB*")
(:results . "silent")))

This way when executing matlab, the matlab-shell written in lisp is
used, and matlab only has to be started once.

Here is his suggestion


#+BEGIN_SRC emacs-lisp

(org-babel-do-load-languages
 'org-babel-load-languages
 '((latex . t)
   (plantuml . t)
   (java . t)
   (matlab . t)
   (C . t)
   (table . t)  ))

(defun org-babel-execute:matlab (body params)
  "Execute a block of matlab code with Babel."
  (org-babel-execute:octave body params 'matlab))


(setq org-babel-default-header-args:matlab
  '((:session . "*MATLAB*")
(:results . "silent")))


#+END_SRC

#+RESULTS:
: ((:session . *MATLAB*) (:results . silent))

So executing 


#+BEGIN_SRC matlab :results output org drawer
x = [1, 2, 3, 4, 5];
fprintf('|%d', x)
#+END_SRC

does not result in code results to be inserted.


* John Kitchin's code

However I also need to insert the result of executed code into my org
buffer, best without the matlab >.

John Kitchin provided me the following rewrite of
org-babel-execute:matlab
in order that his code works I need 
org-babel-default-header-args:matlab to set to nil.

Here is his code

#+BEGIN_SRC emacs-lisp

(setq org-babel-default-header-args:matlab nil)


 (defun org-babel-execute:matlab (body params) 
  (interactive "P")
  (let* ((current-file (buffer-file-name)) 
 (code (org-element-property :value (org-element-context)))
 (result-params (cdr (assoc :result-params params)))
 m-file
 md5-hash)
(with-temp-buffer 
  (insert code)
  (setq md5-hash (md5 (buffer-string))
mbuffer (format "*m-%s*" md5-hash)
m-file (format "m-%s.m" md5-hash)))
;; create the file to run
(with-temp-file m-file 
  (insert code))
(let ((results (shell-command-to-string
(concat
 "/usr/local/bin/matlab "
 "-nodesktop -nojvm -nosplash -nodisplay <"
 m-file
  (delete-file m-file)
  (when results
;; strip out >>
(setq results (replace-regexp-in-string ">> " "" results))
;; remove first 10 lines that are the header.
;; matlab license seem to expire soon, so 5 warning lines are added
;; change first 10 to first 15 lines
(setq results (mapconcat 'identity
 (nthcdr 10 (split-string results "\n"))
 "\n")))
  (org-babel-result-cond result-params
results
#+END_SRC



Now

#+BEGIN_SRC matlab :results output org drawer
x = [1, 2, 3, 4, 5];
fprintf('|%d', x)
#+END_SRC


Results in 
#+RESULTS:
:RESULTS:
| 1 | 2 | 3 | 4 | 5 |
:END:



Which is very nice. The only problem, every time the code is executed
matlab is restarted, which in recent version of matlab can take some
time.

Does somebody has an idea how to combine both code, take John's code but
use the lisp matlab shell???



(John recommended to use the python kernel, but at least in Ubunutu
14.04 32 bit Matlab2012A does not provide that kernel) and in Ubuntu
16.06 with Matlab 2014 it also seems not to work.

Regards

Uwe Brauer




Re: [O] problem exporting org to latex: sections with math

2017-10-26 Thread Eric S Fraga
On Thursday, 26 Oct 2017 at 16:55, Uwe Brauer wrote:
>> My suggestion would be to use top level headlines (level 1) as
>> sections and subheadlines as questions/solutions. I.e. change the
>> org-latex-classes entry.
>
> That is a possibility, thanks, but I think right now I will stick to
> Nick's suggestion.

Always, especially in org, more than one way to skin a cat (apologies to
cat lovers... :-)).
-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-117-g5b2b8f


signature.asc
Description: PGP signature


Re: [O] problem exporting org to latex: sections with math

2017-10-26 Thread Uwe Brauer



   > On Thursday, 26 Oct 2017 at 10:24, Uwe Brauer wrote:

   > [...]


   > My suggestion would be to use top level headlines (level 1) as
   > sections and subheadlines as questions/solutions. I.e. change the
   > org-latex-classes entry.

That is a possibility, thanks, but I think right now I will stick to
Nick's suggestion.

Uwe 




Re: [O] problem exporting org to latex: sections with math

2017-10-26 Thread Uwe Brauer

   > Hello,
   > Uwe Brauer  writes:


   > IIUC, you write the above directly in the document. Org has very limited
   > support for raw LaTeX syntax. It can only understand simple macros with
   > simple arguments -- i.e., no nested arguments.

   > If you need to write more complicated constructs in the document,
   > consider using dedicated syntax, e.g.,

   >   #+latex: \section{Adaptive methods using  $h_{\text{op}}$}

Ah thanks! That solves my problem.




Re: [O] org-babel source block unevaluated into variable?

2017-10-26 Thread Martin Alsinet
Johan:

Maybe this one would work for you:

#+NAME: first
#+BEGIN_SRC js
function one() {
return 1;
}
#+END_SRC


#+NAME: second
#+BEGIN_SRC js
function two() {
return 2;
}
#+END_SRC


#+NAME: third
#+BEGIN_SRC js
function three() {
return 3;
}
#+END_SRC


#+NAME: all
#+BEGIN_SRC sh :results output :noweb yes
echo "
<>

<>

function test(){ console.log('test');}

<>"
#+END_SRC



#+BEGIN_SRC python :results output :var code=all
print code
#+END_SRC

#+RESULTS:
#+begin_example

function two() {
return 2
}

function one() {
return 1;
}

function test(){ console.log('test');}

function three() {
return 3;
}

#+end_example


On Thu, Oct 26, 2017 at 6:17 AM Johan W. Klüwer 
wrote:

> Thanks Martin,
>
> These are good suggestions, but it's not quite what I am after. In your
> second example, I would like ":var code=example" to make "code" carry the
> full (and expanded) text of the "example" block, i.e. to have
>
>   echo ls -alh
>
> as the result -- the code itself, unevaluated.
>
> Johan
>
> 2017-10-25 17:52 GMT+02:00 Martin Alsinet :
>
>> Johan:
>>
>> To use expanded noweb references you can use text source blocks
>>
>> #+NAME: lscode
>> #+BEGIN_SRC *text*
>> ls -alh
>> #+END_SRC
>>
>>
>> #+NAME: example
>> #+BEGIN_SRC sh :noweb yes
>> echo <>
>> #+END_SRC
>>
>> #+RESULTS: example
>> : ls -alh
>>
>>
>> #+BEGIN_SRC emacs-lisp :var code=example
>> (message code)
>> #+END_SRC
>>
>> #+RESULTS:
>> : ls -alh
>>
>>
>> Martín
>>
>> On Wed, Oct 25, 2017 at 10:36 AM Martin Alsinet 
>> wrote:
>>
>>> Johan:
>>>
>>> You can try the following:
>>>
>>> #+NAME: lscode
>>> #+BEGIN_ASCII
>>> ls -alh
>>> #+END_ASCII
>>>
>>> #+BEGIN_SRC emacs-lisp :var code=lscode
>>> (message code)
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> : ls -alh
>>>
>>> I haven't tried the noweb references, but it does return the code block
>>> in the variable.
>>>
>>>
>>> Martín
>>>
>>> On Wed, Oct 25, 2017 at 9:22 AM Johan W. Klüwer <
>>> johan.w.klu...@gmail.com> wrote:
>>>
 Is there a way to assign the uninterpreted content of an executable
 source block to a variable? Preferably, using a :var header argument? That
 is, return the text in the block, not the result of evaluating it, and
 preferably with noweb references expanded.

 "example" blocks return text the way I want, but they can't be
 evaluated, and of course noweb is ruled out for them.

 The function org-babel-ref-resolve could to the job if there were a
 switch to block evaluation.


 Why this is interesting: I wish to use url-hexify-string on the text of
 a named SPARQL query.

 Cheers, Johan

>>>
>


Re: [O] org-babel source block unevaluated into variable?

2017-10-26 Thread Johan W . Klüwer
Following up: A function like this one should help.

(defun expand-named-babel-block (block)
(save-excursion
(org-babel-goto-named-src-block block)
(org-babel-expand-src-block)))

However ... there's something strange here with
org-babel-goto-named-src-block (org 9.0.9). It just jumps to the first
source block in the file, which is not that useful :) I'll try to update
org and see.

2017-10-26 13:17 GMT+02:00 Johan W. Klüwer :

> Thanks Martin,
>
> These are good suggestions, but it's not quite what I am after. In your
> second example, I would like ":var code=example" to make "code" carry the
> full (and expanded) text of the "example" block, i.e. to have
>
>   echo ls -alh
>
> as the result -- the code itself, unevaluated.
>
> Johan
>
> 2017-10-25 17:52 GMT+02:00 Martin Alsinet :
>
>> Johan:
>>
>> To use expanded noweb references you can use text source blocks
>>
>> #+NAME: lscode
>> #+BEGIN_SRC *text*
>> ls -alh
>> #+END_SRC
>>
>>
>> #+NAME: example
>> #+BEGIN_SRC sh :noweb yes
>> echo <>
>> #+END_SRC
>>
>> #+RESULTS: example
>> : ls -alh
>>
>>
>> #+BEGIN_SRC emacs-lisp :var code=example
>> (message code)
>> #+END_SRC
>>
>> #+RESULTS:
>> : ls -alh
>>
>>
>> Martín
>>
>> On Wed, Oct 25, 2017 at 10:36 AM Martin Alsinet 
>> wrote:
>>
>>> Johan:
>>>
>>> You can try the following:
>>>
>>> #+NAME: lscode
>>> #+BEGIN_ASCII
>>> ls -alh
>>> #+END_ASCII
>>>
>>> #+BEGIN_SRC emacs-lisp :var code=lscode
>>> (message code)
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> : ls -alh
>>>
>>> I haven't tried the noweb references, but it does return the code block
>>> in the variable.
>>>
>>>
>>> Martín
>>>
>>> On Wed, Oct 25, 2017 at 9:22 AM Johan W. Klüwer <
>>> johan.w.klu...@gmail.com> wrote:
>>>
 Is there a way to assign the uninterpreted content of an executable
 source block to a variable? Preferably, using a :var header argument? That
 is, return the text in the block, not the result of evaluating it, and
 preferably with noweb references expanded.

 "example" blocks return text the way I want, but they can't be
 evaluated, and of course noweb is ruled out for them.

 The function org-babel-ref-resolve could to the job if there were a
 switch to block evaluation.


 Why this is interesting: I wish to use url-hexify-string on the text of
 a named SPARQL query.

 Cheers, Johan

>>>
>


[O] Multi-layer ergonomic keyboard and org-mode

2017-10-26 Thread Roland Everaert
Hi,

I am considering buying this quite expensive ergonomic keyboard.

https://ergodox-ez.com/

This device can manage up to 32 layers and I wonder how a regular emacs and
org-mode user would organize the layers.

This organization depends on your workflow, but their is surely some
standard key arrangement to improve our typing with our favorite editor an
module.


Regards,


Roland.


Re: [O] org-babel source block unevaluated into variable?

2017-10-26 Thread Johan W . Klüwer
Thanks Martin,

These are good suggestions, but it's not quite what I am after. In your
second example, I would like ":var code=example" to make "code" carry the
full (and expanded) text of the "example" block, i.e. to have

  echo ls -alh

as the result -- the code itself, unevaluated.

Johan

2017-10-25 17:52 GMT+02:00 Martin Alsinet :

> Johan:
>
> To use expanded noweb references you can use text source blocks
>
> #+NAME: lscode
> #+BEGIN_SRC *text*
> ls -alh
> #+END_SRC
>
>
> #+NAME: example
> #+BEGIN_SRC sh :noweb yes
> echo <>
> #+END_SRC
>
> #+RESULTS: example
> : ls -alh
>
>
> #+BEGIN_SRC emacs-lisp :var code=example
> (message code)
> #+END_SRC
>
> #+RESULTS:
> : ls -alh
>
>
> Martín
>
> On Wed, Oct 25, 2017 at 10:36 AM Martin Alsinet 
> wrote:
>
>> Johan:
>>
>> You can try the following:
>>
>> #+NAME: lscode
>> #+BEGIN_ASCII
>> ls -alh
>> #+END_ASCII
>>
>> #+BEGIN_SRC emacs-lisp :var code=lscode
>> (message code)
>> #+END_SRC
>>
>> #+RESULTS:
>> : ls -alh
>>
>> I haven't tried the noweb references, but it does return the code block
>> in the variable.
>>
>>
>> Martín
>>
>> On Wed, Oct 25, 2017 at 9:22 AM Johan W. Klüwer 
>> wrote:
>>
>>> Is there a way to assign the uninterpreted content of an executable
>>> source block to a variable? Preferably, using a :var header argument? That
>>> is, return the text in the block, not the result of evaluating it, and
>>> preferably with noweb references expanded.
>>>
>>> "example" blocks return text the way I want, but they can't be
>>> evaluated, and of course noweb is ruled out for them.
>>>
>>> The function org-babel-ref-resolve could to the job if there were a
>>> switch to block evaluation.
>>>
>>>
>>> Why this is interesting: I wish to use url-hexify-string on the text of
>>> a named SPARQL query.
>>>
>>> Cheers, Johan
>>>
>>


Re: [O] problem exporting org to latex: sections with math

2017-10-26 Thread Nicolas Goaziou
Hello,

Uwe Brauer  writes:

> The problem is that my document also contains latex \section commmands.
> These are exported correctly *only* if they don't contain math.
>
> Works
> \section{Adaptive methods using  hopt}
>
> Does not work:
> \section{Adaptive methods using  $h_{\text{op}}$}

IIUC, you write the above directly in the document. Org has very limited
support for raw LaTeX syntax. It can only understand simple macros with
simple arguments -- i.e., no nested arguments.

If you need to write more complicated constructs in the document,
consider using dedicated syntax, e.g.,

  #+latex: \section{Adaptive methods using  $h_{\text{op}}$}

Regards,

-- 
Nicolas Goaziou



Re: [O] problem exporting org to latex: sections with math

2017-10-26 Thread Eric S Fraga
On Thursday, 26 Oct 2017 at 10:24, Uwe Brauer wrote:
> Hello
>
> I export a org file to latex using the exam class and therefore thanks
> to Thomas Hunter I have defined.

[...]

> So what shall I do?

My suggestion would be to use top level headlines (level 1) as sections
and subheadlines as questions/solutions.  I.e. change the
org-latex-classes entry.

-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-117-g5b2b8f


signature.asc
Description: PGP signature


Re: [O] `fill-paragraph' on headings

2017-10-26 Thread Eric S Fraga
On Wednesday, 25 Oct 2017 at 14:03, Tor wrote:
> this is a feature request for having the ability to use
> `fill-paragraph' on headings.  An example from Emacs news:

Semantically, this makes no sense?  How would org know that the line
that follows a headline is part of the headline or not part of the
headline?

I appreciate that your example from Emacs news in that it mis-uses
(abuses) outline headlines...

-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-117-g5b2b8f


signature.asc
Description: PGP signature


[O] problem exporting org to latex: sections with math

2017-10-26 Thread Uwe Brauer
Hello

I export a org file to latex using the exam class and therefore thanks
to Thomas Hunter I have defined.


(org-latex-classes
(quote
 (
  ("exam" "\\documentclass[12pt, addpoints, answers]{exam}"
   ("\\begin{questions}%%%s" "\\end{questions}"
   "\\begin{questions}%%%s" "\\end{questions}")
   ("\\titledquestion[%s]  " . "")
   ("\\begin{parts}%%%s" "\\end{parts}" "\\begin{parts}%%%s"
   "\\end{parts}")
   ("\\part[%s] " . "")
   ("\\begin{subparts}%%%s" "\\end{subparts}"
   "\\begin{subparts}%%%s" "\\end{subparts}")
   ("\\subpart[%s] " . "")
   ("\\begin{solution}[%s]" "\\end{solution}" "\\begin{solution}[%s]"
   "\\end{solution}")

The problem is that my document also contains latex \section commmands.
These are exported correctly *only* if they don't contain math.

Works
\section{Adaptive methods using  hopt}

Does not work:
\section{Adaptive methods using  $h_{\text{op}}$}


The resulting latex file looks like

Ok
\section{Adaptive methods using  hopt}

The following is not ok,

\section\{Adaptive methods using  \(h_{\text{op}}\)\}


So what shall I do?

Thanks regards

Uwe Brauer