ErgoEmacs has a new version, lots improvements in past month by Matthew L Fidler. Matt also created a new home page for ErgoEmacs keybinding minor mode. This should be the new home page going forward for community. At http://mlf176f2.github.io/ErgoEmacs/
The video presentation is pretty bad. I have much to learn, tech and presentation. I was using Google Plus hangout feature with Hangout On Air to record directly to YouTube. Not sure what's a good solution on Linux yet.
also, i need to write code so that whatever command i called is displayed in a pane. So viewers can see it without me going over.
Dear all, a new version of my tutorial is out. I'm making this a special version, for $40. If you support it, i'd be greatful, and i'll add your name to the Xah's Emacs Tutorial: Acknowledgment as sponsor.
Another way to voice your support is funding a emacs major mode that you might want. Please visit http://pledgie.com/campaigns/19973. Please let me know if you have questions..
i was calling unix uniq from emacs. Got a unexpected result. I thought it's Unicode data passing screwup. Turns out, the bug is in uniq itself.
Unix Shell Util uniq Unicode Bug
Functional Programing Meta Language (ML) in Emacs Lisp!
discovered that emacs has a bundled library for functional programing pattern matching! The package file is 〔pcase.el〕. It's part of GNU Emacs 24.3.1.
it's written by Stefan Monnier, a professor of functional programing research, and one of the two current leader of emacs dev.
you can get to the file by calling describe-function then pcase-let, then click on the file name.
Note: ML stands for Meta Language. It was a family of languages. Current popular descendants include OCaml and Microsoft's FSharp.
〔☛ Xah's OCaml Tutorial〕
Among functional programing languages, OCaml is one of those that's heavily used in the industry (⁖ Mldonkey, Unison
〔☛ Unison Tutorial〕), especially in math formal proof systems ⁖ Coq. And it's famously used in JaneStreet.
〔☛ OCaml Use in Industry: Janestreet Talk by Yaron Minsky 📺〕
more improved. Emacs: Xah CSS Mode. You can now convert RGB hex color under cursor to HSL format (⁖ #aabbcc ⇒ hsl(210,25%,73%)). Call xcm-hex-color-to-hsl.
why should you convert? because, #rrggbb is one of the hack from history. HSL model isn't perfect, but is much more intuitive. You can change the hue, saturation, and lightness. For some explanation of HSL model and color samples, see: CSS3 HSL (Hue, Saturation, Lightness) Color Samples.
Emacs: new major modes for HTML, CSS, PHP, ELISP, and Lean Emacs LISP Manual
updated. All the ways you can set keys. Emacs is all about keys. Set any command to any key you want. Set one key today! Emacs Keybinding Syntax Examples
Matt has done a lot to ErgoEmacs keybinding. I haven't kept up with the features, but i'll blog as i learn. Here's one.
When you use any of the cursor movement keys, you can keep pressing movement key without holding down the Alt. For example, on QWERTY layout, press 【Alt+jj】, it'll move cursor to the left twice. You can turn this off by putting this in your init:
;; turn off ErgoEmacs repeat move without holding Alt feature
(setq ergoemacs-repeat-movement-commands 'nil)
;; set ErgoEmacs repeat movement. Example, on QWERTY, once you press any of 【Alt+i】 or 【Alt+j】 or 【Alt+k】 or 【Alt+l】, then any i j k l key will move cursor, no need to hold Alt anymore. Type any other key automatically exit.
(setq ergoemacs-repeat-movement-commands 'all)
;; set ErgoEmacs repeat move without holding Alt, but one key afterward. Example, on QWERTY, 【Alt+j j】 will move left twice
(setq ergoemacs-repeat-movement-commands 'single)
the only hope for this to improve is waiting for Guile Scheme Lisp to takeover Elisp.
The talk has been on for perhaps a decade now. Last hopeful news i heard is about 2 years ago.
now, open that file, trim out the header and tail. So, the first line should be “Zippy the pinhead data base.” and last line should be the line about “synapses”.
Now, in emacs, call yow, and a zippism will show. To insert, call universal-argument 【Ctrl+u】 first.
** Emacs tries to macroexpand interpreted (non-compiled) files during load.
This can significantly speed up execution of non-byte-compiled code, but can also bump into previously unnoticed cyclic dependencies. These are generally harmless: they will simply cause the macro calls to be left for later expansion (as before), but will result in a warning (“Eager macro-expansion skipped due to cycle”) describing the cycle. You may wish to restructure your code so this does not happen.
Dmitry Gutov wrote a nice article that shows the speed increase: 〔Emacs 24.3's Killer Feature: Eager Macro-Expansion By Dmitry Gutov. @ dgutov.github.io…〕
It's a bit deep. If you code elisp, you should read it. If you don't code elisp, here's the gist:
Before emacs 23.3, byte-compiled file is about 6 or 10 times faster for loading and also execution
After emacs 23.3, byte-compiled seems just twice as fast.
here's ErgoEmacs setup tutorial, by Sindikat: 〔ErgoEmacs tutorial By Sindikat. @ abstractnonsense.net…〕
new version of ErgoEmacs Keybinding is out again. I'm happy to report that the current maintainer Matthew L Fidler has adopted a idea i suggested. Now, “all” of chorded keys has a non-chorded replacement! You can press them by pressing ▤ Menu key first. Here's the current keys:
The keys are position based, and QWERTY layout is used to indicate their position. That means, doesn't matter whether you are using Dvorak, Colemak, Workman, Bépo, …, you can just look at the labels on your keyboard for the right key. The keys may not be final. But Matt is the maintainer now, so, you'd have to ask him, for suggestions or code push. Also, i haven't been keeping up my documentation of it. I hope to fix it down the road. Another new layout support is Persian standard layout, contributed by Shahin Azad. (it also supports Workman layout. and quite a few others now. You can see all layout supported in the menu 〖ErgoEmacs〗)
Matt also created a emacswiki page at http://www.emacswiki.org/emacs/ErgoemacsKeybindings, so you can post there, ask for help, or help make it better. (Matt says that don't use the emacswiki for question, because it's automatically generated from info file.)
i think this is really great, because for years i've been thinking how to resolve the cua-mode and emacs C-x issue. Now, i think this is the answer. The implementation is simple, and we don't need the complex hack of cua-mode anymore, and the traditional C-x are still there if one wanted, and the whole system is one step more efficient and ergonomic, even beats vi-like modes. (the main issue of vi's modal ways is that you need to constantly switch modes.)
there's a great page-break-lines-mode by
Steve Purcell.
It displays FORM FEED char (^L) by a horizontal line.
The package is on MELPA. Call list-packages to install.
〔☛ A Guide on Emacs 24 Package System〕
After you install, you need to specify which major modes it should activate. Like this:
Emacs 24 added a new feature. Some function's inline doc now has a link to elisp manual. For example, call describe-variable on “font-lock-defaults”. Excerpt:
font-lock-defaults is a variable defined in `font-core.el'.
…
(See also Info node `(elisp)Font Lock Basics'.)
…
actually, not sure this is new in emacs 24. I sure hope every function's inline doc links to elisp manual.
anyhow, you could easily find the elisp doc yourself. See Emacs: Finding Functions and Documentation Lookup. For elisp coders, you might define a advice so that describe-function will always have a link at bottom to elisp manual.
old page, one of my earliest tutorial in 2007, updated. Emacs Lisp: Writing a image-linkify Function. The updating process usually involves removing verbiage and auto-admiration, and removing learning thought-flow.
got a kick out of reading this. 〔Just Use Sublime Text “Sublime Text 2 vs Vim” By Andrew Ray. @ delvarworld.github.com…〕
Unicode Rhapsody: Symbols to Represent “emacs lisp”
for Unicode freaks. Found symbols to represent emacs lisp ε ℓ. In normal text, it looks like this “εℓ”. Depending on what browser and OS you are using, it may look beautiful or ugly. Alternatively, use scripted “e” ℯ. ⁖ ℯℓ. But that's got too much affinity with Spanish.
likewise, “ε” can represent “emacs” in a pinch, if you want your writing to become cryptic and symbolic logic like, like i do. 😎
though, i can't help but feel something is missing. the scripted “el” is kinda boring. Maybe we need to add a gnu head or something? Though, there's no gnu but ox and water buffalo and ram and goat. 〔☛ Unicode Animal & Insect Icons 🐭 🐮 🐍 🐵 🐞〕
in emacs 24.3, now execute-extended-command is now written in elisp, not C code. You can see the lisp code by calling describe-function. The emacs 24.3 release notes didn't mention this. This change is made by Aaron S Hawley. Thanks Aaron.
when you isearch a phrase (⁖ “some thing”) and if the 2 words happens to be hard-wrapped into 2 lines, it'll still find it. In other words, emacs added a feature in isearch such that space can stand for a sequence of whitespaces.
This problem has been bugging me before, and i deeply blame it to the damages unix has done to computing. 〔☛ Programing: the Harm of Hard-wrapping Lines〕 But at least now emacs works-around it.
you can read more about this feature by calling view-emacs-news then search for “isearch”.
Mickey of “Mastering Emacs” wrote a easy-to-understand doc of what's new in emacs 24.3. Check it out. 〔WHAT'S NEW IN EMACS 24.3 By Mickey Petersen. @ www.masteringemacs.org…〕
(global-set-key (kbd"<menu> u SPC") " ") ; insert non-breaking space
but this works:
(global-set-key (kbd"<menu> u SPC") (lambda () (interactive) (insert" "))) ; insert non-breaking space
GNU Emacs 24.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2013-02-04 on xah-p6813w
ErgoEmacs distribution 2.0.0
learned a great command vc-annotate from Jon's blog. See:〔vc-annotate By jcs. @ irreal.org…〕
Emacs: Personal Keybinding, Habit, Muscle Memory, Incompatible Key Sets
when you use your personal key for about 2 months, it becomes muscle memory. Just as people who work among {Windows, Mac, Linux}, or switch between {emacs/bash, browser, photoshop}.
you'd unconsciously learn to adopt the different systems. Though, sometimes some error key press still happen. e.g. on the Mac, emacs copy 【Alt+w】 is prone to close a window — very painful. So, when i used to use default emacs keys, i developed a habit to copy by 【Escw】.
ideally, all systems should use the same key system, but that's ideal. haha.
sometimes i read people who reviewed ErgoEmacs keybinding and liked it, but is reserved about using it, because it's another set to learn, creating clash with bash. But the fact is, one already is exposed to so many different systems, one just adopt. (btw, current version of ErgoEmacs can generate keysets for bash or AutoHotkey.)
even web browser, doesn't agree on keys, within the same OS. e.g the keys to switch tabs is different on different browser, and few others. Same browser on diff OS also disagree on keys. ⁖ in Chrome, go back is ⌫ Backspace on Windows, but 【Alt+←】 in Linux.
then, even KDE and Gnome don't agree on many keys. What can you do?
i post frequently on Google Plus at ErgoEmacs. I like g+. It's very convenient for small tips and chat. So, you might give it a try.
Also, i use twitter. Emacs related are posted to ErgoEmacs. So, if you want to quick contact or ask questions, follow. Thanks.
emacs. learned this new trick. delete-indentation. default key is 【Alt+^】. Seems it'll be very useful. (thx to Alexander Gallego)
This is the best straight form mechanical keyboard for programers. See the review for my reasons why.
emacs dired tip: hiding some files
learned a new command. In dired, call dired-do-kill-lines 【k】 to hide marked files. Amazing. Using dired for over a decade and didn't know this command. This is useful when you call find-dired to show all subdirs when you want to do dired-do-query-replace-regexp, but some files you don't want to work on.
discovered that the Ducky keyboard from Taiwan makes real quality keyboards. Check out their website. I don't think you can easily buy it in USA though. But you might be able to buy from the company's site via oversea shipping. (KBC is also quality.)
this gonna be a keyboard week. Lots updates, all about keyboards.
i'll also have lots to say about my new-found-love the Truly Ergonomic Computer Keyboard (TECP). I'll be telling you my experience in adopting the new physical layout.
there are lots new keyboards out there too, including from hushhush and hushhush, won't tell till i write it out.
also, exclusive news, that i'll be writing the firmware for TECP, and tell you how you can help, or sources, etc. For now, just run and buy TECP first. ☺
if you just subscribed to my emacs blog, there's lots existing articles. Do browse around for many tips. After blogging about emacs for 5 years, most generic tips are covered. A good tip is to browse one article a day.
there are still lots of elisp areas i haven't covered and need to learn myself. ⁖ font system, text overlay, window/frame/buffer manipulation, deep understanding of keymap system, process manipulation, networking, minor mode, lisp macros, comprehensive coverage of emacs's completion system, …, i'll gradually do so in the future. So far, the one elisp area i think i pretty much covered is writing interactive or batch text processing commands/scripts. This is probably the most useful.
also, i am starting to do ask emacs Tuesday again. I found that usually i won't be able to answer questions satisfactorily, because the questions are diverse, and usually not about using emacs or elisp, but rather about best modes for xyz or how to make xyz mode do abc. In anycase, i think it's still good to have ask/answer sessions. So, on every Tuesday, you can ask me on any social network, and i'll try my best to answer.
also, again, if you haven't gotten my tutorial, do buy it, as it'll help me really churn out the deeper elisp parts, and create more useful packages (they are all in ErgoEmacs project repo). Only $5 bucks.
should be fun. This problem started in elisp for me few years ago. Over the years, tried several elisp approaches… but overall i was stung twice. Few weeks ago, found a bug in my code. Rewrote it with a new algorithm thinking it's much better, but bang, another bug. That is, incorrect behavior.
Now i think i have a good solution, but still has certain limitations. So, am posting this as a fun coding problem, pulling on the talent pool.
am posting this as a general programing problem, not specific to emacs lisp. I do have a elisp solution, but can be easily translated to any other lang.
I don't think this is for emacs users, but a fun funky keyboard, with mechanical keys (Cherry MX Black). Levetron Mech gaming keyboard
it uses Cherry MX Black, which is linear but require more force to press. I've tried Cherry MX Black, didn't like it at all.
there's a interesting bit about gaming keyboards. For gaming, many don't like any “click” in key press, because imagine pressing the fire button. You need to press it fast repeatedly, so clicky may not be good.
so, ALMOST ALL gaming keyboards, mechanical switch or not, are designed with linear feel.
i've tried Logitech keyboard, don't like the key feel at all.
another interesting bit about gaming keyboard is that they are actually the vanguard of keyboard tech. 6 to 20 extra function keys, robust and easy-to-use software for on-the-fly key recording, onboard memory (no need to diddle with AutoHotkey or whatnot xmodmap, wmctrl, xdotool), backlighting, built-in display, all from gaming keyboards.
also, many gaming keyboards do have mechanical keys. I think most uses the Cherry MX Black, but some uses Blue (which is most clicky), or Brown (which is kinda standard for typing).
〔☛ Guide to Computer Keyboard Key Switch Mechanisms〕
update on the Happy Hacking keyboard. I love it not. But you might. Just drew the layout diagram of Happy Hacking Keyboard in SVG. The Idiocy of the Happy Hacking Keyboard
PS if you gonna buy it, buy it from my amazon link!
One of the major developer of xemacs was Ben Wing. He also suffered from severe RSI.
I was not able to find any info about him before, but a friend helped today.
another Emacs Power Challenge from jcs. These “emacs golf” problems, seemingly trivial and irrelevant in real world, but is often the most fun way to horn your skills and learn new tricks, which will then burn into your muscle memory and increase your emacs power. Check it out.
〔EmacsGolf Challenge 2 By Jon Snader. @ irreal.org…〕
;; after copy Ctrl+c in X11 apps, you can paste by `yank' in emacs
(setqx-select-enable-clipboardt)
;; after mouse selection in X11, you can paste by `yank' in emacs
(setqx-select-enable-primaryt)
might be useful to emacsers. In Linux, sync X11 primary selection with clipboard, so you can copy/paste by both mouth and hand in unison. Linux: Commands Related to GUI Apps
also note, in emacs 24, a change is made to how emacs handle X11 copy/paste mechanism, so its more compatible with the rest Linux apps. see: New Features in Emacs 24
Is it true that keyboards before PC have Control key right besides the A key?
jcs over at Irreal is thinking of starting a blog or website dedicated to “emacs golf”. I submitted a problem and Jon wrote about it.
See: 〔A First Emacs Challenge By Jon Snader. @ irreal.org…〕
What approach would you take?
learning emacs lisp: output to separate buffer
yesterday, we had a elisp problem about extending the code for “extract-url” function. Did you understand the code? Here's simpler version with explanation. Emacs Lisp: Writing a Command to Extract URL
emacs on Microsoft Windows is much inferior when compared to Linux version. Here's quick list.
FTP doesn't work.
Emacs won't display images.
File name with Unicode characters (⁖ Chinese) display as gibberish in dired.
grep, rgrep, and many others won't work.
If you have installed Cygwin, it's very painful to get path and environment variable correct.
even if you have Cygwin set up well, grep or cygwin python/perl etc others don't work well work with Unicode strings (or, extremely complex to setup). e.g git commit Unicode ♥, the heart Unicode char in the message will not be commited correctly.
Calling unix rsync won't work in shell inside emacs. Same for git push.
many unix commands won't work in shell inside emacs, that otherwise works perfectly in Linux.
It is perhaps 5 times slower for anything going thru Cygwin.
We try to fixed many of these in ErgoEmacs, but still, many just can't be fixed.
elisp tip. You can call apropos-value to search a string in emacs variables.
Emacs users typically spit on mouse. Still, you need a mouse or similar device, because it is the best device for browsing web, or manipulating 3D objects. What interesting ones do you use?
learned that the ⌘ Cmd key and ❖ Win are really identical in keyboard hardware. They send out the same scancode. Similarly, ⌥ Opt and Alt are identical. Updated: Difference Between Apple and PC keyboards
Just send off new version of emacs tutorial. Thank you for support.
If you like it, please tell friends.
If you bought my tutorial but isn't on the mailing list, please email me (xah@xahlee.org). Or, if you want to be taken off the list, just reply with “unsubscribe”. It'll be send out at most once a month.
If you haven't bought, buy it here: Buy Xah Emacs Tutorial. Ask me if you have questions.