browser extension development explained: Google vs Firefox

for Google Chrome, you go to their tutorial, in 20 min, you know how to write one, how to pack it, and have a good overview of the API. Pure JavaScript HTML CSS.

for Firefox, there are meta-guide old and new on mozilla blogs, then there are 3 frameworks, one requires to download a SDK that runs python that it asks you to run its random bin/activate fk bash script with instruction about how to untar a tarball, and one is “bootstrap” fk, and another is XUL fk, each fk has their own introduction page, with one thousand links & jargons & guides &warnings & preface & idioms guides. In 1 hour, u still dunno a thing about it.

completely replace emacs one thousand keys, part 2.5

a few months ago, i started to design a keybinding set that completely replaces the entire emacs 1k+ keybinding.

i've been using it for a few months now. I want to publish it nicely, but just haven't got to it.

so, am just pushing it out as its current state, here: https://github.com/xahlee/xah_emacs_init/blob/master/xah_emacs_keybinding.el

again, i'm pushing out in its current chaotic state, hoping some keyboard hackers will pick it up, in case i never do.

to use it, you need:

  • is a emacs lisp hacker.
  • is a keyboard fanatic.
  • it is currently for dvorak. so, if you are not using dvorak, you'll need to remap yourself.
  • the code is not nicely packaged up into a lunchbox. (but, it's not complicated neither. it's very simple)

here's a bit detail to help along:

there are 2 types of command: fast-repeat command and none-fast-repeat command.

the fast-repeat commands are moving cursor, delete characters, etc, where it makes sense to hold down a key and have it repeat. Typically, in emacs, there are 20 to 30 fast-repeat commands.

vast majority of emacs commands are non-fast-repeat. e.g. open file, switch buffer, dired, shell, calc, …

fast-repeat commands you need a single key or key chord.

fast-repeat commands are also the most frequently used commands, every second or few seconds.

ergoemacs-mode, is a package that solved the fast-repeat commands. (ergoemacs-mode also has a system for non-fast-repeat commands, but isn't designed from the ground up. It's based on converting emacs C-x to non-chord key sequences.)

xah fly keys Mode is my new package that deal with fast-repeat commands. The key choices are mostly compatible with ergoemacs-mode. The major difference is that this is a modal input system, like vi.

that leaves the non-fast-repeat commands, which is basically all commands of emacs C-x keys.

so, the news is, i've now designed a set for this. The key map choice is based on frequency of the command and ease of key position.

If you find a GNU emacs command that by default has a key but is not covered here, it's a bug. (actually, it's 98% complete. there are about 100 commands with keys that is rarely used. (you can see them near the end of the file, as commented out lines. i wasn't sure what/where to do with them yet))

this is new because it's the first time i completely designed entire emacs keys for public use. Before, i was simply using my own keys without regard to other people's use.

for stories leading to this, see

addendum: the keys are merged into xah fly keys Mode


xah rumination extempore. hatred of idiots

i've spent significant part of my life arguing with idiots. Mostly, the hacker type of programer idiots. When in argument, most of the time, i know what they are talking about, they dunno what am talking about. That is the thing.

when did this start to happen? i think it's around year 2000. Before that, one could consider i'm a learner. A eager one. Read all the stuff i can get my hands on. Have lots questions. Often frustrated by those who don't know what am asking.

after 2000, when i'm master of perl and unix tech, servers, networking stuff, i started to lash out at the hacker idiots. That's when, people started to call me a troll.

i introspect a lot. that is to say, to a degree that's considered pathological. (it's one of the characteristics of schizoid personality) So, on this issue, i've considered, to extremes, from whether i'm a idiot, or they are, or, what exactly is happening, why does it happen. Like, a deep analysis, of all facts and facets.

i do have some conclusions. It happens because, mostly it's a personality induced thing. That is, my personality. More concretely, unable to chichat, smooth things out, say things in a agreeable manner. But, the other thing is, excuse me for saying so, most these people are idiots. No, rather, i'm a bit ahead, like, 10 years ahead the time, as sometime that's said to some mad scientists. (of course, by saying this myself in a unashamed public way, i win more enemies and ridicule. that's ok.)

you know? you read a lot of things. No, i read a lot of things. Not just programing or math stuff, but psychology, sociology. And one of the most fascinating to me is brain washing, marketing, propaganda, influence, kinda things. Or, leadership. That fascinates me. You see? you can be a great mathematician or scientist or programer, but if you are a leader, you raise a army at your heels, willing to do whatever you want them to do. (as cult leaders, or to a lesser degree politicians) There are tons of books on these topics. One thing common in these thread, is that if you want to lead, to influence people, to negotiate, to be a smooth operator, get people to believe you, trust you (as con man is good at)… that one thing, is to not offend, and from there you can lead, or trick people, that they become your followers.

you have to follow the way people think, and smoothly go from there. persuade them, handhold them — lead them.

but that's something am not sure i want to do. That's the bottom of it. Somethings in life is not a matter of decision or choice. If you are born a harlot, you are likely to be a harlot.


Emacs Lisp: Change Current Word to Wikipedia Link

(defun xhm-word-to-wikipedia-linkify ()
  "Make the current word or text selection into a Wikipedia link.

For Example: 「Emacs」 ⇒ 「<a href=\"http://en.wikipedia.org/wiki/Emacs\">Emacs</a>」"
  (let (linkText bds p0 p1 p2 wikiTerm resultStr)

    (if (region-active-p)
          (setq p1 (region-beginning))
          (setq p2 (region-end)))
        (setq p0 (point))
        (skip-chars-backward "^ \t\n")
        (setq p1 (point))
        (goto-char p0)
        (skip-chars-forward "^ \t\n")
        (setq p2 (point))))

    (setq linkText (buffer-substring-no-properties p1 p2))
    (setq wikiTerm (replace-regexp-in-string " " "_" linkText))
    (setq resultStr (concat "<a href=\"http://en.wikipedia.org/wiki/" wikiTerm "\">" linkText "</a>"))
    (delete-region p1 p2)
    (insert resultStr)))

in Emacs: Xah HTML Mode

this and Emacs: Xah Emacs Lisp Mode i use heavily daily. The xah-html-mode is older, and few times more code and functions. But it's rather chaotic. the xah-elisp-mode is more clean.