Re: [O] Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa /home/pillow/.emacs.d/elpa/org-20151123/)]

2015-12-20 Thread Robert Klein
Hi,

On 12/20/2015 11:06 AM, Pillow Kuda Sai wrote:
> Nicolas Goaziou  nicolasgoaziou.fr> writes:
> 
>> You may try
>>
>>   (org-file-contents "~/Blog/html/preamble.html")
> 
> That worked! Should have figured out that insert-file-contents does not 
> return a string. Thanks for the help Nicolas!
> 
> Happy holidays,
> 
> pillow.
> 


ah, I'll try that, too.

My current solution is a function like


(defun my-html-preamble (options)
  (with-temp-buffer
(insert-file-contents "~/Documents/myproject/html/preamble.html")
(buffer-string)))


Best regards
Robert




Re: [O] Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa /home/pillow/.emacs.d/elpa/org-20151123/)]

2015-12-20 Thread Nicolas Goaziou
Hello,

Pillow Kuda Sai  writes:

> (defun my-html-preamble (options)
>   (insert-file-contents "~/Blog/html/preamble.html"))
>
> but this does not include my preamble.html.
>
> As far as I could tell from the documentation :html-preamble should accept 
> any function that returns a string but so far no luck.

  (insert-file-contents "~/Blog/html/preamble.html")

doesn't return a string, but a list when evaluated (see
`insert-file-contents' docstring).

You may try

  (org-file-contents "~/Blog/html/preamble.html")


Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa /home/pillow/.emacs.d/elpa/org-20151123/)]

2015-12-20 Thread Pillow Kuda Sai
Nicolas Goaziou  nicolasgoaziou.fr> writes:

> You may try
> 
>   (org-file-contents "~/Blog/html/preamble.html")

That worked! Should have figured out that insert-file-contents does not 
return a string. Thanks for the help Nicolas!

Happy holidays,

pillow.






Re: [O] Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa /home/pillow/.emacs.d/elpa/org-20151123/)]

2015-12-19 Thread Pillow Kuda Sai
Hi Robert,

Thanks for the reply but my end goal is to insert the contents of another 
file as the preamble. Ultimately, I want something like this:

(insert-file-contents "~/Blog/html/preamble.html")

To be inserted as the preamble.

Your example works unmodified but once I try to insert the contents of my 
preamble.html it doesn't get included.

I tried:

(defun my-html-preamble (options)
  (insert-file-contents "~/Blog/html/preamble.html"))

but this does not include my preamble.html.

As far as I could tell from the documentation :html-preamble should accept 
any function that returns a string but so far no luck.

Kind regards,

pillow.




Re: [O] Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa @ /home/pillow/.emacs.d/elpa/org-20151123/)]

2015-12-15 Thread Robert Klein
Hi,

I only use a function name, e.g.

(defun my-html-preamble (options)
"my preamble")

and

(setq org-publish-project-alist
  '(
("org-notes"
 :base-directory "~/org/"
 :base-extension "org"
 :publishing-directory "~/public_html/"
 :recursive t
 :publishing-function org-html-publish-to-html
 :html-preamble my-html-preamble)))

Does this work for you?

Best regards
Robert


On 12/12/2015 08:26 PM, Pillow Kuda Sai wrote:
> My setup:
> ;;; Minimal setup to load latest 'org-mode'
> ;; activate debugging
> (setq debug-on-error t
>   debug-on-signal nil
>   debug-on-quit nil)
> 
> ;; add latest org-mode to load path
> (add-to-list 'load-path (expand-file-name "~/.emacs.d/elpa/org-20151123/"))
> (add-to-list 'load-path (expand-file-name
> "~/.emacs.d/elpa/org-20151123/" t))
> 
> What I did:
> (require 'ox-publish)
> (setq org-publish-project-alist
>   '(
>   ("org-notes"
>:base-directory "~/org/"
>:base-extension "org"
>:publishing-directory "~/public_html/"
>:recursive t
>:publishing-function org-html-publish-to-html
>:headline-levels 4 ; Just the default for this project.
>:auto-preamble t
>;; :html-preamble "Howdy" ; does work
>:html-preamble (concat "Howdy")
>)
>   ("org-static"
>:base-directory "~/org/"
>:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
>:publishing-directory "~/public_html/"
>:recursive t
>:publishing-function org-publish-attachment
>)
>   ("org" :components ("org-notes" "org-static"
> 
> What I expected: All off the above code is from
> http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html
> except for the :html-preamble part. I want to add my own preamble by
> using a function. :html-preamble sets org-html-preamble (the options
> are: nil, t, string, function that must return a string). When using a
> string (:html-preamble "Howdy") it works. When using a function that
> returns a string (:html-preamble (concat "Howdy")) it doesn't work.
> 
> I'm not entirely sure if this is a bug or if I'm missing something but
> hopefully the mailing-list can help me out :)
> 
> Thanks in advance, Pillow
> 
> 
> 
> 
> Emacs  : GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
>  of 2015-10-09
> Package: Org-mode version 8.3.2 (8.3.2-39-gd537a3-elpa @
> /home/pillow/.emacs.d/elpa/org-20151123/)
> 
> current state:
> ==
> (setq
>  org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa"
> . artist) ("asymptote" . asy)
> ("dot" . fundamental) ("sqlite" . sql) ("calc" . 
> fundamental)
> ("C" . c) ("cpp" . c++)
> ("C++" . c++) ("screen" . shell-script))
>  org-tab-first-hook '(org-hide-block-toggle-maybe
> org-src-native-tab-command-maybe
> org-babel-hide-result-toggle-maybe 
> org-babel-header-arg-expand)
>  org-sparse-tree-default-date-type 'scheduled-or-deadline
>  org-latex-default-packages-alist '(("AUTO" "inputenc" t) ("T1"
> "fontenc" t) ("" "fixltx2e" nil) ("" "graphicx" t)
>   ("" "longtable" nil) ("" "float" nil) ("" 
> "wrapfig" nil) (""
> "rotating" nil)
>   ("normalem" "ulem" t) ("" "amsmath" t) ("" 
> "textcomp" t) (""
> "marvosym" t)
>   ("" "wasysym" t) ("" "amssymb" t) ("" 
> "hyperref" nil)
> "\\tolerance=1000")
>  org-speed-command-hook '(org-speed-command-default-hook
> org-babel-speed-command-hook)
>  org-occur-hook '(org-first-headline-recenter)
>  org-metaup-hook '(org-babel-load-in-session-maybe)
>  org-html-format-drawer-function '(lambda (name contents) contents)
>  org-clock-into-drawer nil
>  org-latex-format-inlinetask-function 'ignore
>  org-confirm-shell-link-function 'yes-or-no-p
>  org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
>  org-latex-text-markup-alist '((bold . "\\textbf{%s}") (code . verb)
> (italic . "\\emph{%s}")
>  (strike-through . "\\sout{%s}") (underline . 
> "\\uline{%s}")
>  (verbatim . protectedtexttt))
>  org-latex-format-headline-function
> 'org-latex-format-headline-default-function
>  org-after-todo-state-change-hook '(org-clock-out-if-current)
>  org-latex-format-drawer-function '(lambda (name contents) contents)
>  org-src-mode-hook '(org-src-babel-configure-edit-buffer
> org-src-mode-configure-edit-buffer)
>  org-agenda-before-write-hook '(org-agenda-add-entry-text)
>  org-babel-pre-tangle-hook '(save-buffer)
>  org-html-allow-name-attribute-in-anchors t
>  org-latex-logfiles-extensions '("aux" "idx" "log" "out" "toc" "nav"
> "snm" "vrb")
>  org-export-copy-to-kill-ring 'if-interactive
>  org-mode-hook '(#[nil 

[O] Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa @ /home/pillow/.emacs.d/elpa/org-20151123/)]

2015-12-13 Thread Pillow Kuda Sai
My setup:
;;; Minimal setup to load latest 'org-mode'
;; activate debugging
(setq debug-on-error t
  debug-on-signal nil
  debug-on-quit nil)

;; add latest org-mode to load path
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elpa/org-20151123/"))
(add-to-list 'load-path (expand-file-name
"~/.emacs.d/elpa/org-20151123/" t))

What I did:
(require 'ox-publish)
(setq org-publish-project-alist
  '(
("org-notes"
 :base-directory "~/org/"
 :base-extension "org"
 :publishing-directory "~/public_html/"
 :recursive t
 :publishing-function org-html-publish-to-html
 :headline-levels 4 ; Just the default for this project.
 :auto-preamble t
 ;; :html-preamble "Howdy" ; does work
 :html-preamble (concat "Howdy")
 )
("org-static"
 :base-directory "~/org/"
 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
 :publishing-directory "~/public_html/"
 :recursive t
 :publishing-function org-publish-attachment
 )
("org" :components ("org-notes" "org-static"

What I expected: All off the above code is from
http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html
except for the :html-preamble part. I want to add my own preamble by
using a function. :html-preamble sets org-html-preamble (the options
are: nil, t, string, function that must return a string). When using a
string (:html-preamble "Howdy") it works. When using a function that
returns a string (:html-preamble (concat "Howdy")) it doesn't work.

I'm not entirely sure if this is a bug or if I'm missing something but
hopefully the mailing-list can help me out :)

Thanks in advance, Pillow




Emacs  : GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
 of 2015-10-09
Package: Org-mode version 8.3.2 (8.3.2-39-gd537a3-elpa @
/home/pillow/.emacs.d/elpa/org-20151123/)

current state:
==
(setq
 org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa"
. artist) ("asymptote" . asy)
  ("dot" . fundamental) ("sqlite" . sql) ("calc" . 
fundamental)
("C" . c) ("cpp" . c++)
  ("C++" . c++) ("screen" . shell-script))
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
  org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-sparse-tree-default-date-type 'scheduled-or-deadline
 org-latex-default-packages-alist '(("AUTO" "inputenc" t) ("T1"
"fontenc" t) ("" "fixltx2e" nil) ("" "graphicx" t)
("" "longtable" nil) ("" "float" nil) ("" 
"wrapfig" nil) (""
"rotating" nil)
("normalem" "ulem" t) ("" "amsmath" t) ("" 
"textcomp" t) (""
"marvosym" t)
("" "wasysym" t) ("" "amssymb" t) ("" 
"hyperref" nil)
"\\tolerance=1000")
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-clock-into-drawer nil
 org-latex-format-inlinetask-function 'ignore
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-text-markup-alist '((bold . "\\textbf{%s}") (code . verb)
(italic . "\\emph{%s}")
   (strike-through . "\\sout{%s}") (underline . 
"\\uline{%s}")
   (verbatim . protectedtexttt))
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-html-allow-name-attribute-in-anchors t
 org-latex-logfiles-extensions '("aux" "idx" "log" "out" "toc" "nav"
"snm" "vrb")
 org-export-copy-to-kill-ring 'if-interactive
 org-mode-hook '(#[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-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers org-cycle-hide-inline-tasks