Showing posts from May 12, 2013

emacs: open file path under cursor fast

Perm URL with updates: has a command ffap. When your cursor is on a file path or URL, it'll open the file. This is extremely useful in shell ouputs or in HTML file.One problem is that it'll prompt to confirm. This is annoying. Also, the command itself doesn't have a key.You can write a similar command that doesn't need confirmation. Here's the code.(defun open-file-at-cursor () "Open the file path under cursor. If there is text selection, uses the text selection for path. If the path is starts with “http://”, open the URL in browser. Input path can be {relative, full path, URL}. This command is similar to `find-file-at-point' but without prompting for confirmation. " (interactive) (let ( (path (thing-at-point 'filename))) (if (string-match-p"\\`https*://" path) (progn (browse-url path)) (progn; not starting “http://” (if (file-exists-p path) …

set git output non-interactive, set git date iso format

How to set git output non-interactive?use git --no-pager, or, pipe it to cat, like this:git log | cat How to make git display date in ISO format?Use --date=iso.git log --date=iso > z See also: git Tutorial

Google Plus new interface: Claustrophob Box

2013-05-17 new Google Plus interface, featuring the claustrophob box. 〔☛ User Interface Design: Peepshow Windows

video review of the Truly Ergonomic keyboard

video review of the Truly Ergonomic keyboard. More info at Truly Ergonomic Computer Keyboard ReviewNote: for those of you who know me, i got the keyboards free, but my opinion isn't bought, judge for yourself.

emacs: open your own files FAST

Perm URL with updates:'s command that lets you open file fast, by typing a letter or digit:(defvar xah-filelist nil"alist for files i need to open frequently. Key is a short abbrev, Value is file path.") (setq xah-filelist '( ("3emacs" . "~/web/ergoemacs_org/emacs/blog.html" ) ("4code" . "~/web/xahlee_info/comp/blog.html" ) ("js" . "~/web/xahlee_info/js/blog.html" ) ("math" . "~/web/xahlee_info/math/blog.html" ) ("linguistics" . "~/web/wordyenglish_com/lit/blog.html" ) ("chinese" . "~/web/wordyenglish_com/chinese/blog.html" ) ("music" . "~/web/xahmusic_org/music/blog.html" ) ("arts" . "~/web/xaharts_org/arts/blog.html" ) ("sl" . "~/web/xahsl_org/sl/…

emacs lisp: use ido completion for your own commands

emacs lisp: you can use ido-completing-read for your own cmds. It's bundled with emacs 24, at least. Example use:(ido-completing-read "your prompt str:" ‹youList› )Full example: Emacs: Change Brackets () {} [] in Text

Emacs: how i write blogs

A video recording on how i write blogs.emacs: how i write blogs.The commands used are:xah-open-file-fast 〔☛ Emacs Lisp: Hotkeys to Open File Fast〕insert-date-tag 〔☛ Emacs Lisp: Insert Date Time Stamp〕xhm-wrap-html-tag (from Emacs: Xah HTML Mode)xhm-pre-source-code syntax coloring of source code in HTML.xah-browse-url-of-buffer 〔☛ Emacs Lisp: browse-url Function to View URL in a Web Browser〕xah-make-atom-entry 〔☛ Emacs Lisp: Updating Atom Webfeed〕dired-jumpxah-shell-commands. See: 〈Emacs, Shell, Abbrev, and ELISP Power to Bear!〉 video presentation is pretty bad. I have much to learn, tech and presentation. I was using Google Plus's 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.

Programing Craft: Intention vs Coolness

Perm URL with updates: you see a hash table, do you think “Ah, it's a flow control”?in programing, we often do coolness.Python doesn't have {switch, case, cond} construct. Someone asked about it on stackoverflow, and this is the most upvoted answer:# -*- coding: utf-8 -*- # python 3 # emulating “switch” statement in Python. # works in both python 2 and 3 deff(x): return { "a": 1, "b": 2, }.get(x, 9) # 9 is default if x not found # test y = "d"print(f(y)) # 9you use a hash table (aka dictionary) to emulate switch statement.It is cool, but there is a problem: the intention of the programer isn't explicit. Instead, you have to engage your brain to figure out's a simpler, more verbose, version, but the programer intention is clear, and much easier to understand.# -*- coding: utf-8 -*- # python 3 # chained if, similar to “switch” c…

new emacs modes for emacs lisp, php, html, css, and lean elisp manual

Am doing a pledge for a few new emacs projects. Vote for your emacs project: new html-mode, css-mode, php-mode, elisp-mode, or new lean emacs lisp manual. please see

The Unfortunate Fate of Music MIDI File

MIDI is really a great tech, but unfortunately, it never picked up in computer.MIDI is tiny in size, especially great for piano music. For example, a 5 minute piano piece is only 11k bytes.10 years ago, i'd expect by now that on each computer we have high quality sampled sound library for MIDI, so that perhaps just a 100 mega bytes you'd have entire collection of piano music in history, recorded by professionals. Not so.Today, on the web, MIDI isn't supported in html5 audio. 〔☛ HTML5 Audio Tag Example〕 〔☛ HTML5 Tags〕 And it won't play on Linux by default. Here's entire collection of Bach's 〈Well Tempered Clavier〉, just 529k. Music: MIDI Collection of Bach 🎶