GNU Emacs bug: find-dired

Perm URL with updates: http://xahlee.org/emacs/emacs_bugs.html

GNU Emacs bug: find-dired

this seems to be a showstopper bug.

  1. start emacs runemacs.exe -Q
  2. call find-dired.
  3. Give a directory path. e.g. ~/web/xahlee_org/comp/
  4. Give the find option: -name "*html"
  5. expected result: list of files in dired.

Here's what i got:

  find . "(" -name "*html" ")" -exec ls -ld {} ";"
  Access denied - .
  File not found - -NAME

  ---------- BLOG.HTML

  File not found - )
  File not found - -EXEC
  File not found - LS
  File not found - -LD
  File not found - {}
  File not found - ;

  find finished at Sat Apr 28 19:46:27

each of the “…” is about n lines of file content. The n can be 4 to 10 or more. Not sure what's the pattern.

Also, my file names are mostly lowercase. Don't know why it is CAPS there.

GNU Emacs (i386-mingw-nt6.1.7601) of 2012-04-23 on MARVIN ErgoEmacs distribution 1.9.4

Windows 7.

random linux notes 2012-04-28

Perm URL with updates: http://xahlee.org/linux/linux_notes_2012-04-28.html

install Xfce desktop

Xfce is one of the light-weight desktop. If you hate the fancy shit in Ubuntu Unity or GNOME 3, and prefer a classic, standard UI that doesn't suck the blood out of your GPU, then use Xfce. Linus, reportedly, got fedup with KDE 4, then GNOME 3, and now uses xfce.

to install, run this: sudo apt-get install xubuntu-desktop

Xubuntu is basically Ubuntu with xfce as desktop by default.

there's another competing light-weight desktop, called LXDE, and Lubuntu is Ubuntu with LXDE as default desktop.

If you don't know already, Unity and GNOME 3's UI are bleeding-edge, “simplified”, “smart”. Basically, they try to innovate classic desktop metaphor to cater to those brainless computer-illiterates who just use browser, watch movies, and don't know anything about files, folders/directories, apps, workspaces, etc. They try to fashion it to be intuitive and easy-to-use just like Apple's stuff that just works, except that they failed.

since GNOME moved to GNOME 3, leaving GNOME 2 dead in the water, some people forked GNOME 2 and is now named MATE (desktop environment).

Learn Technical Writing from Unix Man in 10 Days

Quote from man apt-get:

    remove is identical to install except that packages are removed
    instead of installed. 


    kicking is identical to kissing except that receiver is kicked
    instead of kissed.

Disappearing URL in Doc

so, i was reading man git. Quote:

Formatted and hyperlinked version of the latest git documentation can
be viewed at http://www.kernel.org/pub/software/scm/git/docs/.

but if you go to that url, it shows a list of over one hundred fourty empty dirs.

I guess unix/linux idiots can't be bothered to have correct documentation. Inability to write is one thing, but they are unable to maintain a link or update doc?

does this ever happen to Apple's docs? If it did, i don't ever recall seeing it from 18 years of using Mac.

more records of careless dead link:

apt-get Package Naming Confusion and 〔/var/lib/〕

so a friend told me about a game named “githug”. It's a command-line app that teaches you git, as if playing a game.

githug site says: gem install githug. I ran which gem and got no result, so i brainlessly typed sudo apt-get install gem and it went. But apparently, the gem package isn't what i want. What i wanted, turns out, is called “rubygems”, which is ruby's package management system.

there are several issues thus far:

  • in unix, never brainlessly run things on command line (like i just did) unless you sure know what you running
  • WTF is “gem” and “gem” named the same?
  • question: how do YOU find a description of a package in “apt-get”?

now, continuing the story… so i: sudo apt-get install rubygems then i gem install githug all went well, except, when i type which githug nothing is to be found. WTF is going on?

Answer: “githug” is installed in 〔/var/lib/gems〕 by default. You need to either call it with full path or add it to your $PATH.

(the command updatedb and locate are helpful in locating files. They are basically a cached version of find …. (Thanks to Huynh Kang))

Why the fuck is it in 〔/var/〕 dir?? To refresh my Unix Philosophy, see: Unix directory structure. Quote:

〔/var〕, a short for “variable.” A place for files that may change often.

in unix shit, there's always some tech justification that makes you feel better.


John Carmack Glorifying Functional Programing in 3k Words

John Carmack glorifying functional programing in 3k words

where was he ten years ago?

Emacs *scratch* Poem

The emacs scratch buffer thread on gnu.emacs.help newsgroup (Source groups.google.com) is rolling, and became a verse fodder.

emacs's *scratch*
amounts to a bitch
but we cannot ditch
the banner of our church

new articles on web dev, 2012-04-26

new articles and updates on web dev.

Javascript: Get a Element's Attribute/Properties

Update HTML CSS Javascript DOM, References

much updated Xah's Javascript Tutorial

Complete update: Xah's CSS Tutorial. More to come.


Emacs 24: Oddity with Bidirectional Language/Script Support

first, here's my emacs version am testing from. “GNU Emacs (i386-mingw-nt6.1.7601) of 2012-02-15 on MARVIN”

Some facts:

  • Right arrow key is bound to right-char.
  • Ctrl+f】 keys is bound to forward-char.

Now, paste this sentence in emacs “(كتاب ألف ليلة و ليلة)”. Then, hold down right arrow key, then when cursor moves into the Arabic text, it'll suddenly reverse direction, and move right to left, until it reaches the left most arabic char sequence, it'll jump back to the english text and continue move right.

Now, do the same but using forward-charCtrl+f】. Actually, the same behavior is observed visually!

from Eli Zaretskii's post (at Source groups.google.com), it seems to be the expected behavior. But then what's the difference of forward-char and right-char? Am totally confused now.

In emacs 23, holding right arrow (or 【Ctrl+f】) simply move cursor to the right, ALWAYS. I was expecting this from emacs 24's right-char.


Sort list-colors-display by Hue

Perm URL with updates: http://xahlee.org/emacs/emacs24_features.html

You can call list-colors-display to list colors and their RGB hex values. But the result is not sorted. Now, you can sort it by hue. Much better. Put this in your emacs init file:

(setq list-colors-sort 'hsv )

Google Chrome's “about:config” Panel

In Firefox, you can goto about:config and tweak your mouse configs.

In Google Chrome, there's something similar. Goto chrome://flags/.

To turn on autoscroll feature on Linux, paste about:config in the URL field, then set general.autoScroll to true.


Emacs 24 now supports bidirectional Text

Perm URL with updates: http://xahlee.org/emacs/emacs24_features.html

e.g. {Arabic, Persian (Iran), Hebrew}. They flow from right to left.

  • In emacs 23, the key invokes forward-char. Always moves the cursor to the right.
  • In emacs 24, the key invokes right-char. The direction the cursor moves depends on cursor point in current text.

Note, it's more logical for the two command's behavior to be exchanged. i.e. “right-char” should always move to the right, and “forward-char” should move depending on context.

Emacs 24: Unicode {Space, Hyphen} Chars Display

Perm URL with updates: http://xahlee.org/emacs/emacs24_features.html

Certain non-ASCII space and hyphen Unicode characters are displayed with a reddish color to distinguish them from similar ASCII ones. Emacs 24 added 2 more. The complete list of such chars are:

  • “HYPHEN” (U+2010)
  • “SOFT HYPHEN” (U+00AD) ­

(Copy the above list and paste in emacs to see.)

Call describe-variable on “nobreak-char-display” to see the detail.

To insert unicode, call ucs-insert. (➲ Emacs and Unicode Tips)

svn upgrade error “svn: E155019”

Recently i upgrade all packages in cygwin. When i did a commit, i got:

svn: E155019: Can't upgrade '/cygdrive/c/Users/h3/ErgoEmacs_Source/ergoemacs/ergoemacs' as it is not a pre-1.7 working copy root, the root is '/cygdrive/c/Users/h3/ErgoEmacs_Source/ergoemacs'

Oh no! Error! My mind is psychologically conditioned to think i'll need to spend a hour or more to fix whatever problem is this. Apparently, svn 1.7 changed its repository metadata format. Luckily, the solution is simple:

  • cd to the root of your project's svn repository.
  • do svn upgrade
  • Repeat for other project's svn root.

Whew, that's not too bad.

Programing Problem: Decimalize Latitude Longitude

Last year, i ran a elisp exercise but i got busy and never gave answer. Let's do this again. Here's the problem

Write a function “latitude-longitude-decimalize”.

It should take a string like this: "37°26′36.42″N 06°15′14.28″W". The return value should be a pair of numbers, like this: [37.44345 -6.25396].

Feel free to use perl, python, ruby, etc. I'll be posting a solution in emacs lisp in 2 days.

If you got stuck, you might peak at Kurt Schwehr's solution in python, at Source schwehr.org.

Kurt's site is down at the moment. Here's a temp site for his python code: Source pastebin.com


• Jon Snader (jcs)'s solution in elisp + CL package, @ Source irreal.org

• Kurt's solution, Python, @ Source pastebin.com

• Mickey Petersen's solution, using emacs calc + elisp, @ Source www.masteringemacs.org

Jean-Sébastien Ney, Ruby. Port of Kurt's python code to ruby, @ Source gist.github.com.

Jorge A. Alfaro Murillo solution in elisp, @ Source pastebin.com

• Ian Kelly. Python 3. @ Source groups.google.com

will write a blog collecting the solutions and summery, and my clunky elisp solution this weekend.

CSS3 Color Linear Gradient

Perm URL with updates: http://xahlee.org/js/css_gradient.html

This page shows a example CSS3's linear gradient feature.

Here's the CSS syntax examples:

  • background-image: linear-gradient(0deg, red, yellow)
0deg, red, yellow

CSS code:

div {background-image: linear-gradient(0deg, red, yellow)}

as of , no browser supports it. Test it here: CSS linear gradient test.

Browsers Experimental Support

Google Chrome, Firefox, Safari, Opera, all have experimental support, except Internet Explorer 9. (IE10 does support it)

270deg, yellow, red

Here's the CSS code:

background-image: linear-gradient(270deg, yellow, red);
background-image: -webkit-linear-gradient(270deg, yellow, red);
background-image: -moz-linear-gradient(270deg, yellow, red);
background-image: -o-linear-gradient(270deg, yellow, red);
background-image: -ms-linear-gradient(270deg, yellow, red);

The first parameter is a degree. Here, 270° means going from top to bottom, vertically.

Smooth Gradiants

in this example, the gradient line is at 0 degree. (horizontal, left to right) The box is evenly divided into 5 colors: yellow, red, green, blue, white.

0deg, yellow, red, green, blue, white

CSS code:

background-image: linear-gradient(0deg, yellow, red, green, blue, white);

This is equivalent to linear-gradient(0deg, yellow 0%, red 25%, green 50%, blue 75%, white 100%);.

Specify Color Stops

Normally, the different colors are evenly divided along 2 end points in a given direction. The starting color is at 0%. The ending color is at 100%.

You can specify the position on the gradient line for each color. In this example, we use the same 5 colors, but with red starting at 80%.

0deg, yellow, red 80%, green, blue, white

CSS code:

background-image: linear-gradient(0deg, yellow, red 80%, green, blue, white);

Color Stops Example 2

Here we specify 2 color stops. Red at 80% and green at 95%.

0deg, yellow, red 80%, green 95%, blue, white

CSS code:

background-image: linear-gradient(0deg, yellow, red 80%, green 95%, blue, white);

Sharp Color Change

When 2 color stops are at the same position, you have a sharp color change. Here, both red and green are at 80%.

0deg, yellow, red 80%, green 80%, blue, white

CSS code:

background-image: linear-gradient(0deg, yellow, red 80%, green 80%, blue, white);

First Color's Color Stop

If the first color has a color stop other than 0%, than all colors before it is the same. (similar for last color)

0deg, yellow 50%, red, green, blue, white

CSS code:

background-image: linear-gradient(0deg, yellow 50%, red, green, blue, white);

Color Stops by Pixels

The percentage for color stops can be any CSS length unit, such as px (pixels).

Each color stop should be equal or greater than its previous color stop value, else it doesn't make sense.

Here's color stops by pixels. The whole bar has 1k pixels.

0deg, yellow, red 100px, green 200px , blue 300px, white

CSS code:

background-image: linear-gradient(0deg, yellow, red 100px, green 200px , blue 300px, white);

RGB, HSL, Color Specs

Note that color spec can be rgb or hsl, even with opacity.



emacs 24 unicode 6 support

Perm URL with updates: http://xahlee.org/emacs/emacs24_features.html

Unicode 6 Support

Unicode 6 is now supported. For example, call ucs-insertCtrl+x 8 Enter】 then “GRINNING CAT FACE WITH SMILING EYES”, then you get this char 😸.

Note: the char won't display in emacs. First, make sure your system has the font. Best is Symbola. (➲ font for Unicode 6) But even if you have Symbola installed, emacs won't show the char unless you actually switch to that font. Am not sure there's much one can do.

Source groups.google.com

Emacs 24 Improvements: copy/paste, describe-char, calc keymap

Perm URL with updates: http://xahlee.org/emacs/emacs24_features.html

Linux/Emacs Copy/Paste Problem

In linux, if copy/paste doesn't work with other apps, you need to add this line:

(setq x-select-enable-clipboard t)

in GNU Emacs, that var is set to t now.

unicode info

When calling “describe-char”, now it display the char's position in the first line.

Here's emacs 23 output:

        character: m (109, #o155, #x6d)
preferred charset: ascii (ASCII (ISO646 IRV))
       code point: 0x6D
           syntax: w    which means: word

Here's emacs 24 output:

             position: 9198 of 11337 (81%), column: 0
            character: m (displayed as m) (codepoint 109, #o155, #x6d)
    preferred charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x6D
               syntax: w        which means: word

calc keys

“calc”'s keymapping seems to have improved.

before, supposed you have set 【Alt+z】 for undo globally. But it won't work in calc. You have to use emacs's default. Now it does.

Emacs Dired Recursive Load Error 2011-05-26

Perm URL with updates: http://xahlee.org/emacs/emacs_dired_recursive_load_error.html

Once you loaded ErgoEmacs, everytime you try to open a file or directory, you get a “Recursive load” error:

expand-file-name: Recursive load: "/usr/share/emacs/23.2/lisp/net/tramp.elc", "/usr/share/emacs/23.2/lisp/shell.elc", "/usr/share/emacs/23.2/lisp/net/tramp.elc", "/usr/share/emacs/23.2/lisp/shell.elc", "/usr/share/emacs/23.2/lisp/net/tramp.elc", "/usr/share/emacs/23.2/lisp/shell.elc", "/usr/share/emacs/23.2/lisp/net/tramp.elc", "/usr/share/emacs/23.2/lisp/shell.elc", "/usr/share/emacs/23.2/lisp/net/tramp.elc"

(Tramp is a package integrated with GNU emacs. It lets you work with files in remote servers.)

I couldn't think of where that error came from. Plain GNU Emacs doesn't have that error, only when ErgoEmacs is loaded. However, ErgoEmacs doesn't redefine find-file in any way. A Google search turns up a post in GNU emacs mailing list. See: The old tramp recursive load By FredCroot. @ Source lists.gnu.org.

There seems to be some change in tramp. The solution suggested is just to load tramp in your init file, and that solved the problem for me. Like this:

(require 'tramp)

This is emacs 23.2.1 on Ubuntu Linux 11.04, running ErgoEmacs. On .

Back to Emacs Misc Bugs.