Xah Emacs Blog Archive 2014-10
am going to stop blogging for the next 4 days. Start again on next Monday,
Elisp: Chinese Character Reference Linkify (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.)
Emacs: Tabs, Space, Indentation Setup (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. What's Lisp-1, What's Lisp-2? Bad Jargon or Good Jargon?
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, Linux
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.
if you are not on emacs 24.4, change the line
(eww ξmyUrl) to
you can write your own lookup commands. No need for a package. See: Emacs: Lookup Google, Dictionary, Documentation
more reorg of elisp tutorial index. This section is new:
- Emacs: Cycle Replace Space Hyphen Underscore
- Emacs: Letter-Case Commands Usability Problems
- Emacs: Change to Title Case
- Emacs: Delete Whitespace around Cursor
- Emacs: Hard Wrap Lines
- Emacs: Toggle Line Wrap
- 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
in emacs, there's
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 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
if you have Repetitive Strain Injury, you might check this out: Using Voice to Code Faster than Keyboard 📺. 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, Linux
major update: Emacs 24.4 New Features (released 2014-10)
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.
① 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 Keyboard 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❕)
② 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)
you can read about the drawing at ErgoEmacs Logo and Mascot
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 for this. It's fantastic.
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.
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: Determine OS, Emacs Version, Machine Host Name
[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: Use Alias for Fast M-x]
Emacs: Search / Highlight Word (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's 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.
GNU Emacs and XEmacs Schism (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 – 2012)
emacs 24.4 is scheduled to be released next week
GNU Emacs 184.108.40.206 (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: Keyboard 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: Next/Previous User Buffer (updated)
Emacs: Switch Buffer (added a screenshot of show vertical)
Emacs: Make Buffer Flow Side-by-Side (updated)
install this if you haven't already. Emacs: Best Undo/Redo Mode (repost)
Best Unicode Fonts for Programer (updated)
for web development tips and tricks, subscribe Xah's Web Dev Blog. Thanks.
Common Emacs Lisp Functions (minor update)
Elisp: Find Replace String in Buffer (added info about how to get match data. Refresh page.)
Elisp: 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 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.
Patreon me $5. Ask me question on patreon