Xah Emacs Blog Archive 2014-10
am going to stop blogging for the next 4 days. Start again on next Monday,
Elisp: Chinese Char To Reference Link (minor update)
Emacs: Run Current File π (minor update. Added a temp solution for clojure. If you have better solution, please let me know in comment.)
How Are Books Made in 1950? Video of Linotype Machine in Action
Emacs Init: Tab, Indent (updated)
LISP Logo (updated)
new version of my emacs + lisp tutorial is out. Buy Xah Emacs Tutorial lots updates from last month. Master emacs or pickup elisp today.
bernhard ask how to have 2 instances of eww browser. See Emacs: Eww Web Browser (major updated)
old rant for your entertainmet. Lisp-1 vs Lisp-2 (single-value-space vs multi-value-space)
where to download emacs 24.4 for Microsoft Windows
many are asking where to download emacs 24.4 for Microsoft Windows
you can get it here:
http://emacsbinw64.sourceforge.net/ prepared by Chris Zheng
also linked from my site here Download Emacs for Windows/Mac
lookup definition/function/Google/Wikipedia in Browser
had this emacs lisp package: https://github.com/xahlee/lookup-word-on-internet now it doesn't have dependencies.
before, it needed a asciffy-string function at https://github.com/xahlee/xeu_elisp_util.el/blob/master/xeu_elisp_util.el
which in turn needs a function to do find replace multi pairs, at https://github.com/xahlee/xah-replace-pairs
now, the asciify function is refactored to not depend anything, and the lookup internet package contains its own copy of xah-asciify-string function.
for the lookup word package: https://github.com/xahlee/lookup-word-on-internet, now it uses emacs 24.4's Eww Web Browser if you are on linux. It's experimental change.
if you are not on emacs 24.4, change the line (eww ΞΎmyUrl)
to (browse-url ΞΎmyUrl)
you can write your own lookup commands. No need for a package. See: Emacs: Command to Search Web π
more reorg of elisp tutorial index. This section is new:
- Emacs: Cycle Space Hyphen Underscore
- Emacs: Letter-Case Commands Usability Problems
- Emacs: Change to Title Case π
- Emacs: Delete Whitespace around Cursor π
- Emacs: Reformat to Long Lines (unfill-paragraph) π
- Emacs fill-paragraph Problem
- Emacs: Remove Accent Marks π
going to do regular review/update on the commands.
here's why i don't trust unix utils to process my text. Unix Shell Util uniq Unicode Bug
you should use elisp or {Perl, Python, Ruby} instead.
see also Problems of grep in Emacs
in emacs, there's delete-blank-lines
, just-one-space
, fixup-whitespace
, delete-horizontal-space
, and emacs 24.4 has cycle-spacing
. Some has a hotkey, not all. I find these too varied. Here's a command that kinda combine them all, you may find useful: Emacs: Delete Whitespace around Cursor π. Give it a easy key. (In ergoemacs-mode , it's Alt+w, in Emacs: Xah Fly Keys π¦ it's w.)
Emacs: Remove Accent Marks π (major rewrite. Now no dependencies)
it's that time of the year again. Emacs Halloween Pumpkin
voice coding
if you have Repetitive Strain Injury, you might check this out: Voice Input for Programing πΊ (year 2013). It's from last year, but apparently it's very popular, and there seems to be some voice-controlled system popping up. See the comments there.
emacs 24.4 is out
download at http://ftp.gnu.org/gnu/emacs/
no official binary for Microsoft Windows yet, but you can download Microsoft Windows binary prepared by others. See: Download Emacs for Windows/Mac
major update: Emacs 24.4 (Released 2014-10)
http://xahlee.blogspot.com/2014/10/truly-ergonomic-keyboard-new-models.html
emacs and vi: numerical argument and keybinding efficiency
there's a stackoverflow question about killing line. Here: http://emacs.stackexchange.com/questions/2347/kill-or-copy-current-line-with-minimal-keystrokes
commonly suggested solutions, are not efficient.
(1) using Alt+1 to Alt+9 to give a numerical argument, such as deleting 3 words.
This is extremely inefficient use of key spots.
It takes out 9 easy keys.
These 9 key spots can be used for 9 different frequently used commands.
For inputing a argument, give universal-argument
a easy key.
For example, if you set it to a thumb key on one of those Best Keyboards for Emacs, then, key 3 would be equivalent to Alt+3.
In this way, your key is actually easier for the hand, and you have 8 more keys for other commands.
(in emacs, it binds both Control 0 to 9 and Meta 0 to 9, so 20 key spots are wasted.
TWENTY!)
(2) editing operations with a numerical argument requires brain cycle. Suppose you want to delete 7 words. But, how do you know it's 7, not 6 or 8? When the number is small, such as 2 or 3, it's fine. But anything large zaps your brain cycle. Better, is to hold a key to repeat, so you edit visually. For example, to delete 7 lines, i just hold a key for a half a second, then typically followed by 1 to 3 key presses. I don't have to think.
thanks to Nsukami for citing my site.
Artur Malabarba wrote a blog detailing his thoughts and solution. http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html
I'm indebted to many people. Please wait for me.
learned a very nice tip. In eshell, you can just type βman lsβ and it'll automatically call Alt+x man
. Emacs: eshell (updated)
added the beautiful ErgoEmacs mascot drawing by David Capello [https://davidcapello.com/] to the ErgoEmacs front page
you can read about the drawing at
updated the GNU Emacs Logo page. You can get Scalable Vector Graphics (SVG) version of the drawing there, and different sizes of png. Also, read about the logo history there.
Emacs: Make elisp-index-search use Current Symbol (repost. recently asked on stackoverflow. very useful.)
this is the proper way to check emacs version number:
(version< emacs-version "24.4")
thanks to [Sylvain Benner https://plus.google.com/+SylvainBenner/posts] for this. It's fantastic.
there's also:
version=
version<
version<=
and several others. Be sure to Alt+x describe-function
to read about their doc string, and go into the source code and see others.
Elisp: Get Version, Host Name, User Name, Init Dir (updated)
found a nasty bug on emacs version checking. To check if emacs is 24.4 or later
(and (>= emacs-major-version 24) (>= emacs-minor-version 4)) ;; wrong!
you should do the following instead:
(or (and (>= emacs-major-version 24) (>= emacs-minor-version 4)) (>= emacs-major-version 25))
If you borrowed code from here on checking whether emacs is 24.4, better update. The old code will fail to be correct if running emacs 25.0 (which is the version on git). Elisp: Get Version, Host Name, User Name, Init Dir
Basics. Emacs: Set Default Window Size
γUseful New Features in 24.4 By Artur Malabarba. At http://endlessparentheses.com/useful-new-features-in-24-4.html , accessed on 2014-10-14γ
Emacs Search Case Sensitivity
remember, to make case sensitive in isearch and other search commands, Alt+x toggle-case-fold-search
. By default it doesn't have a key. Give it a easy key, or alias it to βcβ. γsee Emacs: Command Name Aliasγ
Emacs: Search Text in Current File (updated)
When the 0th bus comes, i'll be on my way to the 0th floor at 0th avenue with my 0th girlfriend.
Whatever programmers think about themselves and these towering logic-engines we've erected, we're a lot more superstitious than we realize. We tell and retell this collection of unsourced, inaccurate stories about the nature of the world without ever doing the research ourselves, and there is no other word for that but βmythologyβ.
read and weep. Language Design: Should Array Index Start at 0 or 1?
emacs 24.4 introduced the much needed string-trim
, but with a tag that says it shouldn't be documented. What the banana?
Elisp: Trim String (on its own page)
glorious photos of the DEC VT100 Terminal
Linux: xmodmap Tutorial (updated)
Emacs: Backup Current File π (updated code)
emacs 24.4 out today, or this week
so emacs 24.4 is going to be out today (). See announcement here: https://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00376.html
i've been using it for about 6 months now.
check out Emacs 24.4 (Released 2014-10)
GNU Emacs and XEmacs Schism (2001) (repost)
lispers, if you are still linking to dan weinreb org, remove your link. It's a SEO site now. Lisp Programer Daniel Weinreb Died (1959 to 2012)
emacs 24.4 is scheduled to be released next week
currently running:
GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of 2014-10-12 on xah-p6813w ErgoEmacs distribution 2.0.0
emacs 24.4 is scheduled to be released next week. But for emacs fans, you might as well build it yourself regularly. See: Emacs: How to Build Emacs from git Repository
Keys are staggered so that the levers underneath can fit nicely.
Emacs: Key Macro (major update)
heavy re-organization of Xah Emacs Tutorial. Again, making it more into a book format. Logical grouping by topic. The first parts are tutorial about using plain GNU emacs. Customization, Emacs lisp code enhancement, third party packages, comes after. Still much to do.
my tutorials are written over the past decade, in a haphazard way. First 5 years its mostly just blogging. Only in past 2 years i had some intention of writing it in a more polished way.
haphazard way doesn't sound so good, but that's actually the most efficient way to go about, in practice. Lots people are asking about how to learn emacs. Just start using it for real work, really. Then you have questions, then find answer, then move on. Trying to be systematic in the beginning usually gets you nowhere and waste understanding.
Emacs: Open File Path Under Cursor π (major update. Added feature to jump to line number.)
http://emacs.stackexchange.com/ is now public. Go check out answers, or ask questions there.
Emacs: Open Last Closed File π (new page. These commands have been in ergoemacs-mode for years.)
Emacs: Next/Previous User Buffer π (updated)
Emacs: Switch Buffer (added a screenshot of show vertical)
Emacs: Buffer Flow Side-by-Side (updated)
install this if you haven't already. Emacs: Undo Saga (repost)
Best Unicode Fonts for Programer (updated)
JavaScript Web Development = No Documentation Hell
Heavy work on JavaScript tutorial in past month again. Hope you like it. Xah JavaScript Tutorial.
there are lots JavaScript tutorials or blogs out there. Typically, they are either too basic, covering the syntax and not much else, often misleading info. Or, they are far advanced, blogging about latest ecma standard news or new libraries and frameworks for those who worked with JavaScript professionally for years.
JavaScript is not like emacs lisp, where there is a nice juicy reference manual. JavaScript doesn't have any documentation (there's the spec [ ECMAScript Language Specification - ECMA-262 Edition 5.1], but written for implementers). Worse is that to write web apps, the DOM and BOM, again has no readable documentation. (BOM is entirely not documented) [JS: Browser's Window Object, What's Browser Object Model (BOM), Document Object Model (DOM)] I hope my JavaScript tutorial gives a good help.
for web development tips and tricks, subscribe Xah's Web Dev Blog. Thanks.
The Roadmap to Completely Replace Emacs Key System, Part 2.5
Elisp: Find Replace Text in Buffer (added info about how to get match data. Refresh page.)
Emacs Lisp: Change Current Word to Wikipedia Link
(defun xah-html-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>γ" (interactive) (let (linkText bds p0 p1 p2 wikiTerm resultStr) (if (region-active-p) (progn (setq p1 (region-beginning)) (setq p2 (region-end))) (progn (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)))
this and Emacs: Xah Elisp 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.