Tales from the Gryphon/ archives/ 2008/

Tales from the Gryphon

Archives for 2008/06

Manoj's hackergotchi
Add a new post titled:
Saturday 21 June
2008
Link: The Command Prompt

Posted terribly early Saturday morning, June 21st, 2008

The Command Prompt

#+STARTUP: hidestars #+TITLE: The Command Prompt #+AUTHOR: Manoj Srivastava #+EMAIL: srivasta@debian.org #+DATE: #+LANGUAGE: en #+TEXT: Or theming PS1 #+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:nil tags:not-in-toc #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js #+LINK_UP: http://www.golden-gryphon.com/blog/manoj/ #+LINK_HOME: http://www.golden-gryphon.com/ I am not fanatical about my command prompt. No sirree, not me. It is just that I spend half my life either staring at an Emacs window, or at an xterm command prompt; so even a marginal boost in productivity goes a long way. And I am often logged in over ssh to machines half a continent away, and am still comfortable enough on the Linux VT to spend time there, and I often do not have the GUI gew-gaws feeding me data. Hmm. Data. inpuuut. No. *Must focus*. With all these open xterms and Emacs terminal mode frames floating around, it is easy to lose track of where I am on each terminal, and what the working directory is. So I want my command prompt to help me keep track of where I am. If the terminal is an xterm, the title can be setup like : "user@host:../shotened/path/to/current/working/dir" I want to know what machine, id (am I root?), and directory I am in. If I am deep down in the labyrinths of some work related directory tree, I want the path to be pruned, from the left, one component at a time. However, this does not help me on the console; so I also want the path to be in the command prompt; but it should not take up too much of the command line; and ideally, should just go away as I type a longish command. Gawd, I love zsh. I once did a analysis of the command history. The most often used command sequences were : cd some-place, ls So. /pwd/ and /ls/. I really really want to see the directory listing when I change directory to a new one. As one grows old, memorizing the directory contents for dozens of machines all the time taxes the gray cells a bit. So, I figure, why _not_ let the command prompt handle all that? Having the current working dir always visible cuts down a heck of a lot on the /pwd/ commands, and so all that's left is to insist that the command prompt thingy _always_ run /ls/ after a change directory. Simple enough. Saves on typing. And time. And this is _not_ just some crazy talk. I want help with noticing whether the previous command exited with an error status (useful for commands that normally do not create an output). If I am logged in to a machine on battery power, I want to know that. I also like visual cues to the amount of power remaining (good for my laptop on the long flights). I don't want to have to know f the machine uses APM or ACPI, I just want my prompt color to change as the power fades. I want my command prompt to let me know if I am in a directory which is under version control, and if so, what branch I am on. (I occasionally have to come in contact with arch, bzr, git, subversion, svk, and mercurial). If I am in a version controlled project, where I am relative to the root of the checked out tree is often more important than the absolute path, so I want to see relative paths, not absolute paths. I want to know if there are uncommitted files in the working directory. Visually. I want to be reminded if I am in the middle of an ongoing : rebase -i . This is not asking for too much, is it? #+BEGIN_HTML Command Prompt #+END_HTML So, here is a screen-shot of this in action: I start from my home directory, go to a directory not under version control, go to a project under git, then a different project with uncommitted files, and then finally to a subversion checkout. All with an angry fruit salad of colors warrantied to make Martin Krafft want to claw his eyes #+BEGIN_HTML out biggrin.png . #+END_HTML If you use zsh, then just grab hold of #+BEGIN_HTML this, #+END_HTML and then do: : autoload -U promptinit : promptinit : prompt manoj This might be a bit of a hit on slow machines, but even my laptop is a core 2 duo, so I do not find it noticeable. Oh, and if you liked this article, you might also like #+BEGIN_HTML Theming Emacs, #+END_HTML and #+BEGIN_HTML Theming XTerms. #+END_HTML

Manoj

Thursday 19 June
2008
Link: Theming XTerms

Posted early Thursday morning, June 19th, 2008

Theming XTerms

#+STARTUP: hidestars #+TITLE: Theming XTerms #+AUTHOR: Manoj Srivastava #+EMAIL: srivasta\@debian.org #+DATE: <2008-06-19 Thu> #+LANGUAGE: en #+TEXT: Or configuring LS COLORS #+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:nil tags:not-in-toc #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js #+LINK_UP: http://www.golden-gryphon.com/blog/manoj/ #+LINK_HOME: http://www.golden-gryphon.com/ After successfully #+BEGIN_HTML Theming Emacs, #+END_HTML I decoded to turn my efforts to providing more copacetic colors in other aspects of my working environment. I'll write more about my effort to write my own color theme for #+BEGIN_HTML fvwm #+END_HTML when it is closer to being done. For now, I'll concentrate on "ANSI Colors" in XTerms, and how one may theme those. The old Tektronics (or ANSI) terminals had 8 colors, namely, /black, red, green, yellow, blue, magenta, cyan/, and /white/. These colors had a normal, and a *bright* mode. The default set of colors is OK, but is not optimal, since they have to work on both dark and light backgrounds; however, I use mostly dark background colors. #+BEGIN_HTML ls colors #+END_HTML Given that, I set to design my own colors, using fully laturated colors, with a base luminosity of 70, and equally spaced in chroma -- and used the same saturation and chroma, but a luminosity of 80, for the bright set. This results in a pleasant pastely set of colors, which are e4asy on the eyes, when used on very dark backgrounds. The configuration can be seen in #+BEGIN_HTML XTerm. #+END_HTML I set the colors for /rxvt/ as well as /xterm/. Now, the most noticeable effect of these changes is if using the color option for /ls/, therefore the next thing to do was to configure the colors used by /ls/ using a utility dedicated for that task, namely, /dircolors/. By trial and error, I modified the default configuration provided by /dircolors/ and ended up with #+BEGIN_HTML dir colors, #+END_HTML with the results as you see.

Manoj

Monday 09 June
2008
Link: Using org-mode with Ikiwiki

Posted terribly early Monday morning, June 9th, 2008

Using org-mode with Ikiwiki

#+TITLE: Using org-mode for Ikiwiki #+AUTHOR: Manoj Srivastava #+EMAIL: srivasta\@debian.org #+DATE: #+LANGUAGE: en #+TEXT: Using org mode to write ikiwiki posts #+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:nil tags:not-in-toc #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js #+LINK_UP: http://www.golden-gryphon.com/blog/manoj/ #+LINK_HOME: http://www.golden-gryphon.com/ I have been much taken by [[http://orgmode.org/][org-mode]] in Emacs recently. Firstly, this has allowed me to actually effectively implement the tenets of "Getting things done", which is amazing by itself. I always used to start with great enthusiasm, which rarely lasted longer than a week. Until org-mode. Then this is so amazingly flexible. It has better handling of tables and even a spreadsheet mode than anything I have used --- and it has a pretty decent HTML export function. I practically live in org-mode on work days now. I strongly recommend org-mode, from things like agendas, TODO lists, calendars, appointments, articles, and now Ikiwiki posts. I rarely ever use markdown, apart from blogging using Ikiwiki -- and thus, since I blog so infrequently, I rarely ever remember all the syntax. On the other hand, org-mode syntax is now at my finger tips -- so I decided it was time to write a Ikiwiki plugin so I can now write my blog posts using syntax I can actually remember. It is still rough around the edges -- firstly, this requires emacs23 (or, on Debian, there is the unofficial emacs-snapshot package), secondly, it uses hueristic hacks to prune away the bits of the stand alone HTML page that org-mode creates; all I can say is that it currently works for me, as you can see from this post. How git this is for mainlne inclusion is another matter. The code is here: [[http://www.golden-gryphon.com/software/misc/org.pm.html][org.pm]]. It can be dropped in to the Ikiwiki plug-in directory, and that's all you need. With this, Ikiwiki pre-process things in the input file, and then passes it to emacs to htmlize it.

Manoj


Webmaster <webmaster@golden-gryphon.com>
Last commit: terribly early Sunday morning, June 8th, 2014
Last edited terribly early Sunday morning, June 8th, 2014