Xah Emacs Blog

Buy Xah Emacs Tutorial. Master emacs benefits for life.

Tips & Tricks for emacs and emacs lisp.

Emacs: Select Line, Block, in Quote, Extend Selection (minor update)

emacs magit tip. press C-u S to stage also untracked files.

see also Emacs: magit-mode Tutorial

emacs lisp toothpick syndrome emacs 24.5 reftex-vars.el
Emacs Lisp Toothpick Syndrome

new emacs tutorial is out. Major update since past 2 months is addition of navigation sidebar, for emacs and elisp pages. The updated version will be sent out to supporters this weekend.

Buy, retweet. Thanks. Buy Xah Emacs Tutorial

Emacs: Byte Compile Elisp Files (updated)

Emacs: Find/Replace in Pure Elisp xah-find.el (added a regex find/replace screenshot)

i do regex find/replace on 5 thousand html files every week, for the past decade. The above, is the best method.

Emacs Lisp: Run Current File (updated, to include golang)

emacs lisp pages now have navigation side panel. See Practical Emacs Lisp

tutorial page navigation sidebar

now the tutorial has side panel for easy navigation. See Practical Emacs

Elfeed Not Support Xhtml? here's a test

if this content shows, then it means, i must use the CDATA thing and it doesn't support xhtml.

Update: yes, elfeed now fixed it! fixed on , see https://github.com/skeeto/elfeed/issues/112

by the way, elfeed is a RSS/Atom feed reader, for emacs, written in elisp. It's excellent. https://github.com/skeeto/elfeed, also on MELPA.

by the way, reddit is also switching to atom. https://www.reddit.com/r/changelog/comments/428vdq/upcoming_reddit_change_switching_from_rss_20_to/

if your blog is using RSS, you should switch to Atom, because RSS is garbage, by Dave Winer. (i think Dave Winer is one of those guys in computing industry i regard is charlatan, but i haven't ascertained my own opinion yet. (charlatan, y'know? like, those selling you snake oil, the gurus, they spread gospels and people buy it. In fact, typically a lot followers. Larry Wall, Martin Fowler, are prime examples. Typically, these guys, their golden touch, is never technical (say, a math theorem), such as say Knuth. But, they rely heavily on social things. It is via social, they get their kicks. In particular, their weapon of choice is fuzzy and cozy and mythical jargons, Unix Philosophy, KISS, defensive programing! (remember that?)! laziness is virtue of programer! (remember that?) Design Patterns! eXtreme Programing, Agile, SCRUM! Idioms! Pythonic!)) (disclaimer: this is all opinion only.)

see also Voodoo of Software Engineering

JavaScript in Depth

News for my JavaScript tutorial. Now, it has side panel for easy navigation.

JavaScript in Depth

JavaScript is now the most used language, depending on how you count, along with C, C++, Java.

If you never touched JavaScript, check it out. If you code JavaScript, you might learn a few things too, from a very differet perspective.

Of existing professionally published JavaScript books out there, i think mine is competitive in depth, in accuracy, in readability. 〔➤ JavaScript Books Review

Emacs Lisp: Get User Input (updated)

how to open a info file

If you have a info file, you can open it in info by first call universal-argumentCtrl+u】 then infoCtrl+h i】. Emacs will prompt for a path.

Emacs: View Info Page Tutorial (updated)

this is useful when you have a 3rd party package that has info doc.

superior method to insert any type of bracket/quote by pair

on reddit, someone asked a question about inserting curly quotes and brackets in pairs.

Here's my explanation, i believe this is superior to any. https://www.reddit.com/r/emacs/comments/41i156/using_smartquotes_with_the_electric_pair_mode/cz2ro2s

updated.

Emacs: How to Install Packages Using ELPA, MELPA (minor update)

Emacs: Auto Save

Paul Graham programming 2007
Hacker News founder, Common Lisp expert Paul Graham, using the Natural 4000 Keyboard, 2007. 〔Photo by Gabor Cselle. Source: https://www.flickr.com/photos/86921622@N00/1162779139 ©

see also Microsoft Natural Ergonomic Keyboard 4000 Review

Disable Ubuntu New/Overlay Scrollbar

Emacs Lisp: Insert Random Number / Hexadecimal (updated)

Which Lisp Should You Learn? (old article. repost)

Emacs Lisp: Regex Patterns and Syntax Table

is it worthwhile to use abbrevs for most used English words?

Emacs Abbrev for Most Used English Words?

Which Mouse to Get for Emacs

someone asked about which mouse to get for emacs

most gaming mouse have onboard memory, such that you set the buttons once, then plug in any computer it'll work. The software is usually Windows only, so you need a windows machine. (or, a virtual box might work)

but if you really want a mouse with linux api, i hear that ROCCAT mouse is famous for that.

roccat has many models. This one i think is physically/functionally best. ROCCAT Tyon Mouse

other models are ROCCAT Gaming Mouse with Linux Support

but i've not used them.

myself recommend plain logitech. I recommend any of the following, up to your preference in size, number of buttons, and whether it has spin wheel.

most mouses, as long as they are standard usb devices, one can also program the various buttons in X11 without the mouse itself providing means, but it's a huge hassel. One'll spend weeks and weeks reading the many many half-written how-tos.

also, a warning. Some gaming mouse REQUIRES installing and registering their “cloud” software for every computer you use the mouse in order for the button config to be remembered. Notably Razer Orbweaver Keypad. So, i generally stay away from anything Razer.

new Common Lisp book: 〈Common Lisp Recipes〉

Common Lisp Recipes: A Problem-Solution Approach By Edmund Weitz. @ amazon

wow, a new Common Lisp book. A Chinese friend, Chun Tian (binghe) https://twitter.com/binghe_lisp, who i regard as one of the top Common Lisp expert, highly regarded the book.

KBC Poker 3 Keyboard. Now, this one, is for programers. It features physical key activated programing. So, you just press keys to start record key macros. No need for software!

Atreus62 Keyboard ⌨

for keyboard hackers, someone custom build a Atreus keyboard by fixing one of its problem of too few keys. The result is beautiful. See updated: Atreus Keyboard ⌨ (refresh page)

emacs reddit gem: Flexible isearch without a package

;; make isearch treat space dash underscore newline as same
(setq search-whitespace-regexp "[-_ \n]")

https://www.reddit.com/r/emacs/comments/3yxk2x/flexible_isearch_without_a_package/

Reddit, on emacs undo

https://www.reddit.com/r/emacs/comments/3yt467/emacs_new_years_resolution_use_undotree/

in summary, once a month or two, you tried to undo but unable, because something's broken.

see also Emacs Undo and Emacs Cult Problem

Emacs's Key Syntax Explained (updated)

See also: Emacs Keys Overview

Implementing Queue in Lisp

someone asked me about how to implement queue. He showed a code using list as data structure and lisp macros and stuff that's just totally wrong.

if you don't know, a “queue” is data structure that's “first-in-first-out”. It's like when you go to a restaurant, you have to wait in line. You can only add to the end, and remove from front.

A naive solution is simply to use a list, by popping front and appending to end. The problem is that doing anything to the end of list is expensive.

Here's a article that shows how to implement queue properly.

FIFO Queues in Scheme and Lisp By jcs. @ http://irreal.org/blog/?p=40

for lisp beginners, see:

JetBrain, IntelliJ, WebStorm, and keyboard

here's a incredible article. The article is about the reaction time the moment you press a key on your keyboard, to the moment it shows up on screen.

Seems silly and useless, but, it went over so many interesting aspects, with hard data and tens of links to other articles, and, specifically, measure some 10 editors/IDEs with data diagrams. Here it is:

Typing with pleasure By Pavel Fatin. @ https://pavelfatin.com/typing-with-pleasure/

It will take me days to go over the article! He took my arena! I've read the article quickly, and many remarks it says by the wayside, ranging from details of the working of emacs to details of the working of keyboard, i can see it's spot on! Very well researched! Yet it covers so many other things i have no idea of. I need to go over every of its claims and tens of links in detail. Days.

it's written by a JetBrain employee.

over the years, i've come to respect the editors from JetBrain. They make many editors geared specifically for each language. ⁖ IntelliJ for Java, WebStorm for JavaScript and web, and also PyCharm, RubyMine, PhpStorm, Clion (C, C++), etc.

i've used PyCharm for a day or two, and it's rather lackluster. But, for more complex stuff, i've tried WebStorm syntax highlighting, it stands out ABOVE ALL. (when you work with web, you know, thousands of keywords from BOM & DOM. 〔➤ JavaScript: Browser Object Model, Document Object Model〕 〔➤ Xah Web Dev Tutorials〕 ) See Syntax Coloring in Editors. Really because, it has a language-aware static analyzer builtin. The emacs counter part is CEDET. 〔➤ Emacs 23.2 Features (released 2010-05)〕 It's been in emacs for 5 years now. But i have yet to tackle it. I'm sure, it will take me a week to figure it out, and the outcome, may just be abandon. While, JetBrain stuff, works out of the box. That's a big difference between commercial software and open source. (if you are reading this, and if you are young, you probably have beefs with my call and forthwith diss xah's blogs. You! Too Simple! Too young! NAÏVE! And if you are the few old bags glued to the FSF ideology or open source nirvana, well, good for you. (you know? actually, i was surprised that there are many people today who do not know the difference between FSF and Open Source, and do not know, that they are at war. (here's trick. To get rms extremely angry, just say to him, sincerely: “Thank you for all your contribution to open source.” (make sure you don't have something shatterable nearby.))))

a new command, “xah-toggle-previous-letter-case”. See updated Emacs: Toggle/Cycle Letter Case

Free Software Foundation, How Much Donation They Get?

Emacs Lisp: How to Write a Toggle/Cycle Command (major rewrite)

Emacs: toggle-word-wrap (on its own page)

for those of you really interested in keyboards. Stenotype Machine

Sacha Chua Interview New Emacs Maintainer John Wiegley

2015-12-10 Emacs Chat - John Wiegley

The video is 50 minutes.

The first 23 minutes, is really a demo about gnus, a very old, powerful, package in emacs for reading newsgroup, mailing list, and mails.

The rest, is about John's experience as the new emacs maintainer, and GNU Emacs directions.

One thing particular that John emphasizes is that, there are a lot emacs devs, who haven't been involved in emacs core development, but now it's time for you perhaps to join again, and John welcomes you very much, and will workout any issues you might have, as he sees this as even more important than emacs technical issues.

You can find the video topics break down at Sacha's site at http://sachachua.com/blog/2015/12/2015-12-10-emacs-chat-john-wiegley-maintaining-emacs-can-help/, or a voice recording version to download. (you won't miss much without video, for this one.)

Atreus Keyboard ⌨ (on its own page)

by Phil Hagelberg, who is a major coder of emacs and clojure. Now you can buy it.

new command, xah-open-in-terminal. See bottom at Emacs Lisp: Open File in External App

new version of emacs tutorial is out. Buy Xah Emacs Tutorial. Buy it. Thanks.

Emacs Lisp: Single Key to Copy/Paste from Register (updated)

FSF GNU Emacs Link Dead Problem 2015

Emacs: Set Default Browser

turn the scroll bar off not

in emacs culture, often you'll hear hacker type that says to turn off scroll bar. They consider it useless, and they look at the percentage in the mode line instead.

this is, the most idiotic advice. It is why am often agaist these hacker types or emacs advocate's opinions.

The visual scroll bar, is more effective at indicating the cursor position within a file, and it also gives you a hint of how vertically long is the file. The bigger the file, the scroll bar becomes smaller.

Visual scroll bar is also in your peripheral vision. You don't need to look at it, yet info is convey'd to you.

The percentage in the mode line, needs to go thru a brain cycle to decipher, also, you need to gaze down to the bottom to look at it. Also bad, is that it changes to “Top” when it is 0%, and changes to “Bot” when cursor is at the bottom. The jarring change to “Top”/“Bot” is Extremely bad User Interface. (i wrote a bug report (suggestion) few years ago. Of course, the emacs dev hacker types, will have none of it. In fact, add injury to insult, they “fixed” a bug that relates to how the percentage is calculated.) 〔➤ Emacs's Mode Line Suggestions

Also, sometimes they say turning off scroll bar saves you screen space. Well yes, it saves 2 to 3 char's width. (and exactly these hacker types will insist that lines be only 70 chars long, so you waste 10 chars worth of space)

Part of the issue the hacker types do these things is that, turning off the scroll bar, doesn't matter if it is technically good move or bad, it is nevertheless a expression of being advanced user. As in, “real programer don't use the mouse”, “real programer uses command line only”, “real programer codes in C”…. This phenomenon, of one-upmanship, superiority, is with us, in any field of mostly males.

Emacs Lisp: Replace HTML Entities (updated code.)

curly quotes in emacs lisp inline doc

btw, recently (about 2 months ago), emacs dev introduced curly quotes in inline doc. (of actually using the unicode curly quotes “”). All is implemented and done in the development branch, by Paul Eggert. Then, it got hundreds of debates, many want nothing except ASCII in code. The maintainer was still Stefan Monnier. He didn't turn it down as far as i know. But, rms, eventually, just make a remark and it is reverted (under heavy pressure). I am really annoyed by that. rms, although isn't maintainer, but he exercise significant clout on decisions, even purely non-political issues. The list is pretty much a opinion war ground. Louder and numerousness wins. I hoped what whoever rms select as maintainer, will be absolute dictator for his term. I think that'd be better.

tangential discussion from reddit https://www.reddit.com/r/emacs/comments/3v19uj/is_there_anything_emacs_cant_do/

use append-to-buffer to accumulate text. Updated at Emacs: Copy/Paste and kill-ring History

Emacs Lisp: Copy File Path of Current Buffer (code updated. Now, result is always full path)

Past Articles by Date

2015-112015-102015-092015-082015-072015-062015-052015-042015-032015-022015-012014-122014-112014-102014-092014-082014-072014-062014-052014-042014-032014-022014-012013-122013-112013-102013-092013-082013-072013-062013-052013-042013-032013-022013-012012-122012-112012-102012-092012-082012-072012-062012-052012-042012-032012-012011-122011-112011-102011-072011-052011-012010-102010-062009-12

Like it? Buy Xah Emacs Tutorial.