11 Years of Writing About Emacs

Emacs: Save Split Windows Configuration (updated.)

There are about 6 hundred pages of tutorials on this site. About one third are emacs tutotial, half are elisp tutorial and commands or elisp scripts tutorial, and lots articles on keybinding and keyboard and Repetitive Strain Injury, and also commentaries and essays on emacs, emacs community, etc, such as:

emacs M-x donuts 2012-09-15
M-x Donuts 〔➤see Emacs Related Essays

I update them about daily. What's to update? lots of things.

  • code update. Lots of them are enhanced commands, which i use and regulary improve. New features, or fixe bugs.
  • emacs, like every other software, changes. I have to keep up. Command name changes, keys change, packages obsoletion, function obsoletion, new feature to do X. All these happens. For example, lexical scope, CL package, magit keys and commands kept changing, etc.
  • Writing improvement. Correct typo, improve sentence, or change style, structure, or rewrite whole. Yes. Many tutorial pages began life as blog from a decade ago. Blog tends to be chatty and potshot, and tends to become obsolete fast. They need to be professionalized as tutorial proper. Covering lots topics, organization, structured.
  • Website and design issues. Yes, a web site doesn't maintin itself. CSS, JavaScript, changes faster than speed of light today. You have to keep up. And, design of your site, restructure, navigation bars, and code them.

I started to blog about emacs back in 2005. Now, it's 11 years.

xah emacs tutorial 2006 screenshot
here's my emacs tutorial back in 2006 Feb. https://web.archive.org/web/20060221050036/http://xahlee.org/emacs/emacs.html

What Tools Are Used to Build This Site?

emacs, of course. The following i use daily, and are the main tools to create this site:

  • xah-fly-keys.el
  • xah-html-mode.el
  • xah-css-mode.el
  • xah-js-mode.el
  • xah-find.el
  • htmlize.el (for syntax coloring code in html)
  • rsync

and lots of personal emacs commands in my init file.

I basically write it manually, or semi-manually, with lots of help of custom emacs commands. In the very beginning, every html tag is typed manually, char by char. Now, set of tags are inserted by emacs command on demand.

Though, i must say, I think my system is faster, less keystrokes, more flexible, more efficient — in a scientifically verifiable way, than any content management system or publishing system out there. org, markdown, wordpress, jekyll, zen, what-have-you.

(actually, the above is not too surprising. Because, if you know a subject well, deeply customized system is far more efficient than any off-the-shelf system, and also, you have precise control.)


emacs M-x customize, good or bad?

Clément Pit-Claudel gave a great answer about why pulling stuff out of custom-set-variables to setq may not work. See comment at Emacs: Stop Cursor Going into Minibuffer Prompt#comment-2734992432

also see comment by bhyde at Emacs's Customization Tutorial#comment-2663524352

the bottom line is that, if you pull out lines from custom-set-variables and change it to setq, it may not work.

i wasn't too pleased about this. This means, the defcustom is more complex than otherwise acting as defvar with a User Interface.

on this subject, there's the question about whether emacs's customize system is a good thing. (it was controversial). I think it's a mixed bag.

There's elisp, which is the core of all emacs and all customization. Why should we add a layer? Now, there are 2 ways to do the same thing. Also, the Graphical User Interface layer isn't complete, as not all customization can be done with it. (e.g. hooks, which is rather quite common and basic.) On the other hand, it does provide a explicit structure to declare what variables are user preference related, and with it, a text based graphical user interface.

but, it isn't a full system, and is not required nor enforced in packages. The consequence of this is that, there's inconsistency.

in general, coding in elisp is full of slack. There's no API, nothing is enforced, and you can do something low level or high level or whichever way. This in intentional from rms. XEmacs had packages since 1991 or so. rms refused it, till recently. I think rms believes this shapelessness helps propagate FSF free software. As in, it forces people to dig into code, not a blackbox API.


emacs custom-set-variables vs setq

Something strange is going on. It seems, pulling things out of the custom-set-variables no longer works?

Here's the test. Put the following in your init, nothing but just the following:

 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
    (read-only t cursor-intangible t face minibuffer-prompt))))

Restart emacs. Then, M-x query-replace and hold left arrow key to see if cursor went over the prompt. Cursor will not move into the prompt.

Now, delete that init, and use the following instead:

(setq minibuffer-prompt-properties (quote (read-only t cursor-intangible t face minibuffer-prompt)))

Restart emacs.

But now, it doesn't work?

This is emacs GNU Emacs

please comment and let me know what happens on your machine, and emacs version. M-x version.


Siri, Cortana, Ok Google, Are the Future of AI, the Embodiment of AI

talking to myself about Cortana, Siri for an hour. It's huge.

They, going to be the AI. For vast majority of people, the general public, it is they, Cortana, going to be the window to tech. With a human female voice User Interface, it will also become intimate, in a natural way. That is, most people, are not tech savvy. They don't even know what a browser is. But Cortana (and Siri, ok Google), because it communicates with user via human language, and being a female, this will lead to natural connection, and making the user wanting more, and will thus push and push for Cortana to mature, and meet demand. (and there'll be porn aspects, a huge industry, but that's different topic. We focus on the average people and phone use here.). Cortana (Siri, similar services) , will become the Embodiment of Artificial Intelligence, as the populace have seen in movies. Most people are not into scifi or tech stuff, but it is via the interaction of human female voice that help daily things, grow attachment, and become average people's connection with tech.

i think ALL our tech progress, will also become measured by them. As in, how mature, how smart, Cortana, Siri becomes.

they going to be the #1 software growth in next decade.


xfce window focus bug

lots focus bug mouse hover to raise window, in xfce ubuntu 14.04. upgrading to xfce14.12, then you got wmctrl problem. 4 hours wasted.

here's the detail.

Activating a window from the taskbar doesn't focus it when 'focus follows mouse' https://bugs.launchpad.net/ubuntu/+source/xfwm4/+bug/1292122

now, its supposedly fixed. See: http://git.xfce.org/xfce/xfwm4/commit/?id=1a20a88

so, now you upgrade xfce to 4.12. Linux: How to Upgrade Xfce

but now, there's wmctrl problem. That is, when you use the wmctrl tool to switch window wmctrl -xa emacs, it won't focus, only raise.

if you turn off mouse raise window, then the problem goes away. But, i want mouse raise window.

sad face.


on the question of too many programing libraries

in the past 5 years, there seems to be a exponential growth of programing language libraries.

this can especially be seen in JavaScript land.

this is different from say 1990s, where, there is usually widely accepted “the best” lib for X.

today, there are so many, that usually a programer never heard of.

so, the question to me is, what to do about it?

i'm the type that tend to know it all, alway keeping a eye on all things. But that has been impossible now, or even, impractical and meaningless.

i want to think about this, as to have some kinda conclusion or closure on the situation.

if i do nothing, then, libs will just grow without my awareness. This been the case for many years already. It can be likened to not knowning all latest movies, or all latest comic books published, or Japan comics books published in Japan, or say TV shows published in China, or not keeping up with gaming community, new games, etc. There are, thousands, millions, of them, things, you don't know. When you were a teen, you might know all the best new video games, or hot movies, or comics books, but not now, because you haven't been following it, no longer interested, or no time.

so, what's the deal with programing language libraries? well, today, not just lib grows exponentially, but also languages, and now programing paradigms.

〔➤see Proliferation of Computing Languages

for example, few years ago, node.js popularized event based programing. Now, reactive programing seems to be hot. There are language and libraries doing it. And, the idea of Persistent data structure seems also getting popular. First popularized by clojure, now Facebook immutable lib for JavaScript.

in the end, i don't think there's much one can do, or should do. Do you know all the movies published in India? In programing, even in the 1990s, not everyone knows about all fields of programing, such as operating systems, database, game programing, networking, scientific programing, etc.

but if you are a philosopher, a observer, then, you might still try to follow, keep in the know and analyze trends and have opinions about where are we going. In some sense, the task now is harder, and more exciting, then compared to 1990s.

actually, the phenomenon of exponential growth, is happening not just in programing libs, but every day things too. Everyday things, trends, inventions, practices, behaviors, i think they are all growing. (for example, think of cell phone, payment methods, dating practice) In this regard, am thinking, humanity has entered a era, sometimes depicted in dystopia scifi, where you have massive diverse groups and things each one odd to another.

i think, the speed and number of new things springing up, is faster than the speed they can be digested or merged with some universal status quo. So, you end up with lots regional phenomenon.

ok. So far so good. But, how does this compare to the era before? say, before the internet, or before industrialization?

before the internet, communication tech isn't as strong, so, first of all, new things may be happening around the world, just that you don't know about them. (the internet made us known things we never know before, such as sexual practices, and all sorts of others things, e.g. we can see and discuss on reddit now.) before the internet, even old things we don't know, such as different cultures. For example, to know what Chinese do, you have to be a academic, or go to library to dig book and look at a handful of pictures, or have lived in china. But now, you can know what chinese do daily, or watch their daily lives if you want to. (for example, twitter, facebook.)

ok, but do new things happen as much in say 1990s as now? I think in general no. Today, the tech is vibrant that new things happen far more often.

now thinking about before industrialization, i think the above is confirmed. Without technology, things don't change much.


sigil for my φvariable ξnames

fret about whether i should continue using funky sigil for my variable names. As in:

xd.drawCircle = function (φcontainer, φcenter, φr, φstyle) {
    var ξcir = document.createElementNS("http://www.w3.org/2000/svg", "circle");
    ξcir.setAttribute("cx", φcenter[0]);
    ξcir.setAttribute("cy", φcenter[1]);
    ξcir.setAttribute("r", φr);

    if (φstyle !== undefined) { ( ξcir.setAttribute("style", φstyle)); };

    if ( φcontainer === undefined ) {
        return ξcir;
    } else {
        return φcontainer.appendChild (ξcir);

the problem, is people. Other people.

you see, it's like the many english spelling reform. It is sound and good, except, the masses, idiots, will not have it, and is doom'd to failure.

the reason i want to do it is here: Sigil for Function Parameter Names and Programing Style: Variable Naming: English Words Considered Harmful.

but i thought about it more due to the my dilemma of continuing the practice, in JavaScript or any lang other than emacs lisp. I took a walk, talking to myself, for 30 min. Here's some more insights.

the essential good of it, is that it embeds semantic info into syntax. That is, you can tell if a variable is a function parameter, or local variable, or not global, just by its name.

This is in general called sigil. (most popularized by perl, followed by ruby.)

there are other examples of widely accepted practice of embedding semantic info in syntax. For example, in Java and python, class names starts with capital letters. This is a strong convention, everyone follows. It is important, because, classes, variable, methods, have very different semantics. Being able to tell by a glance saves you time or error.

also read, if you are inclined:

but i think am going to stop this geek char sigil practice. My emacs lisp code base are full of it, it's hopeless. For lisp, i probably should push on my way, as lisp is weird already. But for my JavaScript code, which there isn't much, am thinking of stop this φsigil ξthing.

the problem, is that whenever it is exposed and seen by other people, it's a problem. You'll need to do explanations, and you'll win yourself a weirdo badge. And, other consequences. For example, the jslint won't accept names that starts with Unicode char.

unless, i keep my code to myself only. Imagine, i, am the greatest coder, couldn't care less what other coder do or say. I just churning out my own code that rules the world. yeah. I think am too old to wishful-thinking that.


Functional Notation vs Operator, Ultimate Solution

suddenly, am thinking of the ultimate answer to the question of superiority of functional notation vs operator notation once for all

this is because, when i read, John Baez's post here

Zamolodchikov Tetrahedron Equation By John Baez. @ http://blogs.ams.org/visualinsight/2016/03/15/zamolodchikov-tetrahedron-equation/〕 (also here, more chatty at: https://plus.google.com/117663015413546257905/posts/QCrdfbbMYhZ )

the article title is daunting, and it immediately talks about 4D space and monoidal category and morphism.

but, actually just ignore those jargons. look at the image of braids. It says:

In other words, we can slide a crossing of two strands under a third strand. In topology this is called the third Reidemeister move, one of three basic ways of changing a picture of a knot without changing the topology of the knot.

now that's the beauty of math. Because, all those equations and symbols, are used only, and necessarily, to capture this simple concepts in a precise and efficient way. In the case here, is braids and movements.

but i digress.

what i personally got a omg moment at this point, is that, notice how he said in the Google Plus post:

My blog article explains it, with pictures. But in simple terms, the idea is this. When you think of the commutative law

xy = yx

as a process rather than an equation,

There! “consider communicative law as a process!

Now, that got me thinking. Because, i have thought about this myself. See:

the Nature of Associative Property of Algebra

in which, i realized the nature of associative law, and in general, the kinda nature of context these laws arise. So, i was thinking now, if thinking of it as a process would give me some more enlightenment.

but immediately, the associative law (a⊕b)⊕c == a⊕(b⊕c) don't have a analogous way as a process to turn it into a braid. You just get 3 staight lines.

i need to think about this some other time. Now I need to do something else.

wait, but back to the title. Why is it some ultimate solution of functional notation vs operator?

you need to read this first: What's Function, What's Operator?

because, notation, and syntax, is my obsession. And, basically, i am suddently prompted at this point to think about whether perhaps there's a way so that one of the notation can be eliminated without picking up disadvantages.

my immediate thought is that, perhaps functional notation can be dropped. Certainly not the other way around, because pure functional notation is too cumbersome (lisp is good example. you can't write math, in lisp). So, perhaps, somehow, operator notation is supreme… well but one immediate problem is that in general operators can only be for binary function. That is, 2 args, on the left and right sides. But, actually we could have match-fix notation. (see match-fix explained here Concepts & Confusions of {Prefix, Infix, Postfix, Fully Nested} Notations) But the issue with match fix is that, then we have to have a way to still use function names. That is, we can't device thousands type of brackets. So, in order to still have names, then have XML or lisp-like things… but oh, we back. Ok. Stopping here now.


Gnu Emacs New Leader: John Wiegley


Wiegley as maintainer was discussed in the gnu emacs dev mailing list for the past couple of months, hundreds of messages.

John Wiegley is the author of eshell, among others, and he lives in emacs. 〔➤ Emacs: M-x eshell

Here's a couple of video interviews of John.

Emacs: Chatting with John Wiegley about the cool things he does with Emacs By Sacha Chua. @ http://sachachua.com/blog/2012/06/emacs-chatting-with-john-wiegley-about-the-cool-things-he-does-with-emacs/
Haskell Talks: John Wiegley with FP Complete

John is a extreme emacs enthusiast, and his primary platform is Mac with strong desire to make emacs better on Mac too out of the box, and he is a very capable programer, and also a sociable person. I think John will bring a lot good things to emacs. Thanks John.


JavaScript wuwu quiz

// quiz. figure out what does this code do
// 2015-10-29

function foo() {
    var eleName = document.getElementById("x79177");
        (function(le) {
            return function(f) {
                return f(f);
            } (function(f) {
                return le(
                    function(x) { return (f(f))(x); }
        }) (function (givenGetDepth) {
            return function (element) {
                return (element === null) ? 0 : givenGetDepth(element.parentNode) + 1;
        }) (document.getElementById(eleName))