Erik Naggum

Xah wrote:
> • Death Of A Troll
> http://xahlee.org/Netiquette_dir/death_of_a_troll.html
> According to Wikipedia, Erik has contributed significantly to emacs.
> ...
> I have become a emacs lisp programer since 2006. I recall, in 2007 or
> so, out of boredom and curiosity, i tried to check what code Erik has
> put in emacs. My check is only casual and not in anyway thorough or as
> research, but i recall, all i can find on the surface is one obscure
> lisp package, i think it was related to date time format. (much of the
> hand-waving in this article will be solidified or corrected in the
> coming months, as i find more time to search my archive or check
> facts)

On Jun 25, 7:11 pm, D Herring wrote:
> Erik authored roughly 176 emacs commits, most of which were small
> bugfixes. Not a prolific coder, Erik definitely cared about details,
> often cleaning up after RMS himself.
> # git-clone git://git.sv.gnu.org/emacs.git
> # cd emacs
> # git log | grep 'Erik Naggum' | wc -l
> 176

Thanks for the info.

I've update my essay on Erik on this and there some minor editing work on links, clarification, etc. Here's some of the more informative pieces on Erik.

* “Erik Naggum” (2009-06-20) by Luis Fernandes (aka elf). Source (Luis is one of the person in emacs community i respect, for his love of humanity. I think Luis is mostly known to public as the author of Emacs Logo.)

* “Erik Naggum, R.I.P.” (2009-06-24) by Kent Pitman Source (Kent is a major figure in the Common Lisp community, most well known for having co-authored many lisp standards or part of the design committee. He also post frequently on comp.lang.lisp for as far as i know over the past decade. (according to google, he's the all time most frequent poster there as of today (2009-06). He and Erik used to tie for the 1st or 2nd place over the years. Since Erik stopped posting in 2004, Erik's is now all-time 5th.))

* “RIP, Erik Naggum” (2009-06-21) by “Xach” (aka Zach) Source (Xach is a regular in the Common Lisp community. Of his commentary, he collected and sorted some of Erik's writings.)

* “My Dinner with Erik” (2009-06-26) by Ron Garret. Source (Ron Garret (aka Erann Gat) was a frequent poster to comp.lang.lisp too, most notable for his Common Lisp involvement at his work JPL. He is one of the person who got into fights with Erik. Some of the most abusive posts from Erik is directed at Ron. (Note: Erik has such standing with a number of high profile lispers too, including, for example, lead programers at Franz Lisp.))

* “RIP Erik Naggum (1965-2009)” (2009-06-27) by Rolf Marvin Bøe Lindgren. Source. (Erik's personal friend since highschool. This one is interesting because it gives some glimpse of how Erik is in real life.)

* Wikipedia. Offers some summary of Erik's works.

* Emacs wiki. Offers some summary of Erik's contribution to emacs.

∑ http://xahlee.org/


emacs tab bar

> > Again, not sure exactly what you're referring to. I have never seen
> > tabs in the MacPorts built version of Emacs.
> From http://aquamacs.org/features.shtml:
> "Aquamacs Emacs can organize the files that you're editing in tabs.
> This preserves screen space but allows you to keep track of all those
> open files easily. You've probably seen the tabs in Safari, Firefox or
> the OS X Terminal program."
> See also http://aquamacs.org/images/aquamacs-screenshot.pngtoo.
> Aquamacs tabs are similar to firefox tabs.

The tabs in Aquamac Emacs is based on the tabbar.el module.

tabs in emacs is quite different from tabs in firefox or any modern app's tabs.

The bottom reason for this is that emacs doesn't do tabs, instead, it has buffers. You can have many windows (what emacs calls frames), and each window can access any buffer. However, tabs in modern apps does not work like that. In modern apps, each windows has a set of tabs. You could move a tab from one window to another in some (such as Firefox version 3 or later), but in general, you don't have a set of tabs that any set of windows can access or display.

in practice, this means when you use tabs in emacs, it's quite different. Tabs in emacs is merely just a prettified GUI for accessing buffers.

See this page on emacswiki:

the following section is largely written by me. I don't like some of the minor editing that made it as is today, but here's the section as it is, which still largely correct:

The tabbar.el is extensively modified and used by AquamacsEmacs to be as close to modern UI’s tab bar as possible. (see AquamacsEmacs’s official website screenshot for a look. You can also try to get the source code from AquamacsEmacs, but it may not work with standard emacs.)

Note that tabbar mode as implemented in Emacs is a bit different than tabs in web browsers or IDEs. In a web browser, each window may have several tabs, and each window’s tabs stay with that window. Namely, you cannot have Window A’s tab jump to window B, unless you drag it over (Firefox 3 support this, for example. Safari 3.2 does not.). However, the tabs implemented in emacs with tabbar mode is more like a GUI-based display of buffer listing, displayed on top of the window. In particular, tabs does not stick to a particular emacs’s Frame, and conversely, each Emacs Frame can display a tab that is also shown in another Emacs Frame.

Also, emacs’s tabbar mode’s tab can be hidden, as if showing only the current “page” of a tab set, called a “group”. By default, tabs are grouped by major mode. So, for example, if current buffer is in html-mode, all the tabs shown are other buffers in html-mode. If there are no other html-mode buffers, then you will have only one tab, even if you have lots other buffers. All your dired buffers, C-mode buffers, java-buffers, etc, are in other tab group and is hidden. You have to click on a special tab widget to switch to them, or use keyboard shortcut to switch tab or tab group.

What is considered as a tab group can be customized. You could set it up so every buffer is of the same group.

Tab bar mode is implemented using a special emacs display area at the top of Emacs Window, not Emacs Frame. (For example, if you split a window into 3 panes, each will have a tab bar). Some other modes also use this area. For example Info, Dired, Slime, ERC, ruler-mode, etc. So that when switching to these modes, the tabs will not shown. You can get the tabs back by typing “M-x tabbar-local-mode”.

∑ http://xahlee.org/

Carbon Emacs vs Aquamac Emacs

On Jun 26, 9:40 am, Marc Tfardy wrote:
> Andrea Crotti schrieb:
> > On 25 Giu, 20:27, Marc Tfardy wrote:
> >> - is the look & feel approximately like GNU Emacs?
> >>
> > Almost, I returned to the carbon version
> >http://www.apple.com/downloads/macosx/unix_open_source/carbonemacspac...
> > which I think is more similar
> Yes, but as I already wrote in other post, carbon support will be
> shortly cutted.

i think that's just a naming issue. Carbon Emacs is named that because it was one one of the earliest popular emacs port on the mac, at the time Cocoa is just budding under OS X and Aqua is buzzword pretty. (this is early 2000s)

AquaMac Emacs didn't come or didn't become popular until few years later.

Although the name is Carbon Emacs, indicating it is based on Apple's Carbon API (which is older technology, replaced by Cocoa API). However, as of today, Carbon Emacs uses whatever is in latest GNU emacs as base, so does AquaEmacs. (and in this year or last, FSF's emacs cvs has deprecated (or removed) the Carbon based emacs code) As far as which of the Carbon Emacs and AquaEmacs are more based on Carbon API or Cocoa API, i suppose they are pretty much equal.

In a nutshell, if you are used to traditional user interface of emacs, stick with Carbon. Because with Aqua, you have to do a lot to customize it. It certainly can be done. Note that AquaMac also launches Apple's proprietary help system as its help file. All in all is very annoying. AquaMac tries to make emacs's interface stick with 100% Apple's GUI Guidelines. This means, it acts like every other Mac app, which is in conflict with emacs ways, some good emacs ways.

I support AquaMac Emacs because it spread idea that many emacs user interface is long overdue for a overhaul, and AquaMac is widely successful for that, esp among academic LaTeX users, who can't be bothered to spend months or years to study emacs's esoteric ways.

If you really want Cocoa API based emacs, i heard NeXT/OpenStep Emacs (aka “Emacs.app”) is it. However, in my experiences of trying it about once a year in the past 3 years, it still have several major issues that i cann't adopt. (it has major problems with unicode, and can't interpret keybindings on the numeric keypad)

btw, as you are switching from Windows to Mac, i'm switching from 19 years of Mac experience with 10 years of unix sys admin, to Windows today. (following is a writeup. Some tutorial on tech details of win sys admin or tech are still work in progress.)

• Switching from Mac/Unix To PC/Windows

∑ http://xahlee.org/

Mac os x Windows Sharing dead after machine wake

On my Windows machine, i often call this command to sync a dir:

$ rsync -z -a -v --delete --rsh="ssh -l xah" ~/web/ xah@

However, i think whenever my mac went to sleep then wake, i get this error:

ssh: connect to host port 22: Connection timed out
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packagi
ng/tmp/rsync-2.6.9/io.c(453) [sender=2.6.9]

i thought i just restart the smb process.
I went to the the System Preferences, Sharing, restarted the Windows Sharing and Remote Login.

However, that didn't help. (restarting the mac works fine)

Any idea what's going on?

My os x version is 10.4.11.

PS in the old days, i recall samba has smbd as its process. but i don't see that in os x. Any tech doc i can read up on how this service has changed?

∑ http://xahlee.org/


list processing in lisp

On Jun 28, 6:26 am, Marc Tfardy wrote:
> Hi!
> I looking for a ELISP function that do the job like Partition in
> Mathematica. The simplest case:
> (partition '(a b c d e f) 2)
> should return:
> ((a b) (c d) (e f))
> Is there something ready out from the box?
> In more sophisticated cases one can define overlap with offset and much
> more interesting things - look at:http://documents.wolfram.com/mathematica/functions/Partition

there's no such function. You have to write it yourself.

my experiences with lisps from Mathematica is that, most basic list processing functions in Mathematica does not exist in lisp, and in general, there's no coherent libraries to use either. Everyone just write it from scratch. (it's not easy to write them either, due to the cons business)

things like Partition, Flatten, Part, Level, etc gets asked every maybe 3 months for example in comp.lang.lisp over the past decade, and the answers are always wild.

might be of interest:

• Xah Lee's Computing Experience Bio

• Fundamental Problems of Lisp

the first one is some of my experience from Mathematica to lisp. The second one is about the cons business, and the shock that lisp doesn't do list procesing well.

∑ http://xahlee.org/


emacs lisp's executing script name $0

On Jun 24, 9:20 pm, Harry Putnam wrote:
> How does elisp reference the current *.el file?... I mean like in the
> way that the variable $0 carries the the value that is the full name
> of the script its in.
> What I'm really after is a say to to add that value to a message
> ('(message "hello")')
> Like this message (wrapped for mail):
> (message "hello world -- from
> /cvsb/reader/home/reader/lisp/site-start.el")
> (sit-for 1)
> that I use sometimes when tracking down how things are loading.
> How can I reference the name in a variable instead of writing it out?

you can use this:
(or load-file-name buffer-file-name)

if you want the full path, call file-name-directory on the result.

∑ http://xahlee.org/

concurrency talk by Anders Hejlsberg and Guy Steele

of recent talks about concurrency, this video interview would be of interest:


Anders Hejlsberg and Guy Steele: Concurrency and Language Design
Posted By: Charles | Oct 6th, 2008 @ 6:27 AM | 75,079 Views | 19 Comments

∑ http://xahlee.org/


emacs, yasnippet, adding a menu

On Jun 19, 2:32 pm, Kirk Strauser wrote:
> I just tried yasnippet today and see the potential, but I'm having a little
> trouble getting started. In particular, when editing a Genshi template with
> nxhtml-mode, the actual mode name is "gXhtml/genshi-nxhtml". I've tried
> creating my snippets in directories named with ever variation I can think
> of, like nxml-mode, nxhtml-mode, genshi-nxhtml-mode, gXhtml-mode, and
> others, but yasnippet still doesn't associate my snippet with that mode.
> Given the slash in the mode name, am I stuck explicitly defining that
> snippet in elisp?

did you reload the snippet dir? try the menu “YASnippet‣reload all snippets”.

also, there may be some confusion with a mode's names... the one displayed in the stat bar, and the value of major-mode while you are in that mode.

if you still have problems, the yasnippet google group is a great place to ask. Not many is using comp.emacs now. You might cross post to gnu.emacs.help, which is more active.

∑ http://xahlee.org/

On Jun 23, 7:46 am, Michal wrote:
> Hallo Group Readers!
> I have NO problem adding new item to the end of the menu. For example:
> (define-key c-mode-map [tool-bar csearch-forw]
> `(menu-item "csearch forward" csearch-forward
> :image (image :type xpm :file "/tmp/right-arrow.xpm")))
> But how to add it to be the first element in a menu?

there's a define-key-after.

• Modifying-Menus.html#Modifying-Menus

i vaguely recall there's also a define-key-before or similar, but can't find it now.

∑ http://xahlee.org/


how windows's file permission maps to unix

On Windows, how's emacs's dired display map the Window's file permission?

for example, emacs display this:

-rw-rw-rw- 1 xah None 814669 06-05 00:09 Snapshot_001.png

however, cygwin termninal displays this:

-rwx------+ 1 xah None 814669 Jun 5 00:09 Snapshot_001.png

The file's Properties shown in Explorer, has 3 group or users:


and the all have allow for every perm bit except the “Special permission” bit.


∑ http://xahlee.org/




i heard about google-code-prettifier last year, but today i took few hours to evaluate it for my needs. The result is here:

• Google-code-prettify Examples

it seems a generic heuristic based parsers have a lot ways to go. Basically, i find that the prettifier has a lot problems when dealing with code that processes url, html, xml, etc. Basically, if your source code contains a lot regex, url, ol html code as string, it'll confuse the prettifier.

this may not be surpsing maybe because it is generic. Anyway, hopefully this is some useful info. I hope the prettifier can improve on this a bit... i don't know how though, but basically when your code contains complex regex or raw html as string (often needed in web apps e.g. perl, python, php, js), it botches the page.

PS the read-me page still points to the old version.

∑ http://xahlee.org/


mac os x keybindings and emacs

in os x, you can define your own editing movement keys:

• How To Create Your Own Keybinding In Mac Os X

However, i've experiemented with it thoroughly and the result is not satisfactory. See the bottom of the article for a summary of the problems.

Also, note that emacs's keybinding is extremely inefficent. For detail, see:

• Why Emacs's Keyboard Shortcuts Are Painful

∑ http://xahlee.org/

emacs+w3m = slooooow

On Jun 19, 1:00 am, Thierry Volpiatto wrote:

> Note that on emacs version >= 23 you have to use the CVS version of
> emacs-w3m.

thanks for this info.

> > I don't particularly recommend it. The advantage is too trivial, and
> > the cost to install and maintain, learn, is a bit high. When using it
> > in emacs, it is actually some 2 or more times slower, than actually
> > using a full featured browser with graphics and css and javascript
> > all.
> Indeed, w3m in emacs is very fast. Faster than any graphic browser.
> You can interact with emacs easily. (many emacs extensions use it).
> When you need more features (javascript etc...) you can switch
> immediately to your graphic browser with "M".

humm? my experience is that it is much slower than a full featured browser. This was my experience on a Mac, OS X 10.4.x running Carbon emacs (based on emacs 22.x).

this is something we can test and verify to avoid the common online mis-info.
Maybe i'll do so again later today, but anyone who has w3m installed can easily check. Please report back.

i searched for my last message posted here about w3m. Apparantly i reported back than from my experience that w3m+emacs is some 5 times slower than a full featured web browser

∑ http://xahlee.org/


emacs string replacement

On Jun 17, 1:34 pm, Michal wrote:
> Hallo Group Members
> I have a string which contains national characters and I would like to
> convert them to ASCII equivalents.
> for example:
> ó -> o
> ³ -> l
> ¿ -> z
> etc.
> one of ways is just using:
> (replace-regexp-in-string "ó" "o" my_string)
> for each national character, but I believe that there is much better
> way.

here's my solution. I frequently need to replace several pairs, for many applications. e.g. html encoding, url encoding, alpha beta gamma to α β γ, Infinity and Pi to ∞ π, C-x to Ctrl+x and M- to Alt+ , text replacement based basic math formula syntax transform between langs... etc.

Here's the 4 basic functions i call in my other elisp programs.

(defun replace-pairs-in-string (str pairs)
"Replace string STR recursively by find/replace pairs PAIRS sequence.

(replace-pairs-in-string \"abcdef\"
'([\"a\" \"1\"] [\"b\" \"2\"] [\"c\" \"3\"])) ⇒ “\"123def\"”.
The replacement is done recursively after each find/replace pair.
Earlier replaced value may be replaced again.
The replacement are literal and case sensitive.

If you want the replacement to be case sensitive, set the global variable case-fold-search to nil. Like this: (let ((case-fold-search nil)) (replace-regexp-in-string-pairs ...)

This function calls `replace-regexp-in-string' to do its work.

See also `replace-regexp-pairs-in-string'."
(let ((mystr str))
(setq mystr str)
(lambda (x) (setq mystr (replace-regexp-in-string
(regexp-quote (elt x 0))
(elt x 1) mystr t t)))

(defun replace-regexp-pairs-in-string (str pairs &optional fixedcase)
"Replace string STR recursively by regex find/replace pairs PAIRS sequence.


The PAIRS can be any lisp sequence data type.

The third argument FIXEDCASE, if non-nil, changes the case of the replacement in a smart way matching the letter case of the find string.

If you want the regex to be case sensitive, set the global variable case-fold-search to nil. Like this: (let ((case-fold-search nil)) (replace-regexp-in-string-pairs ...)

This function calls `replace-regexp-in-string' to do its work.

See also `replace-pairs-in-string'."
(let ((mystr str))
(setq mystr str)
(lambda (x) (setq mystr (replace-regexp-in-string
(elt x 0)
(elt x 1) mystr fixedcase)))

(defun replace-pairs-region (start end pairs)
"Replace regex string find/replace PAIRS in region.

For detail, see `replace-pairs-in-string'."
(let (mystr)
(setq mystr (buffer-substring-no-properties start end))
(delete-region start end)
(insert (replace-pairs-in-string mystr pairs))))

(defun replace-regexp-pairs-region (start end pairs &optional fixedcase)
"Replace regex string find/replace PAIRS in region.

For detail, see `replace-regexp-pairs-in-string'."
(let (mystr)
(setq mystr (buffer-substring-no-properties start end))
(delete-region start end)
(insert (replace-regexp-pairs-in-string mystr pairs fixedcase))))

so i have about 10 other functions that does replacement of various types by calling one of the above.

if all you want is just something one-time, as opposed to the above more general functions, pls see:

Q: How to replace “&” by “&” in a region?

Place the following in your emacs init file:

(defun replace-string-pairs-region (start end mylist)
"Replace string pairs in region."
(narrow-to-region start end)
(lambda (arg)
(goto-char (point-min))
(while (search-forward (car arg) nil t) (replace-match (cadr arg)) )
) mylist

(defun replace-html-chars (start end)
"Replace “<” by “<” and other similar HTML chars that needs to be encoded."
(interactive "r")
(replace-string-pairs-region start end '(
("&" "&")
("<" "<")
(">" ">")

With the above code, you can select a region, then press “Alt+x replace-html-chars”, and have all “&”, “>”, “<” replaced by their encoded entity. You can define a keyboard shortcut for easy operation.

You can also use the code to replace some HTML entities by their actual unicode characters. For example:

“ → “
” → ”
é → é
© → ©

-> → →
=> → ⇒
Pi → π
Infinity → ∞

This makes the HTML source code more elegant and readible. (You need to declare your charset as one of unicode encodings. See Character Sets and Encoding in HTML)

above from:

• Emacs and HTML Tips

emacs string replacement can be tricky, due to emacs's feature of smartly choosing letter case plus a weired way to toggle it. (usually using a global var instead of a function parameter, but not always because ...) Emacs regex can also be tricky because it's diff from Perl or posix and in particular has severe toothpick syndrom that basically doesn't exist in any other lang. For some detail, see:

• Find and Replace with Emacs

• Text Pattern Matching in Emacs

∑ http://xahlee.org/


xahlee.org, vertical drop of traffic from google search

hi, i have question about how google represent my website, and a sudden vertical drop of traffic from google, represented by this image:


I have this math project on my website

• Visual Dictionary of Special Plane Curves

This project is the primary content of my website.
It has been top search result and traffic for my site from 2000 to 2008 june.
(basically, roughly speaking, 70% or more traffic on my website is about math topics in project and other math contents.)

However, i noticed today, that google webmasters sitelink does not even list it.
Instead, my website today is represented by keywords such as the following top 10 keywords result:

young girl
lara croft
rebel flag
girls girls girls
sex position
tony braxton
debbie does dallas

which goes to about 5% of my website's pages that are commentary about human sexuality. Google Analytics basically reports the same. (total number of pages on my site is about 3700.)

There seems to be something drastic that happened within the past half year, starting in 2008 June. Basically, the math content, which is the main content of my site, has been downplayed to almost non-existence, while about some 5% of my website's content, that are rather trivial blog style commentaries on human sexuality, became the main representation for my website. My site traffic from google search has been reduced to 1/3 of 2008 june.

can anyone give me some idea about what's going on? Here's some specific question i have.

1. why is my major project http://xahlee.org/SpecialPlaneCurves_dir/specialPlaneCurves.html that has been around for over a decade and widely linked by edu institutions, now seems largely delisted.

2. i don't want the 5% of my blog writings on lurid matters such as porn or sexuality, became my site's representation, because 95% of my site's content are on strictly math and computer science topics. How can i do this?

3. Starting maybe around 2006, i noticed a huge amount of machine-generated spam sites or blogs that insert my name Xah Lee, or snippets of my site's writings. What can i do about this? (often, if i just search my name xah lee or my site xahlee.org on blogs, newsgroups, the results are largely machine generated spam.)


∑ http://xahlee.org/


problem with emacs shell running sftp, unison, on Windows

looks like emacsW32 have problems running sftp or unison.

the problem with both is this error message:

bash: [4972: 1] tcsetattr: Inappropriate ioctl for device

is there some terminal setting or something in emacs to get this to work?

unisone has a -dumbtty option, however, with that on, still same error. So, apparently, it seems the problem is with emacsW32 or emacs on Windows somewhere. On the Mac, I'm able run unison, rsync, sftp no problem inside emacs's shell command, and i don't recall having to setup setup anything particular...

possibly i need to tweak some termcap in cygwin??



Here's the cygwin log:

Cygwin ~/web > unison -servercmd /usr/bin/unison c:/Users/xah/web
Contacting server...
bash: [6056: 1] tcsetattr: Inappropriate ioctl for device
[1]+ Stopped unison -servercmd /usr/bin/unison c:/
Users/xah/web ssh://...@
Cygwin ~/web >

Cygwin ~/web/mswin/i > sftp xyz@www.example.com
Connecting to www.example.com ...
bash: [4972: 1] tcsetattr: Inappropriate ioctl for device

[1]+ Stopped sftp xyz@www.example.com
Cygwin ~/web/mswin/i >

My emacs version:

GNU Emacs (i386-mingw-nt6.0.6001) of 2009-05-28 on
LENNART-69DE564 (patched)

∑ http://xahlee.org/

PS i can run unison and sftp fine in cygwin. Together with the fact
that emacs shell running unison or sftp works fine on OS X, i presume
this must be a emacsW32 or emacs on Windows issue. On the mac, i'm
running a version of Carbon Emacs that is based on emacs 22.x, so
possibly the problem could be emacs 23 itself...
thanks for any tips.

emacs's shell does not support the shell's keyword completion

On Jun 13, 2:33 pm, jida...@jidanni.org wrote:
> Completing command name...
> No completions of hist
> Completing file name...
> No completions of ali
> PD> Either type "history" and then RET, or create aliases and make them
> PD> known to the *shell* buffer in the file ~/.emacs_bash.
> What do I do?
> alias history=history
> alias alias=alias
> ?
> I am using the *shell* buffer in
> $ emacs -f shell
> instead of trying to use the remote readline functions of
> $ ssh very-far-away-and-slow.org
> Maybe I need to fool *shell* with a directory on $PATH fill of
> executable links with the same names as the bash builtins?
> touch bla
> chmod 755 bla
> ln history alias suspend typeset ... bla

not sure what's your solution.

anyhow, this problem is not difficult to implement. For me, i'd say few days full time.

• How To Implement Keyword Completion in Emacs

I've also been using this package in the 2 years or so:
it support command and file name completions.

;;; shell-command.el --- enables tab-completion for `shell-command'

however, it doesn't support bash keywords as in your message.

∑ http://xahlee.org/


font problems

On Jun 12, 3:23 pm, ken wrote:
> On 06/12/2009 01:53 PM Xah Lee wrote:
> > On Jun 12, 7:54 am, ken wrote:
> >> B) It would be helpful if the code which does the decoding of a file and
> >> renders it into the buffer display, if that part of it would throw an
> >> error message when it encounters a character it doesn't know how to
> >> display, i.e., when a little box character is displayed. After all,
> >> isn't it an error when a little box is displayed in lieu of the correct
> >> character? Possible error messages would be something like: "decoding
> >> process can't find /path/to/charset.file" or "decoding process doesn't
> >> have requisite permission to read /path/to/charset.file" or "invalid
> >> character: [hex/decimal value]" or other.
> > some thought process in the above is not correct.
> Yet emacs puts a little box in the place of a character it cannot find
> (or, per your explanation) possibly confused about. The fact remains
> that the little box is not a correct rendering of the code. It is an
> error... at least it is for me, because that's not what I typed in. So
> it is an error. As an error, there should be a corresponding error
> message, hopefully one (or more) which would help diagnose the problem.
> It seems obvious that, given the long thread on this issue with no
> resolution, we could use some help-- like an error message-- which would
> help in diagnosis.
> Thanks for the information and the links though.

i think displaying a error for each char that emacs cannot find a font for is just not feasible. The app can't know whether it used the right encoding. And even if the encoding used is correct, it can't deal with possible missing fonts in some of the characters in the char set.

i don't have experience in this, but imagine, when a app gets a byte stream, and with a given charset/encoding. With that, it can decode byte length to map to the code points in the char set. (e.g. utf-8, utf-16, both don't have fixed byte-length for chars) After that done, you get a sequence of a code points (i.e. a sequence of integers). At this point, given a integer, you need to map this integere to a character in a font. There are many issues here... a font i guess is a set of glyphs... ultimately a set of integers. I'm not sure what sort of spec or standard specifies what each integer means (i.e. support your app now has a integer that represents B. Now suppose your app is set to use font Aria. Now, Aria is a set of integers, but by what standard that says what integer is B?)... Part of this step is what happens when Aria don't have that character. (i'm guessing a font also has data about what character set it contains...)
But in anycase, finally we'll have a B from font Arial. Then it goes thru the whole display process...

overall i think the technology we have today that actually display fonts and unicode text etc are extremely complex, not to mention vector based fonts and anti-aliasing and font-substitution etc techs.

some interesting read here:


for most modern apps, like browsers, i think they all call OS's APIs to handle it. Some glimps over emacs dev list seems to suggest that emacs implements its own display system... on one hand it's bad because emacs misses out using all modern techs developed in 2 decades by Apple or Adobe or Microsoft, or some Open Source's work, on the other hand it is admirable in that it does it on its own...

sorry am rambling a bit. You are right that the bottom line is that some things just rendered as squares and is a problem. Though, i wanted to say that my point was that it is unfeasible to issue a error for missing fonts or miss-interpretation of the encodings. Part of this is because theoretically there's no way to know that encoding chosen is correct. Part is because in practice missing font or bad chosen encoding is very common. If we all stick with ascii, everything is pretty good. If we stick to western langs, things are still not too bad. But once you have chinese, japanese, korean alphabets, or the ocational use of the many math symbols and greek letters, or adding cyrillic/russian alphabets or arabian alphabets ... the chances of missing font or missing encoding info is very high.

i think a large part of the problem is that char set and encoding info is not part of the file. Things are getting better in the past decade with mime type and unicode standard. But give a byte stream, after being lucky of able to know it is text, there's still little way to know how to interpret it. The char set and encoding meta data often gets lost, implementation are often not robust, font for multi-lang usually are not there, and font-substitution tech just started. (according to Wikipedia, IE before 7 does not even have font substitution (which means, you really need such beast as “unicode font”, namely a font that contains some tens or hundreds thousands of glyphs))

i think all these issue only started to get addressed in the past decade since the globalization partly due to internet. Before, English speakers just stick with ascii and that's pretty sufficient. Each western lang region stick with their particular encoding for a few special chars in their alphabet. Only when things started to mix they get more complex, and now with Chinese & japanese etc. With unicode, the use of math symbols also becomes more common. Before that, it's just ascii markup...

speaking of this. Emacs and FSF docs still stick with 1980s's `quote hack', and arrows like this -> => ... very extremely stupid. Of course i filed polite bug reports, and have argued here too heated, but basically fallen to no ears. Somethings just is impossible to progress in the FSF world.

∑ http://xahlee.org/

unicode, encoding, font, foreign chars

On Jun 12, 7:54 am, ken wrote:
> B) It would be helpful if the code which does the decoding of a file and
> renders it into the buffer display, if that part of it would throw an
> error message when it encounters a character it doesn't know how to
> display, i.e., when a little box character is displayed. After all,
> isn't it an error when a little box is displayed in lieu of the correct
> character? Possible error messages would be something like: "decoding
> process can't find /path/to/charset.file" or "decoding process doesn't
> have requisite permission to read /path/to/charset.file" or "invalid
> character: [hex/decimal value]" or other.

some thought process in the above is not correct.

In general, a program just read a text file as a byte stream, and using a encoding scheme to interpret it, the program has little way to determine if the encoding is correct. Theoretically, it could check with common phrases but that is generally not done by the software we use daily. (some program does scan text guess a encoding, but not always correct)

here's some general technical issues and experiences about using foreign chars:

• the software needs to know what encoding & char set is used in order to interpret the binary stream. If you don't specifically set it, typically it assumes ascii or some iso latin char set. (of software in USA anyway)

• today's software generally don't contain any extra heuristics to check if the encoding used is actually correct. There is no technical way to check that in general. It can be only heuristics, i.e. guesses. e.g. browsers will often guess when reading a page that doesn't have encoding info.

• even when the encoding is correct, the software needs all the proper fonts to display it. Or, rely on some font-replacement technology, e.g. when it finds a char which the current font doesn't have, it uses another font for that char. (in the case of Chinese, this often results in ugly text of mixed char style, some appear thin, some thick, some squarely (like sans-serif), some calligraphic, some bit-mapped) Windows OS and OS X both has font-replacement technology, as well as all the major browsers for both os x and windows. This font replacement technology, however, is not perfect. So, sometimes you'll see squares or question marks here or there, especially on some chars that's not widely used (e.g. math symbols in unicode, double right arrow, tech symbols such as Apple's command key and option key, triple asterisk, etc.).

• when writing a file, the software needs to use a encoding to write it. Just like reading, if you haven't explicitly set it, typically it uses ascii or some iso latin char set, in most western lang countries.

• when you use a software to open a text but with wrong encoding info, the result is gibberish.

the above applies not just to emacs, but applies to all apps. Some commentary are based on my experiences with browsers, web pages, word processors, online forums, mailing list, email apps, instant messaging chat apps, etc, on both mac and windows.

technically, the issues involved is char set, encoding, font. ( the concept of char set and encoding are independent but is often mixed together in a spec, esp earlier ones).

i use mixed chinese & english in single file often and in both mac os x and windows. They work well. On the mac, my emacs is version 22.x. On win, it is emacs23. My encoding in emacs is set to utf-8.

I've wrote a lot about these issues, the following docs might be helpful.

• Emacs and Unicode Tips

• Unicode Characters Example

• the Journey of a Foreign Character thru Internet

• Converting a File's Encoding with Python

• Character Sets and Encoding in HTML

• The Complexity And Tedium of Software Engineering (parts about unicode problem with unison and emacs)

• Mac and Windows File Conversion (parts about unicode filename issues)

• Windows Font and Unicode

the above article contain tens of links to Wikipedia in appropriate places. Wikipedia has massive info in digestible form about these issues, one can spend a month on the above foreign char issues ...

for some examples of mixed chinese & english text i work with, see:

• Chinese Core Simplified Chars

• Ethology, Ethnology, and Lyrics

∑ http://xahlee.org/

On Jun 12, 9:48 am, "B. T. Raven" wrote:

> I wouldn't be surprised if the gaps and overlaps in the CJK ranges of
> glyphs weren't so complicated that many characters from the following
> encodings may not be included in utf-8, especially if they are not
> precomposed. Try some of these encodings to see if some of the empty
> boxes are resolved into characters:
> chinese-big5
> chinese-hz
> chinese-iso-7bit
> chinese-iso-8bit
> chinese-iso-8bit-with-esc
> cn-big5
> cn-gb
> cn-gb-2312
> iso-2022-cjk
> iso-2022-cn
> iso-2022-cn-ext

most chinese encodings are subset or identical to unicode's charset.

In particular, the current, mostly widely used chinese charset the GB 18030, actually is just unicode.

see http://en.wikipedia.org/wiki/GB_18030

Note also, that means china's GB 18030 contain the entirely of traditional chars in unicode too. (though, i don't know about how big5 relates to unicode )

the list you gave above is from emacs? emacs's list always seems strange to me... haven't really looked into it. maybe emacs's list is really encompassing of all encoding that've existed, but it also could be just screwed up like many open source things. For example, it invents its own names by mixing up char set encoding with concepts of EOL convention.

btw, who actually coded the low down levels of char encoding in emacs? e.g. especially unicode, since it came after richard stallman still doing the bulk of emacs. That person should be admirable. lol.

∑ http://xahlee.org/

emacs, efficient way to edit lisp code

On Jun 12, 12:05 am, rustom wrote:
> Im hacking on a 700 line elisp function.
> While doing some (fairly mechanical) cut-paste operations it looks
> like either Ive got a parenthesis or a quote (most likely double quote
> but could also be single quote) error.
> Any suggestions on how to catch such errors?

here's some recommendation based on how i code elisp.

• never type single paren. I always type them in pairs. And never delete one of them.
• use tree navigation to move between code.
• to delete or move parts of expression, select the whole expression, cut & copy to move.

so, when i code in lisp, there is never ever unmatched parenthesis.

this method beats paren-edit mode.

the detail of my editing and setup is here:

• Tips For Editing Lisp Code With Emacs

to select current unit of sexp, i press one key, which is bound to extend-selection, which is defined in my ergoemacs mode. The code is shown here:

• A Text Editor Feature: Extend Selection By Semantic Unit

∑ http://xahlee.org/


is there a way to put a simple google search box for a site?


Hi guys,

How to put a simple google search box on my website?
I know some solutions, but not satisfied, so please bear with me a bit.

if you look at this page

you'll see a neat search box at the top right. Simply a field, a search button, followed by a text “powered by Google”.

I want that on my website for searching my website.

I know about Google Custome Search, but after trying with a bit, the result is not what i wanted. (it has too many adds, links distractions)

So, my question is, is it possible, to put a simple looking google search widged for my own website?

Here's some more detail... a little rant, on this issue, for those more curious. But my main question is just stated above.

• Google Custome Search

Thanks a lot! I really love Google's technologies, as well as the company etho.

(PS i'm reasonably a close follower of google webmaster blogs and webmaster tools, analytics... did some 5 min search here before posting but didn't find answer.)

∑ http://xahlee.org/

Hi Jonathan,

a little follow up...

(1) is there a way to set the width of that search box?
I am able to modify the width:100%; to 40%, however, that means all search results will also be 40% width.

(2) Is there a way to hardcode the domain that will be searched?
Because i have some projects (such as tech docs or classical literature) that also comes in downloaded version. When people view the downloaded version offline, the search box will no longer confine the search on my domain.

• GNU Emacs Lisp Reference Manual

• The Arabian Nights

(3) another extra question i'm wondering is, if it is possible to make the search box confined into a particular dir. For example like the above 2 projects, it'd be more useful for readers to search only on those docs.

Thanks a lot if you have few minute for answer.


emacs, how to find command's shortcut

On Jun 11, 6:30 am, Wudong wrote:
> As the title says.
> For some frequent used command, I would first want to know if there r
> already a existed key-biding to that command in the environment before
> goes further to define one if there is not.
> Is there a way to find the key-binding for a given command in emacs?

one thing every beginning advanced emacs users should know is how to find out a command name given a keyboard shortcut, and vice versa.

• To find the command name of a keybinding, use the command describe-key (Ctrl+h k). This command also lets you find out the command name of a graphical menu or mouse click.

• To find the documentation of a command, or find its keybinding, use describe-function (Ctrl+h f).

• If you forgot the name of a command, you can use apropos-command (Ctrl+h a), which lists all commands of a given string.

• In any mode, if you want to see its documentation, use describe-mode (Ctrl+h m).

• Emacs Less-known Tips

∑ http://xahlee.org/

emacs keybinding notation

On Jun 11, 1:07 am, Nordlöw wrote:
> I am trying to set the key meta-¤ (to the left of % on my swedish
> keyboard) like follows:
> (global-set-key [(meta \¤)] 'regexpl-search-replace-list)
> but it doesn't work, nothing happens when I press the combination. Why
> is that when the following works:
> (global-set-key [(meta \&)] 'query-replace-regexp)
> Thanks in advance,
> Nordlöw

not sure what's the problem. I've switched to kbd notation for all my keybinding needs, because that way, you have a sure way to know what the notation would be like, by calling the command describe-key. In your case, perhaps try that.

I did notice some inconsistencies even with this, especially when defining a non alphanumeric key. Here's a little write up:

Note: A keypress-combination such as “Meta+Shift+2” can also be considered as “Meta+@”. So, in emacs, you might be thinking that both of these code: “(kbd "M-S-2")” and “(kbd "M-@")” will work. Actually, only the latter will work.

When writing a keybinding definition, for a key combination that involves “Meta+Shift+‹key›”, you must use a version without the shift key if possible. For keybinding involving “Ctrl+Shift+‹letter›”, you must use the "-S". Examples:

GOOD BAD Keystroke
(kbd "M-A") (kbd "M-S-a") Meta+Shift+a
(kbd "M-@") (kbd "M-S-2") Meta+Shift+2
(kbd "M-:") (kbd "M-S-;") Meta+Shift+;
(kbd "C-S-a") (kbd "C-A") Ctrl+Shift+a

A easy way to find out the proper syntax, is to call “Alt+x describe-key”, then type the keystroke.

Note also, that keys involving “Ctrl+Shift+‹key›” cannot be distinguished from “Ctrl+‹key›” when emacs runs in a text terminal (i.e. telnet/ssh). So, this means best to avoid any binding with both Control and Shift.

• How to Define Keyboard Shortcuts in Emacs


i reported the above as a bug sometimes late last year or this year, but i think it got dismissed.

emacs's has a keybinding notation hell. For detail, see the section “Representation of Keystrokes” near the bottom.

• The Confusion of Emacs's Keystroke Representation

∑ http://xahlee.org/


run unison in emacs, problem

When running unison within emacsW32 shell, it gives me a error:

bash: [6056: 1] tcsetattr: Inappropriate ioctl for device

is there some terminal setting or something in emacs to get this to work?

I tried -dumbtty according to the doc, but still same error.


(i searched google a bit, with the error or with “unison, emacs”, but didn't seem to help. unison runs fine in the real cygwin terminal. I can run rsync in Carbon emacs, but don't remember i ever did with unison.)

∑ http://xahlee.org/

Here's the cygwin log:

Cygwin ~/web > unison -dumbtty -servercmd /usr/bin/unison c:/Users/xah/web ssh://xah@
Contacting server...
bash: [5208: 1] tcsetattr: Inappropriate ioctl for device

[1]+ Stopped unison -dumbtty -servercmd /usr/bin/unison c:/Users/xah/web ssh://xah@
Cygwin ~/web >

GNU Emacs (i386-mingw-nt6.0.6001) of 2009-05-28 on LENNART-69DE564 (patched)

computing jargons

On Jun 8, 11:59 am, Peter Keller wrote:
> In comp.lang.scheme Xah Lee wrote:
> > lisp1 vs lisp2 is not good. It's old shit. Forever getting people to
> > live in the old days of your lisp vs my lisp fight, in fact, not much
> > different from fights among today's major lang groups.
> So, where is your replacement for the jargon, the syntax, the idioms,
> the math, the language itself? Is there some 64 page document I can
> read which washes away the fields of crap that you see and imposes a
> perfect and irrefutable order upon it?
> If the answer is yes, I'd be happy to read and learn from it.
> If the answer is no, then start writing one.

happy to oblige.

• The Importance of Terminology's Quality In Computer Languages

• Jargons of Info Tech Industry

• Why You should Not Use The Jargon Lisp1 and Lisp2

• The Term Currying In Computer Science

• What Is Closure In A Programing Language

• What are OOP's Jargons and Complexities

• Interface in Java

• Math Terminology and Naming of Things

• Politics and the English Language

On Jun 8, 5:27 pm, Peter Keller wrote:
> George Neuner wrote:
> > Xah has a pathological hatred of jargon - it's best to ignore his
> > rantings about it.
> Ah. I see.
> Don't show him this then:
> http://catb.org/~esr/jargon/html/

btw, i have read the jargon file roughly from cover to cover during 1998-2000 period. That was a period when i was still learning unixes, fascinated by its history. I have also, read pretty much the entirety of documents on fsf.org or gnu.org as they exist at the time, and some other writings by Eric guy such as his bizarre and cathedral fuck. (i happened to actually read his Bazarre essay from cover to cover twice, with some criticisms on the logics of exposition, but never actually have written down.)

Today, i consider Eric S Raymond a asshole. Also, consider this snipped about jargons file, from Wikipedia http://en.wikipedia.org/wiki/The_Jargon_File :

«Eric S. Raymond maintains the new File with assistance from Guy Steele, and is the credited editor of the print version, The New Hacker's Dictionary. Some of the changes made under his watch have been controversial; early critics accused Raymond of unfairly changing the file's focus to the Unix hacker culture instead of the older hacker cultures where the Jargon File originated. Raymond has responded by saying that the nature of hacking had changed and the Jargon File should report on hacker culture, and not attempt to enshrine it.[2] More recently, Raymond has been accused of adding terms to the Jargon File that appear to have been used primarily by himself, and of altering the file to reflect his own political views.[3]»

The Eric asshole also tried to erect his fame by creating some hacker logo mother fuck.

The jargons file, 10 years ago or earlier, functions not only as a dict for tech geeker's slang and culture, but as well as a important technical reference on unixes and earlier technology. For the technical aspect, it is pretty much surpassed by
(which incorporate parts (or entirety) of jargon file)

But today, both are rather obsolete. Wikipedia by itself covers some 100 times the info on computing topics both in breadth and depth, cultural or technical. (Wikipedia, also incorporate freely of both jargon file or the FODOC, especially so in its early years.)

More Xah Lee for tech geekers:

• Links To Wikipedia from XahLee.org

• Lispers and Wikipedia

• Encyclopedia, My Experiences

∑ http://xahlee.org/


emacs doesn't recognize shift+keypad0 on windows?

it seems i'm unable to get emacs to understand Shift + keypad 0, on Windows.

i have this defined:
(global-set-key (kbd "") 'lookup-word-definition)

on the Mac, with Carbon Emacs, i press shift + 0 on the keypad to call my function.

On Windows Vista with emacsW32, it doesn't work. If i do describe-key, emacs reports i'm pressing keyboard insert
(translated from ) runs the command”

doesn't matter if i have the num lock on or not.

Any solutions?

Here's a bit more detail.
With NumLock on,

keypad 0 gets is:
Shift + keypad 0 is:

with NumLock off,

keypad 0 is:
Shift + keypad 0 is:

GNU Emacs (i386-mingw-nt6.0.6001) of 2009-05-28 on LENNART-69DE564 (patched)

∑ http://xahlee.org/

emacs on Wisdows, hyper keybinding for unicode = error

i have this defined in my emacs:

(global-set-key (kbd "H-*") "°")

which inserts a degree character when Hyper + Shift + 8 is pressed.

works fine in OS X, but on Windows Vista + emacsW32, it gives this error:
“After 0 kbd macro iterations: Keyboard macro terminated by a command ringing the bell”

any idea?

GNU Emacs (i386-mingw-nt6.0.6001) of 2009-05-28 on LENNART-69DE564 (patched)


∑ http://xahlee.org/

emacs, open current dir in os desktop

how to get emacs on windows to open the current dir the OS's file manager?

on os x, i just do
(shell-command "open .")

On Windows Vista, i tried
(shell-command "explorer .")
which does the job but freezes emacs in the background until the folder is closed.

I tried
(shell-command "explorer . &")
but that still leaves a running process.
This is annoying when you call shell command again, cause it'll ask you if you want to kill previous instance.

(shell-command "start explorer . ")
seems to invoke cmd-shell.


Here's the function i'm trying to write:

(defun open-in-desktop ()
"Open the current file in desktop."
(let (cmdStr)
((string-equal system-type "windows-nt") (setq cmdStr "explorer . &"))
((string-equal system-type "darwin") (setq cmdStr "open ."))
(shell-command cmdStr)

∑ http://xahlee.org/



On Jun 8, 7:25 am, rustom wrote:
> On Jun 8, 7:10 pm, Xah Lee wrote:
> > how to get emacs on windows to open the current dir the OS's file
> > manager?
> > on os x, i just do
> > (shell-command "open .")
> > On Windows Vista, i tried
> > (shell-command "explorer .")
> > which does the job but freezes emacs in the background until the
> > folder is closed.

> If you use w32-browser C-Ret does open and Alt-Ret does open explorer http://www.emacswiki.org/emacs/w32-browser.el

Thanks rustom. That does it.

(defun open-in-desktop ()
"Open the current file's folder in desktop."
((string-equal system-type "windows-nt") (w32-shell-execute "explore" "."))
((string-equal system-type "darwin") (shell-command "open ."))

btw, just curious, if anyone would mod the code so it works on linuxes too.

∑ http://xahlee.org/

lisp1 vs lisp2


Dear Kent,

I'll reply freely and non-systimatically to some of your points. Just to be sure, this is newsgroup, what i say here is not meant to be some formal conference on humanity's problems, and that applies to you too, despite your more careful and polite and voluable writing style.

i started to have composed some 500 words tot-for-tat style to your reply, to be sure, free of politensess and great, but to cut the chase ... just move on!

lisp1 vs lisp2 is not good. It's old shit. Forever getting people to live in the old days of your lisp vs my lisp fight, in fact, not much different from fights among today's major lang groups.

i don't see Common Lisp or Scheme Lisp ever will see the light of the day again. If there's any hope, that'd be New Lisp and Clojure. Even these, in today's one thousand and one hot functional langs the likes of Ocmal, f#, Mathematica, Haskell, erlang, Oz... lisp's user base is not likely to grow. I'd like to think emacs lisp, with its sizable user base, might have a glint of hope, but not while the Richard Stallman old hat still running the show, with a gaggle of his new apostles and apprentices. I'd be thankful if emacs does not languish too much in the coming years.

• Will Lisp Ever Be Popular?

• Proliferation of Computing Languages

lisp1 vs lisp2 are warts. The lisp community has lots of warts, such as macros differences, and tail recursion fuck, small vs big, loop vs recursion, of fucking no practical matter. It is like a ritual. Every new lisper have to discuss these issues at some point, input their colors into the mix, as if the word elegance depends on it.

Sure, you go on and write your elaborate writes and jolt youngster's attention to history. I'll go on with my campaign on the beauty of Xah Lee and importance of terminology. No hard feelings. At least, the those who code in Common Lisp, appreciate the technicalities in your writings.

• The Importance of Terminology's Quality In Computer Languages

∑ http://xahlee.org/


On Jun 6, 7:47 pm, pit...@nhplace.com wrote:
On Jun 6, 4:28 am, Xah Lee wrote:

> Why You should Not Use The Jargon Lisp1 and Lisp2

Xah, I agree with you on a number of your points but not on your lead-
in. You could build your case better if you didn't go after this.

There's no real harm done by these terms and your campaign to get rid
of them loses audience for you because it seems both mean-spirited and
pointless. I wish you would spend more time paying attention to the
reasons people do and don't resonate to your ideas because it would
get you further in the places where you have something to say.

> • The jargon is opaque. The words do not convey its meaning.

All jargon is opaque if you stare at it too closely. Most words mean
what they mean just because we are told what they mean. The terms
Lisp1 and Lisp2, which I created, are not widely used because I
published a manifesto for their use, they are widely used because they
seemed to name a concept that had no name and they made it possible to
talk succinctly about something that people wanted to talk about a

Even if you succeeded in getting generic terms "multi-meaning space"
or something, the problem is that language naturally seeks to shorten
words that are used a lot, and after a short time you'd hear it called
multimspa or something and perhaps later just multims and so on.
Lisp1 and Lisp2 have the virtue of being only two syllables and this
is as important or moreso than the quality of opacity.

> • Being a opaque jargon, it is often used subconsciously by people in
> a group, to communicate that they are in-group.

This is probably a useful criticism in a few cases but I don't think
dominant. The sad truth is that even if a person who had no idea
about the concept heard a discussion on this, they'd probably still
have to ask questions to learn the detailed meaning of the
discussion. The foreign-ness of the terms actually invite that
conversation because no one should feel ashamed not to know an
acronym, but if the terms are very generic, one might think it showed
lack of creativity or language knowledge and might not ask. So it
could work just the opposite of what you say.

> For another example, consider today's PHP language. Linguistically, it
> is one of the most badly designed language, with many inconsistencies,
> WITH NO NAMESPACE MECHANISM, ...> Now, suppose we narrow the scope of
> “lisp1 vs lisp2” to its context: ...

If what you're gettng to is that people need words like PHP1 and PHP2
in order to discuss these others and wouldn't if there were a more
generic term, then this criticism is valid. However, it is pointless
and bossy to suggest other people need to use a different term in
order for you to have a good term here. Invent and promote your own
better term and just try to get people to use it (affirmatively);
don't try to stop them from using the other term. People are more
receptive to positive promotion than negative in some situations.

> Xah Lee, 2008-10

> Q: The terms “Lisp-1” and “Lisp-2” were invented to expressly *avoid*
> mentioning Common Lisp or Scheme, therefore we shouldn't use the terms
> such as Common Lisp model or Scheme model to describe it.
> Also, another point Kent has mentioned is that people in the community
> naturally picked up these terms. Actually, in my opinion, the
> popularity and continued use of these terms has much to do with Kent's
> promotion.

I was as surprised as anyone to see people using them outside the
context of my paper. It would never have occurred to me to promote
them originally. However, the issue comes up a lot and I do find it
helpful. I don't think that you can really say, though, that I spend
my days at some campaign headquarters strategizing a promotion. And
if your criticism comes down to the idea that I should never involve
myself in a discussion on the matter using terms I created for the
express purpose of that discussion, that seems a bit restrictive.

If any of your ideas ever stick, even multi-meanin-space, which I will
not begrudge you if you can get people to use it, you're not going to
want to be accused of it succeeding merely because you promoted it.

> In the past decade in “comp.lang.lisp”, he constantly
> reminds people of his article, and even explicitly requests others to
> use the terms Lisp1 and Lisp2, as opposed to other terms people used
> when discussing this issue, such as “Common Lisp way” or “Scheme way”.

The reason the term was invented was because Scheme seems to claim a
lock on aesthetics, claiming CL has none. I disagree with that, but it
creates a "warm fuzzy" feeling in the heart of people that biases
their opinions on specifics. The extreme case of this was that once I
was in an ISLISP meeting with someone (I'll decline to embarrass that
person by saying who--it doesn't really matter) and I asked that a
particular definition be taken from CL to ISLISP. No, they said,
because it came from CL and would make ISLISP big and bloated like
CL. No, I said, it would make ISLISP only changed by adding this one
remark. But they said no merely because of the source. I've seen
less extreme cases of that, but my point is that it does happen that
people stop listening when you talk CL (and others stop listening when
you talk Scheme) so it's easier to be neutral and Lisp1 and Lisp2 are
not the official canonical unique only way to be neutral, they're just
possible ways of being. I promote them because they're handy.

This is one of those things like CAR/CDR where I don't really like
those names either. They're not evocative. But no better names have
been advanced that have the uses CAR/CDR does e.g., for composing
CADDR etc. The names LHS/RHS come very close because LRRLHS is
conceivable. But it isn't as pronounceable even in English and is
even less pronounceable for people who have difficulty in an
international community who come from languages that blur the L and R
sound. So I accept criticism for CAR/CDR but still use them. That's
kind of how I use LISP1/LISP2.

Another argument you don't raise is the confusion with Lisp 1 (early
Lisp version, predating Lisp 1.5) and confusion with 1LISP, 2LISP, and
3LISP (Brian Smith's dialectal variants building up to a proper
reflective tower). I wish more people knew of Brian Smith's work
because it's cool, but since they don't, that name collision isn't
very important either.

You further don't seem to treat the fact that CL is really a Lisp4 (at
least) and so the name LISP2 is a problem in that regard. There is
also a term I created in subsequent discussion which is Lisp-Omega,
that talks about a Lisp with arbitrary user-definable namespaces.
There is no implemented Lisp-Omega, but there could be. Still the
distinction between finite-dimension and infinite-dimension is
critical because the formal semantics people tell me that a Lisp-Omega
would have a much smaller formal semantics than a Lisp2 or LispN for
any finite N > 1.

You have also blurred the distinction between modules and packages.
They could co-reside and are not conceptually in conflict. Lisp
packages are not modules and so some of the remarks you make in regard
to that make no sense to me. Packages are a syntactic-token-
resolution-time notion and Modules are a lexical analysis time tool.
To some extent, packages assure a unique name across designers/code-
writers, not across programmatic elements. Modules are more concerned
with some other division among code. The concepts are more akin to
the temporal division between read-time, macro expansion time, etc.
Treating read-time and macro-expansion time in a blurry fashion as if
they were the same thing, as some languages do, omits the opportunity
to give texture and names and semantics to both concepts. So, too,
blurring packages and modules.

I hope my remarks are seen as constructive and non-defensive, Xah. A
lot of people seem to rush to my defense when you post, but I'm not
really bothered by posts such as this, which are constructively worded
and seem to have a fair amount of interesting points to be made. I
marked your post 4 stars in Google to acknowledge that this was an
above-average post by you and in the form I'd like to see more of. I
do disagree with you on some technical matters, but then we live in a
plural society and there's no reason my opinion even has to be right.

Mostly I thought it of interest that I don't 100% disagree with you.
There is in fact some overlap of opinion, we just don't agree on


emacs keyboarding pain

On Jun 7, 9:27 am, Eric Abrahamsen wrote:
> On Jun 7, 2009, at 7:58 PM, Lennart Borgman wrote:
> > On Sun, Jun 7, 2009 at 1:02 PM, Christian
> > Herenz wrote:
> >> Chris Gordon-Smith schrieb:
> >>> Hello All
> >>> I have recently started using Emacs on a regular basis. I read in
> >>> the
> >>> Emacs documentation that it is more efficient to use C-N, C-P etc.
> >>> rather
> >>> than arrow keys. Is this really true? I'm persisting with it, but
> >>> those
> >>> arrow keys still seem pretty attractive.
> I've been using emacs for less than a year. I feel comfortable with
> python mode, outline mode, dired, org-mode, slime and auctex. And yet,
> the stupid f-b-n-p issue is a constant pain. Why, in an editor that's
> utilized through habit and muscle memory, are the most primary
> navigation keys based on *mnemonic* devices like forward-back-next-
> previous? Why is that necessary? I can open files on remote servers,
> eval defuns, and relocate sub-trees easier than I can move forward
> three words and then move forward another two characters. I'm aware of
> solutions like ergo-movement or whatever, but it messes with the whole
> arrangement of keys and really isn't viable. Only now, after nearly a
> year of use, am I finally getting to the point where it is more
> efficient to reach for f-b-n-p than to reach for the arrow keys.
> This is a rant. I have no real point. In the end, it's better to use f-
> b-n-p, but good Lord it takes a long time to get here.

I guess the ergo-movement you are referring to is

• Ergoemacs Keybindings

Maybe give it another try? it is meant to fix this emacs problem. Or tell me what problem you had with you tried to use it.

the reason emacs had the keys it had is largely due to historical reasons. In particular, the f b n p are due to the about 20 lisp hackers who already used to that key when emacs just started, according to the oldest emacs user Daniel Weinreb.


... At the time Guy Steele put together the Emacs default key mappings, many people in the target user community (about 20 people at MIT!) were already using these key bindings. It would have been hard to get the new Emacs bindings accepted by the community if they differed for such basic commands...

—Daniel Weinreb, 2008-06-01, on comp.emacs newsgroup.


• Why Emacs's Keyboard Shortcuts Are Painful

∑ http://xahlee.org/

emacsW32, find-file, default path not current buffer's file path

on unixes, when you do find-file, the default path is the path of the current buffer's file.

On emacsW32 (Windows), the default path (sometimes) is the last directory opened.

Is this intentional? How can i set it to the normal emacs behavior?


GNU Emacs (i386-mingw-nt6.0.6001) of 2009-05-28 on LENNART-69DE564 (patched)

∑ http://xahlee.org/


cygwin+imagemagick+emacsW32 causes Vista to report error

got a very odd problem that's driving me nuts.

in cygwin prompt, i can call one of imagemagick's command and get result.

However, while in emacsw32 shell, identical call results Windows Vista poppig up a window telling me some app crashed.

Anyone got some idea what's wrong?

here's more precise detail.

Here's how i call a program in cygwin terminal:

xah@xah-PC ~/web/dinju/i
$ convert Bazaar_zanjan.jpg Bazaar_zanjan.png

the above converts a jpg image to png, successfully.

Here's how i call it in emacsW32. In dired, cd to the dir, then Alt+x shell, then “convert Bazaar_zanjan.jpg Bazaar_zanjan.png”.
Then, Windows pops up dialog about “convert.exe has stopped working” with the following error:

Problem signature:
Problem Event Name: APPCRASH
Application Name: convert.exe
Application Version:
Application Timestamp: 4807a468
Fault Module Name: cygX11-6.dll
Fault Module Version: 6.0.6001.18000
Fault Module Timestamp: 4791a783
Exception Code: c0000135
Exception Offset: 0006ecfb
OS Version: 6.0.6001.
Locale ID: 1033
Additional Information 1: 9d13
Additional Information 2: 1abee00edb3fc1158f9ad6f44f0f6be8
Additional Information 3: 9d13
Additional Information 4: 1abee00edb3fc1158f9ad6f44f0f6be8

this popup repeats 6 times.

Same thing happens if you simply call “identify” without running any arguments, with about the exact same error message. e.g.

Problem signature:
Problem Event Name: APPCRASH
Application Name: identify.exe
Application Version:
Application Timestamp: 4807a46a
Fault Module Name: cygX11-6.dll
Fault Module Version: 6.0.6001.18000
Fault Module Timestamp: 4791a783
Exception Code: c0000135
Exception Offset: 0006ecfb
OS Version: 6.0.6001.
Locale ID: 1033
Additional Information 1: 9d13
Additional Information 2: 1abee00edb3fc1158f9ad6f44f0f6be8
Additional Information 3: 9d13
Additional Information 4: 1abee00edb3fc1158f9ad6f44f0f6be8

“identify” is another command in imagemagick, it works fine if called in cygwin terminal. Here's the log:

xah@xah-PC ~/web/dinju/i
$ identify Bazaar_zanjan.jpg
Bazaar_zanjan.jpg JPEG 450x445 450x445+0+0 DirectClass 8-bit 65.793kb


Cygwin has been re-installed many times in the past 2 weeks. I was able to run imagemagick commands within emacsW32 before without a problem. The problem happened with my last reinstall of cygwin.

the odd thing is that it runs fine within cygwin terminal. I thought maybe i'm missing some component in cygwin, but don't know which X11 related package corresponds to cygX11-6.dll. I thought maybe i had some bad path setup in emacsW32, but went thru all my emacs init files couldn't identify it. Same problem happens if i run emacs with -q, then manually set-variable w32shell-cygwin-bin to “"C:\\cygwin\\bin"” and w32shell-shell to “cygwin”, then run my command.

any suggestions?


∑ http://xahlee.org/


On Jun 7, 2:13 am, Lennart Borgman wrote:
> On Sun, Jun 7, 2009 at 2:21 AM, Xah Lee wrote:
> > got a very odd problem that's driving me nuts.
> > in cygwin prompt, i can call one of imagemagick's command and get
> > result.
> > However, while in emacsw32 shell, identical call results Windows Vista
> > poppig up a window telling me some app crashed.
> > Anyone got some idea what's wrong?
> Different paths. At the cygwin prompt you have imagemagick's
> convert.exe first in path.
> At a cmd prompt you by default have windows convert.exe in the path.
> (There is a which utility you can get from gnuwin32.)
> So I do not think this is related to EmacsW32. If it is then please
> give me more information.

Hi Len,

Thanks! You solved my problem.

I'm aware of Window's convert.exe ... my path problem is a bit subtle... but from youp reply, i compared my $PATH in cygwin terminal and $PATH in emacsW32's cygwin-shell, seeing that they are different, then i set emacsW32's cygwin-shell's $PATH to the same as the $PATH shown in cygwin terminal, then the problem is solved.

For the record, here's the value of $PATH in cygwin terminal (reformatted for readibility):

/cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static
/cygdrive/c/Program Files (x86)/QuickTime/QTSystem/

Here's the value of $PATH in emacsW32 cygwin-shell:

/cygdrive/c/Program Files (x86)/Emacs/emacs/bin/
/cygdrive/c/Program Files/Microsoft IntelliType Pro/
/cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static
/cygdrive/c/Program Files (x86)/QuickTime/QTSystem/

The interesting thing is that imagemagick's convert is in /usr/bin, so, while in emacsW32's cygwin-shell, i can do “which convert” and it reports the right program. So, apparantly, subsequent paths much have fucked things up. This probably also mean that /usr/bin/convert relies on other pieces to work. (same goes for imagemagick's “identify” command.)

Thanks again Lennart. I owe you one.

∑ http://xahlee.org/


emacs for Python

On May 25, 10:35 am, LittleGrasshopper wrote:
> With so many choices, I was wondering what editor is the one you
> prefer when coding Python, and why. I normally use vi, and just got
> into Python, so I am looking for suitable syntax files for it, and
> extra utilities. I dabbled with emacs at some point, but couldn't get
> through the key bindings for commands. I've never tried emacs with vi
> keybindings (I forgot the name of it) but I've been tempted.
> So what do you guys use, and why? Hopefully we can keep this civil.

I use emacs.

If you never tried emacs, you might check out:

• Xah's Emacs Tutorial

• Xah's Emacs Lisp Tutorial

you can use python to write emacs commands:

• Elisp Wrapper For Perl Scripts

Emacs keyboard shortcuts is problematic indeed. See:

• Why Emacs's Keyboard Shortcuts Are Painful

However, you can completely fix that. See:

• Ergoemacs Keybindings

∑ http://xahlee.org/