Xah Emacs Blog Archive 2016-07
I've been reading and benefiting from your contributions to the Emacs community for many years now. You are truly a pillar of our community and I am very grateful for your presence in it.
😂. Thank you.
Buy Xah Emacs Tutorial
pikachu in emacs
Emacs Pikachu Alert
Emacs: Clean Empty Lines (code minor update)
Xah Lee on Mickey Petersen's Mastering Emacs
Mickey Petersen wrote a book Mastering Emacs. The few times i read his articles, honestly, it's incomprehensible to me. He usually write in certain technical precise or comprehensive style that i think some hacker types prefer. Of his writing style, am often thinking, why would i read it instead of elisp manual? In fact, i prefer elisp manual, finding it actually easier to understand and definitely comprehensive.
but, as hackers wont say, YMMV. (Your Mileage May Vary)
Here's a example of Mickey Petersen's tutorial, check it out:
[Mastering Key Bindings in Emacs By Mickey Petersen. At https://www.masteringemacs.org/article/mastering-key-bindings-emacs , accessed on 2016-07-28 ]
PS I find his book cover design extremely beautiful.
Elisp: Command to Extract URL (updated code.)
Emacs: Replace Invisible Unicode Chars
updated code. Twitter recently started to use the character ￼. It is invisible in Google Chrome, but Firefox shows a dashed square with word OBJ inside.
more side navigation panels and the classification problem and hardship of running a site
Emacs Lisp Toothpick Syndrome
pages in misc directory now has side panel. See above link as example. Side panel are convenient for user, and connecting many disparate pages into a more weighty and convincing presentation.
I'm still working on some pages that don't have side panel.
it's quite tricky to do them for several reasons, some technical.
first, you have to make sure the contents are related, at least somewhat. You have to group them, put them together in the panel. This is the most time consuming. (you have to read them. And, nuance, style, attitude of article may change its category/subject-matter) If you don't categorize, you have one big pile of links of random articles, and in that case, having a side panel makes the page worse.
Daniel Weinreb Rebuttal to Richard Stallman's Story of LISP History
xah-select-block, repeat extend downward
Emacs: Select Line, between Quotes, Extend Selection
new is the command
xah-select-block. It will extend selection downward when called repeatedly. This is, FANTASTIC!
xah-select-line is also new, similar.
Really, massive amount of work on my emacs stuff in past weeks.
emacs ido switch window/frame problem
Emacs: Delete Text Block (new)
emacs major mode keys not compatible as key sequence
new version. Find Replace in Pure Elisp xah-find.el
Emacs: xah-find.el, Find Replace in Pure Elisp
new version. Now, the brackets are ASCII ones by default. And customizable.
This is perhaps my most useful package. I use it everyday to do find replace on thousands of files for past 3 years. Before, it's various other methods in emacs. But this is the best. It's the only one written in elisp, that get rid of lots problems.
how to remove file name association with a major mode?
(setq auto-mode-alist (rassq-delete-all 'js-mode auto-mode-alist))
Emacs: Set File to Open in a Major Mode
Someone asked on stackoverflow. (currently is down) Answer added to the above.
Emacs: Delete Current File (code update)
Elisp: Command to Extract URL (updated code)
Emacs: Convert Image Files in Dired (minor update)
All sigil has been syntematically replaced
there are 55 files.
1015 ξ and 298 φ
the file with the most sigil ξxi is Elisp: Command to Change Earth-Coordinate to Google Map Link, at 100 ξxi sigils.
also, turned on CSS coloring, so now all function parameters has its own coloring, and local variables has its own coloring.
for example, see Emacs: HTML Image Path to Img Tag
Elisp: String Match in List (on its own page, originally from a 2014 post.)
Emacs: Setup Mouse Click to Highlight Matching Words (rid of φgreek ξsigil)
Emacs: Copy Rectangle Region to kill-ring (fixed broken code.)
Elisp: Multi-Pair String Replacement with Report (rid of φgreek ξsigil)
Emacs: Convert Straight/Curly Quotes (rid of φgreek ξsigil)
Emacs: Escape Quotes Command (rid of φgreek ξsigil)
Emacs: Copy File Path of Current Buffer (rid of φgreek ξsigil)
Emacs: Cycle Space Hyphen Underscore (updated code. no more ξsigil)
Keyboard and RSI, Forearm Pronation, is Keyboard Tenting Important?
Emacs Keybinding, Keyboard, Articles Index
major update. Now, the index on the navigation panel contains only relevant articles.
Good news. The Microsoft Sculpt Ergonomic Keyboard is not vunerable to the KeySweeper password sniffing device
see Microsoft Sculpt Ergonomic Keyboard Review
if you haven't subscribed to my keyboard blog yet, do so now
navigation panel index now like proper book table of contents
The navigation panel of Practical Emacs has been completely redone. Now, the index is like book's table of contents, of proper topics in organized way. (Pruned out 20 links that's misc and esoteric, such as bug reports or workaround of some packages, and emacs new features of past version.)
- Xah MELPA package collection. Simple code, thoughtful design. Craftsman's choice. 😹
- 杀杀 MELPA 包大全。代码简厉，设计周全。达人之器。😂
Emacs: HTML Image Path to Img Tag (removed greek ξsigil)
Emacs: What's Major Mode (For beginner. New page out of old writings.)
Emacs: Set Default Browser (minor update)
Emacs: Move Cursor to Beginning of Line/Paragraph (code updated. Removed ξsigil)
Emacs: Move Cursor by Text Block (code updated. Removed ξsigil)
Emacs: Reformat Lines for Source Code
this is good for working with programing source code. see the page for detail. (refresh the page, lots edit)
Emacs: Toggle Line Wrap (code entirely rewritten and renamed.)
Emacs: Hard Wrap Lines (minor rewrite)
Elisp: Command to Change Earth-Coordinate to Google Map Link (updated)
removing Greek sigils ξxi φphi
I've removed Greek sigils in my packages. See them at Xah Emacs Packages
actually, replaced φ by *
and ξ by -
making variable distinct from other identifiers is still useful, and sigil helps.
ξsigil, is like a syntactic type. Sigil to syntax is types to semantics. #haskell #ocaml
each day, i'll update 1 or 2 pages of code on my emacs/elisp tutorial site.
Here's today: Emacs: Remove Accent Marks
if you haven't done so, read The Sigils WAR, Language Design and Coding Convention (updated. refresh page.)
Thanks for voting!
an eulogy to sigils ξ φ
Emacs: Xah CSS Mode
fully revamped. On MELPA now. Clean code, full featured, no more pesky Greek sigils ξ φ. Enjoy!
sigil war on reddit. https://www.reddit.com/r/emacs/comments/4s499h/emacs_lisp_sigil_war/
voice your thoughts there.
my reasons for sigil, is Sigil for Function Parameter Names
emacs lisp sigil war! make your choice!
please vote at
New Xah Emacs Tutorial version out. Buy it.
Buy Xah Emacs Tutorial
New version is being sent out to previous buyers. Thank you. If you changed email, just let me know.
emacs M-x list-non-matching-lines
several people wrote list-non-matching-lines. See https://www.reddit.com/r/emacs/comments/4rif8d/emacs_lisp_listnonmatchinglines/
I'll be going thru them tonight.
stop treating lines as hard-coded-format. Stop using paredit!
eval-defun are really annoying, because they DEPEND on the code to be formatted in a particular way.
if your code is not indented, they behave badly, such as eval wrong part of the code.
try this. Put the following in a file, place cursor in front of the interactive parenthesis, then Alt+x
(defun insert-p-tag () "Insert <p></p> at cursor point." (interactive) (insert "<p></p>") (backward-char 4))
What you get is just the interactive line.
What this means is that, you basically just don't want to use
eval-defun, because the behavior is unpredictable.
Unless, whenever you call that, your code is well-indented by emacs lisp convention.
this is my major bitch with format-dependent treatment of code, which is a idiocy that permeates the whole hackerdom, including, all the paredit, smarparen, style guide, etc conventions and practices.
i've wrote like tens of essays and argued for this for over a decade now, but it's hopeless. People do not get it. The lisper idiots, think you are an idiot or troll. And, now, after 2 decades, new generation comes, all my effort is unheared of.
very sad. am a sad man. and am dying.
if you want to understand the issue, you have to read the following.
- Elisp: Automatic Code Formatting, Auto Indentation
- Programing: the Harm of Hard-wrapping Lines
- A Text Editor Feature: Extend Selection by Semantic Unit
- Programing: Tab vs Space in Source Code
- Emacs: Why I Don't Use paredit
the point is, stop treating code as hard-formatted presentation.
Corollary: stop counting lines of code.
Corollary: your language should never have line-based syntax, or hard-format syntax such as in Haskell.
[see Language Syntax: Brackets vs Begin/End vs Indentation for Nesting]
[see What Does it Mean When a Programing Language Claims “Whitespace is Insignificant”?]
but, i think, the world is slowly getting it. golang has gofmt builtin, which is fantastic. It tears down the entire edifice of “code format convention”. AND, it enforces tabs, not spaces, for indentation! (that's good, because tab is semantic, while using spaces for indentation is hard-coded formatting. [see Programing: Tab vs Space in Source Code] )
of course, as steve job said, the only solution is to wait till the older generation die.
O, by the way, there's a guy in emacs community, also a big contributor in clojure, Bozhidar Batsov, who kept churning out Style Guides. Like, Style Guide for emac lisp, Style Guide for ruby, Style Guide for clojure. Very sad.
Actually, style guide for code formatting should be abolished in theory. In practice, not so fast, because we already are stuck with lots of things that basically dependent on hard-formatted code. (most of this hard-line practice, came from unix, the grand-daddy of hack.) (For another example, you know that magit annoyingly tells you your commit message line is longer than 70 chars? that is the idiocy.) (and, do you know where the 70 char convention came from? it's from punch-cards. And, unix back then, can't handle long lines, so many program silently cut it off. [see Unix, RFC, Line Truncation] (and, by the way, today, we still suffer such consequence in emacs. Try to have a file with very long lines. Emacs will slow down to a crawl. (and, by the by the way, about some 7 years ago, it was some hundred flame wars, to get emacs arrow down key to move by visual line instead of hard-line. Hundreds of flame war posts. The emacs die-hards, huffy-and-puffy. Many olbies blame the idiocy of new generation. Your truly, scarified an arm and a leg in red blood for visual lines. )))
- Rants on Emacs Visual Lines by Don Hopkins and Mark Crispin
- Emacs 23.1 New Features (released 2009-07)
- Emacs: Visual Line Mode, Wrap Lines
But the important key point here is that, we need to understand the concept, of why, it is no good. And most hackers, are blessed with ignorance here, but think they know it all! (yes, the hacker types. Those elite types, mentioning emacs vim all the time types, the style guide types.)
- What is a Tech Geeker?
- Computing Culture: What's Hacker?
- Paul Graham's Infatuation with the Concept of Hacker
Secondly, more controversially, coding style itself, in general, should be ban'd. I do not think there's any scientific evidence that they help. Of course, some common sense and consistency help, but not the way most style guides programer thoughts to be. We are getting into details here. As, you'll start to define exactly, which style guide is good or bad.
The only style guide, is rather, is language gotcha's that effect algorithmic efficiency. Such as Python: Append String in Loop.
see also Programing: Why Idiomatic Programing Are Bad
Programing Language Design: Syntax Sugar Problem: Irregularity vs Convenience
Elisp: Batch Script to Validate Matching Brackets
repost. Example of elisp as script.
Elisp: Parsing Date Time (minor update)
Emacs: Xah CSS Mode
updated. It's not on melpa, you'll need to get it on github.
Emacs: Working with CSS Color Values (now supports hexadecimal color of 3 digits. e.g.
Eric S Raymond and keyboardio