Xah Emacs Blog Archive 2017-04
doc string popup update
Now, when you browse my tutorial, all commands have popup doc string.
(note, technically not ALL, but all that are documented in emacs and elisp manuals.)
Emacs: Avoid Lambda in Hook (minor update)
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 Line, between Quotes, Extend Selection (code update for
Emacs: Select Line, between Quotes, Extend Selection (code update for
xah-select-block. fixed bug where it select block before cursor)
Emacs AutoHotkey Mode (ahk-mode) (minor update)
Emacs: Insert Random Number/Hex/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 Emacs and vi Keys
thanks to whoever submitted.
Emacs: Change Brackets/Quotes (now supports ascii quote)
Emacs: xah-lookup.el, Lookup the Web (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 “email@example.com”. Or, buy something from my keyboard pages at Keyboard Articles Index.
Elisp: Association List (new article)
Elisp: Sequence: List, Array (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 firstname.lastname@example.org or private message via twitter to schedule a time. my twitter: https://twitter.com/ErgoEmacs
Emacs: xah-lookup.el, Lookup the Web (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.
Elisp: Font Lock Mode Basics (on its own page, expanded.)
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 to Beginning of Line/Paragraph (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: Convert Straight/Curly Quotes (code update. fixed highlight bug.)
Emacs: Move Cursor to Beginning of Line/Paragraph (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: How to Define Menu Key (minor update)
Emacs Always use
kbd to define keys. Other syntax got problems and should be ban'd.
Emacs: Move Cursor to Beginning of Line/Paragraph (code upgrade. now support
visual-line-mode. Thanks to stasvlasov.)
Emacs Keybinding Syntax Examples (updated)
more code update. Now support • `emacs' • `markdown` • ~org~ and others.
emacs 25.2 released
Download Emacs for Windows, Mac, Linux (updated)
See also: How to Build Emacs on Linux
Emacs in Microsoft Windows FAQ (updated.)
Emacs: Change Brackets/Quotes (new code. Now work with markdown style quotes and double square brackets)
Emacs: Move Cursor to Beginning of Line/Paragraph (code upgrade. now moves to indentation.)
Emacs: Change Brackets/Quotes (fixed a bug of xah-change-bracket-pairs when region is active)
Emacs: Proportional Font (on its own page.)
moved from Emacs: Cycle Fonts by Command
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.
My Typing/RSI Experience 1992 to 2017 (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))
Using Emacs Lisp as Scripting Language
A question on reddit asking about using elisp as scripting language.
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
here's emacs packages for them
Emacs: Toggle Letter Case (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 ]
Customize Hippie Expand to Words Only
about 1 or 2 years ago, Hippie Expand started to have annoying behavior of expanding a word into a line or a blob of long text.
Here's how to fix. Put this in your init.
(setq hippie-expand-try-functions-list '( try-expand-dabbrev try-expand-dabbrev-all-buffers ;; try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol try-complete-file-name-partially try-complete-file-name ;; try-expand-all-abbrevs ;; try-expand-list ;; try-expand-line ))
Note: order matters. This is what am using now.
nice to find 2016 book still cite Xah Lee.
Patreon me $5. Ask me question on patreon