The Case Sensitive Problem of the Code Identifiers in Org Mode
Contents
While I am using Org Mode to write blog articles, I need to insert source code frequently. Emacs Org Mode provides an easy way to do this job, and I am using Org Mode to insert source code, publish to Html and upload it to WordPress.
While inserting source code in Org Mode, I use YASnippet mode. So, what’s the specific of the Identifiers of programming languages?
Working With Source Code: Languages has already described the abbreviation of the Identifiers, but I still try to make it clearly whether we can use uppercase or lowercase identifier, or both.
After my test, the Identifiers are case sensitive, so we should pay attention to it and input the identifiers according to Org Mode manual exactly.
For example, if we use Cpp to identify following code, the output HTML color theme is:
// assignment operator with lists
#include
using namespace std;
int main ()
{
list
second=first;
first=list
cout « “Size of first: " « int (first.size()) « endl; cout « “Size of second: " « int (second.size()) « endl; return 0; }
If we use cpp which is lowercase, the output HTML color theme is:
// assignment operator with lists
#include
using namespace std;
int main () { list<int> first (3); // list of 3 zero-initialized ints list<int> second (5); // list of 5 zero-initialized ints
second=first; first=list<int>();
cout « “Size of first: " « int (first.size()) « endl; cout « “Size of second: " « int (second.size()) « endl; return 0; }
If we identify above code using C which is upppercase, the output HTML color theme is:
// assignment operator with lists
#include
using namespace std;
int main () { list<int> first (3); // list of 3 zero-initialized ints list<int> second (5); // list of 5 zero-initialized ints
second=first; first=list<int>();
cout « “Size of first: " « int (first.size()) « endl; cout « “Size of second: " « int (second.size()) « endl; return 0; }
If we use c which is lowercase, the output HTML color theme is:
// assignment operator with lists
#include
using namespace std;
int main () { list<int> first (3); // list of 3 zero-initialized ints list<int> second (5); // list of 5 zero-initialized ints
second=first; first=list<int>();
cout « “Size of first: " « int (first.size()) « endl; cout « “Size of second: " « int (second.size()) « endl; return 0; }
So, there is tiny difference! Let’s pay attention to programming language identifiers while you insert source code block in Org Mode.
BTW:
- please change the HTML CSS file to make the background of source code block to be black. By doing this, Reading code will be visual enjoyment.
- Htmlize is just used to output elisp file ( which is using el extention ) to HTML file and keep the color Highlighted. It doesn’t affect Org Mode to export source code as HTML.
Author Watterry
LastMod 2012-10-16