Photo: Ganges River

Perm url with updates: http://xahlee.org/dinju/ganges_river.html

Photo: Ganges River

Xah Lee, 2011-10-20

Ganges river.

Ganges river Varanasi
Ganges River at Varanasi, India. 2005-01-08 img src
Devprayag Bhagirathi Alaknanda-s
Devprayag, India. img src
800px-Ganges-Brahmaputra-Meghna basins
img src

View Larger Map

Emacs Lisp: Loop Thru a List with dolist

Emacs Lisp: Loop Thru a List

Learned 2 elisp functions: {“dolist”, “number-sequence”}.

“dolist” lets you loop over a list with a variable. Here's sample usage:

(dolist (x '(1 2 3)) (insert (number-to-string x))) ; inserts "123"

“number-sequence” just generates a list of numbers:

(number-sequence 3 8) ; ⇒ (3 4 5 6 7 8)

Both are parts of emacs 23, but they are implemented as lisp macros. (Call “describe-function” to see their doc and source code.)

Normally, you can loop with a “while”, but the “dolist” syntax is leaner.

I learned them from jcs's blog. See:

Jon is a expert in Common Lisp, Scheme Lisp, and C. He often give useful tips about emacs. Very well written.


梨花淚 (Tears of Pear Blossom)

Perm url with updates: http://xahlee.org/music/blossom_tears.html

梨花淚 (Tears of Pear Blossom)

Xah Lee, 2011-10-19

A beautiful song. 梨花淚, originally sung by 于櫻櫻 (b1954) in 1977. The song is written by 于文.

Title: 梨花淚
Date: 1977
Singer: 于櫻櫻
Lyrics: 于文
Music: 于文
English translation: 李杀 (Xah Lee)




tears of pear blossom

loving you i could never regret
who else better understands me

the rain drizzles like the falling of pear blossoms
every petal is precious

when together the sweetness fills me
in separation a beautiful dream is gone

the rain drizzles like the falling of pear blossoms
hoping it will bud again
“姚蘇蓉-梨花淚”, 1978
“于櫻櫻-梨花淚”, 1977
pear blossoms
pear blossoms. img src

The flower of the pear tree is very small, having a diameter of ~3 cm. When windy, they fall like rain.

pear tree pyrus calleryana
Pear tree img src


Why X11 Color Names Are Fuckedup

Quote from Wikipedia X11 color names:

In computing, on the X Window System, X11 color names are represented in a simple text file, which maps certain strings to RGB color values. It is shipped with every X11 installation, hence the name, and is usually located in ‹X11root›/lib/X11/rgb.txt.

It is not known who originally compiled the list. The list shows a continuity neither in selected color values nor in color names, and many color triplets have multiple names. Despite this, graphic designers and others got used to them, making it practically impossible to introduce a more stringent and logical alias list.

Why it's like that? Because it's the unix philosophy!

Time to reread: The X-Windows Disaster.

Qi lisp functional language new home page

The lisp derived functional language Qi, now has a home page at shenlanguage.org.

the Death of Dennis Ritchie

Perm url with updates: http://xahlee.org/comp/Death_of_Dennis_Ritchie.html

Slightly annoyed by the so many eulogies of Dennis Ritchie from programing geeks (and then the one thousand SEO fucking sites trying to make a buck out of it (such as TechCrunch, SearchEngineLand — am nice guy and respect all — scumbags)).

So, am about to badmouth this idiot who just died — your hero, who you consider did great contribution to mankind. Are you gonna be offended?

Let me give you this perspective. Let's say it's someone you hate, is someone you consider a criminal of mankind, who did massive harm to society in a indirect way. Say, it's George W Bush, or the Catholic Pope, or Bill Gates.

Can you see the perspective now?

I hate unix. It is unix and its people, that did the computing world massive harm. It is unix, that introduced sloppy hack to the programing industry, brought about the entire security/hacking scene to the computing world. Well i exaggerated a bit, but you know i hate unix, and its people, in particular a few charlatans such as Larry Wall and i believe also Rob Pike and Eric Raymond. (disclaimer: all opinion only.)

Dennis Ritchie i don't really know what's his character. But i do know that C language, his creation, is one of the most fucked up hack.

While many tech geekers evoke a feeling of unfairness about why the mob cries a river over the death of Steve Jobs but not Dennis while Dennis did “far more contribution”, but then, have you thought about why you couldn't even name one mathematician who died in the past decade yet whose contribution to mankind far surpass Dennis Ritche?

emacs lisp update: replace-digits-by-subscript

Thanks to Jon Snader (aka jcs)'s solution on last week's problem and some discussion, now updated: Emacs Lisp Exercise: replace-digits-by-subscript.


Emacs Cygwin gunzip Problem

Perm url with updates: http://xahlee.org/comp/emacs_cygwin_gunzip_problem.html

Emacs Cygwin gunzip Problem

Xah Lee, 2011-10-18

If you are on Windows and using Cygwin and emacs, there's a problem with gunzip.


When in dired, when you press Z on a gzipped file, emacs will give this error:

apply: Searching for program: no such file or directory, gunzip


The solution is to add a file at 〔c:/cygwin/bin/gunzip.bat〕. The file content should be this:

@echo off 
gzip -d %1


Here's some detail about this problem i wrote in 2009.

From: Xah Lee
Date: Nov 4 2009, 9:32 am
Subject: gunzip problem on Windows
To: gnu.emacs.help, comp.emacs

when using emacs on Windows, when in dired, when i press Z on a file
that's gzip compressed, emacs tells me:
'gunzip' is not recognized as an internal or external command,

the problem is apparently that emacs won't recognize the gunzip shell
script without the exe suffix. (the gunzip is in the same dir as
gzip.exe) But if i rename gunzip to gunzip.exe, but Windows complain
that the file is not a exe format.

How to solve this problem?

extra detail:

when i do
(executable-find "gzip")
emacs says

(executable-find "gunzip")

the gunzip exists at

which is a shell script.
From: Xah Lee
Date: Nov 5 2009, 12:34 pm
Subject: gunzip problem on Windows
To: gnu.emacs.help, comp.emacs

So far, i haven't been able to get this to work, after taking in all
the suggestions in this thread.

Here's a more full report.

Suppose in dired you have a a file named x.txt.gz, and you move your
cursor to it, then press Z. Emacs will ask you “Compress or uncompress
x.txt.gz? (y or n)”. Answer y should uncompress the file, as the
expected behavior.

I have “gunzip” installed by cygwin at “C:\cygwin\bin”. In emacs, when
you do a “shell-command” then “which gunzip”, the output is “/usr/bin/gunzip”.
This means, emacs can find the file.

The content of that file is:
exec gzip -d "$@"

Here's the problem. When i do Z, i get this error:
“apply: Searching for program: no such file or directory, gunzip”.

This is odd and shouldn't happen, since the file is right there and
emacs can find the file by “which gunzip”.

if i rename the file to gunzip.bat, then i do Z in dired on the file,
i get this error:

'#!' is not recognized as an internal or external command,
operable program or batch file.


c:\Users\xah\web\xahlee_org\emacs>exec gzip -d "$@"
'exec' is not recognized as an internal or external command,
operable program or batch file.
Failed to compressc:/Users/xah/web/xahlee_org/emacs/xxxx.txt.gz

So, apparantly, emacs can find the program now, but for some mixed
reasons of Windows cmd.exe and cygwin bash and emacs, it seems to run
it as win cmd.exe script and not bash. I suppose this is expected

if i rename the file to gunzip.sh, i get this error:

«apply: Searching for program: no such file or directory, gunzip»

the value of my exec-suffixes is
(".exe" ".com" ".bat" ".cmd" ".btm" "")
after changing it to
(".exe" ".com" ".bat" ".cmd" ".btm" ".sh" "")

still same error.

Renaming the file to gunzip.exe wont work because .exe files needs to
be in certain format.

Note that also even if renaming to gunzip.bat or gunzip.sh worked for
this emacs usage situation, that probably isn't a good solution
because it will probably break cygwin, since in unix shell it is
expected to be just “gunzip” not “gunzip.bat” or “gunzip.sh”. So, if
renaming can work for emacs, possibly i'll just create it else where
and put it in a different path...

am i missing something?

does Z in dired on a compressed file work for anyone in Windows?
From: Xah Lee
Date: Nov 5 2009, 1:23 pm
Subject: gunzip problem on Windows
To: gnu.emacs.help, comp.emacs

Found a solution. Create a file name gunzip.bat, with this content:

@echo off
gzip -d %1

thanks to Eli and others.

I filed a bug report to FSF on this. #4867. I think this should still
considered a bug though. Considering it as a Windows OS problem isn't
very helpful in solving this. I'm sure if similar problems happens in
linux that's OS issue, people probably will not look at it as “Oh,
it's OS issue, emacs doesn't need to deal with it”.

The full thread is at Source groups.google.com.