Most editors will give you syntax colouring for languages which they support, typically Java, C++, and C and a gaggle of scripting languages. And a whole bunch of user supplied syntax files in each editor specific language file.
Emacs too provides such a feature but with a different twist where the things can be coloured on the fly. More importantly, any random buffer can be made to highlight any keyword based on regular expressions.
While working on Autosys scripts which had close to 100 odd steps it looked like the first screenshot.
To make it more readable, here's what I did
1. Colour the comment green
2. Colour the command shell script blue
3. Colour the Box name blue
4. Colour the condition as red
a. Start off by invoking M-x hi-lock-mode
b. hit C-x w l /\* RET hi-green-b and you get the second screenshot
c. hit C-x w l command: RET hi-blue-b
d. hit C-x w l box_name: RET hi-blue-b
e. hit C-x w l condition: RET hi-red-b
After doing the above, you should get something akin to the final screenshot. Now, that is something which is easier on the eyes (OK, bad colour choices) than the plain vanilla text file. In fact, nothing happens to the actual text file, only the emacs buffer containing the file is fontified.
In the Info manual, please see Emacs->Highlight Interactively to see other keybindings and colouring or font locking options.
Postings on living in an Emacs world. Posts will be mostly on using Emacs, related functions and tools.
Ads by Google
Wednesday, October 24, 2007
Thursday, October 18, 2007
Dired Power
One thing which strikes you when using Emacs is how it is designed by programmers for programmers. And then some.
Small things which might require a whole series of actions in other editors or complete context switching to another application are too easy in Emacs.
Take for example, getting the file name putting it in the clipboard or another application.
In Dired, just hit 'w' and you will get the file name in the kill ring. Paste that into any other application. Just think of the effort required on a Windows machine!
Want the full path? No problem, hit '0 w' to get the absolute path.
Right, you want a bunch of file names to be copied? mark all the files with 'm' and then hit w or '0 w'. You will get a space separated list of names in the kill ring which you can paste into another buffer.
Go on, try it out. Invoke dired by M-x dired or C-x d.
Small things which might require a whole series of actions in other editors or complete context switching to another application are too easy in Emacs.
Take for example, getting the file name putting it in the clipboard or another application.
In Dired, just hit 'w' and you will get the file name in the kill ring. Paste that into any other application. Just think of the effort required on a Windows machine!
Want the full path? No problem, hit '0 w' to get the absolute path.
Right, you want a bunch of file names to be copied? mark all the files with 'm' and then hit w or '0 w'. You will get a space separated list of names in the kill ring which you can paste into another buffer.
Go on, try it out. Invoke dired by M-x dired or C-x d.
Tuesday, October 16, 2007
A good habit
is to check the site, http://planet.emacsen.org/ every day. Bunch of people use Emacs any which way and it's always nice to see someone use it in ways that make you go ahhhh!
Sunday, October 14, 2007
Repeating Numbers in Emacs
With the universal prefix, ' C-u', it's possible to repeat text, either the default 4 times or with numeric arguments 'n', n times.
So
C-u 1 0 #
will give you 10 #s.
What if you want 10 1s?
C-u 1 0 1
only specifies a 101 repeat sequence.
A quick peek at the manual reveals the answer.
`C-u 6 4 a' inserts 64 copies of the character `a'. But this does not work for inserting digits; `C-u 6 4 1' specifies an argument of 641. You can separate the argument from the digit to insert with another `C-u'; for example, `C-u 6 4 C-u 1' does insert 64 copies of the character `1'.
So the answer is 'C-u 1 0 C-u 1'.
Emacs has all the answers, you need to ask the right questions. :-)
So
C-u 1 0 #
will give you 10 #s.
What if you want 10 1s?
C-u 1 0 1
only specifies a 101 repeat sequence.
A quick peek at the manual reveals the answer.
`C-u 6 4 a' inserts 64 copies of the character `a'. But this does not work for inserting digits; `C-u 6 4 1' specifies an argument of 641. You can separate the argument from the digit to insert with another `C-u'; for example, `C-u 6 4 C-u 1' does insert 64 copies of the character `1'.
So the answer is 'C-u 1 0 C-u 1'.
Emacs has all the answers, you need to ask the right questions. :-)
Well, it's about Time....
to create my own blog, I guess after everyone else has been there, done that. I'm going to try to stick to Emacs as much as possible without trying to engage in flames, baiting and insults. But my patience is legendary by its absence, so it's not going to be a promise.
That's it. This is done through the Web posting method on blogger. I'll soon figure out Emacsen way of posting to Blogger.
That's it. This is done through the Web posting method on blogger. I'll soon figure out Emacsen way of posting to Blogger.
Subscribe to:
Posts (Atom)