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 20160731085413 f9045-s319x196
Emacs Pikachu Alert

Emacs: Clean Empty Lines 🚀 (code minor update)

Xah Lee on Mickey Petersen's Mastering Emacs

Mickey Petersen Mastering Emacs cover
Mickey Petersen Mastering Emacs book. https://www.masteringemacs.org/book

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.

Emacs: HTML, 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.

second, there's technical issues. It'll be time consuming to detail it, but basically, you don't want url to change, and yet, articles are in different directories, but the content isn't nicely group by directories (because they are written in 10 years, and many articles, really can't be categorized into A or B or C…, and also, to create a system of categories is a non-trivial classification problem by itself, think of Dewey Decimal system), and am using relative links because i want my whole site to be 100% usable offline and fast, and without requiring JavaScript. (each page's side panel source code need to be exactly the same) In short, it's not all that easy to do.

Daniel Weinreb Rebuttal to Richard Stallman's Story of LISP History (2007)

xah-select-block, repeat extend downward

Emacs Select Word Command Problem

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 gnu apl mode xmas tree 2016-07-22
GNU APL mode lights up like xmas tree

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 Replace (xah-find.el)

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.

see:

how to remove file name association with a major mode?

like this:

(setq auto-mode-alist (rassq-delete-all 'js-mode auto-mode-alist))

Emacs Init: Set Default Major Mode

Someone asked on stackoverflow. (currently is down) Answer added to the above.

Emacs: Delete Current File 🚀 (code update)

Emacs: HTML, Extract URL 🚀 (updated code)

Emacs: Xah Dired Mode (xah-dired.el) (minor update)

All sigil has been syntematically replaced

there are 55 files.

1015 ξ and 298 φ

the file with the most sigil ξxi is Emacs Lisp: 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

Emacs Lisp: String Match in List (on its own page, originally from a 2014 post.)

Emacs: Copy Rectangle Region to kill-ring 🚀 (fixed broken code.)

updated code. removed φgreek ξ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.)

removed article links 2016-07-14
removed links
xah emacs packages melpa 2016-07-14
Xah Emacs Packages

Emacs: HTML Image Path to Img Tag (removed greek ξsigil)

Emacs: What is Major Mode (For beginner. New page out of old writings.)

Emacs: Move Cursor to Beginning of Line or 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 fill-paragraph Problem (code entirely rewritten and renamed.)

  • Emacs: Reformat to Long Lines (unfill-paragraph) 🚀
  • (minor rewrite)

    Emacs Lisp: 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 (2016) (updated. refresh page.)

    Thanks for voting!

    The Sigils WAR, Language Design and Coding Convention (2016)

    Emacs: Xah CSS Mode (xah-css-mode.el)

    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 Variable Names

    emacs lisp sigil war! make your choice!

    emacs lisp sigil war 03115
    emacs lisp sigil war! which do you prefer?

    please vote at

    https://plus.google.com/113859563190964307534/posts/YskMtvB7rkn

    or

    [ https://twitter.com/ErgoEmacs/status/752008581411540992 accessed: 2016-07-09]

    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!

    emacs's narrow-to-defun and 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 narrow-to-defun.

    (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.

    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. )))

    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.)

    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

    Emacs Lisp: Batch Script to Validate Matching Brackets

    repost. Example of elisp as script.

    Emacs Lisp: Parse Date Time (minor update)

    Emacs: Xah CSS Mode (xah-css-mode.el)

    updated. It's not on melpa, you'll need to get it on github.

    Emacs: List Colors, Name, Hexadecimal (now supports hexadecimal color of 3 digits. e.g. #abc)

    Eric S Raymond keyboardio 2015-06-18-s
    Eric S Raymond and keyboardio