Xah Emacs Blog

Buy Xah Emacs Tutorial. Master emacs benefits for life.

Tips & Tricks for emacs and emacs lisp.

Monroe, Simple Clojure nREPL client for Emacs

if you are a Clojure programer and also a emacs lisp programer, you'd be interested in this.

“Monroe - Clojure nREPL client for Emacs” https://github.com/sanel/monroe

it is a SIMPLE nrepl for clojure in emacs.

here's a short explanation if you have no idea what it is.

nREPL is written in Clojure. 〔➤ Clojure Tutorial: nREPL

Who uses nREPL?

So, nREPL is a essential tool for Clojure.

And, for emacs, CIDER is the other essential tool, because it is thru CIDER (which talks to nREPL) that allows Clojure mode to eval Clojure code, as well as having a Clojure shell inside emacs.

But, here's the thing. CIDER is annoying in that it prints “hacker quotes” messages whever you start it. Also, it is large, some 7k lines. It's more than just a emacs client to nREPL.

Here's what “Monroe - Clojure nREPL client for Emacs” comes in.

i haven't tried it yet.

emacs has “eshell”, which is a shell written in emacs lisp.

I'm now fond of eshell. I tried to use it before, but always have problems. But now, eshell is actually better then shell for many tasks. It's hard to describe exactly. You just have to spend time to try and decide for yourself.

“eshell” keys & commands.

key             binding
---             -------

C-a             eshell-bol
C-c             eshell-command-prefix
TAB             eshell-pcomplete
RET             eshell-send-input
ESC             Prefix Command
<C-down>        eshell-next-input
<C-up>          eshell-previous-input
<M-tab>         eshell-complete-lisp-symbol
<backtab>       pcomplete-reverse
<down>          eshell-next-matching-input-from-input
<tab>           eshell-pcomplete
<up>            eshell-previous-matching-input-from-input

C-c C-a         eshell-bol
C-c C-b         eshell-backward-argument
C-c C-c         eshell-interrupt-process
C-c C-d         eshell-send-eof-to-process
C-c C-e         eshell-show-maximum-output
C-c C-f         eshell-forward-argument
C-c TAB         pcomplete-expand-and-complete
C-c C-k         eshell-kill-process
C-c C-l         eshell-list-history
C-c RET         eshell-copy-old-input
C-c C-n         eshell-next-prompt
C-c C-o         eshell-kill-output
C-c C-p         eshell-previous-prompt
C-c C-r         eshell-show-output
C-c C-s         list-processes
C-c C-t         eshell-truncate-buffer
C-c C-u         eshell-kill-input
C-c C-w         backward-kill-word
C-c C-x         eshell-get-next-from-history
C-c C-y         eshell-repeat-argument
C-c ESC         Prefix Command
C-c C-\         eshell-quit-process
C-c SPC         pcomplete-expand
C-c <return>    eshell-copy-old-input
C-c <space>     pcomplete-expand
C-c <tab>       pcomplete-expand-and-complete

C-M-i           eshell-complete-lisp-symbol
C-M-l           eshell-show-output
M-RET           eshell-queue-input
M-.             eshell-find-tag
M-?             pcomplete-list
M-n             eshell-next-matching-input-from-input
M-p             eshell-previous-matching-input-from-input
M-r             eshell-previous-matching-input
M-s             eshell-next-matching-input

C-c M-b         eshell-insert-buffer-name
C-c M-d         eshell-toggle-direct-send
C-c M-h         eshell-completion-help
C-c M-i         eshell-insert-process
C-c M-m         eshell-display-modifier-help
C-c M-n         eshell-next-input
C-c M-o         eshell-mark-output
C-c M-p         eshell-previous-input
C-c M-q         eshell-display-predicate-help
C-c M-r         eshell-previous-matching-input-from-input
C-c M-s         eshell-next-matching-input-from-input
C-c M-v         eshell-insert-envvar

Emacs Lisp: Open File in External App (minor update code)

Corsair now has a compact version of its mechanical keyboard. See: Keyboard: Corsair K60, K65, K70, K95 Review

Emacs: magit-mode Tutorial (minor update)

Emacs Lisp: Escape Quotes (Updated. Removed lib dependency)

Problems of Calling Unix grep in Emacs (old article)

emacs's isearch advanced features sucks

emacs's isearch advanced features {isearch-forward-symbol-at-point, isearch-forward-symbol, isearch-forward-word} are annoying, to the point of useless.

first problem is that they check boundary. So, searching “xyz” may not find “xyz2”. This seems useful to programers in source code, but is rather useless. Most of the time you want to find all occurances of a string, even if it is part of another string. And, isearch-forward-symbol-at-point is very dangerous, in the sense that it seems to be convenient for searching the word under cursor, but the boundary check fools you.

then, the isearch-forward-word seems useful, as it will treat {_,-, } as same. But, it also checks boundary, and, you cannot find next occurrence as with isearch if it is not below cursor (it doesn't wrap). This too, fools you dangerously. You think some string doesn't occur, but you are WRONG! YOU NO UNSTAND emacs!

O, you can't easily modify them to make them work neither. isearch is a complicated special-case minor mode. It's easier if you just write a function from scratch.

to this date, there's no easy command to search the current string under cursor. You resort to the wilderness of 3rd party stuff.

Emacs: Search & Highlight Words

see also Emacs's Incremental Search (isearch) Problems

for unparalleled emacs efficiency, try ErgoEmacs mode http://ergoemacs.github.io/

for keybinding tinkerers, the ultimate efficiency, try xah fly keys Mode (more efficient than vim)

Emacs Lisp: Convert Unicode Chars to ASCII (Zap Gremlins) (updated code. Now it works on chars such as ā ē ī ō ū)

Secretly Sniff Anything Typed from Microsoft Wireless Keyboard

Emacs Lisp: Automatically Eval Elisp Code When File Opens

Emacs Lisp: Copy File Path of Current Buffer. Updated. Now the command also print the path.

Emacs Lisp: Writing a Toggle Command (new, on its own page)

Emacs: How to Turn Major/Minor Mode on/off? (major update)

the famous LISP expert Paul Graham asked how to type the logic symbol forall on Twitter. 〔https://twitter.com/paulg/status/555062607074586624〕.

this can be easily done. How to Create a APL or Math Symbols Keyboard Layout ⌨ (minor update)

the new Mac book is rumored to have the Power key at the Esc key location. A woe for vim users and emacs users alike.

to fix, see Mac OS X: Keyboard Layout, Keymapping, Keybinding, Software ⌨ (updated)

for Linux and Microsoft Windows, see:

Emacs Command Frequency

my emacs command frequency.

For all major modes:

 216265   24.78%  self-insert-command
  58315    6.68%  next-line
  47313    5.42%  xah-beginning-of-line-or-block
  41892    4.80%  previous-line
  41648    4.77%  xah-end-of-line-or-block
  40317    4.62%  backward-word
  38398    4.40%  forward-word
  23821    2.73%  xfk-command-mode-activate
  22765    2.61%  isearch-printing-char
  22113    2.53%  xah-close-current-buffer
  18698    2.14%  xfk-insert-mode-activate
  18337    2.10%  mwheel-scroll
  14144    1.62%  yank
  14032    1.61%  newline
  12238    1.40%  delete-backward-char
  10953    1.25%  xah-backward-left-bracket
   9751    1.12%  handle-switch-frame
   9411    1.08%  save-buffer
   8389    0.96%  backward-kill-word
   8187    0.94%  backward-char
   8186    0.94%  isearch-repeat-forward
   7409    0.85%  xah-forward-right-bracket
   6399    0.73%  xah-shrink-whitespaces
   6309    0.72%  xah-cut-line-or-region
   6040    0.69%  kill-word
   5807    0.67%  xah-copy-line-or-region
   5591    0.64%  forward-char
   5490    0.63%  isearch-forward
   4389    0.50%  other-window
   3945    0.45%  open-line
   3910    0.45%  dired-previous-line
   3857    0.44%  undo-tree-undo
   3532    0.40%  isearch-exit
   3413    0.39%  dired-find-file
   3378    0.39%  dired-next-line
   3359    0.38%  delete-other-windows
   3275    0.38%  set-mark-command
   3274    0.38%  xah-open-file-fast
   3213    0.37%  minibuffer-keyboard-quit
   3119    0.36%  scroll-up-command
   3042    0.35%  delete-char
   2986    0.34%  xah-select-current-line
   2644    0.30%  xah-extend-selection
   2642    0.30%  xhm-wrap-html-tag
   2496    0.29%  left-char
   2422    0.28%  xah-select-text-in-bracket-or-quote
   2159    0.25%  kill-line
   2156    0.25%  xah-open-file-path-under-cursor
   2153    0.25%  scroll-down-command
   2105    0.24%  org-self-insert-command
   2081    0.24%  xhm-wrap-p-tag
   1988    0.23%  split-window-vertically
   1943    0.22%  xah-toggle-letter-case
   1845    0.21%  beginning-of-buffer
   1819    0.21%  xah-select-current-block
   1722    0.20%  exit-minibuffer
   1650    0.19%  keyboard-quit
   1645    0.19%  xah-compact-uncompact-block
   1589    0.18%  dired-jump
   1515    0.17%  right-char
   1514    0.17%  previous-history-element
   1509    0.17%  xah-next-user-buffer
   1440    0.16%  xah-clean-whitespace
   1430    0.16%  xah-all-linkify
   1427    0.16%  xah-browse-url-of-buffer
   1225    0.14%  xah-previous-user-buffer
   1197    0.14%  xah-forward-punct
   1054    0.12%  query-replace
   1022    0.12%  xah-copy-file-path
   1013    0.12%  ido-exit-minibuffer
    953    0.11%  isearch-repeat-backward
    908    0.10%  comment-dwim
    895    0.10%  xah-insert-paren
    875    0.10%  revert-buffer
    836    0.10%  xah-new-empty-buffer
    826    0.09%  xah-insert-corner-bracket「」
    815    0.09%  smex
    805    0.09%  markdown-enter-key
    793    0.09%  xah-insert-space-after
    778    0.09%  xah-shell-commands
    703    0.08%  isearch-forward-symbol-at-point
    682    0.08%  xah-brackets-to-html
    664    0.08%  eshell
    641    0.07%  describe-key
    619    0.07%  delete-window
    603    0.07%  eshell-send-input
    598    0.07%  describe-function
    520    0.06%  xah-find-text
    506    0.06%  dired-up-directory
    504    0.06%  ido-delete-backward-updir
    498    0.06%  xah-delete-current-file
    495    0.06%  xah-run-current-file
    489    0.06%  xah-insert-double-curly-quote“”
    472    0.05%  recentf-open-files
    460    0.05%  xah-cite
    451    0.05%  magit-toggle-section
    443    0.05%  xhm-toggle-syntax-coloring-markup
    443    0.05%  recenter-top-bottom

see Emacs's Command Frequency Statistics

Emacs Lisp: Decode URI Percent Encoding (major update)

see also: Emacs: Xah HTML Mode

Emacs: How to List & Set Font (updated)

Emacs Lisp: Switching Next/Previous User Buffers. Updated code. Now, has a feature to ignore dired buffers.

emacs & vi: Science of Command Efficiency (minor update)

Clojure Instaparse Parser Tutorial (draft version. Read in peril & pain)

Intro to Chinese Punctuation

Emacs Lisp Function Frequency (updated with popup doc)

discovered a new keyboard mechanical key switch, the Cherry ML switch. The interesting thing is that it's not a full depth key, but somewhat like laptop key, but taller. Yet, mechinacl switch. See: Cherry G84 4100 Keyboard

see also Best Keyboard for Emacs

Get yourself one for the holidays. Logitech Gaming Keyboards Review (minor update)

Emacs Gnus Bug: Broken Atom Webfeed Relative Link

Clojure lisp binding forms: syntax sugar on drugs. Clojure Tutorial: Parallel Assignment, Destructure Binding

Emacs Should Adopt HTML as Texinfo Replacement

old article. The issue resurfaced recently by esr.

On being web-friendly and why info must die By Eric S Raymond. @ https://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00347.html

GNU and the Open Source have like a 5 to 10 years lag in adopting technology, for reasons that are inadvertently intentional and or simply incapable.

The Moronicities of Typography: Hyphen, Dash, Quotation Marks, Apostrophe

Lisp, Clojure, Mathematica

every developer should buy a copy of Mathematica, because it will expand their mind. —Rich Hickey (Clojure inventor)

Here's some intro Wolfram Language, Mathematica

emacs bookmark autosave

(setq bookmark-save-flag 1) ; everytime bookmark is changed, automatically save it

In emacs 24.4, by default, bookmark is automatically saved when emacs quits. This change is not documented. You can change the default behavior, see updated: Emacs: Using Bookmark Feature

See also: New Features in Emacs 24.4 (updated)

The Operative Efficiency of Emacs's Deleting Text to kill-ring (old article)

on reddit, “computer keyboard design flaws”: http://www.reddit.com/r/MechanicalKeyboards/comments/2mz5ex/xah_lee_on_computer_keyboard_design_flaws/

How to find the current font used?

Call describe-char

see updated at Emacs: How to List & Set Font

see also: Emacs: Unicode Tutorial

ergoemacs thanks Drake Sobania 2014-11-20

made our day.

happy hacking keyboard pro japan 3143
Happy Hacking Keyboard Pro JP, with customized keycaps. (photo by Rick Cogley @ https://plus.google.com/+RickCogley/posts/ZeLsRgiypjG. used with permission)

see The Idiocy of Happy Hacking Keyboard

does Rich Hickey uses emacs? am unhappy with current #clojure mode, and its not written by him.

gnus gnu emacs mug 2014-11-19
“In a cloud, bones of steel.” (photo by Luis Fernandes. https://plus.google.com/112932121740612610785/posts/iG2dJK9su6W)

history of GNU Emacs Logo

Emacs: Searching for Text in Files (grep, find) (added screenshots)

show/edit zip file content in emacs

there's a patch for opening zip files in emacs. When opening a zip archive of a single file, emacs now can display its content (and you can edit it)

See: 《bug#1702: [PATCH]: feature request: correctly display single file zip archive》 at

It's going to be in emacs 25.x. Thanks to Matthew Leach for the patch.

Emacs Lisp: Multi-Pair String Replacement with Report (updated. Removed lib dependency.)

logitech g502 mouse 2
Logitech G502 Proteus mouse

latest and greatest. Logitech G502 Proteus Gaming Mouse.

All programers should use a gaming mouse. See Why You Need 9 Buttons Mouse?, and Logitech Mouse with Spin Wheel.

some powerful coders in emacs community who also contributed to clojure.

Phil Hagelberg. http://technomancy.us/https://twitter.com/technomancyhttps://github.com/technomancy

Steve Purcell http://www.sanityinc.com/https://twitter.com/sanityinchttps://github.com/purcell

Bozhidar Batsov http://batsov.com/https://twitter.com/bbatsovhttps://github.com/bbatsov

John Wiegley (haskell) http://newartisans.com/https://twitter.com/jwiegleyhttps://github.com/jwiegley

to this list i must also add:

Christopher Wellons http://nullprogram.com/https://github.com/skeeto

but am not sure if Christopher does Clojure or Haskell.

this is just a list of people that comes to my mind at the moment. There are a lot great coders.

note also, these people are open source contributors, and they also blog. So, they are well-known. There are also lot great coders who code prorietary software and don't talk much. That is rather the norm. (e.g. many startups are like that) Only small percent of coders actually write blog.

comment at https://plus.google.com/113859563190964307534/posts/CM35uJdDH9u

Clojure is the king of lisp.

new: Emacs: Run Interactive Clojure Shell/REPL in Emacs: cider

This is useful for refactoring. Emacs Lisp: Refactoring, Move Code to Files (updated. major rewrite)

steam punk sojourner keyboard
Steam Punk Sojourner Keyboard, cherry mx mechinacl key switch

all you need to do now is swap the CtrlCaps Lock.

Emacs Lisp: Command to Change Earth-Coordinate to Google Map Link

20 min job, and i have: Emacs: Xah Clojure Mode. it's basically a copy of Emacs: Xah Emacs Lisp Mode with language keywords swapped in. Not yet good for public use, but i use it now. I'll hack it as i go. I just started with Clojure.

by the way, clojure is a superbly beautiful language, and used by industry, unlike some other lisps that live in fairy tales or tail recursion in a desert.

subscribe Xah's Programing Blog for my clojure travelogue.

accidentally M-x ethio-modify-vowel, thx to ido.

comment at https://plus.google.com/113859563190964307534/posts/bKC3R3b4Lm2

emacs & vi: Science of Command Efficiency

emacs bookmark, when using bookmark-jumpCtrl+x r b】 you can use * for wildcard. ⁖ *today will match todo today. Updated: Emacs: Using Bookmark Feature

Richard Stallman in MIT AI Lab: High-tech Prankster (repost. Added info.)

Like it? or share

Past Articles by Date