Xah Emacs Blog

You, put in a few bucks in my patreon. https://www.patreon.com/xahlee

(set-frame-name "emacs")

Elisp: File and Directory Functions (minor update)

Elisp: Regex Tutorial (updated)

Emacs: Open File Path Under Cursor (code update. Now open f.ts if exist, instead of f.js)

Elisp: String Functions (on its own page, expanded)

Emacs: Compile Current TypeScript File

if you like my work, put $5 at https://www.patreon.com/xahlee

or, Buy Xah Emacs Tutorial

Emacs: Run Current File (more code update. TypeScript part changed)

xah-fly-keys integration discussion on reddit

https://www.reddit.com/r/emacs/comments/7yprnq/xahflykeys_integration/

post your experience there.

emacs keys how-to

emacs keys howto 2018 02 20 71222
Emacs Keybinding, Keyboard, Articles Index

Emacs: Convert Straight/Curly Quotes (code update)

Elisp: Change URL into HTML Link (updated code)

Xah Emacs Sitemap, with random page button

Emacs: Run Current File (bug fix. No more buffer not found error when eval a elisp buffer)

iOS Crash with Indian Unicode Characters

ios unicode crash 2018 02 15 55551
[see Search Unicode]

ok, i found a #emacs bug! this sequence U+0915 U+094D U+0930 U+200C U+093E results in क्र‌ा the last char does not combine in emacs! now, crash your Mac!

Emacs: Xah Math Input Mode now support U+ prefix, e.g. u+3b1α

emacs grep, gnu grep, problems

my reply on a reddit question:

https://www.reddit.com/r/emacs/comments/7xljw0/of_you_emacs_users_on_macos_which_grep_version_do/dubem1l/

in 1990s to 2000s, first thing on any machine, is to install gnu version of file utils and text utils (which includes grep).

now, i don't bother. These tools, wasn't as important as in the past. e.g. python ruby golang etc, one can write trivially and do much better.

new ones keep cropping up every 5 years. as well as new shells. But i never bothered. For speed, a flash drive is much more important than spinning disk. Most time spent is loading files. (i 'grep' or do find/replace on 5 thousand files every week for past 10 years)

also, gnu text util has unicode bug, but they refuse to consider it as bug. see Linux Shell Util uniq Unicode Bug

so today, i use unix grep only when i need to search a word. If the search involves unicode, or multi-line text, or programing language code with lots slash or backslash, i either use xah-find.el i wrote that stays in pure elisp (avoiding unicode problem, multi-line problem, and toothpick syndrom escape problem), or go to a python script i wrote, for 5x faster speed. (gonna do a golang version soon)

See also:

Emacs: Run Current File (updated code. Now, there's output, switch to the output buffer.)

emacs controversy. What causes emacs slowness

https://www.reddit.com/r/emacs/comments/7wezb4/how_can_i_make_line_rendering_faster/du0a87s/

That's Xah vs Eli

MELPA No Longer Distributes Packages from Emacswiki

Buy Xah Emacs Tutorial

The best emacs + emacs lisp tutorial in existence, by far, of depth, breath, and readability. Get my book.

Buy Xah Emacs Tutorial

Emacs: Xah Fly Keys (minor update, and added more screenshots)

there are some git pull request. Sorry, i haven't got to them yet.

xah emacs accolade 2018-01-25

xah emacs accolade 2018 01 25 76695
xah emacs accolade 2018-01-25 https://twitter.com/jjasghar/status/956719416053567488

thanks.

browser vs emacs complexity

how many times more complex (as man hours) is a modern browser (e.g. chrome, Firefox) to emacs, write from scratch?

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

xah reddit channel

been posting to my reddit r/Xah. see https://www.reddit.com/r/Xah/

just trying it out. If you are reddit user, find my post on reddit as convenient, vote up my posts. If i don't see much user, i'll stop doing it.

also, since i have blogs on emacs, JavaScript, programing, and other topics, do let me know what you want to see, so i can shape up what kinda things i post there.

Emacs: Open File in External App (more update.)

xah-show-in-desktop fixed a bug when file path contains space, in MacOS.

ask Xah, 2018-01-07

https://www.patreon.com/posts/16282546

emacs abbrev for English and templates

if you haven't mastered emacs abbrev yet, do today.

about a year ago, tried to abbrev most frequently used words in English to save typing, and am very happy with it, e.g.

i also have 1 thousand others for elisp, JavaScript, css, html, golang, etc.

here's how to setup Emacs: Abbrev Mode

Emacs: Xah Fly Keys now supports programer's dvorak layout. That is, dvorak with number/symbol row swapped. Thanks to akater.

Emacs: Open File in External App

updated. Fixed a bug for xah-show-in-desktop, in MacOS, when current directory is empty.

Thanks to FSF/GNU, and 2 Kinds of Thanks

first, i like to say i'm thankful to FSF. No, i was a fanatic of rms, and has been ban'd in mailing lists (around 2002) for pro fsf/gnu/rms harsh opinions. People have called me a rms fanboy.

but, i don't like criticism of fsf/gnu/rms gets voted down for disagreement of opinion than lack of points.

as to appreciation, we, need to thank our mom. She gave birth to us. But we need to thank our dad too, else, we wouldn't exist. Then, we need to thank society, because mom and dad can't survive by themselves. And, we need to thank our firemen, for, he protects us, and soldiers. Thanks to our teachers and philosophers too, sans of which, i haven't clawed your eyeballs out yet.

there are 2 kinds of thanks. One is which they do by themselfs. The previous paragraph, are such. Your mom and dad no really need thanks from you because they'd birthed someone else anyway.

the other thanks, is person do because of you and for you sans necessity. If i give you a buck, or been kind to you, you thank me, a dear thank, because i don't have to. In this regard, the average parents, firemen, soldier, teacher, family, your church, school, company, government, don't qualify. But particular good persons, qualify. I have many people in emacs community am thankful to in this regard, too.

2017-12-23, context: https://www.reddit.com/r/emacs/comments/7la3qv/the_elisp_interpreter_inside_of_emacs/drmb7k5/

Emacs: Remapping Keys Using key-translation-map (minor update)

emacs history: major changes in emacs core

  1. 1985-07-15, Emacs 16.56
  2. 1985-12-20, Emacs 17.36
  3. 1986-10-02, Emacs 18.24
  4. 1992-10-31, Emacs 18.59
  5. 1994-11-01, Emacs 19.28 • Initial support for X
  6. 1996-08-22, Emacs 19.34
  7. 1997-09-15, Emacs 20.1 • Support for non-ASCII text.
  8. 1997-09-20, Emacs 20.2
  9. 1998-08-19, Emacs 20.3
  10. 1999-07-12, Emacs 20.4
  11. 2001-10-28, Emacs 21.1. • New display engine with support for variable-size fonts and TTY colors in Emacs 21.
  12. 2002-03-18, Emacs 21.2.
  13. 2003-03-24, Emacs 21.3.
  14. 2005-02-06, Emacs 21.4.
  15. 2007-06-02, Emacs 22.1.
  16. 2008-03-26, Emacs 22.2.
  17. 2008-09-05, Emacs 22.3.
  18. 2009-07-29, Emacs 23.1. • Unicode-based internal representation of text in Emacs 23. • Emacs client/server. • Visual lines. (down arrow key moves by visual line) • New font engine. Now support OS's fonts.
  19. 2010-05-08, Emacs 23.2. • open large files, up to 512 mb.
  20. 2011-03-10, Emacs 23.3.
  21. 2012-01-29, Emacs 23.4.
  22. 2012-06-10, Emacs 24.1. • Bidirectional text display
  23. 2012-08-27, Emacs 24.2.
  24. 2013-03-11, Emacs 24.3.
  25. 2014-10-20, Emacs 24.4.
  26. 2015-04-10, Emacs 24.5.
  27. 2016-09-17, Emacs 25.1.
  28. 2017-04-21, Emacs 25.2.
  29. 2017-09-11, Emacs 25.3.
  30. 2018, Emacs 26. • Concurrency/threads

(ones before emacs 23 are listed by Eli Zaretskii, a long time core emacs developer. https://www.reddit.com/r/emacs/comments/7kpwmb/how_much_has_emacs_core_changed_over_the_years/drgtqyx/ )

for details, see Emacs News Panel Index

Elisp: require, load, load-file, autoload, feature (updated)

emacs, best simple package source code to learn from?

someone asked on reddit.

my answer https://www.reddit.com/r/emacs/comments/7l98a8/best_simple_package_source_code_to_learn_from/drkrnbs/

well, i run a emacs tutorial on writing major modes. If you haven't seen already, The topics covered are:

How to Write Major Mode

Syntax Table

see Emacs Lisp How to Write Major Mode

if you read the emacs lisp manual, it recommends that the text-mode is a simple mode you can learn from.

For programing modes, i learned things from the builtin css-mode written by the previous emcas leader Stefan Monnier.

but other than that, i didn't learn writing mode much from looking at other modes. I learned mostly from reading elisp manual and writing your own, and looking at source code of arbitrary builtin functions when necessary.

emacs lisp: how to undefine a face

someone asked at https://www.reddit.com/r/emacs/comments/7l42rc/how_do_a_unbind_a_face/

my answer: https://www.reddit.com/r/emacs/comments/7l42rc/how_do_a_unbind_a_face/drjerh6/

detail at

Elisp: How to Define Face

#emacs, current problem is, ido-completing-read doesn't take obarray. very annoying. so now, like, i need to rewrite ido-mode

here's the problem. ido-completing-read doesn't take an obarray. (obarry is a special array that hold all elisp symbols) And that's probably why ido doesn't do M-x.

To use ido for M-x, you need to convert obarray to a list of strings. But you don't wannna do this everytime M-x is called. length of obarray is 15k.

Thus, a cache idea is born. So that's probably why smex has cache, probably as after thought. with added feature of sorting most frequently used command. But note, cache adds complexity, cuz now you have the issue of when to regenerate cache.

the emacs completion is truly a mess. The mothership don't change due to org problems, so you have a wild bunch packages trying to improve it, for the past 20 years. Note that, icomplete is from 1993. What really should be done is fix emacs completing-read (it's in C)

hippie-expand, complete-symbol, iswitch (now defunct), icicles, ido, ivy, helm, company, auto-complete, yasnippet, all tries to implement their own completion.

elisp, What's the difference between set and setq

someone asked on reddit. My answer:

https://www.reddit.com/r/emacs/comments/7jyv0o/whats_the_difference_in_setq_and_set/draapog/

but more detailed answer is here Elisp: Lisp Symbol

should a beginner programer learn emacs lisp?

someone asked on reddit.

https://www.reddit.com/r/emacs/comments/7jr2y3/as_a_beginner_programmer_would_it_be_a_bad_idea/dr8krcf/

here's my reply.

if you are new to programing, best is to read Emacs Lisp Intro by Robert J. Chassell

this is part of emacs. Just M-x info and you'll see it. (it's also on FSF website.)

this is for people who never programed before.

however, if you already know a programing language, it is a worst, useless, book. Because, you will have to scan 10 pages to learn 1 simple elisp thing. It'll be explaning what's a variable, function, loop, etc, intermixed with elisp stuff.

for beginner programer, should you learn elisp? it depends. Learn elisp does not hurt at all, nor will it be magic in teaching you something you won't find elsewhere.

The question is really, what do you prioritize.

If you want to customize emacs, yes, learn elisp. It is the only way.

If you are thinking maybe elisp is a stepping stone to get you over other programing or jobs meanwhile you still get value of customizing emacs, then, stop the fantasy right here. You better off to learn python, ruby, golang.

Found a problem with ivy mode. If you run repeat-complex-command, it bloats up your history like this:

ivy redo problem 2017 12 12 92325
ivy redo problem 2017-12-12. Blowing up minibuffer history. The line should be just “(xah-image-autocrop)”

emacs 26 force typing yes/no for deleting dir?

emacs 26 dired deleting directory force user to type full “yes/no”. exceedingly annoying. apparently, it's hardcoded, bypassing yes-or-no-p alias to y-or-n-p

this is hardcoded in dired--yes-no-all-quit-help at dired.el

This is super annoying. Why's this change?

it used to be, the code calls yes-or-no-p, and user can alias it to y-or-n-p, so that typing y or n is enough.

comment at https://www.reddit.com/r/emacs/comments/7iypxo/emacs_26_force_typing_yesno_for_deleting_dir/

emacs lisp byte code internal

here's a great article.

http://nullprogram.com/blog/2014/01/04/

Chris Wellons is one of say top 5 elisp expert i know.

and i think he's about the only one, who writes emacs tech blog and writes well and in depth.

he not just know elisp in depth, but, programing and associated computer science.

i can't readily think of anyone else on emacs or emacs lisp.

most other elispers, when they have a blog or opinions, i find them idiotic.

emacs, recommended dropin replacements for standard packages

my own:

ok. that's one too many.

now, a reverse replacement.

The ones i consider actually harmful are:

* s.el f.el, dash.el, god mode, hydra.

They seem convenient, but actually don't do much, adds complexity and bloat. You can do what they do with plain emacs lisp trivially.

The ratio of power/simplicity is the key.

recommended dropin replacements for standard at reddit emacs

learn emacs source code to master computer science?

when i was younger, at one point i thought of studying emacs + elisp as a way of getting into or mastering “computer science”.

turns out, that was a very silly idea. You can master emacs source code but would learn basically 0 computer science and gain very little industrial coding skill. (as with respect to get a programing job. If you master emacs source code, but have no other coding experience, you probably won't find job. Sure you can, in the 1 job per year niche. (but, of course, for some, you might become star coder. But, for such person, he would be regardless of emacs.))

though, Matz the ruby guy, studied emacs lisp and created ruby, based on it.

[see Ruby Creator Matz on How Emacs Changed My Life]

its like this. Would you be a great writer, or get a writing job, if you, say, mastered Shakespere's play?

depends on what's your interest and goal, you probably better off to write a web app, read general programing book, computer science book, instead of looking into emacs source code.

but, if your focus is to contribute to emacs, then, yeah, and you do need to read emacs lisp manual.

as to how to approach emacs source code... i guess just dive in. e.g. say you don't like some command's behavior, or you find elisp lacking some function. You look at their source code, by describe-function, and soon you'll dig into from elisp to C. And, maybe, one thing leads to another.

from how to read and understand gnu emacs source code at reddit emacs

Hello, my name is rms, YOU belongs to me

emacs has ido-mode, but it doesn't cover M-x or C-h f. icomplete-mode does, but its UI is way inferior. and complete-symbol and hippie-expand adds to the total confusion.

each time these are brought up in emacs dev, one ball of philosophical flamewar flies, hundreds of debates and arguments, gouging each other's eyes. End result is nothing is done.

then, there's MELPA, of warlords, each oneupmanship other, for no money but fame. “Try Me”, “I'm Modern”, each bottle cries. And rms considered them foreign, wants people to fold to “GNU”, and sends an army to get them to switch from gpl2 to gpl3. Hello, my name is rms, YOU belongs to me.

Rms, lives in the woods, haven't been coding for like 20 years. Every few months, makes a outlandish statement. Like, Can somebody make emacs into Microsoft Word? What is magit? and why isn't it in GNU emacs? Can somebody make emacs change font size?

then, undying woodworkers crawl out of the woodwork, with suckling millennials, defending rms, like, a god. rms is always right. He sees the future!

The emacs dev list, has this culture of communism commune, where, every clueless joe is “equal”, and voices shit freely. So, any issue, is a debate ball, from all corners of the earth. No process. No rule. We are cooperative peace on earth, the heaven of equal opinions!

One'd expect that code contribution rules in emacs dev, at least. Well, get in line, regardless what celestial deity you are. Prostrate and bow to the GNU. Then, we might look at what your problem is. Then, mention ye code again. If it survives feast of opinions. Beg again. Maybe.

this emacs dev problem comes up every now and then thru the years, by many coders, big and small names, old and new. (reddit, hackernews) Each time, some, e.g. abo abo, eli, insist and deny, any problem whatsoever. gnu people are nice, emacs dev is smooth, rms is god, all's well.

Emacs: Copy/Cut Current Line If No Selection (minor code update. Now, when copy, don't print a message)

emacs 26 problem: Error in post-command-hook (ido-exhibit): (error "Attempt to modify read-only object" "goto-char") problem seems to be smex. but hard to debug.

reproduce: M-x smex, then type “go”

ok, comes to be thinking, what if i am to lead emacs.

ok, first thing, axe all platforms other than mac, windows, linux.

then, axe, without mercy, any deprecated or obsolete code that's more than 10 years old.

then, axe, the common lisp fk in emacs lisp. Aggressively suck in the newer replacement from melpa people.

then, axe, anything complex, and anything approaches of a hack.

ok, char limit. something like that.

How to Avoid the Emacs Pinky Problem (minor update. updated all hand toys.)

Ask Xah, emacs, JavaScript, keyboard, 2017-12-01 at https://www.patreon.com/posts/15656041

Richard Stallman Pushing for GPL3, Kicked Out Free Software from Free Software Platform

now on its own page

How to Write a Emacs Major Mode for Syntax Coloring (minor update)

removed use of global variables.

i was, using setq for temp variables.

was that way, because it's simpler for beginner to understand, instead of let*

but now, 10 years later, time's changed.

Emacs's Command Frequency Statistics (repost)

remember, that linum mode makes your emacs super slow.

download emacs 26, and Alt+x global-display-line-numbers-mode

see Emacs: Display Line Numbers

for linux, download and compile it. Emacs: How to Build Emacs from git Repository

for MacOS, get emacs 26 beta at https://emacsformacosx.com/builds

also, whenever you upgrade emacs, you may need to recompile, or update, all your external packages.

[see Emacs: How to Install Packages Using ELPA, MELPA]

My Typing/RSI Experience 1992 to 2017 (updated)

the following pages, have been reviewed/updated

emacs window/frame management problem

an emacs frequently asked questions, the window/pane config reset problem. https://www.reddit.com/r/emacs/comments/7evidd/windmove_shortcuts/

my reply

that's a frequently asked questions, comes up every few months.

Best solution, is to stop 1-window full-screen workflow. Because, all sorts of emacs commands will constantly pop up and split your nicely setup panes. You'll have to fight it every few minutes.

This 1-window style came from terminal and IDEs. The former, are conditioned to have just 1 window (unless you make another connection to server). The latter, the IDEs, are based on pallette idea, where you have a fixed pane config, and every tool is predefined to sit in some pane/drawer/tab that lets you open or collapse them.

there are various packages that help you “reset” your windows config. But they just add more work to your fingers.

Instead, use 2 windows side by side workflow. This way, your window config never changes unexpectedly. And, operating system provides much more flexible and powerful ways to control them. (e.g. Mac expose, or various linux tiling managers, and virtual screens) And, you can now fully utilize emacs split/unsplit horizontal/vertical on any window as you work, view different parts of a buffer, run calc, calendar, dired, shell, etc. Fluid and flexible.

check out my article on effective windows management for screenshots and detail.

Emacs: Effective Windows Management

Best Keyboard for Emacs (more update)

2 new commands for Mac. xah-open-in-textedit, xah-open-in-safari

see Emacs: Open File in External App

emacs lisp, still don't have trim string. how many more years?

in any language, trim string is a fundamental string function. #emacs lisp still don't have it! sitting in limbo for 3 years. How many more years? see

https://www.reddit.com/r/emacs/comments/7eblq0/nice_list_functions_in_emacs_251/

code example for 30 new list functions

emacs lisp. Planning to write example for each of the 30 new elisp functions.

see Elisp: Filter a List

patreon tip me if you like to see it.

https://www.patreon.com/xahlee

better nav panel, emacs + elisp in 1 place

now, the side panel, contain both emacs and elisp in one place, for easy navigation.

see Practical Emacs Tutorial

empty cache and refresh browser. (in chrome, shift+f5)

tip me at my patreon. https://www.patreon.com/xahlee

emacs lisp sequence functions finally here

emacs 25.1 added over 10 list processing functions. Finally. For detail, see

Elisp: Filter a List

Emacs: Cycle Replace Space Hyphen Underscore (repost)

removed comment system on my site

just removed disqus comment on all my sites for now. They are now forcing image ads. And their ads are those low quality sensational types. To opt ad free, would be $10/month. But, comment takes 30min/day to reply, and 95% are garbage. (i have 5 thousand pages on my sites) might add back, we'll see. let me know what you think.

Emacs: Search / Highlight Word

important update. For isearch-forward, make these equivalent: sequence of: space newline tab hyphen underscore

before, i didn't add a plus sign, so that if you isearch a text with newline followed by 2 spaces, emacs will not find the next occurrence. Possibly a emacs bug.

science of Keybinding Design ⌨

lisp is dead

today is probably a good day to declare lisp dead. For a few years now, you don't hear lisp as cool stuff anymore. Not even much clojure. A new generation of programers, unceremoniously took place.

I think time moved on. No new Common Lisp coders. Scheme quietly went away, replaced by pyret (python) by themselves. Clojure struggle among tons of new langs, confined in enterprise coding on java platform. emacs lisp remain in handful of emacs users.

San Francisco Bay Area Keyboard Meetup Impressions. i smashed 100 keyboards! see San Francisco Bay Area Keyboard Meetup 2017-11 Impressions

updated the following.

Emacs: Eww Web Browser (major update. new screenshot. added keybinding, and a new rename function)

buy me a coffee at my patreon. https://www.patreon.com/xahlee thanks.

Emacs: Regex Tutorial (minor update)

Tips on Long Term Emacs Productivity (updated)

thanks to jcs for mention, at http://irreal.org/blog/?p=6733

jcs is a long time emacs blogger, check out his blog, containing many tips i don't cover much here, especially on using org mode, TeX, and web security.

Emacs Opening Large File Slow (on its own page)

Emacs: 𝔗ℌ𝔒𝔘 𝔖ℌ𝔄𝔏𝔗 𝔈𝔐𝔄ℭ𝔖 (minor update)

Best Way to Type/Insert Parenthesis, Brackets

another emacs rsi

https://www.reddit.com/r/emacs/comments/7bgw48/are_these_early_symptoms_of_rsi_or_i_am_just/

Elisp: Find String Inside HTML Tag (minor update)

How to Write grep in Emacs Lisp (minor update)

Emacs: xah-lookup.el, Lookup the Web (corrected a init setup doc error.)

Emacs: Cycle Fonts by Command (minor update)

Emacs: Effective Windows Management (minor update)

the following line wrap articles have been reviewed and updated

the following has been reviewed and updated

New version of xah emacs tutorial is sent to previous buyers. If you haven't already, buy it now.

Buy Xah Emacs Tutorial

Thanks to many who requested to be kept on the update list. You'll continue to receive updates.

Elisp: Simple Emacs Lisp Examples (updated)

Emacs: Select Line, between Quotes, Extend Selection (updated xah-select-line, xah-select-block, so that they don't depend on my other functions.)

emacs on Mac!

Why Run Shell in Emacs? (added a Mac screenshot!)

since am now on a Mac (after 5 years on linux desktop), am going to add more Mac screenshots.

by the way, my history of emacs desktop (at home) is:

Start Emacs with New Empty Buffer

Emacs: New Empty Buffer

updated. now it returns the buffer. With instructions on how to start emacs with empty buffer.

thanks to Vaddi3 asking on https://www.reddit.com/r/emacs/comments/79wsn7/mx_helppls_startup_empty_buffer_error/

Emacs: GUI Emacs vs Terminal Emacs (updated)

ask me questions on patreon

https://www.patreon.com/posts/15161253

San Francisco Bay Area Mechanical Keyboard Meetup, Saturday, November 11th, 2017

I'll be going! Thanks to Andy Lee.

i'll be there probably 10am to afternoon. Exactly i don't know yet. email or twitter me if you want to get in touch.

so far there are 200 people registered. Be sure to register. I think they allow max of 300.

https://www.reddit.com/r/MechanicalKeyboards/comments/6wodcp/bay_area_mechanical_keyboard_meetup_2017/

Best Keyboard for Emacs (updated)

put a few bucks in my patreon. https://www.patreon.com/xahlee

or buy my emacs tutorial. Buy Xah Emacs Tutorial

x bows keyboard top 26650
X-Bows Keyboard Unboxing

I highly recommended this keyboard for emacs.

ask me question on reddit https://www.reddit.com/r/MechanicalKeyboards/comments/73zhle/xbows_keyboard_unboxing/

emacs smex mode 2017 10 76342
emacs smex mode

Highly recommended.

Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Ask me question on patreon