Xah Emacs Blog

You, put $5 in my patreon. https://www.patreon.com/xahlee

Subscribe FeedTwitter me

i've just recored a emacs lisp tutorial intro. 35 min. completely idiotic. stutters n disorganized unpleasant to listen to and incoherent. gawd it takes some skill to do presentation. not sure gonna upload it. but will probably retry util it's ok.

also, teaching a lang in real time takes some skill and experience. harder than i thought. the issue is to convey what you know in a structured and coherent and smooth manner and in the right order of topics.

1 solution of teaching real time is basically read the text book style. but that's the worst, as student's minds r split between reading it themselfs or listening to u reading it. Same problem with presentation with slides, when the slides became the main dish.

#emacs am doing another video today or tomorrow. Let me know what topic you like.

vote at https://twitter.com/ErgoEmacs/status/1053000368915853312

emacs meetup, Mountain View


Wednesday, October 24, 2018 6:30 PM to 8:30 PM

see you there

Lisp Celebrities and Computing History from “Worse Is Better”

xah-fly-keys, someone provides code solution for russian layout users. https://www.reddit.com/r/xahflykeys/comments/9mb3qw/welcome/e7vc7qh/ thx to techibech

minor updates

new video. emacs keyboard macro demo

emacs keyboard macro demo

Emacs: Keyboard Macro

emacs video. intro to xah fly keys

intro to xah fly keys. a efficient emacs keybinding system.

home page at Emacs: Xah Fly Keys

Emacs: Run Current File

code update. Now, for golang file, if press C-u first, it'll build the file.

How to stop emacs from creating .#lock file links?

Emacs: Turn Off Backup

solution found. see above link. refresh page

subtle problems of using JavaScript to syntax color source code on your blog.

Google Code Prettify and Ampersand Encoding

emacs video, lines to html list, lines to dt

Famous Emacs Users

created a subreddit for xah-fly-keys

created a subreddit for xah-fly-keys https://www.reddit.com/r/xahflykeys/

it's for public discussion.

i have my site Emacs: Xah Fly Keys and pages there you can comment, if you have a question about something discussed on my page.

however, we don't have a public discussion forum, where people can post their own blogs about xah-fly-keys, or wishlist or comparison to other packages etc. So, that's what this this new sub reddit is for.

Emacs: Change Major Mode Keys (minor update)

Emacs: Show kill-ring

code update. Now uses FORM FEED character for divider, and changed output buffer name, that does not offer save.

demo of using google code prettify js, and showing alternative in emacs, and workflow, text processing on html.

Sacha Chua interviews Thierry Volpiatto


it's a text version interview, with one photo.

Thierry Volpiatto is the guy who maintained helm mode.

very interesting read. Turns out, he wasn't a professional programer. He only started in 2006. (but to write helm, i'd say it's not easy.) and he's 55 years old, and his professional job is guide people rock climbing mountains!

Emacs: Move Cursor by camelCase, snake_case

Emacs been using subword mode for maybe 5 years. Now trying it off. It's got this annoying problem. Try move cursor from left to right on this word ▮QT2. It's going to do this Q▮T2▮. If you work a lot with id like this lCkSAtqt2LY6, it'll do this l▮Ck▮S▮Atqt2▮L▮Y6▮. Super annoying.

the ontology of syntax coloring

Syntax Coloring in Editors (major update)

Lisp Programer Daniel Weinreb Died (1959 – 2012)

Daniel Weinreb (1959 – 2012) is one of the founder of Symbolics. He, was, a major force of giving us lisp history, ones that contradict Richard Stallman's version that gets widely spread.

Emacs: Open File in External App

xah-show-in-desktop better. On Mac, if in dired, and if cursor not on a file name, still work.

2018-09-28 Emacs: How to Define Keys (minor update)

emacs tv 📺

emacs. htmlize source code 📺

List of Emacs Default Keybinding

and head over to Xah keyboard Blog lots new lisp keyboard updates.

write grep in emacs lisp 📺

Lisp Machine Keyboards (lots update)

history of vi

Then George Coulouris from Queen Mary College came to Berkeley and brought along this thing called em, which stood for “editor for mortals.”

Interview with Bill Joy (creator of vi)

emacs does to your keyboard 3122f-s289x217
What Emacs Does

emacs. xah-find.el demo 📺

new video

emacs, htmlize.el package, tab to space problem now fixed


thx to the author Hrvoje Nikšić. by the way, he's an old emacs hacker. He is for xemacs, opposes rms's politics

emacs. mwe log, editing elisp xah-make-atom-entry 2018-09-18 📺

new video

#emacs many asked for kill-line behavior in xah fly keys. It's been added a few months ago! 【space g】 does it. (in dvorak, it's 【space i】)

emacs, delete-selection-mode as default?

one big emacs dev war on delete-selection-mode as default https://lists.gnu.org/archive/html/emacs-devel/2018-09/threads.html

twitter poll.

#emacs do you have delete-selection-mode on? (to test, make a selection, then say type e. If selection is replaced by e, you have it on.)


Elisp: Sequence Functions

major rewrite. Now, this should cover most often used functions that work on list or vector.

this is not final. more work to do. but am calling it a day. Note, ones with “cl-” prefix are not included.

elisp data structure tutorial, and why it's hard to write tutorial

worked 5 hours on my elisp tutorial. On the following pages. Better.

writing tutorial isn't so easy. Even just reviewing and updating what i have there, still took 5 hours. (here am working on something i already knew well. As opposed to, say writing golang tutorial, where most of the time spent is actually learning. Or, compare to writing JS in depth, where having years of experience coding the lang is helpless in trying to explain how the lang elements actually works.)

So, if i already knew elisp well, why does it took 5 hours just to review or edit or update and add stuff that already exist? Well, hard to explain. But for example, when you have a list function, you need to consider whether it should be in the tutorial. (you don't want to simply copy or cover everything in elisp manual. That actually devalue your tutorial) if so, you need to consider which page it should be in, what section link group it should be in. For example, mapcar. Should it be in a chapter or page on flow control? But it's often used with list/vector. Should it be grouped there instead? If elsewhere already mentioned the function, either a section or in link groups, you need to consider either remove that, make a link, consolidate the info, or duplicate rewrite parts to fit a particular page. Some function may need to be on a page of its own. Or, when a page gets long, you should move parts into a section on their own page. You need to give example, or more than one if appropriate to illustrate optional args or working on different types of arg.

(all this is assuming you already have the doc tech down, such as how to format your tutorial in html, chaptes, sections, how you format code examples, what you do to get syntax highlight, etc. Which i do and is at my fingertip, writing raw html easier and faster than org mode users.)

and note, if you are just starting to write it, the actual typing, just typing few hundred pages of text, is a non-trivial labor by itself.

i have a obsession with docs. For much more, see doc by dummies

found a friend with elaborate setup of xah-fly-keys https://github.com/pengpengxp/emacs-xah-fly Thx Xie Peng

Emacs: Show kill-ring

Practical Emacs Lisp

Worked 5 hours on it. More organization of topics, made it easier to use as a reference while you code. Removed repeated info spread on different pages. And lots topics expanded.

Go there, empty cache, refresh browser. In Google Chrome, press shift+f5 should do.

Emacs: Xah Emacs Lisp Mode (better explanation of syntax coloring feature and abbrev)

Elisp: Buffer and File Functions (much update)

EmacsCast 4 - Spacemacs vs Doom vs Emacs. by Rakhim Davletkaliyev. (audio only) https://www.youtube.com/watch?v=6xKzrcrv_fU

the first 10 minutes, he discuss open source money problems. Thank you Rakhim.

his home page is https://emacscast.org/

how to collect elisp functions, and how to find which file it is defined

next few hours, hacking on emacs lisp. need to redo all the mouse hoover popup inline doc on my emacs tutorial site. Then, once i have the new code, update my emacs manual online to emacs 26. Same with all pop up inline docs.

emacs if you go over to Emacs Lisp Basics mouse hoover on a elisp function, you see this popup.

emacs tutorial popup 2018-09-08 d8a3a
emacs tutorial popup 2018-09-08 d8a3a

notice how it's different from describe-function output?

normally, it looks like this.

emacs tutorial popup 2018-09-14 8ac11
emacs tutorial popup 2018-09-14 8ac11

It includes info about:

you can programatically get the output by simply grabbing help-buffer content after calling describe-function. But i don't need the keybinding info, and don't want the [Back] link. This gets interesting.

The problem is: given a function, find the file its defined in, its keybinding, and its inline doc string. if you look at source of describe-function, its just 100 lines, but somewhat complex, involving some advance lisp and emacs system details.

The other interesting problem is, you want to gather inline doc of functions, but what is the set function you want? how you gather it? 1 way is to use all symbols in obarray. Another way is to go thru elisp manual and extract all documented symbol. Both are problematic.

emacs symbols obarray list 2017-01-06
emacs symbols obarray list 2017-01-06

the problem using all symbols in obarray is: most symbols there are not actually used. You get many obscure functions or symbols. u get 15305 symbols in obarray when emacs is run as --batch.

But also, some function should be there but are not, eg , eval-last-sexp, ielm, describe-function.

so, solution is to filter symbols in obarray. but the problem is again: you don't know which you want. What's the list of symbols that lisp programers ever need to lookup. (not counting external packages)

the solution, is to grep and get all symbols mentioned in both emacs manual and elisp manual. But this too, have problems. It tends to miss a lot commonly used symbols.

reddit emacs keybinding flamewar ish


I agree with both of your points, however, there's details.

When one needs to do a task X times, with method Y, how good is Y depends on the magnitude of X. So, the X here is, just how much you type? that differs greatly between programers or writers, by a magnitude. And the Y therefore also blows up by the same proportion.

So, Dvorak does not improve speed in general, true. But if you are typist in Olympics, it's a matter of win and lose. For average people, Dovark improves comfort by a long mile.

And it's true many may use emacs default keys for life sans problems. But, as we know, every month since 2000s on internet we see someone with hand pain using emacs and seeking solution. For those insist emacs default key is ok, lol, type what i type for 2 months, then it won't be ok.

And, similarly, basing shortcut key choice on how easy it is to remember by associating command name with English alphabet, is really inefficient. It creates more hand stress in comparison to key chosen by how easy they are to type. For “average” programers it may not matter. But you don't want to stamp this as canon and tell all programers efficient choice of letters doesn't matter.

put in another way, you know someone who uses notepad++ and is good programer? Linus uses microemacs, which is not emacs. He seems to do fine. No magit, no ivy, no fly keys, no god mode, no ergoemacs, no evil. It's all just fine! you don't even need emacs. emacs is redundant.

about which is more important for hand health: keyboard, letter layout (e.g. qwerty vs dvorak vs colemak etc), and keybinding layout (e.g. emacs keybinding set, vs ergoemacs, or modal and different modal sets), the order is this:

i've written about a hundred articles on these with detail and scientific analysis. Those interested, can read on my site. I get a lot readers, got question posted to me regularly in past 10 years, quite a few have developed RSI to the degree of visiting doctors. But on reddit, there are still many who kept INSISTING ignorant things about keys, unaware that their habit governs their thought.

if any don't want to read my articles, there are plenty elsewhere. colemak runs a forum that used to have vibrant discussions about letter layout efficiency, and quite a handful other sites and blogs. e.g. geekhack, reddit mk occasionally, layout study sites, and lots blogs (am not going to take the time to gather url, as i did and posted for 10+ years. The repetition gets tiring.) 3 months down the road, the cycle starts all over again, right here.

there are a lot study and discussion about letter layout efficiency, but not much on shortcut efficiency, and basically none-existent is command efficiency. I've discussed them. Perhaps start with this article emacs and vi: Science of Command Efficiency

there's also the issue of hand health vs speed. In general, ergonomic study also includes speed consideration. However, if we focus exclusively on speed, they are quite distinct.

for example, if you are interested in competitive sprint speed typing of duration 1 min. Then, fancy ergo keyboard like ergodox or kinesis or keyboardio is no good. Laptop keys rules!

if for marathon speed typing contest of 5 hours duration, or if you have to compete regularly and tally scores as basketball player's win/lose stat, then, you do want ergonomic keyboard with mechanical keys.

Emacs: Replace Invisible Unicode Chars Code update. added zero width space.

programming languages for text processing

reddit discussion https://www.reddit.com/r/emacs/comments/9c8f9o/programming_languages_for_text_processing/

key bind efficiency xah fly keys

reddit discussion https://www.reddit.com/r/emacs/comments/9dyuwm/key_bind_efficiency_xah_fly_keys/

if you use it, post a comment on your thoughts. I appreciate it. Thanks.

python, skeleton.el, templates, yasnippet

python mode skeleton 2018-09-07 9466d
python mode skeleton 2018-09-07

just discovered that python mode is using skeleton.el. it's one of the template system builtin in emacs (like yasnippet). i never looked into, but now i know, it sucks. always hated those template that ask questions or enforce your cursor movement into fields.

just use abbrev, define your own. Simple, more efficient, and you in control. Emacs: Abbrev Mode

emacs trivia. yasnippet began 10 years ago by a chinese guy nicked pluskid. It was to emulate then popular textmate editor's template system, to the point that textmate's snippet can be copy/pasted and used in emacs directly.

after a few years, pluskid moved on and João Távora took leadership of yasnippt. Note, there's already quite a few template systems, including at least 2 builtin in emacs. One of them is skeleten.el (1993) by Daniel Pfeiffer [occitan@esperanto.org]

at 1st i loved yasnippet. cuz it allows anyone who doesn't know elisp to create template. it's just text file + markup. e.g. here's a template for html img tag with field stops <img src="$1" class="$2" alt="$3"> more example at my old tutorial Emacs: How to Define Templates in YASnippet

textmate (2004) was hugely popular among Mac users in 2000s. Then, it stumbled and textmate v2 never got around, then became open source in 2012, and since, we never heard of it.

template system diff from emacs abbrev in that it allow features like field stops, position cursor, insert date or elisp function call result e.g. date. Note, emacs abbrev can do these too, but more difficult. Whereas a template system like skeleton.el is designed so.

when yasnippet became more elaborate, with more field stops, i got annoyed. Like many packages, it became complex. you have to learn its own system. That's also when i studied emacs abbrev (implement it in my modes), and find it much better. ditched yasnippet.

the thing about field stops is that, when you have very efficient keybinding to move around, the field stops is a bottle neck. you rather want a full function parameter show up than filling up a form one at a time. Worse is when it ask u questions by prompts, like python mode does.

Emacs: Xah Math Input Mode

package update on github. more abbrev with just letters. e.g. s2 instead of ^2 for ². also

so they are easier to type.

symbols still remain, e.g. != for ≠. Symbol is good when in many programing language or TeX or convention. you don't have to learn it because you already knew, and easy to use when you need to convert some text to unicode symbol. But once you need to type lots of them, letter is faster, easier on your hand.


Elisp: Read File. Expanded. how to open for read, in elisp batch script.

worked several hours to improve my elisp tutorial. Most of the following have been reviewed and some are now new standalone pages. Working towards organizing it in a way people can find topics while coding elisp.

Elisp: Call Shell Command (on its own page)

Elisp: Walk Directory

Elisp: find-lisp.el

major rewrite.

emacs lisp vs golang, generate sitemap

emacs lisp vs golang. the elisp takes 3 seconds. go is 1 second.

(total num of files to go thru is 20 k, counting image etc files. The actualy number of lines (files) in the generated sitemap is 3.4k.)

elisp is just 70 lines. go is at least twice, even if we ignore gofmt and compact the lines. But i'd say, go is some 3 times easier to write, and read. I have just 1 week experience. But 10 years coding elisp.

here's the code

elisp sitemap 2018-09-04 265b9
elisp sitemap 2018-09-04 Elisp: Create Sitemap
golang sitemap 2018-09-04 229d3
Golang: Generate Sitemap
timing elisp vs golang 2018-09-04 6ec59
timing elisp vs golang 2018-09-04 6ec59

one lesson learned about emacs lisp is, never use find-lisp-find-files of (require 'find-lisp). its purpose is to skip some dir when walking dir. But actually ~5 times slower than u just directory-files-recursively on all then filter result yourself.

Emacs: Xah Fly Keys

here's the commit log, woot!

xah-fly-keys commit log  2018-09-03 f525a
xah-fly-keys commit log 2018-09-03

Golang: Generate Sitemap

compare elisp version Elisp: Create Sitemap

M-x fill-paragraph for SOURCE CODE

emacs M-x fill-paragraph has problems when the text is programing language code. sometimes it adds extraneous character. Here's a command to Reformat Lines for SOURCE CODE

Emacs: Reformat Lines for Source Code

use emacs lisp for text processing, create sitemap

here's typical way to use emacs lisp for text processing. here's a tutorial on how to create sitemap Elisp: Create Sitemap you run it as a script, like perl python ruby, without need to start emacs.

write emacs extension in golang


is emacs lisp best for text processing?

elisp hole 2018-08-31 9a9b0
emacs lisp hole 2018-08-31

for 11 years, starting in 2006, i tried to port/write all my text processing needs in emacs lisp. I thought emacs buffer datatype power is unbeatable. Gradually, i realized it's a mistake, since 2016. here's a account in 2012. One Language to Rule Them All? Or, What Language to Use for Find Replace? read that first. Continued.

today, i find that doing text processing in emacs lisp is a mistake. problems: ① no literal quote. If your find string is a snippet of regex, spend 10 min to manually quote it first. ② elisp regex sucks donkey ass. ③ the lang is at least 6 times slower than python perl.

None of these problems are intrinsic to emacs lisp. They could be fixed, relatively easily. But the GNU emacs dev have lots org problems, and the emacs cult prevents much progress, suppress any voice of its problems. All we do daily is sing the song of emacs superiority.

it's unfortunate, because elisp with its buffer datatype is super powerful (which lets you move a “cursor” back and forth, do regex on parts, etc), and emacs the whole is text processing system. Plus, any code can also run interactively by design.

about 3 years ago, i stopped writing new text processing tasks in elisp, unless it's just for current buffer. This is pretty sad. Now, it's back to calling external software (e.g. grep). you want the speed of other lang, but you want the syntax coloring and interactivity in emacs.

now, my new lang for text processing is golang. For processing thousands of files each being typical html file size, if you have a spinning disk, it's not faster than perl python. The disk IO is the bottle neck. (flash drive helps, or huge memory)

so now am thinking if i should write elisp wrapper to golang scripts, e.g. emacs M-x grep call unix grep, but + color and clickable link. This is sad, cuz the wrapper doubles the coding work, and communication makes the whole thing slow again. if your find string is regex snippet, good luck passing it unharmed.

i kept thinking, it's not hard for someone like Daniel Colascione to single handedly rewrite emacs from scratch within 1 year. The problem is, there'd be no money support, plus, the community hate. Until it take off, most would probably give it cold shoulders.

if compatibility is ignored, the task would be much easier, someone could do it in golang or such, a editor with ALL emacs qualities we love. But again, money is a problem. Nobody would pay. Nobody wants to change habit. Only a corp like github can risk (e.g. atom).

[xah-fly-keys rough edges By Jaredj. At https://j.agrue.info/xah-fly-keys-rough-edges.html ]

jaredj wrote about some problems with xah-fly-keys.

just fixed the e and r issue! at github.

thanks jaredj. I don't see comment or contact on your blog. So here's some comment.

About c for copy not including end of line, that someone has raised an issue on github. (closed now) Please look there for discussion.

about o not opening like vi. i think someone also asked about that. I think mostly it's from vim habit. But still, the question is open one. The issue is this:

vi's o will: ① add a line below current. ② move cursor there. ③ activate insert mode.

about activating insert mode, that's another issue. namely, whether there should be more than 1 or even more than 2 ways to activate insert mode. But let's ignore that for now. So the issue now is, should it add a line below and move cursor there, and not caring about current cursor position. As opposed to, add a newline character after cursor (the emacs open-line behavior).

the open line is similar to pressing return. The difference is one insert newline after cursor, and the other inserts before. (another similar issue is when inserting space. Space key insert space before cursor. While xah-insert-space-before before. )

and the question is, should you actually need 2 commands to insert newline that only differ by before/after?

i find the emacs open line useful. Because the enter key is often bound to also do special things, like expand abbrev, indent, sent stuff, etc.

the general question is, what minimal command set is more essential, or more frequently needed. I can't say emacs way is. Some more discussion about this at emacs and vi: Science of Command Efficiency

emacs blogs to read

on mastodon trayofbees is building a emacs bot https://mstdn.io/web/statuses/100643011419554187 go there suggest maybe.

my list is probably

i don't read much blog actually. 10 years ago some. then blogs collapsed, google killed its Reader. even less people blogs. the thing is, as info gets rampant and specialized, generic blogging lost value. unless u specialize in 1 very specific topic, as a job, n write that ONLY.

i think blog traffic disappeared all across. 10 yrs ago i have maybe few hundred reading my emacs blog. i dunno today, maybe less than 100 who does few times a week.

today is such that, if u have 20 min a day to read random. there's wikipedia, n dedicated tutorials on diverse topics. (plus thousand spam from corps trying to sell u xyz). blogs can hardly compete. blog is somewhat more connection with people and twitter etc is stomping on it.

How to Write grep in Emacs Lisp

Problems of Calling Unix grep in Emacs

Emacs: xah-find.el, Find Replace in Pure Elisp

massive update. Soon, you can hook it up to use my golang scripts for find/replace. i.e. golang is much faster and efficent. and xah-find.el act as wrapper, so you have word highlight and click on it jumps to the file location.

Emacs: xah-find.el, major update

Emacs: xah-find.el, Find Replace in Pure Elisp

most editors, use line number and column number to identify a cursor position. Emacs typically uses char position. Is there any other editor or compiler output report by char position or support goto nth char? e.g. M-x goto-char

Emacs: Show Formfeed ^L as Line

name change. from xah-display-control-l-as-line to xah-show-formfeed-as-line

Emacs: Run Current File

now run in background.

Elisp: Get Buffer String

golang does not allow emacs formfeed U+000c ^L character

formfeed golang 2018-08-28 fe29e
formfeed golang 2018-08-28 fe29e

lol. golang does not allow emacs formfeed U+000c ^L character. pushing old school out. i was thinking it would, because old school. i guess progress is eventual. I was rather fond of using ^L in my code and text files

had big philosophy on it. ^_^ Emacs Form Feed (^L) Page Marker

Emacs: Xah Fly Keys now support Brazil Portuguese keyboard layout.

thanks to Nicolau Werneck nlw0

wow, Steve Yegge left Google

Steve Yegge left Google https://medium.com/@steve.yegge/why-i-left-google-to-join-grab-86dfffc0be84

Steve Yegge, always have great insight. there is lots goodies here, but one thing is, mobile dev is hell, worse than web dev, and React Native is way to go. https://medium.com/@steve.yegge/who-will-steal-android-from-google-af3622b6252e

Yegge wrote js2-mode, which contains real-time JavaScript code validation. And ejacs mode, which contains JavaScript compiler, in emacs lisp.

Yegge is famous. Am a fan. I mentioned him a lot in past decade. here's my mentions:

  1. Emacs: Problems of the Scratch Buffer
  2. Criticism of Stevey Yegge's “Effective Emacs”
  3. Emacs Lisp Sucks Donkey Ass. Please Grow Emacs, Not External Tools
  4. Emacs: JavaScript Mode War
  5. Emacs Redisplay Internals, and JS Mode War
  6. Emacs Lisp vs JavaScript?
  7. Emacs: Why You Should Not Swap CapsLock and Control
  8. Testimonial on Xah's Emacs Tutorial
  9. Tips on Long Term Emacs Productivity
  10. Text Processing: Emacs Lisp vs Perl
  11. Emacs 23.2 Features (released 2010-05)
  12. Emacs Dev Inefficiency and Emacs Web 2.0?
  13. Modernization of Emacs: Simple Changes Emacs Should Adopt
  14. Syntax Coloring in Editors
  15. Steve Yegge's Google Platforms Rant

Grow Emacs, Not External Tools

it seems to me, emacs users have become more and more dumb, as seen on reddit over decade. it used to be, emacs users are the hardcore coders, hackers, of C et al. but now, like average IDE user who want stuff, like LSP, and lots packages, features, and that's ALL.

LSP, the Language Server Protocol, would kill emacs. With emacs lisp staying at 1990s cutting edge, and now LSP, emacs becomes a shell, like every other IDE. More will rely on LSP, cuz every other lang is 10 times better faster.

now when you start emacs, hundreds phone calls are made. “hey, Joe Block turned on his computer.” That's the cloud. Like amazon google apple, soon, they gonna decide when to wipe your disk. This began with the use-package auto-install fak.

Emacs Lisp Sucks Donkey Ass. Please Grow Emacs, Not External Tools

Emacs: xah-find.el, Find Replace in Pure Elisp

fixed a bug. now xah-find-replace-text-regex will prompt to ask for backup. Before, it always does. thx to imdic.

eshell Cannot have two processes in ‘*grep*’ at once.

a problem of eshell: “Cannot have two processes in ‘*grep*’ at once.”

Emacs: eshell

Emacs: Show Line Numbers

to my patreons, thank you and notes https://www.patreon.com/posts/20816906

Emacs: xah-find.el, Find Replace in Pure Elisp

changed default file path regex prompt from html\' to html$. cuz $ is familiar and practically correct. emacs \' is annoying. people ask wtf is that.

emacs meetup at San Francisco, Saturday, Aug 18, 1 to 3 pm. https://www.meetup.com/Emacs-SF/events/253565625/

emacs, create link of word etymology

here's one of my helper command.

(defun xah-words-word-etymology-linkify ()
  "Make the current word into a etymology reference link.
Version 2018-08-16"
  (let ($p1 $p2 $input $result)
    (if (use-region-p)
        (progn (setq $p1 (region-beginning))
               (setq $p2 (region-end)))
      (progn (setq $p1 (line-beginning-position))
             (setq $p2 (line-end-position))))
    (setq $input (buffer-substring-no-properties $p1 $p2))
    (setq $result (concat "etymology of <a href=\"http://www.etymonline.com/word/" $input "\">" $input "</a>"))
    (delete-region $p1 $p2)
    (insert $result)))

i've been using the above command for maybe 5 or more years for my “Wordy English” blog.

since i work in html raw, i have lots of these. the way i work in html is similar to most using org mode.

so if you are a org mode user, you can also easily create a command that generate links to etymology of the word under cursor. and you can press a button to look it up. and also publish it. (e.g. if you blog about literature stuff a lot)

emacs htmlize.el, not convert tab to spaces inside pre tag?

just submitted a bug report.


is it possible to not convert tab to spaces inside pre tag?

in golang, its a community convention to use tabs, enforced by the bundled tool gofmt. (and i think tabs are critical in makefile.)

I write tutorials. So my primary use of htmlize is to convert programing language source code to a htmlized form. With golang, this maybe be a minor problem. thanks.

Emacs: What's Hook?

Emacs: Set File to Open in a Major Mode

golang is superb

kudos to Dominik Honnef for writing go-mode.el extremely well done. https://github.com/dominikh/go-mode.el

by the way am truly impressed by golang.

golang vs python 3 speed comparison https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go-python3.html go is 50+ times faster there.

am starting my own tutorial. Golang Tutorial

Emacs: Spaces to New Lines

scimax emacs kit for scientific computing and publishing

spend 3 hours today with @johnkitchin in a coffee shop! most wonderful experience. he showed me https://github.com/jkitchin/scimax , basically making org mode do scientific computation and publication. interactive computation in org mode, with ipython, math, LaTeX, plotting, bibliography management features.

pretty print in emacs lisp

discovered the package lisp/emacs-lisp/pp.el.gz

and it's written by Randal Schwartz, famous perl hacker.

;; Copyright (C) 1989, 1993, 2001-2018 Free Software Foundation, Inc.
;; Author: Randal Schwartz
;; Keywords: lisp

use it like this

'(defun xah-copy-file-path (&optional @dir-path-only-p) "Copy the current buffer's file path or dired path to `kill-ring'. Result is full path. If `universal-argument' is called first, copy only the dir path. If in dired, copy the file/dir cursor is on, or marked files. If a buffer is not file and not dired, copy value of `default-directory' (which is usually the “current” dir when that buffer was created) URL `http://ergoemacs.org/emacs/emacs_copy_file_path.html' Version 2018-06-18" (interactive "P") (let (($fpath (if (string-equal major-mode 'dired-mode) (progn (let (($result (mapconcat 'identity (dired-get-marked-files) "\n"))) (if (equal (length $result) 0) (progn default-directory ) (progn $result)))) (if (buffer-file-name) (buffer-file-name) (expand-file-name default-directory))))) (kill-new (if @dir-path-only-p (progn (message "Directory copied: %s" (file-name-directory $fpath)) (file-name-directory $fpath)) (progn (message "File path copied: %s" $fpath) $fpath )))))

the output is like this

"(defun xah-copy-file-path
    (&optional @dir-path-only-p)
  \"Copy the current buffer's file path or dired path to `kill-ring'. Result is full path. If `universal-argument' is called first, copy only the dir path. If in dired, copy the file/dir cursor is on, or marked files. If a buffer is not file and not dired, copy value of `default-directory' (which is usually the “current” dir when that buffer was created) URL `http://ergoemacs.org/emacs/emacs_copy_file_path.html' Version 2018-06-18\"
  (interactive \"P\")
            (string-equal major-mode 'dired-mode)
                    (mapconcat 'identity
                     (length $result)
                    (progn default-directory)
                  (progn $result))))
            (expand-file-name default-directory)))))
     (if @dir-path-only-p
           (message \"Directory copied: %s\"
                    (file-name-directory $fpath))
           (file-name-directory $fpath))
         (message \"File path copied: %s\" $fpath)

2018-08-04 thanks to Bo Yao

i wonder if it is practical to use this to implement automatic formatting of lisp code.

see Elisp: Automatic Code Formatting, Auto Indentation

See also: Emacs: Why I Don't Use paredit

Emacs: Insert Random Number/Hex/String

updated code for xah-insert-random-string. Now will use any A to Z, a to z, 0 to 9. Before, it uses only lower case, and avoids some vowels etc that may look like other, e.g. 1 l, o 0 O.

Emacs: Convert Full-Width/Half-Width Punctuations

code update. fixed a bug on xah-convert-fullwidth-chars

Xah Emacs Blog Archive

Patreon me $5 patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

If you have a question, put $5 at patreon and message me.