I did try it, but the resulting code wasn’t fitting with my cute CSS. Still, the idea of having a nicely highlighted code was a little lingering desire of mine.
I knew there was a way to do it with the Org-Mode export, but somehow the solution eluded me.
The first problem was directly in my org file:
#+BEGIN_SRC Powershell :exports code $visio = [Runtime.InteropServices.Marshal]::GetActiveObject("Visio.Application") #+END_SRC
Seems about right? NO! The language mode must not begin by a capitalized letter! This is how it should be:
#+BEGIN_SRC powershell :exports code $visio = [Runtime.InteropServices.Marshal]::GetActiveObject("Visio.Application") #+END_SRC
“But Frozenlock, your elisp code wasn’t pretty either!” Urhm… no it wasn’t, which brings me to the second problem. A careful attention to the
*Messages* buffer shown that Babel was talking about a certain
htmlize.el file. Guess what? This file didn’t come by default in my Win32 Emacs, nor in my org-mode package. The usual download and following code in my .emacs solved the problem:
(add-to-list 'load-path (concat dropbox-directory "htmlize")) ; Where dropbox-directory is the path to my dropbox.
Solved the elisp problem!
Unfortunately, Powershell was still a challenge. Again, the
*Messages* buffer gave me the necessary hint:
(wrong-type-argument stringp t)
A quick google search brought me to Xah Lee’s website (which is like Rome, but for Emacs… you always end up there).
Note: as of version 0.5 of powershell-mode, it has a bug that generats the error 「(wrong-type-argument stringp t)」. This error is quite harmless but you can get rid of it by commenting out the devar of powershell-imenu-expressions (line 167-170), and comment out the defun of powershell-setup-imenu (line 171-179), and comment out line 206 of 「(powershell-setup-imenu)」.
Finally, after all this, you can now enjoy pretty syntax highlighting directly from my org files! Phew!