Matthias Pfeifer: Building a tree-view for xml data

Even though I am a long time Emacs user I only recently realized that I am really missing treeviews. There a numerous applications like getting an overview of a directory hierarchy  or structure of documents in xml format. It’s a nice thing to have and of course Emacs does not stand back and has something … Building a tree-view for xml data weiterlesen
-1:-- Building a tree-view for xml data (Post Matthias)--L0--C0--February 21, 2017 11:17 AM

sachachua: 2017-02-20 Emacs news

Links from, /r/orgmode, /r/spacemacs, Hacker News,, Youtube, the changes to the Emacs NEWS file, and emacs-devel.

Past Emacs News round-ups

-1:-- 2017-02-20 Emacs news (Post Sacha Chua)--L0--C0--February 21, 2017 03:11 AM

Irreal: Another Emacs/GCal Solution

Last month, I had three (1, 2, 3) posts on how people are integrating their Google Calendars with Emacs. The common idea was to be able to see some or all of the calendar items in Emacs. Mike Zmansky’s solution goes further and allows you to move data in both directions so that you can add data to your Google Calendar from Emacs.

James Williams has his own take on the problem. Like Zamansky, he uses org-gcal to move entries between Emacs and GCal. He also uses emacs-calfw to get a nice calendar-like display.

Even if you’re not a GCal user, you may be interested in emacs-calfw. It can be configured for use with Org, Emacs diary, iCalendar (GCal, iCal, etc.), and howm.

These four solutions for integrating GCal show again how easily you can adapt Emacs to your workflow. And, of course, how you can spend most of your time in Emacs.

-1:-- Another Emacs/GCal Solution (Post jcs)--L0--C0--February 20, 2017 06:36 PM

Irreal: Migrating Notes from Evernote to Org

I use Evernote to keep copies of resources that I think may disappear over time and I’m pretty happy with it. Recently, they’ve introduced a new fee structure and there’s been some grumbling about finding another platform. As I say, I’m happy with them for now but if you’re looking for a way to migrate off Evernote and you’re an Org mode user, Karl Voit tells us one way to do it

Everorg was written by Mario Martelli to migrate his Evernote data to Org mode because of the new pricing policy. It appears to be pretty complete<img src=—" class="wp-smiley" style="height: 1em; max-height: 1em;" />see the README<img src=—" class="wp-smiley" style="height: 1em; max-height: 1em;" />but if you have special needs you may have to do part of the migration by hand.

Again, I’m happy with Evernote for the time being so I haven’t used EverOrg but if you’re looking for a migration solution EverOrg is the best I’ve seen.

-1:-- Migrating Notes from Evernote to Org (Post jcs)--L0--C0--February 19, 2017 04:41 PM

Marcin Borkowski: Using isearch-string on exit from isearch

Recently, I wanted my function, which asks the user for some string, use the isearch term as the default. That’s easy – the variable isearch-string holds the term searched (note that it may be a plain string or a regex!). The problem was, I wanted that to be the default only when I invoked my command from isearch (sort of what M-% does when called from within isearch). The way M-% does its magic when invoked during isearch is simple: in isearch-mode-map, that key is bound to isearch-query-replace and not the usual query-replace. I didn’t want anything like that, though: I wanted my command to be callable via M-x.
-1:-- Using isearch-string on exit from isearch (Post)--L0--C0--February 18, 2017 04:05 PM

Got Emacs?: Emacs 25.2 RC1 out

The first release candidate for what will be the 25.2 release of Emacs is out. 
-1:-- Emacs 25.2 RC1 out (Post sivaram ( 17, 2017 10:55 AM

My Acid Words: Displaying org-mode appointments in calendar

One neat feature of org-mode agenda is ability to display appointments in Emacs calendar. Sadly, this isn't obvious nor enabled by default - I discovered it accidentally by browsing through Emacs themes screenshots.

In screenshot below, you can see highlighted days with planned meetings and scheduled work in my calendar.


Setup is very easy. First, set calendar-mark-diary-entries-flag with:

(setq calendar-mark-diary-entries-flag t)

Then create $HOME/diary file, if not present, and add this line:


Now in Emacs, open agenda view with (org-agenda) and open calendar with c; you will get highlighted all important dates. Alternatively, calling

M-x calendar

will essentially do the same (open calendar) with fewer strokes.

Reverse action will also work - to see what is scheduled for particular highlighted day, just point cursor to that day and hit key c - Emacs will open org-mode agenda view and place cursor under correct entry.

Using with appointments (appt)

In case you use org-mode with appointments to get visual reminders, be aware that calling (appt-activate 1) will run diary and making this call in your Emacs configuration will display diary window at Emacs startup, which I didn't like. To circumvent this behavior, appt-display-diary variable should be used.

In short, my appointments setup looks like this:

(add-hook 'org-finalize-agenda-hook
  (lambda ()
    (setq appt-message-warning-time 10        ;; warn 10 min in advance
          appt-display-diary nil              ;; do not display diary when (appt-activate) is called
          appt-display-mode-line t            ;; show in the modeline
          appt-display-format 'window         ;; display notification in window
          calendar-mark-diary-entries-flag t) ;; mark diary entries in calendar
    (org-agenda-to-appt)                      ;; copy all agenda schedule to appointments
    (appt-activate 1)))                       ;; active appt (appointment notification)
-1:-- Displaying org-mode appointments in calendar (Post)--L0--C0--February 15, 2017 11:00 PM

Grant Rettke: Asynchronous src_block Execution For Org-Babel

Via here:

ob-async enables asynchronous execution of org-babel src blocks

It works for any language.

-1:-- Asynchronous src_block Execution For Org-Babel (Post Grant)--L0--C0--February 15, 2017 06:53 PM

sachachua: 2017-02-13 Emacs News

Links from, /r/orgmode, /r/spacemacs, Hacker News,, Youtube, the changes to the Emacs NEWS file, and emacs-devel.

Past Emacs News round-ups

-1:-- 2017-02-13 Emacs News (Post Sacha Chua)--L0--C0--February 15, 2017 07:21 AM

Chris Wellons: Asynchronous Requests from Emacs Dynamic Modules

A few months ago I had a discussion with Vladimir Kazanov about his Orgfuse project: a Python script that exposes an Emacs Org-mode document as a FUSE filesystem. It permits other programs to navigate the structure of an Org-mode document through the standard filesystem APIs. I suggested that, with the new dynamic modules in Emacs 25, Emacs itself could serve a FUSE filesystem. In fact, support for FUSE services in general could be an package of his own.

So that’s what he did: Elfuse. It’s an old joke that Emacs is an operating system, and here it is handling system calls.

However, there’s a tricky problem to solve, an issue also present my joystick module. Both modules handle asynchronous events — filesystem requests or joystick events — but Emacs runs the event loop and owns the main thread. The external events somehow need to feed into the main event loop. It’s even more difficult with FUSE because FUSE also wants control of its own thread for its own event loop. This requires Elfuse to spawn a dedicated FUSE thread and negotiate a request/response hand-off.

When a filesystem request or joystick event arrives, how does Emacs know to handle it? The simple and obvious solution is to poll the module from a timer.

struct queue requests;

Frequest_next(emacs_env *env, ptrdiff_t n, emacs_value *args, void *p)
    emacs_value next = Qnil;
    if (queue_length(requests) > 0) {
        void *request = queue_pop(requests, env);
        next = env->make_user_ptr(env, fin_empty, request);
    return next;

And then ask Emacs to check the module every, say, 10ms:

(defun request--poll ()
  (let ((next (request-next)))
    (when next
      (request-handle next))))

(run-at-time 0 0.01 #'request--poll)

Blocking directly on the module’s event pump with Emacs’ thread would prevent Emacs from doing important things like, you know, being a text editor. The timer allows it to handle its own events uninterrupted. It gets the job done, but it’s far from perfect:

  1. It imposes an arbitrary latency to handling requests. Up to the poll period could pass before a request is handled.

  2. Polling the module 100 times per second is inefficient. Unless you really enjoy recharging your laptop, that’s no good.

The poll period is a sliding trade-off between latency and battery life. If only there was some mechanism to, ahem, signal the Emacs thread, informing it that a request is waiting…


Emacs Lisp programs can handle the POSIX SIGUSR1 and SIGUSR2 signals, which is exactly the mechanism we need. The interface is a “key” binding on special-event-map, the keymap that handles these kinds of events. When the signal arrives, Emacs queues it up for the main event loop.

(define-key special-event-map [sigusr1]
  (lambda ()
    (request-handle (request-next))))

The module blocks on its own thread on its own event pump. When a request arrives, it queues the request, rings the bell for Emacs to come handle it (raise()), and waits on a semaphore. For illustration purposes, assume the module reads requests from and writes responses to a file descriptor, like a socket.

int event_fd = /* ... */;
struct request request;
sem_init(&request.sem, 0, 0);

for (;;) {
    /* Blocking read for request event */
    read(event_fd, &request.event, sizeof(request.event));

    /* Put request on the queue */
    queue_push(requests, &request);
    raise(SIGUSR1);  // TODO: Should raise() go inside the lock?

    /* Wait for Emacs */
    while (sem_wait(&request.sem))

    /* Reply with Emacs' response */
    write(event_fd, &request.response, sizeof(request.response));

The sem_wait() is in a loop because signals will wake it up prematurely. In fact, it may even wake up due to its own signal on the line before. This is the only way this particular use of sem_wait() might fail, so there’s no need to check errno.

If there are multiple module threads making requests to the same global queue, the lock is necessary to protect the queue. The semaphore is only for blocking the thread until Emacs has finished writing its particular response. Each thread has its own semaphore.

When Emacs is done writing the response, it releases the module thread by incrementing the semaphore. It might look something like this:

Frequest_complete(emacs_env *env, ptrdiff_t n, emacs_value *args, void *p)
    struct request *request = env->get_user_ptr(env, args[0]);
    if (request)
    return Qnil;

The top-level handler dispatches to the specific request handler, calling request-complete above when it’s done.

(defun request-handle (next)
  (condition-case e
      (cl-ecase (request-type next)
        (:open  (request-handle-open  next))
        (:close (request-handle-close next))
        (:read  (request-handle-read  next)))
    (error (request-respond-as-error next e)))

This SIGUSR1+semaphore mechanism is roughly how Elfuse currently processes requests.


Windows doesn’t have signals. This isn’t a problem for Elfuse since Windows doesn’t have FUSE either. Nor does it matter for Joymacs since XInput isn’t event-driven and always requires polling. But someday someone will need this mechanism for a dynamic module on Windows.

Fortunately there’s a solution: input language change events, WM_INPUTLANGCHANGE. It’s also on special-event-map:

(define-key special-event-map [language-change]
  (lambda ()
    (request-process (request-next))))

Instead of raise() (or pthread_kill()), broadcast the window event with PostMessage(). Outside of invoking the language-change key binding, Emacs will ignore the event because WPARAM is 0 — it doesn’t belong to any particular window. We don’t really want to change the input language, after all.


Naturally you’ll also need to replace the POSIX threading primitives with the Windows versions (CreateThread(), CreateSemaphore(), etc.). With a bit of abstraction in the right places, it should be pretty easy to support both POSIX and Windows in these asynchronous dynamic module events.

-1:-- Asynchronous Requests from Emacs Dynamic Modules (Post)--L0--C0--February 14, 2017 02:30 AM

Marcin Borkowski: Sorting Org entries by most recent activity

As I mentioned a lot of times, I use Org-mode – and in particular, clocking – very heavily. Sometimes I have this Org entry with a lot of (clocked) subentries, and I’d like to see which ones of them I haven’t touched in a long time – and which ones I’ve been working recently. I wanted to ask on the Org mailing list whether it was possible, but – taught by experience – I decided to check in the manual first.
-1:-- Sorting Org entries by most recent activity (Post)--L0--C0--February 13, 2017 11:33 AM

Pragmatic Emacs: Batch-edit file permissions in dired

I’ve written before about using the editing features in dired (AKA wdired) to do neat things like redirect symlinks. I recently discovered that by adding the following option to your emacs config file:

;; allow editing file permissions
(setq wdired-allow-to-change-permissions t)

then you can also edit the file permissions directly in the dired buffer.

Here’s a quick animated example where I want to set group write permissions for all the pdf files in a particular directory. I use several tools to make this really easy:

  1. I used dired-narrow to filter the view down to just the pdf files
  2. I use C-x C-q to make the dired buffer editable
  3. I move to the group write permission spot on the first line and then use multiple cursors to add a cursor for each line
  4. I hit w to set the write permission, RET to quit multiple cursors, and C-c C-c to make the change permanent


-1:-- Batch-edit file permissions in dired (Post Ben Maughan)--L0--C0--February 13, 2017 12:24 AM

Phil Hagelberg: in which four pieces are placed in a row

The other day my son and I were at a friend's house, and we were just on our way home. As we were leaving he saw they had the game Connect 4 and asked if we could play. Since we were on our way I told him, "We can't play the game now, but when we get home, we can program the game, and then play that." I wasn't sure exactly how this would work out, but I thought we'd have some fun on the way.

This isn't the first time I've adapted a physical game to a program with my kids. But since then I've done most of my games using LÖVE, the 2D Lua game framework along with Polywell, a text editor and development tool that runs in it. Polywell is roughly a port of Emacs, and I've found that the foundation it provides of buffers, modes, and keymaps is useful for all kinds of games. As a bonus, you can use the text editing features of Polywell to code the game from within the game itself, which makes experimentation and reloading seamless.

My son and I sat down and knocked out an implementation of Connect 4 pretty quickly using Polywell, and I thought it would be interesting to step through how it works since it can serve as a very succinct explanation for how to use Polywell.

local e = require("polywell")

local board = { {}, {}, {}, {}, {}, {}, {} }
local colors = {red={255,50,50},yellow={255,238,0}}
local turn = "yellow"

We start out by loading "polywell" and putting it in the e local (e for editor). Most of the game state is in the board table[1], which has an empty table for each column in it. The Connect 4 board has seven columns in which pieces can be dropped. It's a bit unusual, but we represent columns as lists of pieces from the bottom up, because the tokens are subject to gravity and fall to the bottom of the column they're placed in. Finally we set up colors which maps each player's color name to an RGB triplet and store the final bit of state (the current turn) in the turn local. So far so good!

local draw = function()
   for col=1,7 do
      for n,color in ipairs(board[col]) do
         local x,y = col * 75, 800 - n*75[color])"fill", x, y, 30)

Our draw function is very natural once you understand the unusual structure of the board; we simply loop over each column with an inner loop over each piece in the column. The piece is represented by n, its numeric position within the list of pieces, and its color. We calculate x and y from the col and n respectively and draw a colored circle for each piece from the bottom of the column upwards. This is basically the only place we use the LÖVE framework directly.

e.define_mode("connect4", nil, {draw=draw, read_only=true})

Using Polywell's define_mode function we create a "connect4" mode which will contain all the key bindings for the game. Modes in Polywell are assumed to be textual unless otherwise specified, but since our game is graphical we pass nil as the second argument because our mode does not inherit from any existing mode. For our third argument, we pass in our previously-defined draw function as the mode's draw property, overriding the default draw which simply displays the current mode's text. We also mark it as read_only to avoid accidentally inserting any text into the buffer.

e.bind("connect4", "escape", function() e.change_buffer("*console*") end)
e.bind("connect4", "backspace", function()
          for i=1,7 do lume.clear(board[i]) end

Polywell's bind function allows us to attach a function to be called when a specific keystroke is pressed in a specific mode. In this case we say that escape will switch back to the Lua console while backspace will just clear each column in the board.

for key=1,7 do
   e.bind("connect4", tostring(key), function()
             local column = board[key]
             if(#column >= 6) then return end
             table.insert(column, turn)
             turn = turn == "red" and "yellow" or "red"

Almost done! Here's where the meat of the game is. We loop from 1 to 7, which is the number of columns in the game. For each column, we bind that number key to a function which grabs the corresponding column table from the board. It checks to make sure the column isn't full (each one can only hold 6 pieces) and if not it inserts the color of the current player into the column with table.insert. Then it changes the turn to the next player., "*connect4*", "connect4")

Finally it uses the open function to create a new buffer named "*connect4*" with "connect4" mode active. The first argument is nil because this buffer is not attached to the filesystem; it's a free-floating thing that doesn't get loaded or saved. You could leave this line out and Polywell would simply boot to a Lua console where you could invoke connect4 mode manually from there.

And that's it! 27 lines is all it took, and me and my son were off to the races playing the game. While we were writing it I kept him involved by asking each step of the way what we should do next. Once I wrote the draw function we were able to test it out by editing the board table directly using Lua code in the console. Our first pass of the number key function simply called table.insert, so once we tried it out he was able to point out which features were still missing, and I could ask leading questions which helped him piece together roughly what was needed to address those things.

Of course there's a lot more that Polywell can do, but it doesn't take much code to get a simple game going. Try it for yourself; you might have a lot of fun.

[1] Lua tables can be a bit confusing since they're a single data structure that can act both sequentially (as with board here which is basically used as a vector/array) or associatively (as with colors which acts like a map). The thing to remember is that the sequential/associative property is not inherent in the table but rather part of how it's used.

-1:-- in which four pieces are placed in a row (Post Phil Hagelberg)--L0--C0--February 12, 2017 11:15 PM

emacspeak: Audio Deja Vu: Audio Formatted Math On The Emacspeak Desktop

Audio Deja Vu: Audio Formatted Math On The Emacspeak Desktop

1 Overview

This article previews a new feature in the next Emacspeak release —
audio-formatted Mathematics using Aural CSS. Volker Sorge worked
at Google as a Visiting Scientist from Sep 2012 to August 2013, when
we implemented math
access in ChromeVox
— see this brief overview. Since leaving
Google, Volker has refactored and extended his work to create an Open
Source Speech-Rule-Engine implemented using NodeJS. This
speech-rule-engine can be used in many different environments;
Emacspeak leverages that work to enable audio-formatting and
interactive browsing of math content.

2 Overview Of Functionality

Math access on the Emacspeak desktop is implemented via module
emacspeak-maths.el — see js/node/ in the Emacspeak GitHub
repository for setup instructions.

Once loaded, module emacspeak-maths provides a Math Navigator that
implements the user interface for sending Math expressions to the
Speech-Rule-Engine, and for interactively browsing the resulting
structure. At each step of the interaction, Emacspeak receives math
expressions that have been annotated with Aural CSS and produces
audio-formatted output. The audio-formatted text can itself be
navigated in a special Spoken Math emacs buffer.

Module emacspeak-maths.el implements various affordances for
dispatching mathematical content to the Speech-Rule-Engine — see
usage examples in the next section.

3 Usage Examples

3.1 The Emacspeak Maths Navigator

  • The maths navigator can be invoked by pressing S-SPC (hold
    down Windows key and press SPC) — this runs the command emacspeak-maths-navigator/body.
  • Once invoked, the /Maths Navigator can be used to enter an
    expression to read.
  • Pressing SPC again prompts for the LaTeX math expression.
  • Pressing RET guesses the expression to read from the current context.
  • The arrow keys navigate the expression being read.
  • Pressing o switches to the Spoken Math buffer and exits the

See the relevant chapter in the online Emacspeak manual for details.

3.2 Math Content In LaTeX Documents

  1. Open a LaTeX document containing math content.
  2. Move point to a line containing mathematical markup.
  3. Press S-SPC RET to have that expression audio-formatted.
  4. Use arrow keys to navigate the resulting structure.
  5. Press any other key to exit the navigator.

3.3 Math Content On Wikipedia

  1. Open a Wikipedia page in the Emacs Web Wowser (EWW) that has
    mathematical content.
  2. Wikipedia displays math as images, with the alt-text giving the
    LaTeX representation.
  3. Navigate to some math content on the page, then press S-SPC
    a to speak that content — a is for alt.
  4. As an example, navigate to Wikipedia Math Example, locate math expressions on that page, then
    press S-SPC a.

3.4 Math Content From The Emacs Calculator

  1. The built-in Emacs Calculator (calc) provides many complex
    math functions including symbolic algebra.
  2. For my personal calc setup, see tvr/calc-prepare.el in the
    Emacspeak GitHub repo.
  3. This setting below sets up the Emacs Calculator to output results
    as LaTeX: (setq calc-language 'tex)
  4. With the above setting in effect, launch the emacs Calculator by
    pressing M-##.
  5. Press ' — to use algebraic mode — and enter sin(x).
  6. Press a t to get the Taylor series expansion of the above
    expression, and press x when prompted for the variable.
  7. This displays the Taylor Series expansion up to the desired
    number of terms — try 7 terms.
  8. Now, with Calc having shown the results as TeX, press S-SPC
    RET to browse this expression using the Maths Navigator.

4 And The Best Is Yet To Come

This is intentionally called an early preview because there is still
much that can be improved:

  1. Enhance the rule engine to infer and convey more semantics.
  2. Improved audio formatting rules to better present the available information.
  3. Update/tune the use of Aural CSS properties to best leverage
    today's TTS engines.
  4. Integrate math-reading functionality into more usage contexts in
    addition to the ones enumerated in this article.

5 References

  1. Youtube Video from early 2013 demonstrating Math Access in Chrome
  2. AllThings Digital outlining math access — published June 2013.
  3. Assets 2016 publication describing this work.
  4. js/node/aster-math-examples.tex Collection of math examples in
    LaTeX from AsTeR. Used to progressively improve speech-rules and
    the resulting audio-formatted output
  5. Speech-Rule-Engine on github.
  6. Speech-Rule-Engine in action: Accessible Maths in all browsers

Date: 2017-02-08 Wed 00:00

Author: T.V Raman

-1:-- Audio Deja Vu: Audio Formatted Math On The Emacspeak Desktop (Post T. V. Raman ( 10, 2017 07:22 PM

Alex Bennée: checkpatch-mode

A couple of weeks ago I mused that I should really collect together the various hacks to integrate checkpatch into my workflow into a consistent mode. Having a quick look around I couldn’t find any other implementations and went to create the said mode. It turns out I’d created the directory and done the initial commit 3 years ago. Anyway I polished it up a bit and you can now get it here. I hope it’s useful to the wider community and as ever patches welcome 😉

Flattr this!

-1:-- checkpatch-mode (Post Alex)--L0--C0--February 09, 2017 03:30 PM

emacshorrors: Strange Code

(defface w3m-history-current-url
  ;; The following strange code compounds the attributes of the
  ;; `secondary-selection' face and the `w3m-arrived-anchor' face,
  ;; and generates the new attributes for this face.
  (let ((base 'secondary-selection)
        (fn (if (featurep 'xemacs)
              'custom-face-attributes-get));; What a perverseness it is.
        ;; Both `face-custom-attributes-get' in XEmacs and
        ;; `custom-face-attributes-get' in CUSTOM 1.9962 attempt to
        ;; require `font' in Emacs/w3 and `cl' arbitrarily. :-/
        (features (cons 'font features))
        base-attributes attributes attribute)
    (setq base-attributes (funcall fn base nil)
          attributes (funcall fn 'w3m-arrived-anchor nil))
    (while base-attributes
      (setq attribute (car base-attributes))
      (unless (memq attribute '(:foreground :underline))
        (setq attributes (plist-put attributes attribute
                                    (cadr base-attributes))))
      (setq base-attributes (cddr base-attributes)))
    (list (list t attributes)))
  "Face used to highlight the current url in the \"about://history/\" page."
  :group 'w3m-face)

These days one would simply use :inherit for both w3m-arrived-anchor and secondary-selection.

-1:-- Strange Code (Post Vasilij Schneidermann)--L0--C0--February 08, 2017 12:01 AM

Bryan Murdock: SystemVerilog and Python

Design patterns in programming are when engineers find themselves writing the same code over and over to solve the same problems. Design patterns for statically typed object oriented languages (C++ and Java) were cataloged and enshrined in the famous book, "Design Patterns: Elements of Reusable Object-Oriented Software" by Erich Gamma, John Vlissides, Ralph Johnson, and Richard Helm. The authors are lovingly called, The Gang of Four, or the GOF and the book is often referred to as the GOF book.

The subset of SystemVerilog used in writing testbenches is a statically typed object oriented language (it's most similar to Java). As people started using SystemVerilog to write testbenches, frameworks for writing testbenches quickly became popular. These frameworks all provide code that implements design patterns from the GOF book. The various frameworks were similar because they were all essentially implementing the same design patterns. Eventually the various frameworks all coalesced into one, the humbly named, Universal Verification Methodology, or UVM.

Below is a table that matches up GOF design patterns with their UVM implementation. This was adapted from this presentation:

GOF Pattern Name UVM name 
Factory Method, Abstract Factory uvm_factory, inheriting from uvm base classes 
Singleton UVM Pool, UVM Global report server, etc. 
Composite UVM Component Hierarchy, UVM Sequence Hierarchy 
Facade TLM Ports, UVM scoreboards 
Adapter UVM Reg Adapter 
Bridge UVM sequencer, UVM driver 
Observer UVM Subscriber, UVM Monitor, UVM Coverage 
Template Method UVM Transaction (do_copy, do_compare), UVM Phase 
Command UVM Sequence Item 
Strategy UVM Sequence, UVM Driver 
Mediator UVM Virtual Sequencer 

If we switched from SystemVerilog to Python for writing our testbenches, would we need to re-implement each of those parts of the UVM? Python is not a statically typed object oriented language like Java and SystemVerilog. It is a dynamically typed language. Prominent and well respected computer scientist Peter Norvig explored this topic for us already. He did this when Python was still a very young language, so he examined other dynamic languages instead (Dylan and Lisp) and he concluded that of the 23 design patterns from the GOF book, 16 of them are either invisible or greatly simplified due to the nature of dynamic languages and their built-in features. As an example to explain how this could be, he points out that a defining a function and calling it used to be design patterns. Higher-level languages came along and made the pattern of defining and calling a function a part of the language.

This is essentially what has happened with dynamic languages. Many design patterns from GOF are now simply part of the language. According to Dr. Norvig, the patterns that dynamic languages obsolete are:

  • Abstract-Factory
  • Flyweight
  • Factory-Method
  • State
  • Proxy
  • Chain-Of-Responsibility
  • Command
  • Strategy
  • Template-Method
  • Visitor
  • Interpreter
  • Iterator
  • Mediator
  • Observer
  • Builder
  • Facade

That reduces the above table to:

GOF Pattern Name UVM name 
Singleton UVM Pool, UVM Global report server, etc. 
Composite UVM Component Hierarchy, UVM Sequence Hierarchy 
Adapter UVM Reg Adapter 
Bridge UVM sequencer, UVM driver 

Trusting that, if we were to write a pure Python testbench we can see that we would still likely implement a few design patterns. Thinking about this, it makes sense that we'd still probably have classes dedicated to transforming high-level sequence items to pin wiggles, just like the sequencer and driver work together to do in the UVM. It also makes sense that we'd have a class hierarchy to organize and relate components (such as the sequencer and driver equivalents) and sequences (high-level stimulus generation). Thing like that.

The more striking thing is the amount of code we would not need.
-1:-- SystemVerilog and Python (Post Bryan ( 07, 2017 07:53 PM

John Stevenson: Spacemacs - Using Magit With Github

By adding the git layer to Spacemacs you have the fully featured git client called magit. The github layer allows you to clone repositories from Github and to create, list, update and delete gists

Today I discovered Magithub which can create a new remote repository on Github from within Spacemacs, using the command line tool called hub.

Previously I opened a shell inside Emacs and ran the hub create command to create a new remote Github repository for a project. This worked, but not the same speed as having a feature built-in to Magit itself.

What is Magithub

Magithub is an interface to GitHub using the `hub’ command line tool. Its integrated into Magit workflows and allows very easy, very basic GitHub repository management. Supported actions include:

  • pushing brand-new local repositories up to GitHub
  • creating forks of existing repositories
  • submitting pull requests upstream
  • viewing and creating issues

Spacemacs - Magit Status - Magithub in action

Adding magithub to Spacemacs

As Magithub.el is not part of a layer, it can be added as an additional package in the dotspacemacs/layers of the ~/.spacemacs file.

dotspacemacs-additional-packages &apos(magithub)

The Magithub package needs to be loaded into Spacemacs once magit has been loaded. So we need to add a hook in the dotspacemacs/user-config section of the ~/.spacemacs file

(use-package magithub
:after magit
:config (magithub-feature-autoinject t))

Using Magithub

Open magit status with SPC g s and then you have access to the magithub features.

Press `H’ in the magit status buffer and you will see the following menu

Spacemacs - Magit Status - Magithub menu

Here is a simple example of taking an unversioned project, putting under Git version control with Magit and then creating a remote repository on Github with Magithub.

Thank you.

-1:-- Spacemacs - Using Magit With Github (Post)--L0--C0--February 06, 2017 01:43 PM

Wilfred Hughes: These Weeks in Remacs

It’s been about two weeks since the last Remacs status update, but development continues apace!

For readers who use Arch Linux, Remacs is now available as a remacs-git package on AUR.

We’ve seen a lot of work on builds recently. Thanks to a heroic effort from some OS X developers, Remacs now builds on OS X! A particular thanks to @pnkfelix who wrote a custom allocator to ensure unexec works with Remacs using Rust RFC 1398.

Our CI has improved too. We now run almost the entire Emacs test suite on Travis, for both 64-bit Linux and OS X. The few failing tests are being skipped, though in several cases they’re legitimate upstream issues that we’ve reported.

Work continues on other platforms: we’ve found that Remacs won’t compile on 32-bit systems due to inappropriate use of tuple structs. This is currently being worked on, but we hope the #[repr(transparent)] Rust RFC will eventually give us a cleaner solution.

Contributors have also been looking at using Rust crates to replace C code included in Emacs. Work is underway for SHA checksums, MD5 checksums and generating temporary files.

Finally, Remacs now has a, which GitHub shows when creating a new issue or PR. This should make it easier for new contributors, as it teaches them how to contribute effectively.

If you’re interested in contributing, our help needed list is regularly updated with interesting ways to contribute. We also have issues tagged ‘Help Wanted’ on GitHub.

Onwards and upwards!

-1:-- These Weeks in Remacs (Post Wilfred Hughes ( 05, 2017 12:00 AM

Manuel Uberti: Automatic language detection for Flyspell

I am always looking for new ways to improve my Emacs experience. Months ago, it happened to my spell-checking configuration thanks to the work of Nicolas Petton.

(defvar mu-languages-ring nil "Languages ring for Ispell")

(let ((languages '("en_GB" "it_IT")))
  (validate-setq mu-languages-ring (make-ring (length languages)))
  (dolist (elem languages) (ring-insert mu-languages-ring elem)))

(defun mu-cycle-ispell-languages ()
  (let ((language (ring-ref mu-languages-ring -1)))
    (ring-insert mu-languages-ring language)
    (ispell-change-dictionary language)))

This handy code lets me cycle quickly through the languages I need in Flyspell. However, wouldn’t it be easier if Emacs was capable of automatic language detection?

That’s the hole the guess-language package fills.

(use-package guess-language         ; Automatically detect language for Flyspell
  :ensure t
  :defer t
  :init (add-hook 'text-mode-hook #'guess-language-mode)
  (setq guess-language-langcodes '((en . ("en_GB" "English"))
                                   (it . ("it_IT" "Italian")))
        guess-language-languages '(en it)
        guess-language-min-paragraph-length 45)
  :diminish guess-language-mode)

Notice how I set guess-language-langcodes. It has to be set this way to make guess-language work with my setup for Hunspell.

Support for different languages and language detection for multiple languages in the same document are provided out of the box. guess-language is still young, but it’s already making spell-checking in Emacs so much easier.

-1:-- Automatic language detection for Flyspell (Post)--L0--C0--February 04, 2017 12:00 AM

Alex Schroeder: Homebrew and Emacs


alex@Megabombus:~$ emacs
dyld: Library not loaded: /usr/local/opt/imagemagick/lib/libMagickWand-6.Q16.3.dylib
  Referenced from: /usr/local/bin/emacs
  Reason: image not found
Abort trap: 6

OK, reinstall…

alex@Megabombus:~$ brew reinstall emacs-mac
==> Reinstalling railwaycat/emacsmacport/emacs-mac --with-xml2 --with-official-icon --with-gnutls --with-imagemagick
==> Downloading
Already downloaded: /Users/alex/Library/Caches/Homebrew/emacs-mac-emacs-25.1-z-mac-6.1.tar.gz
==> Downloading
Already downloaded: /Users/alex/Library/Caches/Homebrew/emacs-mac--official-icon-25.icns
==> ./
==> ./configure --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-mac/emacs-25.1-z-mac-6.1/shar
==> make
==> Summary
🍺  /usr/local/Cellar/emacs-mac/emacs-25.1-z-mac-6.1: 4,067 files, 109.7M, built in 20 minutes 31 seconds


-1:-- Homebrew and Emacs (Post)--L0--C0--February 03, 2017 08:39 AM

Ben Simon: Adventures in hardware hacking: adding foot pedal support to emacs

A few months back I came across this video showing how to control a DSLR with a foot pedal. This re-ignited a long time project I've wanted to try: adding foot pedal control to emacs. How cool would it be to control emacs with not only 10 fingers, but your feet!

Looking more into this, I learned that such an idea was both totally doable and relatively inexpensive. Here's a recipe for exactly what I'd need to realize this dream: USB Foot Switch. The parts were easy enough to order off of Adafruit's website. I'd needed only a $7.00 foot switch and a $10.00 microcontroller.

The instructions promised a build time of less than an hour, however, I was skeptical. My area of expertise is in the software side of things, so clipping wires, soldering and such seems awfully intimidating.

To get around this, I decided to follow the instructions in reverse. First I'd program the chip. Then I'd see if I could get the keyboard behavior working. Then I'd plunge into the soldering side of things. It would take longer, but I'd get to start in my comfort zone.

I figured the best place to start was to get the hello world of programs running on the Trinket Pro chip, an LED blinker. To accomplish this, I followed the tutorial here.

Being an emacs snob, I completely skipped over the IDE instructions and jumped right into using AVRDude. Heck, a simple brew command line installed avrdude. I was on a roll. And then things came to a screeching halt when my attempts to use avrdude gave me various error messages. I googled for solutions, but it was beginning to look hopeless.

So, plan B: I returned to the IDE Instructions. While I had a couple of false starts, the instructions were really quite accurate. Everything seemed to work. I loaded up the blinker program:

int led = 1; // blink 'digital' pin 1 - AKA the built in red LED

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);


// the loop routine runs over and over again forever:
void loop() {
    digitalWrite(led, HIGH); 
    digitalWrite(led, LOW);

Hit the upload button, and poof, I successfully loaded the program into the chip. It was so effortless that I actually dug around and turned on verbose messages just to confirm that it was truly working.

There was only one problem: the program appeared to load, yet the LED on the board didn't blink. What the heck?!

On a whim, I brought up the pin-out of the Trinket Pro 5v:

Upon closer inspection I realized that the red LED I was after was labeled as #13. Aha! I updated my program to set 'led' to 13 and uploaded it to the device. And just like that, I had a blinking Trinket. Whoo!

OK, so I can get my code to run on the Trinket. Next up to was to do something with the keyboard library. I altered my blinking program to be like so:

#include <cmdline_defs.h>
#include <ProTrinketKeyboard.h>
#include <ProTrinketKeyboardC.h>
#include <usbconfig.h>

const int PIN_SWITCH = 0;    // Trinket pin to connect to switch 
int led = 13;

void setup()
  pinMode(led, OUTPUT);
  TrinketKeyboard.begin();  // initialize keyboard library

void loop()
  digitalWrite(led, HIGH);
  TrinketKeyboard.print("Hello World!"); // use for string instead of char
  digitalWrite(led, LOW);

Along with toggling the LED, it spits out the text Hello World every 8 seconds.

I pushed the program the Trinket, and lo-and-behold, it worked! Now, it was a particularly useful program, but it did show that I was able to get the Trinket to simulate a keyboard action.

The final task I wanted to try was to have the board generate Hello World in response to a circuit being closed. After all, the switch is just a fancy way of grounding pin #1. At this point, any hardware geek would have busted out their soldering iron and gotten to work on finishing this project. But I wasn't quite ready to go there. I grabbed a few short lengths of wire and crudely attached them to the board by winding them into place:

I then installed the following program on the Trinket:

#include <cmdline_defs.h>
#include <ProTrinketKeyboard.h>
#include <ProTrinketKeyboardC.h>
#include <usbconfig.h>

const int PIN_SWITCH = 0;    // Trinket pin to connect to switch 
const int LED        = 13;
void setup()
  // Set button pin as input with an internal pullup resistor
  // The button is active-low, they read LOW when they are not pressed

  TrinketKeyboard.begin();  // initialize keyboard library

void loop()

  if (digitalRead(PIN_SWITCH) == LOW)  // If the foot switch grounds the pin
    TrinketKeyboard.print("Hello World!"); // use for string instead of char
    digitalWrite(LED, HIGH); 
    digitalWrite(LED, LOW);

With the Trinket plugged into my Mac via the USB cable, I ever so carefully touched the two exposed wires together. And to my amazement, Hello World blurted out on the screen. I tried again. And again. Success!

The end of the project is now in sight: I need to wire in the foot pedal switch and update the program to send a keystroke rather than a chunk of text. And then I need to figure out what bit of magic I want emacs to do when I hit the foot pedal. Hopefully that will be the hardest part.

Man, this Arduino hacking stuff is fun!

Update: While I had visions of using the pedal to power emacs, my first real use was a macOS hack.

-1:-- Adventures in hardware hacking: adding foot pedal support to emacs (Post Ben Simon ( 01, 2017 12:41 PM

Chris Wellons: How to Write Fast(er) Emacs Lisp

Not everything written in Emacs Lisp needs to be fast. Most of Emacs itself — around 82% — is written in Emacs Lisp because those parts are generally not performance-critical. Otherwise these functions would be built-ins written in C. Extensions to Emacs don’t have a choice and — outside of a few exceptions like dynamic modules and inferior processes — must be written in Emacs Lisp, including their performance-critical bits. Common performance hot spots are automatic indentation, AST parsing, and interactive completion.

Here are 5 guidelines, each very specific to Emacs Lisp, that will result in faster code. The non-intrusive guidelines could be applied at all times as a matter of style — choosing one equally expressive and maintainable form over another just because it performs better.

There’s one caveat: These guidelines are focused on Emacs 25.1 and “nearby” versions. Emacs is constantly evolving. Changes to the virtual machine and byte-code compiler may transform currently-slow expressions into fast code, obsoleting some of these guidelines. In the future I’ll add notes to this article for anything that changes.

(1) Use lexical scope

This guideline refers to the following being the first line of every Emacs Lisp source file you write:

;;; -*- lexical-binding: t; -*-

This point is worth mentioning again and again. Not only will your code be more correct, it will be measurably faster. Dynamic scope is still opt-in through the explicit use of special variables, so there’s absolutely no reason not to be using lexical scope. If you’ve written clean, dynamic scope code, then switching to lexical scope won’t have any effect on its behavior.

Along similar lines, special variables are a lot slower than local, lexical variables. Only use them when necessary.

(2) Prefer built-in functions

Built-in functions are written in C and are, as expected, significantly faster than the equivalent written in Emacs Lisp. Complete as much work as possible inside built-in functions, even if it might mean taking more conceptual steps overall.

For example, what’s the fastest way to accumulate a list of items? That is, new items go on the tail but, for algorithm reasons, the list must be constructed from the head.

You might be tempted to keep track of the tail of the list, appending new elements directly to the tail with setcdr (via setf below).

(defun fib-track-tail (n)
  (let* ((a 0)
         (b 1)
         (head (list 1))
         (tail head))
    (dotimes (_ n head)
      (psetf a b
             b (+ a b))
      (setf (cdr tail) (list b)
            tail (cdr tail)))))

(fib-track-tail 8)
;; => (1 1 2 3 5 8 13 21 34)

Actually, it’s much faster to construct the list in reverse, then destructively reverse it at the end.

(defun fib-nreverse (n)
  (let* ((a 0)
         (b 1)
         (list (list 1)))
    (dotimes (_ n (nreverse list))
      (psetf a b
             b (+ a b))
      (push b list))))

It might not look it, but nreverse is very fast. Not only is it a built-in, it’s got its own opcode. Using push in a loop, then finishing with nreverse is the canonical and fastest way to accumulate a list of items.

In fib-track-tail, the added complexity of tracking the tail in Emacs Lisp is much slower than zipping over the entire list a second time in C.

(3) Avoid unnecessary lambda functions

I’m talking about mapcar and friends.

;; Slower
(defun expt-list (list e)
  (mapcar (lambda (x) (expt x e)) list))

Listen, I know you love dash.el and higher order functions, but this habit ain’t cheap. The byte-code compiler does not know how to inline these lambdas, so there’s an additional per-element function call overhead.

Worse, if you’re using lexical scope like I told you, the above example forms a closure over e. This means a new function object is created (e.g. make-byte-code) each time expt-list is called. To be clear, I don’t mean that the lambda is recompiled each time — the same byte-code string is shared between all instances of the same lambda. A unique function vector (#[...]) and constants vector are allocated and initialized each time expt-list is invoked.

Related mini-guideline: Don’t create any more garbage than strictly necessary in performance-critical code.

Compare to an implementation with an explicit loop, using the nreverse list-accumulation technique.

(defun expt-list-fast (list e)
  (let ((result ()))
    (dolist (x list (nreverse result))
      (push (expt x e) result))))
  • No unnecessary garbage is created.
  • No unnecessary per-element function calls.

This is the fastest possible definition for this function, and it’s what you need to use in performance-critical code.

Personally I prefer the list comprehension approach, using cl-loop from cl-lib.

(defun expt-list-fast (list e)
  (cl-loop for x in list
           collect (expt x e)))

The cl-loop macro will expand into essentially the previous definition, making them practically equivalent. It takes some getting used to, but writing efficient loops is a whole lot less tedious with cl-loop.

In Emacs 24.4 and earlier, catch/throw is implemented by converting the body of the catch into a lambda function and calling it. If code inside the catch accesses a variable outside the catch (very likely), then, in lexical scope, it turns into a closure, resulting in the garbage function object like before.

In Emacs 24.5 and later, the byte-code compiler uses a new opcode, pushcatch. It’s a whole lot more efficient, and there’s no longer a reason to shy away from catch/throw in performance-critical code. This is important because it’s often the only way to perform an early bailout.

(4) Prefer using functions with dedicated opcodes

When following the guideline about using built-in functions, you might have several to pick from. Some built-in functions have dedicated virtual machine opcodes, making them much faster to invoke. Prefer these functions when possible.

How can you tell when a function has an assigned opcode? Take a peek at the byte-defop listings in bytecomp.el. Optimization often involves getting into the weeds, so don’t be shy.

For example, the assq and assoc functions search for a matching key in an association list (alist). Both are built-in functions, and the only difference is that the former compares keys with eq (e.g. symbol or integer keys) and the latter with equal (typically string keys). The difference in performance between eq and equal isn’t as important as another factor: assq has its own opcode (158).

This means in performance-critical code you should prefer assq, perhaps even going as far as restructuring your alists specifically to have eq keys. That last step is probably a trade-off, which means you’ll want to make some benchmarks to help with that decision.

Another example is eq, =, eql, and equal. Some macros and functions use eql, especially cl-lib which inherits eql as a default from Common Lisp. Take cl-case, which is like switch from the C family of languages. It compares elements with eql.

(defun op-apply (op a b)
  (cl-case op
    (:norm (+ (* a a) (* b b)))
    (:disp (abs (- a b)))
    (:isin (/ b (sin a)))))

The cl-case expands into a cond. Since Emacs byte-code lacks support for jump tables, there’s not much room for cleverness.

(defun op-apply (op a b)
   ((eql op :norm) (+ (* a a) (* b b)))
   ((eql op :disp) (abs (- a b)))
   ((eql op :isin) (/ b (sin a)))))

It turns out eql is pretty much always the worst choice for cl-case. Of the four equality functions I listed, the only one lacking an opcode is eql. A faster definition would use eq. (In theory, cl-case could have done this itself because it knows all the keys are symbols.)

(defun op-apply (op a b)
   ((eq op :norm) (+ (* a a) (* b b)))
   ((eq op :disp) (abs (- a b)))
   ((eq op :isin) (/ b (sin a)))))

Fortunately eq can safely compare integers in Emacs Lisp. You only need eql when comparing symbols, integers, and floats all at once, which is unusual.

(5) Unroll loops using and/or

Consider the following function which checks its argument against a list of numbers, bailing out on the first match. I used % instead of mod since the former has an opcode (166) and the latter does not.

(defun detect (x)
  (catch 'found
    (dolist (f '(2 3 5 7 11 13 17 19 23 29 31))
      (when (= 0 (% x f))
        (throw 'found f)))))

The byte-code compiler doesn’t know how to unroll loops. Fortunately that’s something we can do for ourselves using and and or. The compiler will turn this into clean, efficient jumps in the byte-code.

(defun detect-unrolled (x)
  (or (and (= 0 (% x 2)) 2)
      (and (= 0 (% x 3)) 3)
      (and (= 0 (% x 5)) 5)
      (and (= 0 (% x 7)) 7)
      (and (= 0 (% x 11)) 11)
      (and (= 0 (% x 13)) 13)
      (and (= 0 (% x 17)) 17)
      (and (= 0 (% x 19)) 19)
      (and (= 0 (% x 23)) 23)
      (and (= 0 (% x 29)) 29)
      (and (= 0 (% x 31)) 31)))

In Emacs 24.4 and earlier with the old-fashioned lambda-based catch, the unrolled definition is seven times faster. With the faster pushcatch-based catch it’s about twice as fast. This means the loop overhead accounts for about half the work of the first definition of this function.

Update: It was pointed out in the comments that this particular example is equivalent to a cond. That’s literally true all the way down to the byte-code, and it would be a clearer way to express the unrolled code. In real code it’s often not quite equivalent.

Unlike some of the other guidelines, this is certainly something you’d only want to do in code you know for sure is performance-critical. Maintaining unrolled code is tedious and error-prone.

I’ve had the most success with this approach by not by unrolling these loops myself, but by using a macro, or similar, to generate the unrolled form.

(defmacro with-detect (var list)
  (cl-loop for e in list
           collect `(and (= 0 (% ,var ,e)) ,e) into conditions
           finally return `(or ,@conditions)))

(defun detect-unrolled (x)
  (with-detect x (2 3 5 7 11 13 17 19 23 29 31)))

How can I find more optimization opportunities myself?

Use M-x disassemble to inspect the byte-code for your own hot spots. Observe how the byte-code changes in response to changes in your functions. Take note of the sorts of forms that allow the byte-code compiler to produce the best code, and then exploit it where you can.

-1:-- How to Write Fast(er) Emacs Lisp (Post)--L0--C0--January 30, 2017 09:08 PM

Pragmatic Emacs: Customise the reply quote string in mu4e

You know the bit of text that appears before the quoted email when you reply to someone? Of course you can customise this in mu4e. By default a quoted reply will be preceded with something like

"On Mon, 30 Jan 2017, Joe Bloggs wrote:"

I wanted to include the time and email address of the sender, so I customised the variable message-citation-line-format as follows

;; customize the reply-quote-string
(setq message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n")
;; choose to use the formatted string
(setq message-citation-line-function 'message-insert-formatted-citation-line)

which translates to something like this

On Mon 30 Jan 2017 at 19:17, Joe Bloggs <> wrote:

The formatting options can be found by looking up the help for the variable with C-h v message-citation-line-format.

Sadly, this change broke my function to extract the sender name for my email template. Here is an updated version:

;; function to return first name of email recipients
;; used by yasnippet
;; inspired by
(defun bjm/mu4e-get-names-for-yasnippet ()
  "Return comma separated string of names for an email"
  (let ((email-name "") str email-string email-list email-name2 tmpname)
      (goto-char (point-min))
      ;; first line in email could be some hidden line containing NO to field
      (setq str (buffer-substring-no-properties (point-min) (point-max))))
    ;; take name from TO field - match series of names
    (when (string-match "^To: \"?\\(.+\\)" str)
      (setq email-string (match-string 1 str)))
    ;;split to list by comma
    (setq email-list (split-string email-string " *, *"))
    ;;loop over emails
    (dolist (tmpstr email-list)
      ;;get first word of email string
      (setq tmpname (car (split-string tmpstr " ")))
      ;;remove whitespace or ""
      (setq tmpname (replace-regexp-in-string "[ \"]" "" tmpname))
      ;;join to string
      (setq email-name
            (concat email-name ", " tmpname)))
    ;;remove initial comma
    (setq email-name (replace-regexp-in-string "^, " "" email-name))

    ;;see if we want to use the name in the FROM field
    ;;get name in FROM field if available, but only if there is only
    ;;one name in TO field
    (if (< (length email-list) 2)
        (when (string-match "^On.+, \\([^ ,\n]+\\).+wrote:$" str)
            (setq email-name2 (match-string 1 str))
            ;;prefer name in FROM field if TO field has "@"
            (when (string-match "@" email-name)
              (setq email-name email-name2))
-1:-- Customise the reply quote string in mu4e (Post Ben Maughan)--L0--C0--January 30, 2017 08:56 PM

Raimon Grau: Autocomplete erc nicks with @ sign (for slack)

This is a very quick hack for something I've wanted for some time.  I'm using slack through their IRC gateway. That allows me to use erc, yasnippets, bug-reference-mode,  and whatnot.

The few things that annoy me of that interface is that to ping users, in slack you are expected to prepend the nick with an at sign. That makes autocompletion kinda useless because, as this redditor explains , it's a pain in the ass to type the nick, autocomplete, go back, add the @ sign, and move forward.

I haven't found a way to solve this in an elegant way, but as a hack, I could add tihs advice functions that will understand @nick as well as 'nick' when autocompleting.  I'd love to be able to just type the name and the autocompletion framework fill the '@'  sign itself, but I couldn't find it, so I'll try this approach I got so far and see if it works well enough for me.

I hope it's useful for some of you, dear emacslackers :)

-1:-- Autocomplete erc nicks with @ sign (for slack) (Post Raimon Grau ( 22, 2017 08:57 PM

emacsninja: Trapping Attackers With Nyan Cat

In case you haven’t done it yet, I strongly recommend you to give telnet a try. If you don’t have a telnet client ready, head over to instead and enjoy the pretty pictures.

I’ve wondered for quite some time whether it would be possible to run the same thing on a SSH server. It turns out that it’s not too hard to do as not only Kevin Lange’s creation can be run in a TTY, but OpenSSH allows you to do something else than giving you a shell after a successful authentication attempt.

First of all you’ll need to install and test the nyancat program:

% pacman -S nyancat
$ nyancat

To restrict the impact of the public-facing service, I decided to create a new user for it and run a separate SSH daemon with its own config and service file:

% useradd -m -s /bin/sh anonymous
% cp /usr/lib/systemd/system/sshd.service /etc/systemd/system/nyanpot.service
% cp /etc/ssh/sshd_config /etc/ssh/nyanpot_sshd_config

Relevant changed bits in the service file:

Description=OpenSSH Honeypot
ExecStart=/usr/bin/sshd -D -f /etc/ssh/nyanpot_sshd_config

The SSH config is a bit special as it locks out everyone who isn’t the anonymous user:

Port 22
PermitRootLogin No
PermitTTY No
PasswordAuthentication No
X11Forwarding No
AllowTcpForwarding No
Match User anonymous
    PasswordAuthentication Yes
    PermitTTY Yes
    ForceCommand nyancat

You can test the service with systemctl start nyanpot.service and logging in (ideally from a different system) as the anonymous user. If everything works fine, enable the service permanently with systemctl enable nyanpot.service. My honeypot is available via ssh (PW: anonymous). Enjoy!

-1:-- Trapping Attackers With Nyan Cat (Post Vasilij Schneidermann)--L0--C0--January 22, 2017 01:54 PM

Grant Rettke: A Hydra For Country Business Marks

(defhydra help/trademark (:color blue :hint nil)
American _R_egistered Trademark
American _U_nregistered Trademark
American _S_ervice Mark
_J_apanese Industrial Standard
_K_orean Standard
  ("R" (lambda () (interactive) (insert "®")))
  ("U" (lambda () (interactive) (insert "™")))
  ("S" (lambda () (interactive) (insert "℠")))
  ("J" (lambda () (interactive) (insert "〄")))
  ("K" (lambda () (interactive) (insert "㉿"))))
-1:-- A Hydra For Country Business Marks (Post Grant)--L0--C0--January 21, 2017 04:45 PM

Raimon Grau: git contribution spans (emacs case study)

Let's play a little, just for the fun of it, and to gather some metainformation about a codebase.

I sometimes would like to find out the commit spans of the different authors. I may not care about the number of commits, but only first and last. This info may be useful to know if a repo has most long time commiters or the majority of contributors are one-off, or one-feature-and-forget.

First we'll sharpen a bit our unix chainsaw:

Here's a little helper that has proven to be very useful. It's similar to uniq, but you don't need to sort first, and also it accepts a parameter meaning the column you want to be unique. (Unique by Column)

function uc () {

    awk -F" " "!_[\$$1]++"


And then, you only have to look at man git-log to find out you can reverse the order of the logs, so you can track the first and the last appearence of each commiter.

git log --format='%aE %ai'  | uc 1 | sort  >/tmp/last

git log --reverse --format='%aE %ai -> '  | uc 1 | sort >/tmp/first

paste /tmp/first /tmp/last > /tmp/spans.txt

Here is the output file. it has some spurious parsing errors, but I think it still shows how powerful insights we can get with just a bit of bash, man and pipelines.

Just by chance, the day after I tried this, I discovered git-quick-stats, which is a utility tool to get simple stats out of a git repo. It's great that I could add the same functionality there too via a Pull Request :).

Big thanks to every one of the commiters in emacs, being long or short span and amount of code contributed. Thanks to y'all
-1:-- git contribution spans (emacs case study) (Post Raimon Grau ( 19, 2017 10:45 PM

Wilfred Hughes: This Week in Remacs

Wow, what a start to the Remacs project! We’ve had a ton of media attention: Soylent News Heise,, Linux Magazin, Phoronix and Hacker News.

This has brought a number of new contributors on board, and we’ve landed lots of features this week:

We’ve added 28 primitive elisp functions written in Rust. These included floating point arithmetic, type checks, basic list manipulation and even some string creation (which requires allocation).

The code is now much more idiomatic Rust, and you can write things like LispObject::from_bool(true) and it does exactly what you’d expect.

Our Makefile has vastly improved. Cargo is now driven from Make, and we have users on both Linux and BSD. Windows and OS X are both being actively worked on.

Remacs is now based on Emacs’ master branch. All the latest goodies in upstream Emacs are available in Remacs too.

Finally, our branding has improved. The welcome screen now explicitly says Remacs, and the build process produces a remacs binary. This means you can install Remacs alongside your current Emacs instance!

Huge thanks to our contributors:

  • 0xAX
  • Arseniy Zaostrovnykh
  • c-nixon
  • CrLF0710
  • Daroc Alden
  • David DeSimone
  • David Zmick
  • dk87
  • Felix S Klock II
  • Femi Agbabiaka
  • Jean Pierre Dudey
  • Liang Ying-Ruei
  • Martin Feckie
  • Roger Marlow
  • Sharif Nassar
  • Victor Hugo Borja
  • William Orr

If you’re interested in contributing, we have a tutorial to get you started and a list of tasks you might like to start with. All PRs are reviewed, so we can help you if you get stuck!

-1:-- This Week in Remacs (Post Wilfred Hughes ( 19, 2017 12:00 AM

Matthias Pfeifer: Emacs Gems: scroll-all-mode

An Emacs Gem is one of the many little tools/functions/modes that Emacs ships with and that turned out to be ‚extremely usefull‘ in a specific situation. Introduction If you ever want to compare two buffers line by line and are too lazy to fire up ediff or don’t use ediff at all you might end … Emacs Gems: scroll-all-mode weiterlesen
-1:-- Emacs Gems: scroll-all-mode (Post Matthias)--L0--C0--January 17, 2017 10:11 AM