Re: [O] Export to pdf when path name has ~

2016-06-10 Thread Stig Brautaset
Nicolas Goaziou  writes:
>> Fabulous. I wanted to test it, but even though I think I have the latest
>> Org I can't get this to work. =M-x org-version= says:
>>
>> Org-mode version 8.3.4 (8.3.4-79-gbd4948-elpaplus @
>> /Users/stig/.emacs.d/elpa/org-plus-contrib-20160606/)
>
> The change was introduced in master, whereas you're using stable branch.

Oh right! Thanks for that. Well, I have now installed the master branch
and confirmed that this fixes my issue. Thanks :-)

Stig




Re: [O] [PATCH] ob-sql.el: Support sqlcmd and cygwin environment

2016-06-10 Thread Xi Shen
Hello Nicolas,

Please see my replies inline.

On Sat, Jun 11, 2016 at 6:06 AM Nicolas Goaziou 
wrote:

> Hello,
>
> Xi Shen  writes:
>
> > I would like to apply this path to add sqlcmd support, and allow org-mode
> > to execute and capture sqlcmd output in cygwin environment.
>
> Thank you for the patch.
>
> > I added a "platform-convert-file-name" function to convert a *nix path to
> > Windows path. Should I put this function in ob-sql.el, or somewhere
> > else?
>
> I'm surprised it doesn't exist. Wouldn't `convert-standard-filename' do
> the job?
>
> In any case, it doesn't have a proper prefix.
>
>
>> According to
https://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-File-Names.html,
the `convert-standard-filename` works for *nix and MS-DOS, but not Cygwin
environment. And I tested, it does not work. For the prefix, please advice
me a better one. Maybe we should path this function first? How can I
patch/update a Emacs native function?


> > Subject: [PATCH] ob-sql.el: Support sqlcmd and cygwin environment
> >
> > * lisp/ob-sql.el (org-babel-sql-dbstring-mssql): Format Microsoft
> >   sqlcmd command line args.
> >
> > * lisp/ob-sql.el (platform-convert-file-name): Convert a *nix path to
> >   Windows long path in Cygwin environment, or do nothing.
> >
> > * lisp/ob-sql.el (org-babel-execute:sql): Add `mssql` command support.
> >   For both `msosql` and `mssql` the `input` and `output` path will be
> >   mapped by `platform-convert-file-name`
>
> You can write it like
>
>  * lisp/ob-sql.el (org-babel-sql-dbstring-mssql): Format Microsoft
>sqlcmd command line args.
>  (platform-convert-file-name): Convert a *nix path to Windows long path
>  in Cygwin environment, or do nothing.
>  (org-babel-execute:sql): Add `mssql' command support. For both `msosql'
>  and `mssql` the `input` and `output' path will be mapped by
>  `platform-convert-file-name'
>
> >> Sure, I will update the ChangeLog entry.


> > The `osql` command line tool was last updated in 2004,
> > https://technet.microsoft.com/en-us/library/aa214012(v=sql.80).aspx,
> > and could not output the query result in a way that morden
> > `org-table.el` expects.  The `sqlcmd` is the preferred command line
> > tool to connect the Microsoft SQL Server and it also has a Linux
> > version,
> > https://msdn.microsoft.com/en-us/library/hh568447(v=sql.110).aspx.
>
> Would it make sense to remove the msosql support then?
>
> >> Yes, but I am also thinking about backward compatibility. Do you want
me to create a patch to remove `msosql` support?


> > +(defun org-babel-sql-dbstring-mssql (host user password database)
> > +  "Make Microsoft sqlcmd commmand line args for database
> > +connection."
>
> The first sentence has to fit on a single line.
>
> > Will do, thanks~


> > +  (mapconcat 'identity
>
> Nit-pick:
>
> #'identity
>
>
>> OK, but what's the difference? Care to give me a short lesson? Thanks!


> > +  "In Cygwin environment convert the file path into Windows long
> > +path and quote it."
> > +  (if (fboundp 'cygwin-convert-file-name-to-windows)
> > +  (format "\"%s\"" (cygwin-convert-file-name-to-windows file))
> > +file))
>
> See above.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Thanks,
David

-- 

Thanks,
David S.


Re: [O] Changing org-block background with org-src-fontify-natively

2016-06-10 Thread John Kitchin
That is some rock-star stuff! Thanks!

Rasmus writes:

> Andreas Leha  writes:
>
>> My Org mode experience would also benefit a lot from having source block
>> backgrounds again and with per-language configurable background colour.
>
> That’s possible with the attache patch.  An example of the horrors you can
> subject yourself to is also attached.


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



[O] [PATCH]: Fix latex image bug in org-mime-org-buffer-htmlize

2016-06-10 Thread Carlo Nucera
Hi,

attached is a patch that should fix a bug in the function
org-mime-org-buffer-htmlize (thanks to punchagan on irc!).

When exporting an org buffer with a latex snippet including the org
option tex: dvipng the images were always created in /tmp/ltxpng/, but
the reported link in the htmlized buffer was the local ./ltxpng folder;
so, unless the org file to htmlize was actually in /tmp, the user got an
error saying that the image could not be found.

This was caused by the two different ways in which the function
org-mime-replace-images is used inside of org-mime-org-buffer-htmlize
and org-mime-htmlize.

To correct the problem, the function org-mime-replace-images doesn't
take anymore the current-file parameter (that was only used to get its
directory) and instead always creates a temporary directory using
temporary-file-directory.

Keep up the good work!
Carlo Nucera
From e8dcf9996481053da856cd6684898cff28df0213 Mon Sep 17 00:00:00 2001
From: meditans 
Date: Fri, 10 Jun 2016 23:32:05 +0200
Subject: [PATCH] Fix latex image bug in org-mime-org-buffer-htmlize

When exporting an org buffer with a latex snippet including the org
option tex: dvipng the images were always created in /tmp/ltxpng/, but
the reported link in the htmlized buffer was the local ./ltxpng folder;
so, unless the org file to htmlize was actually in /tmp, the user got an
error saying that the image could not be found.

This was caused by the two different ways in which the function
org-mime-replace-images is used inside of org-mime-org-buffer-htmlize
and org-mime-htmlize.

To correct the problem, the function org-mime-replace-images doesn't
take anymore the current-file parameter (that was only used to get its
directory) and instead always creates a temporary directory using
temporary-file-directory.
---
 contrib/lisp/org-mime.el | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index 682f635..42fee3c 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -173,7 +173,7 @@ and images in a multipart/related part."
 "--" "}-<>\n"))
 ('vm "?")))
 
-(defun org-mime-replace-images (str current-file)
+(defun org-mime-replace-images (str)
   "Replace images in html files with cid links."
   (let (html-images)
 (cons
@@ -185,7 +185,7 @@ and images in a multipart/related part."
  (let* ((url (and (string-match "src=\"\\([^\"]+\\)\"" text)
   (match-string 1 text)))
 (path (expand-file-name
-   url (file-name-directory current-file)))
+   url temporary-file-directory))
 (ext (file-name-extension path))
 (id (replace-regexp-in-string "[\/]" "_" path)))
(add-to-list 'html-images
@@ -212,8 +212,6 @@ otherwise export the entire body."
(point-max)))
  (raw-body (concat org-mime-default-header
 			   (buffer-substring html-start html-end)))
- (tmp-file (make-temp-name (expand-file-name
-"mail" temporary-file-directory)))
  (body (org-export-string-as raw-body 'org t))
  ;; because we probably don't want to export a huge style file
  (org-export-htmlize-output-type 'inline-css)
@@ -224,7 +222,7 @@ otherwise export the entire body."
  ;; to hold attachments for inline html images
  (html-and-images
   (org-mime-replace-images
-	   (org-export-string-as raw-body 'html t) tmp-file))
+	   (org-export-string-as raw-body 'html t)))
  (html-images (unless arg (cdr html-and-images)))
  (html (org-mime-apply-html-hook
 (if arg
@@ -317,7 +315,7 @@ otherwise export the entire body."
 	 (org-export-htmlize-output-type 'inline-css)
 	 (html-and-images
 	  (org-mime-replace-images
-	   (org-export-string-as (funcall bhook body 'html) 'html t) file))
+	   (org-export-string-as (funcall bhook body 'html) 'html t)))
 	 (images (cdr html-and-images))
 	 (html (org-mime-apply-html-hook (car html-and-images
 	(insert (org-mime-multipart
-- 
2.5.5



Re: [O] HTML export without org title as H1?

2016-06-10 Thread Christian Wittern

On 06/10/2016 10:17 PM, John Kitchin wrote:

I am not sure I follow what you want. You can get rid of the title with
the option:  title:nil

Yes, this is exactly what I need.  Thank you!

All the best,

Christian

--
Christian Wittern, Kyoto



Re: [O] [PATCH] ob-sql.el: Support sqlcmd and cygwin environment

2016-06-10 Thread Nicolas Goaziou
Hello,

Xi Shen  writes:

> I would like to apply this path to add sqlcmd support, and allow org-mode
> to execute and capture sqlcmd output in cygwin environment.

Thank you for the patch.

> I added a "platform-convert-file-name" function to convert a *nix path to
> Windows path. Should I put this function in ob-sql.el, or somewhere
> else?

I'm surprised it doesn't exist. Wouldn't `convert-standard-filename' do
the job?

In any case, it doesn't have a proper prefix.

> Subject: [PATCH] ob-sql.el: Support sqlcmd and cygwin environment
>
> * lisp/ob-sql.el (org-babel-sql-dbstring-mssql): Format Microsoft
>   sqlcmd command line args.
>
> * lisp/ob-sql.el (platform-convert-file-name): Convert a *nix path to
>   Windows long path in Cygwin environment, or do nothing.
>
> * lisp/ob-sql.el (org-babel-execute:sql): Add `mssql` command support.
>   For both `msosql` and `mssql` the `input` and `output` path will be
>   mapped by `platform-convert-file-name`

You can write it like

 * lisp/ob-sql.el (org-babel-sql-dbstring-mssql): Format Microsoft
   sqlcmd command line args.
 (platform-convert-file-name): Convert a *nix path to Windows long path
 in Cygwin environment, or do nothing.
 (org-babel-execute:sql): Add `mssql' command support. For both `msosql'
 and `mssql` the `input` and `output' path will be mapped by
 `platform-convert-file-name'

> The `osql` command line tool was last updated in 2004,
> https://technet.microsoft.com/en-us/library/aa214012(v=sql.80).aspx,
> and could not output the query result in a way that morden
> `org-table.el` expects.  The `sqlcmd` is the preferred command line
> tool to connect the Microsoft SQL Server and it also has a Linux
> version,
> https://msdn.microsoft.com/en-us/library/hh568447(v=sql.110).aspx.

Would it make sense to remove the msosql support then?

> +(defun org-babel-sql-dbstring-mssql (host user password database)
> +  "Make Microsoft sqlcmd commmand line args for database
> +connection."

The first sentence has to fit on a single line.

> +  (mapconcat 'identity

Nit-pick:

#'identity

> +  "In Cygwin environment convert the file path into Windows long
> +path and quote it."
> +  (if (fboundp 'cygwin-convert-file-name-to-windows)
> +  (format "\"%s\"" (cygwin-convert-file-name-to-windows file))
> +file))

See above.

Regards,

-- 
Nicolas Goaziou



Re: [O] Export to pdf when path name has ~

2016-06-10 Thread Nicolas Goaziou
Hello,

Stig Brautaset  writes:

> Fabulous. I wanted to test it, but even though I think I have the latest
> Org I can't get this to work. =M-x org-version= says:
>
> Org-mode version 8.3.4 (8.3.4-79-gbd4948-elpaplus @
> /Users/stig/.emacs.d/elpa/org-plus-contrib-20160606/)

The change was introduced in master, whereas you're using stable branch.

Regards,

-- 
Nicolas Goaziou



Re: [O] org-export-resolve-id-link

2016-06-10 Thread Nicolas Goaziou
Hello,

Fabrice Popineau  writes:

> Again in the need of some hint.
>
> I am exporting some subtree.
> There is a custom_id pointing in the same org
> file but outside of the subtree.
>
> * Foo
> :PROPERTIES:
> :CUSTOM_ID: foo
> :END:
>
> Lorem ipsum...
>
> * Bar
>
> [[#foo]]
>
> When I try to export the second subtree, I get
> an error from #'org-export-resolve-id-link.
>
> (user-error Unable to resolve link: "foo")
>
> What is the easiest way to trap this error
> so that I can compute something myself for this link ?

With a recent version (i.e., development), you can have a look to
`org-export-with-broken-links'.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH} Re: inline code block problem; first attempt

2016-06-10 Thread Nicolas Goaziou
Hello,

"Charles C. Berry"  writes:

> Sounds good.

Done. Thank you for the feedback.

Regards,

-- 
Nicolas Goaziou



[O] org-export-resolve-id-link

2016-06-10 Thread Fabrice Popineau
Again in the need of some hint.

I am exporting some subtree.
There is a custom_id pointing in the same org
file but outside of the subtree.

* Foo
:PROPERTIES:
:CUSTOM_ID: foo
:END:

Lorem ipsum...

* Bar

[[#foo]]

When I try to export the second subtree, I get
an error from #'org-export-resolve-id-link.

(user-error Unable to resolve link: "foo")

What is the easiest way to trap this error
so that I can compute something myself for this link ?

Thanks in advance.

Fabrice


Re: [O] org-get-tags-at

2016-06-10 Thread Fabrice Popineau
2016-06-09 13:42 GMT+02:00 Nicolas Goaziou :

> Hello,
>
> Marco Wahl  writes:
>
> > That was a bug and has been fixed now AFAICT.
>
> Thank you for the fix.
>
>
+1

Fabrice


Re: [O] Export to pdf when path name has ~

2016-06-10 Thread Stig Brautaset
Nicolas Goaziou  writes:
>> I also agree that the best way would be to change the meaning of %f.
>
> Done in 3d0ade9. Thank you for the feedback.

Fabulous. I wanted to test it, but even though I think I have the latest
Org I can't get this to work. =M-x org-version= says:

Org-mode version 8.3.4 (8.3.4-79-gbd4948-elpaplus @ 
/Users/stig/.emacs.d/elpa/org-plus-contrib-20160606/)

Stig




[O] Bug: Adding a simple list item expands the entire simple list [8.3.4 (8.3.4-79-gbd4948-elpa @ c:/Users/sb/.emacs.d/elpa/org-20160606/)]

2016-06-10 Thread Steinar Bang
What I did do:
I pressed M-RET to insert a new item in an org simple list, with the
other items, some containing sub lists with items, closed.

What I expected to happen:
I expected the items that were closed to stay closed, and a new item to
be inserted.

What happened instead:
When the item was inserted, the entire simple list tree was expanded.

To explain what I mean by "expanded":

If I have
 ** Item1
  - First item of simple list
- Child of first item of simple list
  - Second item of simple list
- Child of second item
  - Child of child of second item
 ** Item2

and have most of the nodes closed, like this:
 ** Item1
  - First item of simple list...
  - Second item of simple list...
 ** Item2

and then insert a new item into the simple list, the entire tree will

open (like the first example).

Emacs  : GNU Emacs 24.4.1 (i686-pc-mingw32)
 of 2014-10-24 on LEG570
current state:
==
(setq
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point 
org-babel-execute-safely-maybe)
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo 
org-habit org-irc org-mew org-mhe org-rmail org-vm org-wl org-w3m)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-babel-pre-tangle-hook '(save-buffer)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-log-into-drawer t
 org-export-backends '(ascii html icalendar latex md odt)
 org-load-hook '((lambda nil (require (quote org-install)) (add-to-list (quote 
auto-mode-alist) (quote ("\\.org\\'" . org-mode))) (global-set-key ".l" (quote 
org-store-link)) (global-set-key ".a" (quote org-agenda)) (global-set-key ".b" 
(quote org-iswitchb))
  (add-hook (quote org-mode-hook) (quote turn-on-font-lock)) 
(add-hook (quote org-mode-hook) (quote turn-off-auto-fill)) (add-hook (quote 
org-mode-hook) (quote turn-on-visual-line-mode)) (if running-emacs22 
(transient-mark-mode 1)))
 )
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(turn-on-visual-line-mode turn-off-auto-fill turn-on-font-lock 
#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook 
org-show-block-all append local] 5] #[nil "\300\301\302\303\304$\207" 
[org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-clock-into-drawer "CLOCK"
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-load-languages '((emacs-lisp . t) (sparql . t))
 org-confirm-shell-link-function 'yes-or-no-p
 )



Re: [O] org-notify: Need to get notifications at the start time of the task (in addition to the deadline)

2016-06-10 Thread Amit Tendulkar
Charles Philip Chan  writes:

> Amit Tendulkar  writes:
>
> Hi Amit:
>
>> I put notify.el in my load path and added the following lines in my init
>> file.
>>
>> (autoload 'notify "notify" "Notify TITLE, BODY.")
>> (appt-activate 1)
>> (org-agenda-to-appt)
>>
>> Still I am getting only inline intimations for the appointments. Am I
>> missing something?
>
> Sorry, I set this up a long time ago, so I gave you the wrong info,
> After searching my configuration files, I found this:
>
> ;; Update appt list and dbus appt notification
> ; Get appointments for today
> (defun my-org-agenda-to-appt ()
>   (interactive)
>   (setq appt-time-msg-list nil)
>   (let ((org-deadline-warning-days 0));; will be automatic in org 5.23
> (org-agenda-to-appt)))
>
> ; Run once, activate and schedule refresh
> (my-org-agenda-to-appt)
> (appt-activate t)
> (run-at-time "00:01" nil 'my-org-agenda-to-appt)
>
> ; 5 minute warnings
> (setq appt-message-warning-time 15)
> (setq appt-display-interval 5)
>
> ; Update appt each time agenda opened.
> (add-hook 'org-finalize-agenda-hook 'my-org-agenda-to-appt)
>
> ; Setup zenify, we tell appt to use window, and replace default function
> (setq appt-display-format 'window)
> (setq appt-disp-window-function (function my-appt-disp-window))
>
> (defun my-appt-disp-window (min-to-app new-time msg)
>   (save-window-excursion
> (shell-command
>  (concat "/home/hoor/bin/org-appt-notify '" msg "'  '" min-to-app "'&")
>  nil nil)
> )
>   )
>
>
> and here is the content of "org-appt-notify"
>
>
> #!/bin/sh
> SOUND="/home/hoor/GNUstep/Library/WindowMaker/Sounds/Kopete_Received.ogg"
> ICON="/home/hoor/GNUstep/Library/Icons/apps/system-config-date.tif"
>
> ogg123 "$SOUND"
> notify-send --icon="$ICON" "APPOINTMENT" "$1\ndue in $2 mins."
>
>
> Charles

Thanks Charles. The above is indeed very helpful. I replaced the
notify-send command with the below one as the notification popup wasn't
visible to me when I was connected to Citrix desktop. Whereas the below
command worked.

zenity --info --text="$1 due in $2 minutes" --title "APPOINTMENT" --timeout 60

Regards,
Amit




Re: [O] ob-C doesn't support load libraries

2016-06-10 Thread Thierry Banel

  
  
Change the first line to
  
    #+BEGIN_SRC C :libs -lm
  
  This instructs the C++ compiler to link with the "m" library
  (mathematical functions).
  
  You need a pretty new version of ob-C.el, as the :libs parameter
  was introduced recently.
  
  
  Le 10/06/2016 14:01, numbch...@gmail.com a écrit :


  
I have a code example like this:



  #+BEGIN_SRC C
  #include 
  #include 
  

  /* define complex struct */
  struct complex_struct {
    double x, y;
  };
  

  /* some helper functions on complex struct */
  double real_part(struct complex_struct z) {
    return z.x;
  }
  double img_part(struct complex_struct z) {
    return z.y;
  }
  double magnitude(struct complex_struct z) {
    return sqrt(z.x * z.x + z.y * z.y);
  }
  double angle(struct complex_struct z) {
    return atan2(z.y, z.x);
  }
  

  /* helper functions to construct complex
  variable */
  struct complex_struct
  make_from_real_img(double x, double y) {
    struct complex_struct z;
    z.x = x;
    z.y = y;
    return z;
  }
  

  struct complex_struct make_from_mag_ang(double
  r, double A) {
    struct complex_struct z;
    z.x = r * cos(A);
    z.y = r * sin(A);
    return z;
  }
  

  /* implement complex arithemtic */
  struct complex_struct add_complex(struct
  complex_struct z1, struct complex_struct z2) {
    return make_from_real_img(real_part(z1) +
  real_part(z2), img_part(z1) + img_part(z2));
  }
  

  int main(int argc, char *argv[]) {
    struct complex_struct z1, z2 = {1.1, 2.4};
    
    struct complex_struct z;
    z = add_complex(z1, z2);
    
    printf("%f", z);
    return 0;
  }
  #+END_SRC
  
  
  But
evaluate it got error:
  
  
  ```
  
/tmp/cckFlXlJ.o: In function `magnitude':
C-src-18467gDZ.c:(.text+0xa8): undefined reference to
  `sqrt'
/tmp/cckFlXlJ.o: In function `angle':
C-src-18467gDZ.c:(.text+0xfe): undefined reference to
  `atan2'
/tmp/cckFlXlJ.o: In function `make_from_mag_ang':
C-src-18467gDZ.c:(.text+0x174): undefined reference to
  `cos'
C-src-18467gDZ.c:(.text+0x190): undefined reference to
  `sin'
collect2: error: ld returned 1 exit status
zsh:1: no such file or directory:
  /tmp/babel-18467-Yn/C-bin-18467tNf
```


So I think `ob-C.el` doesn't support to load included
  header files.
  




  

  
[stardiviner]     GPG key ID: 47C32433
  IRC(freeenode): stardiviner    
  Twitter:  @numbchild
  Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4
  B8E5 47C3 2433
  Blog: http://stardiviner.github.io/

  

  

  


  




Re: [O] Symbol's function definition is void: org-beamer-insert-options-template

2016-06-10 Thread Nicolas Goaziou
Hello,
Giacomo M  writes:

> I would find useful to have a template for beamer presentations. I was
> wandering in the menus and under Org -> Latex I found a "Template for
> BEAMER", which sounded good for what I was looking for. But if I press
> it I get:
>
> menu-function-46: Symbol's function definition is void:
> org-beamer-insert-options-template
>
> Any ideas?

This was a reference to a removed function. I removed it, so it should
not appear anymore in the menu.


Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] interesting dilemma with ob-ipython

2016-06-10 Thread John Kitchin
Thanks for this tip. It was a great start! I turned it into this:

#+BEGIN_SRC emacs-lisp
;; make src blocks open in the right mode
(add-to-list 'org-src-lang-modes '("jupyter-hy" . hy))
(add-to-list 'org-latex-minted-langs '(jupyter-hy  "hylang"))

;; set default headers for convenience
(setq org-babel-default-header-args:jupyter-hy
  '((:results . "output replace")
(:session . "hy")
(:kernel . "hy")
(:exports . "code")
(:cache .   "no")
(:noweb . "no")
(:hlines . "no")
(:tangle . "no")))

(defalias 'org-babel-execute:jupyter-hy 'org-babel-execute:ipython)

(add-to-list 'org-structure-template-alist
 '("hy" "#+BEGIN_SRC jupyter-hy\n?\n#+END_SRC"
   "\n?\n"))
#+END_SRC

Which solves all the problems!
1. src-blocks open in hy-mode and export as hylang in minted.
2.  John Kitchin writes:
>
>> I was looking into ob-ipython as a replacement for regular
>> org-babel-python because it seems to be better at sessions. Also, you
>> can use other kernels with it!
>>
>> For example:
>>
>> #+BEGIN_SRC ipython :session hy :results output :kernel hy
>> (print "hello world")
>> (import time)
>> (print (time.asctime))
>> #+END_SRC
>>
>> #+RESULTS:
>> : hello world
>> : Thu Jun  9 17:26:56 2016
>>
>> Here is the dilemma:
>> If I special edit this, it is in python-mode, not hy-mode. And similarly
>> on export, it is highlighted as ipython, not hy-lang.
>>
>> Any thoughts on how to address these?
>
> I've had success using something like this,
>
> (add-to-list 'org-src-lang-modes '("ipython" . haskell))
>
> in a :noexport: setup section.
>
> Anthony


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] Symbol's function definition is void: org-beamer-insert-options-template

2016-06-10 Thread B.V. Raghav
Giacomo M  writes:

> Dear all,
>
> I would find useful to have a template for beamer presentations. I was
> wandering in the menus and under Org -> Latex I found a "Template for
> BEAMER", which sounded good for what I was looking for. But if I press
> it I get:
>
> menu-function-46: Symbol's function definition is void:
> org-beamer-insert-options-template
The same function on a fresh org file in my system inserts the following
text at point:

#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation]
#+BEAMER_THEME: default
#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act) %4BEAMER_col(Col) 
%8BEAMER_opt(Opt)
#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC

>
> Any ideas?
>
I do not know much else, but `C-c C-e # beamer' inserts the following
text at point

#+OPTIONS: H:1
#+BEAMER_COLOR_THEME:
#+BEAMER_FONT_THEME:
#+BEAMER_HEADER:
#+BEAMER_INNER_THEME:
#+BEAMER_OUTER_THEME:
#+BEAMER_THEME: default
#+LATEX_CLASS: beamer

May be it helps to do once with `emacs -Q' + `M-: (add-to-list
 'org-export-backends 'beamer)' + `M-: (require 'ox-beamer)' followed by
 `C-c C-e # beamer' and/or `Menu > Org > LaTex > Template for BEAMER' on
 a fresh Org file

If that helps all you need is to add to `init.el' is:

(add-to-list 'org-export-backends 'beamer)
(require 'ox-beamer)

HTH
r
-- 
(B.V. Raghav)



Re: [O] HTML export without org title as H1?

2016-06-10 Thread John Kitchin
I am not sure I follow what you want. You can get rid of the title with
the option:  title:nil

This:
#+TITLE: Kanripo 漢籍リポジトリ
#+OPTIONS:   num:nil toc:nil html-style:nil

#+begin_html

   
 
...
#+end_html

** Here starts the first real head

..
and so on

exports to this for me (just the body export).


   
 
...


Here starts the first real head


..
and so on






Christian Wittern writes:

> Hello org users,
>
> I am trying to export an org file to the "content" part of a HTML file. 
> Using header lines and inline html blocks, I basically succeeded in 
> constructing it the way I need it.  However, there is still one stumbling 
> block: It seems that it is hardcoded to use the title of the org file as the 
> first H1 element. This breaks my file, so I would like to suppress that, 
> together with the first  element.  Does anybody know how to achieve 
> that?  Or are there better ways to achieve this?
> What I have so far basically looks like this:
>
> #+TITLE: Kanripo 漢籍リポジトリ
> #+SETUPFILE: kanripo.blog.setup
> #+OPTIONS:   num:nil toc:nil html-style:nil
>
> #+begin_html
> 
>
>  
> ...
> #+end_html
>
> ** Here starts the first real head
>
> ..
> and so on
>
> Any help appreciated,
>
> Christian


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



[O] Symbol's function definition is void: org-beamer-insert-options-template

2016-06-10 Thread Giacomo M

Dear all,

I would find useful to have a template for beamer presentations. I was 
wandering in the menus and under Org -> Latex I found a "Template for 
BEAMER", which sounded good for what I was looking for. But if I press 
it I get:


menu-function-46: Symbol's function definition is void: 
org-beamer-insert-options-template


Any ideas?

Thanks,

Giacomo
Org-mode version 8.3.4 (8.3.4-79-gbd4948-elpaplus)
GNU Emacs 24.5.1 (x86_64-w64-mingw32)




[O] ob-C doesn't support load libraries

2016-06-10 Thread numbch...@gmail.com
I have a code example like this:

#+BEGIN_SRC C
#include 
#include 

/* define complex struct */
struct complex_struct {
  double x, y;
};

/* some helper functions on complex struct */
double real_part(struct complex_struct z) {
  return z.x;
}
double img_part(struct complex_struct z) {
  return z.y;
}
double magnitude(struct complex_struct z) {
  return sqrt(z.x * z.x + z.y * z.y);
}
double angle(struct complex_struct z) {
  return atan2(z.y, z.x);
}

/* helper functions to construct complex variable */
struct complex_struct make_from_real_img(double x, double y) {
  struct complex_struct z;
  z.x = x;
  z.y = y;
  return z;
}

struct complex_struct make_from_mag_ang(double r, double A) {
  struct complex_struct z;
  z.x = r * cos(A);
  z.y = r * sin(A);
  return z;
}

/* implement complex arithemtic */
struct complex_struct add_complex(struct complex_struct z1, struct
complex_struct z2) {
  return make_from_real_img(real_part(z1) + real_part(z2), img_part(z1) +
img_part(z2));
}

int main(int argc, char *argv[]) {
  struct complex_struct z1, z2 = {1.1, 2.4};

  struct complex_struct z;
  z = add_complex(z1, z2);

  printf("%f", z);
  return 0;
}
#+END_SRC

But evaluate it got error:

```
/tmp/cckFlXlJ.o: In function `magnitude':
C-src-18467gDZ.c:(.text+0xa8): undefined reference to `sqrt'
/tmp/cckFlXlJ.o: In function `angle':
C-src-18467gDZ.c:(.text+0xfe): undefined reference to `atan2'
/tmp/cckFlXlJ.o: In function `make_from_mag_ang':
C-src-18467gDZ.c:(.text+0x174): undefined reference to `cos'
C-src-18467gDZ.c:(.text+0x190): undefined reference to `sin'
collect2: error: ld returned 1 exit status
zsh:1: no such file or directory: /tmp/babel-18467-Yn/C-bin-18467tNf
```

So I think `ob-C.el` doesn't support to load included header files.

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


[O] HTML export without org title as H1?

2016-06-10 Thread Christian Wittern

Hello org users,

I am trying to export an org file to the "content" part of a HTML file. 
Using header lines and inline html blocks, I basically succeeded in 
constructing it the way I need it.  However, there is still one stumbling 
block: It seems that it is hardcoded to use the title of the org file as the 
first H1 element. This breaks my file, so I would like to suppress that, 
together with the first  element.  Does anybody know how to achieve 
that?  Or are there better ways to achieve this?

What I have so far basically looks like this:

#+TITLE: Kanripo 漢籍リポジトリ
#+SETUPFILE: kanripo.blog.setup
#+OPTIONS:   num:nil toc:nil html-style:nil

#+begin_html

  

...
#+end_html

** Here starts the first real head

..
and so on

Any help appreciated,

Christian

--
Christian Wittern, Kyoto



[O] org-use-tag-inheritance property for a specific header and sub headers?

2016-06-10 Thread Xebar Saram
Hi all

i normally have this in my config  (setq org-use-tag-inheritance nil) which
is what i want 99% of the time.
I recently noticed that for specific project headers it would be great to
add tag inheritance. is it possible to set tag-inheritance for a specific
header and sub headers? if not how does one set it per file basis?

best

Z