Xah Emacs Blog Archive 2017-04
Emacs: What's the Best Setup for Python, Ruby, Java, JavaScript, etc? (rewrite)
doc string popup update
Now, when you browse my tutorial, all commands have popup doc string.
For example, go to Emacs Keys: Overview or Elisp: Quick Start, move hover on any command name.
(note, technically not ALL, but all that are documented in emacs and elisp manuals.)
Emacs Init: Avoid Lambda in Hook (minor update)
Emacs Keys: Change Major Mode Keys
Emacs Keys: Change Minor Mode Keys
minor updates
Emacs: Uncolor Region/Buffer (minor update)
emacs lisp find/replace text processing saved the day
this saved the day. 250 files, among some 7 thousand html files.
Emacs Select Word Command Problem (code update for xah-select-block
)
Emacs Select Word Command Problem (code update for xah-select-block
. fixed bug where it select block before cursor)
Emacs: Xah AutoHotkey (AHK) Mode π¦ (minor update)
Emacs: Insert Random Number or String π (code update. Now, by default, insert 4 digits.)
History of Emacs and vi Keys, on hackernews
my article hit hackernews. yay. https://news.ycombinator.com/item?id=14367207
the article is History of Key Shortcuts: Emacs, vim, WASD
thanks to whoever submitted.
Emacs: Change Brackets π (now supports ascii quote)
Emacs: Xah Lookup Web (xah-lookup.el) π¦ (package updated)
emacs tutorial update 2017 May
new version of emacs tutorial is out. If you haven't got it yet, buy it. Thanks. (sending update to previous buyers this week)
last update is Feb 17. So it's been full 3 months.
in the past 3 months, quite a lot updates, you can see here in the blog. They are pretty much minor updates and code updates on tens of pages, and few pages are complete rewrite. (only content update counts here. I typically make typo and format updates (such as adding/changing navigation bar etc) every week on lots pages.)
also, i work on my emacs packages all the time. γsee Xah Emacs Packagesγ The updates there are not counted for the tutorial here.
or, if you liked my work, please donate. goto paypal.com , and pay to βXah@XahLee.orgβ. Or, buy something from my keyboard pages at Xah Keyboard Guide
Thank you.
Elisp: Association List (new article)
Elisp: List vs Vector (new figure added)
Xah teaching emacs/lisp, one-on-one video hangout
i'm teaching emacs or elisp, one-on-one, via video hangout.
It can be free-form, where you can ask me questions randomly.
or, we can do it in a free-form course format. Where, i teach you emacs for beginner from the ground up, or, i teach you elisp from the ground up. Starting at a level you are comfortable with.
I charge $25 per hour, via paypal.
please email me xahlee@gmail.com or private message via twitter to schedule a time. my twitter: https://x.com/ErgoEmacs
Emacs: Xah Lookup Web (xah-lookup.el) π¦ (package updated. More ergonomic default keys.)
someone on reddit asking about whether he should use ergoemacs.
If you use it, please voice your views. Thanks.
https://www.reddit.com/r/emacs/comments/6b88xt/keybindings_in_2017/
Elisp: Font Lock Mode (on its own page, expanded.)
xah pen spinning
yours truly fidgeting with pens like double lightsaber
good for preventing Repetitive Strain Injury!
and onto the roads of How to Avoid Emacs Pinky
Emacs: Move Cursor by Text Block π (sorry, more fixes.)
Emacs: Xah Fly Keys, swapped keys for copy/cut
Emacs: Xah Fly Keys π¦ (code update)
Swapped keys for xah-copy-line-or-region , xah-cut-line-or-region. Because, it seems lots users question it, and now looking at stats, my reasoning that cut is more frequently used does not have solid evidence.
Emacs: Replace Straight Quotes to Curly π (code update. fixed highlight bug.)
Emacs: Move Cursor by Text Block π (revert to previous version. The version that moves to indentation end then beginning of line is too slow (too many steps) to jump over paragraphs.)
Emacs Keys: Menu Key (minor update)
Emacs Always use kbd
to define keys. Other syntax got problems and should be ban'd.
see https://www.reddit.com/r/emacs/comments/6adli0/preferred_syntax_for_defining_keys/dheggib/
Emacs: Move Cursor by Text Block π (code upgrade. now support visual-line-mode
. Thanks to stasvlasov.)
Emacs Keys: Syntax (updated)
more code update. Now support β’ `emacs' β’ `markdown` β’ ~org~ and others.
emacs 25.2 released
Download Emacs for Windows/Mac (updated)
See also: How to Build Emacs on Linux
Emacs: Microsoft Windows FAQ (updated.)
Emacs: Change Brackets π (new code. Now work with markdown style quotes and double square brackets)
xah-js-mode now properly deal with /regex/ as string for syntax coloring. Emacs: Xah JS Mode (JavaScript) π¦
Emacs: Move Cursor by Text Block π (code upgrade. now moves to indentation.)
Emacs: Change Brackets π (fixed a bug of xah-change-bracket-pairs when region is active)
Emacs: Toggle Monospace / Proportional Font (on its own page.)
moved from Emacs: Cycle Fonts by Command π
Function Key vs Key Chord, Which is Healthier, Which is Faster?
If we rank people who sit in front of comp longest, measured by statistics with a device on the seat, i'd say i rank within top 500.
Xah Lee, Typing Experience and Repetitive Strain Injury (updated)
Emacs: Open File Fast π (code updated. Now ignore bookmarked cursor position.)
emacs. Don't use text-mode, use fundamental-mode
text-mode is annoying because the βU+22: QUOTATION MARKβ does not have syntax of string.
that means, when in Xah Fly Keys, the qwerty d key does not delete the whole string.
you can solve by:
(add-to-list 'auto-mode-alist '("\\.txt\\'" . fundamental-mode))
Emacs: Delete Brackets by Pair π (code change. fixed https://github.com/xahlee/xah-fly-keys/issues/19#issuecomment-297099907 )
Using Emacs Lisp as Scripting Language
A question on reddit asking about using elisp as scripting language.
https://www.reddit.com/r/emacs/comments/66gh2q/elisp_for_scripting/
my answer:
i wrote a lot elisp scripts, for over 10 years. Converted my perl python scripts to elisp. We had build script in elisp for ErgoEmacs distro back then. But i'd recommend use ruby python perl for those, or Scheme/Racket, golang. I don't write batch scripts in elisp anymore.
Here's elisp problems for scripting.
- 10 times slower.
- cannot read large files. Best only for files that's just few hundred k. (each time you read a file, it has to be a buffer.)
- you don't have fine control of reading a file, such as encoding. Yes you can, but much more work in elisp than typical scripting lang. (For real simple script such as find/replace, elisp is easier.)
- emacs regex becomes a major pain. All the backslashes. Typical scripting need lots regexes. If you need to pass complex regex into a external grep, it is hell.
- there's no raw string quote in elisp. You need to add backslashes. A big inconvenience for text processing. (say, you have a piece of regex code you need to find. It's a pain just to put that string in elisp.)
- for typical scripts, you often need to call external commands. Say, make, or imagemagic's convert, or imagemagic lib, find file type, etc. Get output, or error code, pass stadin, and arguments. In python etc, you have fine control, faster, easier. In elisp, it's a pain.
- traverse directory. Also far easier and faster than elisp and finer control.
- python ruby etc has 100 times more libs you need, such as for string processing, html parser, or http protocol related. In elisp, it's a pain. Even for basic string manipulation. Only ~3 years ago elisp has strim string, and for some reason the developers decided it should be in a obscure package than core.
- in elisp, there are tons of global variables that can affect the functions you call. For example, anytime you do string search or replacement, there's `case-fold-search` you have to watch out. For the replacement text, you need also possibly disable the smart case replacement. These implicit globals makes your code error-prone. In python ruby etc, they are usually part of function parameter.
- in general, lots of things you have to disable or watchout. For example, font-lock-mode, undo, auto backup, hooks, all implicit.
elisp shines when you need interactivity, and especially if you want to run it inside emacs and output in emacs. Such as grep or find/replace on directory of files. It's still much slower, but much easier to write, more convenient to use, can jump to file by link, colored output, etc, in a buffer.
but if you are comparing to bash+awk, i'd stick with elisp. Bash+awk are less powerful.
rms is on gnusocial, accessible via mastodon
@rms@gnusocial.no
here's emacs packages for them
Emacs: Usability Problems of Letter-Case Changing Commands (better code. Now will do whole string connected by low line _ and hyphen -.)
Emacs: Open File Fast π (now the command will open file from emacs bookmarks, instead own list.)
Emacs: Bookmark (complete update)
γMy Journey with Touch Typing and Vim By Chris Wellons. At http://nullprogram.com/blog/2017/04/01/ , accessed on 2017-04-08γ
Printed Citations to Xah Lee Site
nice to find 2016 book still cite Xah Lee.