Jorgen Schäfer: Buttercup 1.1 Released

I just released version 1.1 of Buttercup, the Behavior-Driven Emacs Lisp Testing framework.

Buttercup is a behavior-driven development framework for testing Emacs Lisp code. It is heavily inspired by Jasmine.

Installation and Use

Buttercup is available from Marmaladeand MELPA Stable.

Example test suite:

(describe "A suite"
(it "contains a spec with an expectation"
(expect t :to-be t)))

Suites group tests, and suites can be nested. Contrary to ERT, suites can share set-up and tear-down code for tests, and Buttercup comes with built-in support for mocks in the form of spies. See the package homepage above for a full description of the syntax for test suites and specs.

Buttercup comes with a shell script to run the default discover runner. If used together with cask, cask exec buttercupwill find, load and run test suites in your project.

Changes Since 1.0

  • Buttercup now sports a full reporter interface, in case you want to write your own reporter. By default, there is a batch and an interactive reporter.
  • Reporters now display failed tests properly at the end of the test run, together with a properly-formatted backtrace.
  • Pending specs and disabled suites as in Jasmine are now supported.
  • Emacs 24.5 is now officially supported.
  • There’s now a buttercup script to run the most common command line.
  • Test runners are now autoloaded.
  • Test discovery now ignores dot files and dot directories.
  • Buttercup tests can now be instrumented with Edebug.
-1:-- Buttercup 1.1 Released (Post Jorgen Schäfer ( 26, 2015 05:46 PM

Emacs Life: Download / Install — eclim (eclipse + vim)

Download / Install — eclim (eclipse + vim):

-1:-- Download / Install — eclim (eclipse + vim) (Post Steven Ness ( 26, 2015 01:24 AM

Emacs Life: auto-complete/auto-complete.el at master · auto-complete/auto-complete

auto-complete/auto-complete.el at master · auto-complete/auto-complete:

-1:-- auto-complete/auto-complete.el at master · auto-complete/auto-complete (Post Steven Ness ( 26, 2015 01:24 AM

emacspeak: Emacspeak 3.0: Released 20 Years Ago Today!


1 Emacspeak Was Released Twenty Years Ago Today

The more things change, the more they remain the same.

Emacspeak was released 20 years ago on April 25, 1995 with this announcement. The Emacspeak mailing list itself did not exist in its present form — note that the original announcement talks about a mailing list at DEC CRL. When Greg started the mailing list at Vassar, we seeded the list from some/all of the messages from the archive for the mailing list at DEC.e

-1:-- Emacspeak 3.0: Released 20 Years Ago Today! (Post T. V. Raman ( 25, 2015 04:49 PM

Ryan Rix: When You Get To The Point Where A Project Feels Stuck

I hit a dead end on a lot of my projects this week, and getting past those dead ends has been a bit of a headache for me. How can I improve upon that, and use those skills to prevent dead ends and improve my ability to empathize with those around me?
-1:-- When You Get To The Point Where A Project Feels Stuck (Post)--L0--C0--April 25, 2015 12:00 AM

Flickr tag 'emacs': smart-mode-line

ohyecloudy posted a photo:


-1:-- smart-mode-line (Post ohyecloudy ( 24, 2015 02:41 PM

Irreal: Calc Update

I've written before that I've started learning Calc. That last post was after I'd worked through the introductory material (which is, itself, quite dense). I've now completed the first three sections of the tutorial covering

  • Basic Tutorial (RPN, stack, algebraic notation, Undo/Redo, Modes)
  • Arithmetic Tutorial (arithmetic and scientific functions)
  • Vector/Matrix/List Tutorial (operations on vectors and matrices)

It may seem that my progress is slow<img src=—" class="wp-smiley" style="height: 1em; max-height: 1em;" />that last post was two weeks ago<img src=—" class="wp-smiley" style="height: 1em; max-height: 1em;" />but there's a huge amount of material, especially in the last section. The basic and arithmetic tutorials are pretty much what you'd expect although you'd probably be surprised at how many different functions there are. The last section is astounding. For example, there is a function to calculate the dot product of two vectors but even if there weren't you could do the same operation using the map and reduce functions. In Elisp (but not Calc) terms that would be

(reduce #'+ (cl-mapcar #'* V1 V2))

There are lots of examples that don't have a simple, single command so these functions turn out to be really powerful and useful.

The tutorial has exercises, some of which could be from the Euler Project. They're not all that hard, thankfully, but some of them require careful thinking about before you can solve them. They're really useful for helping to cement some of the functions and techniques in your head.

I've already started using Calc in my day-to-day work. Where before I'd bring up a Lisp REPL or try to make do with Elisp, I now just pop into Calc and perform whatever calculations I need. It's nice that I don't have to worry about overflow and things like that. The only downside is that I still haven't internalized all the function codes. They are generally one or two characters and while some—like *, +, …—are obvious others are less so. For example VC is the cross product of two vectors and HL is \log_{10}. Fortunately, there's a cheat sheet that lists the most common commands.

I'm really enjoying working through the tutorial and am learning a lot. I'll post another status report when I've worked through more of the tutorial.

-1:-- Calc Update (Post jcs)--L0--C0--April 24, 2015 01:56 PM

(or emacs: Oremacs config is on Github

I noticed that the packages that I've published on Github in the last year did get a nice boost in quality just from being published, viewed, used and commented on.

So it makes sense to do the same for my full Emacs config, which lives in the oremacs repository as of today.

The config is personal in the sense that I'm actually using it verbatim, but it's been configured in a way that's it's easy to replicate and modify it.

Who can benefit from this config

The audience is people like me, who like to tinker with Elisp just for fun of it. If you want things to just work, or you find learning Elisp a chore, it's not for you.

The config won't work initially, it won't work always, but when it finally does work (hopefully), it will be glorious!

Installation and Running


Emacs 24 is required. Obviously, newer versions are better, but the default emacs24 that you get from the package manager should work.

I'm currently switching between Emacs 24.5.2 built from source and the current master from git.

Install command

This config doesn't assume to become your main config when you install it. It installs in-place in the git directory and will start from there without touching your main config. But you still get access to all your stuff, like bookmarks stored in your actual ~/.emacs.d/ etc.

cd ~/git
git clone
cd oremacs
make install

Run command

Run without updating:

make run

Run with an upstream + ELPA update:

make up

Run with an upstream + ELPA + org-mode + CEDET update:

make install



You can try it without messing up your current Emacs config. I actually have multiple versions of this on my system to work-around incompatibility between versions. This way, I can use my full setup even in case I get a bug report for an older Emacs version.

Fast start up

With a SSD, it starts in 1 second. Most features are autoloaded and it's easy to add new autoloaded features.

Tracks the most recent org-mode and CEDET

Since these packages take a long time to byte compile, they are updated not with make up but with make install. They are actually git submodules, which means that they won't update if I don't update them in the upstream.


It's hard to become Emacs-bankrupt with this config, since the config is composed of many independent pieces that you can simply ignore if you don't need them.


The config comes with its own .Xmodmap that makes ; into an additional modifier. RSI savers:

  • ;-v instead of Enter.
  • ;-o instead of Backspace.
  • ;-f instead of Shift-9 and Shift-0.
  • ;-a instead of -.
  • ;-s instead of Shift--.
  • ;-q instead of Shift-'.
  • ;-e instead of =.
  • ;-u in addition / instead of C-u.

And obviously the replacements for the two keys that the mod takes away:

  • ;-j instead of ;.
  • ;-d instead of Shift-;.

One more Elisp-level RSI-saver is the swap between C-p and C-h. Moving up/down line is very important, and it's nice to have these keys close, which C-n and C-h are.

It also includes:

  • a bunch of Hydras that save you key strokes.
  • lispy-mode which quickens any LISP mode, especially Elisp.
  • worf-mode which quickens org-mode.
  • ivy-mode which quickens all completion.
  • swiper which quickens isearch (by replacing it).
  • C/C++ is customized with function-args-mode and a bunch of hacks.

Org mode starter

The config starts you off with a fully configured org-mode setup that includes:

  • for getting things done.
  • to track entertainment.
  • wiki folder for quickly starting and selecting wikis.


I hope that you try and enjoy the new config. Perhaps not verbatim, but if you find the tips on this blog helpful, this config is their actual implementation that you can use for reference.

-1:-- Oremacs config is on Github (Post)--L0--C0--April 23, 2015 10:00 PM

Irreal: Text in Academic Writing

If you're an academic in the sciences, you have an advantage over your colleagues in the liberal arts: you can write in LaTeX using any editor you choose1. Your document is in plain text and can be operated on by several text processing utilities. If you're an Emacs user, you don't even have to bother with LaTeX; you can write in Org mode and export the result to LaTex for submission. Best of all, you never have to touch Word. Those in the Liberal Arts, on the other hand, almost certainly have to submit their articles in Word format.

Now some of those liberal Arts academics are rebelling and looking for ways to do their writing in plain text too. Of course, they still have to submit their articles in Word format but there are, fortunately, tools that allow this. One such effort is the Scholarly Markdown Project. It's goal is to allow researchers to write in a slightly extended Markdown and use a port of Pandoc to convert it to other formats such as HTML or Word.

The Scholarly Markdown Project is still in the alpha stage so some academics are going their own way. W. Caleb McDaniel is a historian who is using Markdown to produce his books and articles. His post lays out his objection to using Word and then goes on to show how he's replaced it with Markdown. I like how he's not afraid of the Unix tools and uses them to assemble his documents.

We've now reached the stage where anyone who'd rather not use Word has other options but can still submit a final product in Word format. Emacs users have powerful built-in options: they can write in Org-mode and export to docx format. Those who prefer not to use Emacs, can write in Markdown using any editor they choose and translate to docx or any other of a number of formats using Pandoc. Lots of people don't mind<img src=—" class="wp-smiley" style="height: 1em; max-height: 1em;" />or even prefer<img src=—" class="wp-smiley" style="height: 1em; max-height: 1em;" />Word, of course, and they're free to continue using it. For those who've had enough of that walled garden and all the problems it brings, there are now alternatives.



Yes, yes, a few scientific journals also require submission in Word format but they are, fortunately, few in number.

-1:-- Text in Academic Writing (Post jcs)--L0--C0--April 23, 2015 02:09 PM

(or emacs: Swiper 0.3.0 is out, with ivy-mode.

This release packs more than 90 commits, which is quite a lot for me. The most important part of this release is ivy-mode, which is a nice alternative to ido-mode or helm-mode. I've mentioned it already in an earlier post, I'll just review all the little details, changes and customizations here.

Important: remove the old ivy package

One important change related to MELPA is that the ivy package was merged into swiper package. So if you still have a stand-alone ivy package, you should delete it, or you'll get incompatibility problems.

Video Demo of counsel-git-grep

If you like videos, you can watch the this quick demo which mostly shows off the new counsel-git-grep function.


Add work-around for window-start being not current

From now on, you won't encounter some un-highlighted matches when your window is scrolled.

Make thing-at-point work

C-h v and C-h f should select thing-at-point properly.

Don't try to fontify huge buffers

It's a nice feature of swiper that everything in the minibuffer is fontified. However, this can cause a slowdown for buffers with x10000 lines. So this feature is automatically turned off for these large buffers.

Exclude a few modes from font locking

Some modes just misbehave when font-lock-ensure is called. Excluded:

  • org-agenda-mode
  • dired-mode

New Features

ivy-mode: complete everything with Ivy

ivy-mode uses swiper's approach to completion for almost all completion in Emacs, like:

  • execute-extended-command
  • package-install
  • find-file

See the wiki page for the details on the key bindings related to ivy-mode, which are especially important to know for find-file. Also see the intro video.

New Counsel functions

  • counsel-describe-variable - replacement for C-h v.
  • counsel-describe-function - replacement for C-h f.
  • counsel-info-lookup-symbol - just a wrapper around info-lookup-symbol, you get the same behavior by just calling info-lookup-symbol with ivy-mode on.
  • counsel-unicode-char - replacement for ucs-insert.


This is a really cool command for grepping at once all the files in your current git repository. For smaller repositories (<20000) lines, ivy handles the completion by itself. For larger repositories, it defers the work to git grep. It works really well for the Emacs repo with its 3,000,000 lines, especially if you're using Emacs 25 (from emacs-snapshot or self-built).

This function makes use of C-M-n and C-M-p bindings, which switch between candidates without exiting the minibuffer. Also, they highlight the current candidate with the swiper faces. You can think of this command as multi-swiper.

Even for very large repos, it will always display the amount of matches correctly. Also note that swiper-style regex is used here (spaces are wild), and the case is ignored.

The arrows can take numeric arguments

C-n / C-p, C-s / C-r, and C-M-n / C-M-p can all take numeric args, e.g. M-5 or C-u.

Add a recenter binding

C-l will recenter the window in which swiper was called.

Look up Ivy key bindings with C-h m

While in the minibuffer, press C-h m to see the active modes. Ivy also has a paragraph with its bindings.

Use C-v and M-v to scroll

You can use these bindings to speed up your minibuffer scrolling.

Allow C-. to jump-to-definition

For counsel-describe-variable and counsel-describe-function:

  • pressing C-m will actually describe the current candidate.
  • pressing C-. will instead jump to definition of the the current candidate.

This is very useful for me, I jump to definitions more often that describe.

Bind arrows

The actual arrow keys are also bound to the corresponding Emacs arrows.

Add a way to exit ignoring the candidates

If your current input matches a candidate, C-m and C-j will exit with that candidate. If you want to exit with your exact input instead, press C-u C-j. This is very useful for creating new files and directories.

Use M-q to toggle regexp-quote

This can be useful while completing file names (with a lot of dots). Pressing M-q toggles between regex and non-regex matching.

Customize ivy-re-builders-alist

This is pretty intricate, look up the variable to see the details. In short, you can use this to apply `regexp-quote' for some types of completion if you want.

Customize what to do on DEL error

The standard behavior on a DEL error (usually empty minibuffer) is to exit the minibuffer. I like this behavior, since it's similar to the behavior to fixing wrongly typed chars: only in this case DEL "fixes" a wrongly typed command.

But if you want to customize it, just set ivy-on-del-error-function to something other than minibuffer-keyboard-quit.

Customize ivy-extra-directories

Customize this if you don't want to see ../ and ./ while completing file names.

Customize ivy-sort-functions-alist

Use this variable to customize sorting, depending on what you're completing. For example:

(setq ivy-sort-functions-alist
  '((read-file-name-internal . ivy-sort-file-function-default)
    (internal-complete-buffer . nil)
    (counsel-git-grep-function . nil)
    (t . string-lessp)))

Customize ivy-subdir-face

While completing file names, the directories will use ivy-subdir-face.


Big thanks to all who contributed, especially @tsdh.

-1:-- Swiper 0.3.0 is out, with ivy-mode. (Post)--L0--C0--April 21, 2015 10:00 PM

Julien Danjou: Gnocchi 1.0: storing metrics and resources at scale

A few months ago, I wrote a long post about what I called back then the "Gnocchi experiment". Time passed and we – me and the rest of the Gnocchi team – continued to work on that project, finalizing it.

It's with a great pleasure that we are going to release our first 1.0 version this month, roughly at the same time that the integrated OpenStack projects release their Kilo milestone. The first release candidate numbered 1.0.0rc1 has been released this morning!

The problem to solve

Before I dive into Gnocchi details, it's important to have a good view of what problems Gnocchi is trying to solve.

Most of the IT infrastructures out there consists of a set of resources. These resources have properties: some of them are simple attributes whereas others might be measurable quantities (also known as metrics).

And in this context, the cloud infrastructures make no exception. We talk about instances, volumes, networks… which are all different kind of resources. The problems that are arising with the cloud trend is the scalability of storing all this data and being able to request them later, for whatever usage.

What Gnocchi provides is a REST API that allows the user to manipulate resources (CRUD) and their attributes, while preserving the history of those resources and their attributes.

Gnocchi is fully documented and the documentation is available online. We are the first OpenStack project to require patches to integrate the documentation. We want to raise the bar, so we took a stand on that. That's part of our policy, the same way it's part of the OpenStack policy to require unit tests.

I'm not going to paraphrase the whole Gnocchi documentation, which covers things like installation (super easy), but I'll guide you through some basics of the features provided by the REST API. I will show you some example so you can have a better understanding of what you could leverage using Gnocchi!

Handling metrics

Gnocchi provides a full REST API to manipulate time-series that are called metrics. You can easily create a metric using a simple HTTP request:

POST /v1/metric HTTP/1.1
Content-Type: application/json
"archive_policy_name": "low"
HTTP/1.1 201 Created
Location: http://localhost/v1/metric/387101dc-e4b1-4602-8f40-e7be9f0ed46a
Content-Type: application/json; charset=UTF-8
"archive_policy": {
"aggregation_methods": [
"back_window": 0,
"definition": [
"granularity": "0:00:01",
"points": 3600,
"timespan": "1:00:00"
"granularity": "0:30:00",
"points": 48,
"timespan": "1 day, 0:00:00"
"name": "low"
"created_by_project_id": "e8afeeb3-4ae6-4888-96f8-2fae69d24c01",
"created_by_user_id": "c10829c6-48e2-4d14-ac2b-bfba3b17216a",
"id": "387101dc-e4b1-4602-8f40-e7be9f0ed46a",
"name": null,
"resource_id": null

The archive_policy_name parameter defines how the measures that are being sent are going to be aggregated. You can also define archive policies using the API and specify what kind of aggregation period and granularity you want. In that case , the low archive policy keeps 1 hour of data aggregated over 1 second and 1 day of data aggregated to 30 minutes. The functions used for aggregations are the mathematical functions standard deviation, minimum, maximum, … and even 95th percentile. All of that is obviously customizable and you can create your own archive policies.

If you don't want to specify the archive policy manually for each metric, you can also create archive policy rule, that will apply a specific archive policy based on the metric name, e.g. metrics matching disk.* will be high resolution metrics so they will use the high archive policy.

It's also worth noting Gnocchi is precise up to the nanosecond and is not tied to the current time. You can manipulate and inject measures that are years old and precise to the nanosecond. You can also inject points with old timestamps (i.e. old compared to the most recent one in the timeseries) with an archive policy allowing it (see back_window parameter).

It's then possible to send measures to this metric:

POST /v1/metric/387101dc-e4b1-4602-8f40-e7be9f0ed46a/measures HTTP/1.1
Content-Type: application/json
"timestamp": "2014-10-06T14:33:57",
"value": 43.1
"timestamp": "2014-10-06T14:34:12",
"value": 12
"timestamp": "2014-10-06T14:34:20",
"value": 2

HTTP/1.1 204 No Content

These measures are synchronously aggregated and stored into the configured storage backend. Our most scalable storage drivers for now are either based on Swift or Ceph which are both scalable storage objects systems.

It's then possible to retrieve these values:

GET /v1/metric/387101dc-e4b1-4602-8f40-e7be9f0ed46a/measures HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

As older Ceilometer users might notice here, metrics are only storing points and values, nothing fancy such as metadata anymore.

By default, values eagerly aggregated using mean are returned for all supported granularities. You can obviously specify a time range or a different aggregation function using the aggregation, start and stop query parameter.

Gnocchi also supports doing aggregation across aggregated metrics:

GET /v1/aggregation/metric?metric=65071775-52a8-4d2e-abb3-1377c2fe5c55&metric=9ccdd0d6-f56a-4bba-93dc-154980b6e69a&start=2014-10-06T14:34&aggregation=mean HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

This computes the mean of mean for the metric 65071775-52a8-4d2e-abb3-1377c2fe5c55 and 9ccdd0d6-f56a-4bba-93dc-154980b6e69a starting on 6th October 2014 at 14:34 UTC.

Indexing your resources

Another object and concept that Gnocchi provides is the ability to manipulate resources. There is a basic type of resource, called generic, which has very few attributes. You can extend this type to specialize it, and that's what Gnocchi does by default by providing resource types known for OpenStack such as instance, volume, network or even image.

POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
"id": "75C44741-CC60-4033-804E-2D3098C7D2E9",
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D"
HTTP/1.1 201 Created
Location: http://localhost/v1/resource/generic/75c44741-cc60-4033-804e-2d3098c7d2e9
ETag: "e3acd0681d73d85bfb8d180a7ecac75fce45a0dd"
Last-Modified: Fri, 17 Apr 2015 11:18:48 GMT
Content-Type: application/json; charset=UTF-8
"created_by_project_id": "ec181da1-25dd-4a55-aa18-109b19e7df3a",
"created_by_user_id": "4543aa2a-6ebf-4edd-9ee0-f81abe6bb742",
"ended_at": null,
"id": "75c44741-cc60-4033-804e-2d3098c7d2e9",
"metrics": {},
"project_id": "bd3a1e52-1c62-44cb-bf04-660bd88cd74d",
"revision_end": null,
"revision_start": "2015-04-17T11:18:48.696288Z",
"started_at": "2015-04-17T11:18:48.696275Z",
"type": "generic",
"user_id": "bd3a1e52-1c62-44cb-bf04-660bd88cd74d"

The resource is created with the UUID provided by the user. Gnocchi handles the history of the resource, and that's what the revision_start and revision_end fields are for. They indicates the lifetime of this revision of the resource. The ETag and Last-Modified headers are also unique to this resource revision and can be used in a subsequent request using If-Match or If-Not-Match header, for example:

GET /v1/resource/generic/75c44741-cc60-4033-804e-2d3098c7d2e9 HTTP/1.1
If-Not-Match: "e3acd0681d73d85bfb8d180a7ecac75fce45a0dd"
HTTP/1.1 304 Not Modified

Which is useful to synchronize and update any view of the resources you might have in your application.

You can use the PATCH HTTP method to modify properties of the resource, which will create a new revision of the resource. The history of the resources are available via the REST API obviously.

The metrics properties of the resource allow you to link metrics to a resource. You can link existing metrics or create new ones dynamically:

POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
"id": "AB68DA77-FA82-4E67-ABA9-270C5A98CBCB",
"metrics": {
"temperature": {
"archive_policy_name": "low"
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D"
HTTP/1.1 201 Created
Location: http://localhost/v1/resource/generic/ab68da77-fa82-4e67-aba9-270c5a98cbcb
ETag: "9f64c8890989565514eb50c5517ff01816d12ff6"
Last-Modified: Fri, 17 Apr 2015 14:39:22 GMT
Content-Type: application/json; charset=UTF-8
"created_by_project_id": "cfa2ebb5-bbf9-448f-8b65-2087fbecf6ad",
"created_by_user_id": "6aadfc0a-da22-4e69-b614-4e1699d9e8eb",
"ended_at": null,
"id": "ab68da77-fa82-4e67-aba9-270c5a98cbcb",
"metrics": {
"temperature": "ad53cf29-6d23-48c5-87c1-f3bf5e8bb4a0"
"project_id": "bd3a1e52-1c62-44cb-bf04-660bd88cd74d",
"revision_end": null,
"revision_start": "2015-04-17T14:39:22.181615Z",
"started_at": "2015-04-17T14:39:22.181601Z",
"type": "generic",
"user_id": "bd3a1e52-1c62-44cb-bf04-660bd88cd74d"

Haystack, needle? Find!

With such a system, it becomes very easy to index all your resources, meter them and retrieve this data. What's even more interesting is to query the system to find and list the resources you are interested in!

You can search for a resource based on any field, for example:

POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
"=": {
"user_id": "bd3a1e52-1c62-44cb-bf04-660bd88cd74d"

That query will return a list of all resources owned by the user_id bd3a1e52-1c62-44cb-bf04-660bd88cd74d.

You can do fancier queries such as retrieving all the instances started by a user this month:

POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
Content-Length: 113
"and": [
"=": {
"user_id": "bd3a1e52-1c62-44cb-bf04-660bd88cd74d"
">=": {
"started_at": "2015-04-01"

And you can even do fancier queries than the fancier ones (still following?). What if we wanted to retrieve all the instances that were on host foobar the 15th April and who had already 30 minutes of uptime? Let's ask Gnocchi to look in the history!

POST /v1/search/resource/instance?history=true HTTP/1.1
Content-Type: application/json
Content-Length: 113
"and": [
"=": {
"host": "foobar"
">=": {
"lifespan": "1 hour"
"<=": {
"revision_start": "2015-04-15"

I could also mention the fact that you can search for value in metrics. One feature that I will very likely include in Gnocchi 1.1 is the ability to search for resource whose specific metrics matches some value. For example, having the ability to search for instances whose CPU consumption was over 80% during a month.

Cherries on the cake

While Gnocchi is well integrated and based on common OpenStack technology, please do note that it is completely able to function without any other OpenStack component and is pretty straight-forward to deploy.

Gnocchi also implements a full RBAC system based on the OpenStack standard oslo.policy and which allows pretty fine grained control of permissions.

There is also some work ongoing to have HTML rendering when browsing the API using a Web browser. While still simple, we'd like to have a minimal Web interface served on top of the API for the same price!

Ceilometer alarm subsystem supports Gnocchi with the Kilo release, meaning you can use it to trigger actions when a metric value crosses some threshold. And OpenStack Heat also supports auto-scaling your instances based on Ceilometer+Gnocchi alarms.

And there are a few more API calls that I didn't talk about here, so don't hesitate to take a peek at the full documentation!

Towards Gnocchi 1.1!

Gnocchi is a different beast in the OpenStack community. It is under the umbrella of the Ceilometer program, but it's one of the first projects that is not part of the (old) integrated release. Therefore we decided to have a release schedule not directly linked to the OpenStack and we'll release more often that the rest of the old OpenStack components – probably once every 2 months or the like.

What's coming next is a close integration with Ceilometer (e.g. moving the dispatcher code from Gnocchi to Ceilometer) and probably more features as we have more requests from our users. We are also exploring different backends such as InfluxDB (storage) or MongoDB (indexer).

Stay tuned, and happy hacking!

-1:-- Gnocchi 1.0: storing metrics and resources at scale (Post Julien Danjou)--L0--C0--April 21, 2015 03:00 PM

Eric James Michael Ritz: Luacheck

Today I want to briefly talk about Luacheck. The program performs static analysis on Lua code, acting as a linter. Since my game development consists of code primarily written in Lua this program has quickly become an attractive tool.

Once installed you can run Luacheck on a series of files, or an entire directory and all of its sub-directories. It produces output like so, taken directly from the project page:

$ luacheck src extra_file.lua another_file.lua
Checking src/good_code.lua               OK
Checking src/bad_code.lua                Failure

    src/bad_code.lua:3:23: unused variable length argument
    src/bad_code.lua:7:10: setting non-standard global variable embrace
    src/bad_code.lua:8:10: variable opt was previously defined as an argument on line 7

Checking src/python_code.lua             Syntax error

    src/python_code.lua:1:6: expected '=' near '__future__'

Checking extra_file.lua                  Failure

    extra_file.lua:3:18: unused argument baz
    extra_file.lua:4:8: unused loop variable i
    extra_file.lua:13:7: accessing uninitialized variable a
    extra_file.lua:14:1: value assigned to variable x is unused
    extra_file.lua:21:7: variable z is never accessed

Checking another_file.lua                Failure

    another_file.lua:2:7: unused variable height
    another_file.lua:3:7: accessing undefined variable heigth

Total: 10 warnings / 1 error in 5 files

As you can see, Luacheck not only finds syntax errors—nice for game development to catch those early (as with any software)—but it also warns you on a number of potential problems. From the output above you can see how it catches unused variables, access to uninitialized variables, defining non-standard globals, and so forth. There are a variety of command-line options to control what Luacheck reports but the default settings have proven satisfactory enough in my initial testings.

For Emacs Users

Flycheck is a terrific on-the-fly code checking package for Emacs. It comes with built-in support for Lua that will use Luacheck, if available. So if you’re a developer who uses Emacs, like myself, then enabling Flycheck in your Lua buffers will let you see Luacheck’s warnings and errors in real-time. Very useful.


That’s it. A very brief article, I know. But if you’re a Lua developer and you’ve yet to try Luacheck, give it a moment of your time. Already in my limited use I’ve found it catch mistakes earlier, and that helps me to write better code more efficiently by weeding out those errors quickly.

-1:-- Luacheck (Post ericjmritz)--L0--C0--April 21, 2015 12:04 PM

punchagan: Playing music using mpsyt from Emacs

I've started using the wonderful mpsyt to play any music from youtube, since I'm not really interested in the video. But, since I use emacs for chat/IRC, I end up getting youtube links into emacs and opening them opens them up in my browser. I ended up writing some elisp to play the songs from within an instance of mpsyt running inside an emacs buffer.

(defun pc/short-url-at-point ()
  "Gets the short url at point.

This function is required only because
`thing-at-point-url-at-point' ignores urls (without a scheme)
that don't start with www."
  (let ((bounds (thing-at-point-bounds-of-url-at-point t)))
    (when (and bounds (< (car bounds) (cdr bounds)))
      (buffer-substring-no-properties (car bounds) (cdr bounds)))))

(defun pc/mpsyt-url (url)
  (let ((buffer (current-buffer))
	(mpsyt-proc-name "*mpsyt*"))

    ;; Start a new term with *mpsyt* if there isn't one
    (unless (get-process mpsyt-proc-name)
      (when (get-buffer mpsyt-proc-name)
	(kill-buffer (get-buffer mpsyt-proc-name)))
      (ansi-term "mpsyt" "mpsyt"))

    ;; Play given url in mpsyt
    (let ((mpsyt-proc (get-process mpsyt-proc-name)))
      ;; If something is already playing, stop it and play this...
      (term-send-string mpsyt-proc "\n\n\n")
      ;; We wait for a bit, since looking for the prompt seems to fail, sometimes?
      (sleep-for 1)
      (term-send-string mpsyt-proc "\n")

      ;; Actually send the command to playurl
      (term-simple-send (get-process mpsyt-proc-name)
			(format "playurl %s" url)))

    (switch-to-buffer buffer)))

(defun pc/mpsyt-url-at-point ()
  "Play the URL at point using mpsyt."
  (let ((url (or (url-get-url-at-point) (pc/short-url-at-point))))
    (if (not url)
      (message "No URL found")
	(message (format "Playing %s with mpsyt" url))
      (pc/mpsyt-url url))))

The current version of mpsyt crashes when run from inside emacs due to a bug in the code to get the terminal size, which should be fixed once this patch is merged.

I would've expected thing-at-point-url-at-point to be able to find urls even when they don't have a schema, but it tries to guess the schema from urls and fails to work when the url starts with instead of

I started off using the command-line interface of mpsyt by running it using shell-command or start-process. But, it seemed useful to have a buffer of mpsyt to switch to – easier to search for new music, repeating songs, etc. Not all tasks/actions are achievable through mpsyt's command line args.

I ended up writing more code than I thought I would have to1. But, I'm pretty happy with how this all works, right now.



- Isn't it true, more often than not?

-1:-- Playing music using mpsyt from Emacs (Post punchagan)--L0--C0--April 20, 2015 06:17 PM

Endless Parentheses: Better backspace during isearch

I’ve never been too pleased with the default behaviour of Backspace during isearch. If the last key you hit was C-s, then it does the same as C-r (albeit with less repetition), and if your match failed several characters ago, you need to hit it that many times to get back on track. Fortunately, asmeurer took the time to phrase this problem I barely realised I had.

In response, Drew provides a command to:

  1. delete the entire portion of isearch string that doesn’t match,
  2. if everything matches, fallback on deleting last char instead of moving backwards.

I’ll let you follow the link for the code, but I’ll say I had to use a different keybind for it to work.

(define-key isearch-mode-map (kbd "<backspace>") 

Comment on this.

-1:-- Better backspace during isearch (Post)--L0--C0--April 20, 2015 12:00 AM

Ryan Rix: Learning Elisp by Solving My Own Problems

I've wanted to build a strong knowledge of Lisp and functional programming for a while, what better way to do it than to solve my own interview questions?
-1:-- Learning Elisp by Solving My Own Problems (Post)--L0--C0--April 18, 2015 12:00 AM

sachachua: Emacs Hangout 2015-04-15 show notes

We chatted about packages, packaging, databases, and the upcoming Emacs conference.

Event page:

What’s this Emacs Hangout thing about? This is an informal way for Emacs geeks to get together and swap tips/notes/questions. You can find the previous Hangouts or sign up for the mailing list at .

Upcoming Emacs Hangouts:

Emacs Lisp Development Tips with John Wiegley
April 28, 2015 Tue 4:00 PM Toronto time (8 PM GMT)

Emacs Hangout
April 30, 2015, at 2 PM Toronto time (6 PM GMT, 8 PM CET):

Want to find out about upcoming hangouts? You can sign up for notifications at or follow the Emacs conferences and hangouts page.

Timestamps are approximate since I was a little distracted. =)

  • 0:25:14 8:26 PM whoops, forgot to keep track of stuff. Before this: conversation about Unity/C#/etc. in Emacs; Spacemacs
  • 0:26:33 Howard demonstrates literate database queries with a remote SQL server. SSH tunnel + –protocol=tcp
  • 0:28:55 Naming the results of queries and then using them in a different calculation
  • 0:30:39 Hmm, might be a good technique for exploring old databases
  • 0:31:13 sx.el – StackExchange client
  • 0:34:16 howdoi-emacs
  • 0:34:57 sx setup, sx-tab-all-questions
  • 0:35:59 hydra sample use cases: opening files and directories, changing the quotation of strings, mode switching
  • 0:37:30 clone indirect buffers
  • 0:39:35 Cask
  • 0:43:27 use-package
  • 0:44:57 paradox
  • 0:49:11 packages
  • 0:56:02 Emacs conference stuff
  • 1:05:11 weird Emacs things =)
  • 1:07:43 Next up: literate config (Dylan, Sean)
  • 1:13:19 wrapped up

Text chat and links:

me 8:08 PM By the way, we can use this text chat as a backchannel. After the chat, I’ll copy it and share it with the show notes so that other people can grab links.
Howard Abrams 8:14 PM Here is my investigation of my save hooks in case you can kick off some sort of script:
me 8:15 PM External to Emacs, but possibly interesting:
Dylan Thiedeke 8:16 PM You said there was a ruby-guard? I will have to look into that for authoring and editing cookbooks and recipes for use with Chef
me 8:17 PM ?
Dylan Thiedeke 8:18 PM Awesome! Will definitely be looking at that thanks Sacha
Swaroop C H 8:20 PM csharp layer – ?
M. Ian Graham 8:21 PM Nice link Swaroop, I’ll see if I can pull it in
me 8:25 PM
Swaroop C H 8:26 PM
Sod Oscarfono 8:32 PM +1 for being a bassist!
M. Ian Graham 8:32 PM
Howard Abrams 8:32 PM Here is the blog post about the literate database work:
me 8:34 PM
Zachary Kanfer 8:48 PM There’s an Emacs song: and
Samer Masterson 8:53 PM gimmie a sec, getting headphones
me 8:56 PM Question from a viewer: Why would someone use both Cask and use-package at the same time ?
Sod Oscarfono 8:57 PM i’m an ex-event manager… i’d be keen on helping get one happening in oceania
me 8:57 PM Oooooh
Sod Oscarfono 8:57 PM nz or aus maybe
Samer Masterson 8:57 PM
Dylan Thiedeke 8:57 PM Sod I’m in AU. Not qualified enough to present but would help out if I could
Sod Oscarfono 8:59 PM thanks Dylan. perfect/ any ideas on a rough idea of numbers of emacs users globally? by region? hard to quantify i realise but are we talking hundreds, thousands, hundreds of thousands do you think? keen as Samer… i’m nowhere near as proficient with emacs, or programming as most here but i have many other skills.. event management, audio engineer, graphic design and close connection with large format commercial printer
Dylan Thiedeke 9:03 PM Sod in Australia I couldn’t even imagine a number. Maybe poll the #emacs IRC channel on friend and the emacs group on G+
me 9:03 PM Sod: Woohoo! Awesomeness.
Dylan Thiedeke 9:04 PM Sod I’m not a programmer either but use emacs for documentations and starting to use it for project management with org-mode etc
Sod Oscarfono 9:04 PM community is the magic word when talking to me
Samer Masterson 9:04 PM
Sod Oscarfono 9:05 PM feel free to add me Dylan we can fire some ideas back and forth. maybe a poll of interest in a local conf or meetup
me 9:06 PM Sod, Dylan: Neato!
Howard Abrams 9:07 PM I’m sorry, but I have to leave as well. Thanks for the fun and I will listen to the rest later.

The post Emacs Hangout 2015-04-15 show notes appeared first on sacha chua :: living an awesome life.

-1:-- Emacs Hangout 2015-04-15 show notes (Post Sacha Chua)--L0--C0--April 16, 2015 01:37 AM

emacspeak: HowTo: Log Speech Server Output To Aid In Developing TTS Servers

HowTo: Log TTS Server Output To Aid In TTS Server Development

1 HowTo: Log TTS Server Output To Aid In TTS Server Development

This is mostly of interest to developers of Emacspeak speech servers. This article outlines how one can log TTS server output to a file. The loggeds record all commands send by Emacspeak to the TTS server. It is best to generate the logs in an Emacs session that is separate from the Emacs session where you are developping your code. This keeps the logs short, and makes isolating problems much easier.

1.1 How It Works

The emacspeak/servers directory now contains log_<tts-name> servers for the various supported speech servers. When selected, these log-speech servers produce no speech output; instead, they output the speech server commands received from Emacspeak to a file in /tmp named tts-log-$$. Once you're done logging, you can examine this file from the primary Emacs session.

1.2 Typical Workflow

Assume you want to see the speech-server commands sent by Emacs when you perform a specific action, in this instance, pressing C-e m to execute command emacspeak-speak-mode-line.

  1. In a separate Linux console or X-Window, launch Emacs with Emacspeak loaded — this is separate from your primary Emacs session.
  2. In this Emacs session, use C-e d d (command dtk-select-server) and select log-<tts-name> as the speech server, where tts-name corresponds to the speech engine you're testing.
  3. Emacspeak will now start the logging server, and fall silent; all commands sent by Emacspeak to the speech-server will be logged to a file in /tmp.
  4. Press C-e m – to produce the log output you want to see.
  5. Use command _emacspeak-emergency-tts-restart to get speech back.
  6. Open a dired buffer on /tmp, press s to sort files by date, and find your generated log output at the top of the list.
  7. Note: It is useful to configure your default speech engine via Custom – see user option emacspeak-emergency-tts-server. It provides a quick-fire means to get speech back if you ever switch to a speech-server that fails for some reason.

Share And Enjoy

Date: <2015-04-15 Wed>

Author: raman

Created: 2015-04-15 Wed 17:33

Emacs (Org mode 8.2.10)


-1:-- HowTo: Log Speech Server Output To Aid In Developing TTS Servers (Post T. V. Raman ( 16, 2015 12:37 AM

Phillip Lord: m-buffer 0.11

m-buffer is a package which provides a high-level convienience API for interacting, searching and changing the contents of an Emacs buffer. It abstracts away from Emacs’ use of global state, and provides list-orientated operations removing the need for explicit looping.

Hence, we can replace:

(while (re-search-forward "foo" nil t)
     (replace-match "bar"))


 (m-buffer-match (current-buffer) "foo")

m-buffer also protects global state, so the first form actually needs to be something closer to:

  (goto-char (point-min))
    (while (re-search-forward "foo" nil t)
      (replace-match "bar"))))

There have been a few changes since the 0.10 release [1]. The interface has been improved slightly (in a backward compatible way). In addition some error-checking has been added to pick up what I think was counter-intuitive behaviour. So, previously:

(m-buffer-match-page (current-buffer) :regexp "this")

would return all matches to “this” rather than pages.

The biggest change, however, has been the full use of lenticular source documentation [2], which provides a richer explanation of the code base. At the moment, I think that this is very usable, although I am aware that it is less clean than, for example, the documentation for dash, but it still is a nice demonstration of how lenticular text can work.


  1. P. Lord, "m-buffer.el 0.10", An Exercise in Irrelevance, 2015.
  2. P. Lord, "Lentic Doc — self documenting source for emacs", An Exercise in Irrelevance, 2015.
-1:-- m-buffer 0.11 (Post Phillip Lord)--L0--C0--April 15, 2015 04:45 PM

Bryan Murdock: Mercurial Offers More Choice Than Git

I know, I know, this is the emacs vs. vi debate of our age, never to be settled and pointless to continue arguing.  I'm going to write just a little more about mercurial as compared to git (or git as compared to mercurial, whichever is less inflammatory to say) because today I realized something and I need to write about it.

I've been using mercurial daily at work for a good 5 years now and not much git.  I recently had cause to use git a little more  and I realized something.  The common belief is that git is Freedom and mercurial is tightly constrained Bondage.  I think that is mostly based on a very outdated understanding of how mercurial works and what you can do with it.  Today it has all the same commit and history editing functionality of git with record, amend, graft, rebase, histedit, and so forth commands built-in.  Mercurial is not missing flexibility and freedom enhancing functionality that git has, as far as I know.  The thing I realized is that today's mercurial actually has more freedom and flexibility than git.  Using git I felt like I was being constrained to work in the way Linus does.  For example, I really don't feel the need for the index, especially when you are able to amend commits or do all sorts of other editing of commits with rebase, yet, there's really no way around it, with git you have to use the index.  With mercurial you can choose to have index-like functionality, or not.  With git you have one way to keep track of branches, using the reference-like things that git calls branches.  These come with all the complexity and confusion of remote tracking branches and local branches and fast-forward merges (that are not really merges) and so forth.  With mercurial you have three choices for keeping track of branches, a couple of which are much more simple and easy to use than git branches. I like having these options.

I guess I can't think of anything else right now, both tools are very similar in functionality and both offer far, far more freedom and power than any other version control tool that I know of.  I'm sure git users will comment and tell us where git is more flexible than mercurial.
-1:-- Mercurial Offers More Choice Than Git (Post Bryan ( 14, 2015 05:04 PM

Timo Geusch: GNU Emacs 24.5 on (X)ubuntu 14.10

GNU Emacs 24.5 was released on April 10th. I’m in the process of setting up a dual boot Windows/Linux machine right now as I’m slowly moving away from Mac OS X, mainly because of the cost of the hardware but also because I don’t like it that much as a Unix-y development environment anymore. Xubuntu… Read More »

The post GNU Emacs 24.5 on (X)ubuntu 14.10 appeared first on The Lone C++ Coder's Blog.

-1:-- GNU Emacs 24.5 on (X)ubuntu 14.10 (Post Timo Geusch)--L0--C0--April 14, 2015 04:58 AM

Grant Rettke: Emacs, Calendars, Google, and Org Mode

This post has a few nice links. emacs-calfw is calendar framework for Emacs. google-maps displays Google Maps directly inside Emacs. org-gcal.el synchronizes org-mode with Google Calendar.

-1:-- Emacs, Calendars, Google, and Org Mode (Post Grant)--L0--C0--April 14, 2015 01:07 AM

Endless Parentheses: (Very Late) SX.el Announcement, and more launcher-map

SX.el, the awesome Emacs client for the StackExchange network, has been stable and happy for many months now, and it’s about time I mentioned it here. We have put considerable effort into making the interface intuitive, teaching you how to use it without the need for explanations. In fact, it would probably be a disservice to the package for me to post a tutorial, so I won’t just yet. Instead, I’ll just urge you to give it a try.

After installing it from Melpa, the only thing you need to do is authenticate with M-x sx-authenticate. Once that is done, you’re ready to invoke any of the entry commands.

The main command is sx-tab-all-questions. But that’s so many letters, we simply must to bind it to a key. And if you read the post title, you know where I’m going with this.

;; Ordered by frequency of use, for no particular reason.
(define-key launcher-map "qq" #'sx-tab-all-questions)
(define-key launcher-map "qi" #'sx-inbox)
(define-key launcher-map "qo" #'sx-open-link)
(define-key launcher-map "qu" #'sx-tab-unanswered-my-tags)
(define-key launcher-map "qa" #'sx-ask)
(define-key launcher-map "qs" #'sx-search)

Before signing off, I will also bring to your attention the magnitude of the SX.el feature set. This is not just a cute toy that lets you browse or search questions. The client has so many features it could take the website itself in a fight. Voting, editing, commenting, answering, asking, deleting, inbox viewing, and source code font-locking are all things that just popped into my head. And that’s without mentioning a host of Emacs-oriented features like tabbing through buttons, or folding (hiding) comments like org headlines.

I’m probably saying too much already, let’s leave some content for future posts. If you have any questions or would like to give feedback, Sean, Jonathan and I are always floating around our Gitter chat room (and we do love to hear compliments).

Comment on this.

-1:-- (Very Late) SX.el Announcement, and more launcher-map (Post)--L0--C0--April 13, 2015 12:00 AM

Got Emacs?: Emacs 24.5 released

In what is  a bug fix release, Emacs 24.5 is out.
-1:-- Emacs 24.5 released (Post sivaram ( 11, 2015 05:41 AM

Flickr tag 'emacs': 2015-04-08b Spectrum of Awesomeness - Emacs Conference -- index card #emacs #emacsconf #spectrum

sachac posted a photo:

2015-04-08b Spectrum of Awesomeness - Emacs Conference -- index card #emacs #emacsconf #spectrum

-1:-- 2015-04-08b Spectrum of Awesomeness - Emacs Conference -- index card #emacs #emacsconf #spectrum (Post sachac ( 10, 2015 01:27 AM

Chen Bin (redguardtoo): Use git-timemachine with Evil

git-timemachine is simple.

After "M-x git-timemachine", a new read-only buffer is created and I need only use six key bindings: "n", "q", "p", "w", "W", "g".

The problem is I'm using Evil. How to make git-timemachine's key bindings override Evil's?

I consulted the issue with Frank Fischer.

The solution is simple. Insert below code into ~/.emacs:

;; @see
(eval-after-load 'git-timemachine
     (evil-make-overriding-map git-timemachine-mode-map 'normal)
     ;; force update evil keymaps after git-timemachine-mode loaded
     (add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps)))

I also recommend reading his in-depth discussion on general handling of keybindings conflict between evil and other minor modes.

-1:-- Use git-timemachine with Evil (Post Chen Bin)--L0--C0--April 09, 2015 11:47 PM

sachachua: 2015-04-08 Emacs Lisp Development Tips with John Wiegley

You can find John Wiegley on Twitter (@jwiegley) or at

0:00:00 Paredit mode. Start with it from day 1! Matching pairs of parentheses, won’t let you delete one without the other. Inserts appropriate newlines, too
0:03:56 Emacs as a Lisp environment. (Also, Helm is what’s responsible for the display.) Evaluating a function makes it available in the global scope, which has all these functions and commands you can do. This makes it easy to iteratively develop your functions, because you can just execute things directly.
0:05:08 Without (interactive), you can’t call functions with M-x. You can use M-: or put the call in your scratch buffer.
0:06:00 command-log-mode
0:06:47 pp-eval-last-sexp. Check out for other config things
0:07:14 debugging. e to evaluate within the current context. Also, stepping, quit.
0:08:09 Edebug with C-u C-M-x. Interactive debugging. SPC moves you forward, one Lisp form at a time. It shows you results in the minibuffer. You can descend into Lisp forms or go into functions. ? shows keybindings. Check out the Emacs Lisp chapter on EDebug, highly recommendeg.
0:09:25 You can also use the (debug) form to go to the debugger.
0:10:26 eldoc: Seeing arguments in the minibuffer as you type, because no one remembers all the arguments anyway. eldoc-mode, or add (turn-on-eldoc-mode) to your config.
0:11:30 What functions should you call in the first place? What concepts? Emacs predates many standard terms, so that’s why things are a little confusing. Ex: “frames” and “windows” are not what you might think they are. OS window = frame. Area within Emacs = window. Opposite of HTML. Use the Emacs tutorial C-h t.
0:13:04 Read the Emacs Lisp intro, which you can get to with C-h i (which lists the manuals that are available). Read the Emacs Lisp manual too.
0:14:03 Other weird terms: point, mark, marker. (point) vs (point-marker).
0:15:35 C-h f (describe-function) shows the help for the function. Nearly all functions you’ll probably call are documented well. Lots of options. Check out C-h f for interactive, for example.
0:17:17 C-h v (describe-variable).
0:17:46 More in-depth documentation: C-h i, go to the Emacs Lisp manual, then use i to view the index.
0:18:22 info-lookmore shows you the Info documentation for the symbol under point. Works for other Lisps too (ex: Common Lisp)
0:19:46 Sanity-checking paired parentheses with M-x check-parens. Handy for adding to your after-save-hook in Emacs Lisp mode.
0:20:40 Paredit editing capabilities. Ex: C-k kills the current sexp. paredit-raise-sexp replaces the parent sexp with the following sexp. slurping and barfing. Barfing – spitting out an element from the list form. C-{ or C-} (with suggested keybindings). C-( and C-) are slurping, which pulls forms in. Works for strings, too.
0:22:38 Maximum barfage and slurpage. Useful for slurping everything in, for example. paredit-slurp-all-the-way-forward.
0:24:13 redshank (companion to paredit) for refactoring. Ex: redshank-condify-form converts an if to a cond for when you realize you’ve got more than two conditions.
0:25:05 M-1 M-( surround the next one thing with parens
0:25:25 redshank: wrap a let, change if to a when, etc.
0:25:52 C-h k (describe-key) shows what a keyboard shortcut or menu item will do.
0:27:26 Took a while to get used to paredit, but you eventually get into the zen of paredit.
0:27:54 Linter – M-x elint-current-buffer. Loads every module that your code depends on (so the first time is slow), and then shows you style notes.
0:28:50 C-q for manually inserting parentheses
0:29:10 Helm, which shows you all the other stuff that matches your query. Lets you select by regex, multiple patterns, etc. Much nicer and more interactive.
0:30:29 Profiler M-x elp-instrument-function, then call the function, then elp-results will show you the time it took to execute. Results aggregate, and are reset when you call elp-results.
0:32:30 Measuring memory consumption. Also, internal representation of lists. reverse vs. nreverse. Like nconc, nreverse, setcar, setcdr. This can greatly speed up your code, if you can avoid using the garbage collector. EmacsWiki – memory-use-counts, but not particularly helpful? Another package that extends the Emacs Lisp profiler? Avoid premature optimization.
0:38:55 elint and flycheck? flycheck’s designed for external processes, so that might be a challenge. Possibility: use async to spawn another Emacs? Doesn’t seem to be available yet.
0:40:40 ert
0:48:11 testcover,, undercover.el
0:48:13 Read Emacs Lisp manual, etc.
0:48:20 Creating a mode. You don’t have to make it from scartch – start by copying someone else, and then strip away everything you don’t want.
0:49:58 checkdoc – checks the style of your documentation strings.
0:51:30 defining a minor mode
0:56:08 when to define a major mode – structure of your buffer

The post 2015-04-08 Emacs Lisp Development Tips with John Wiegley appeared first on sacha chua :: living an awesome life.

-1:-- 2015-04-08 Emacs Lisp Development Tips with John Wiegley (Post Sacha Chua)--L0--C0--April 08, 2015 09:09 PM

Chen Bin (redguardtoo): Code search in Emacs

After shutdown of Google Code Search, I turned to plain google search instead.

For example, if I want to search Emacs Lisp code. I google "keyword filetype:el".

"el" is the file extension of Emacs Lisp file.

Since I use Emacs for everything, it's natural to search code in Emacs.

So here is my solution.

Step 1, install w3m and its Emacs wrapper.

Step 2, insert below code into ~/.emacs:

(defun w3m-get-url-from-search-engine-alist (k l)
  (let (rlt)
    (if (listp l)
      (if (string= k (caar l))
          (setq rlt (nth 1 (car l)))
        (setq rlt (w3m-get-url-from-search-engine-alist k (cdr l)))))

(defun w3m-set-url-from-search-engine-alist (k l url)
    (if (listp l)
      (if (string= k (caar l))
          (setcdr (car l) (list url))
        (w3m-set-url-from-search-engine-alist k (cdr l) url))))

;; C-u S g RET <search term> RET in w3m
(setq w3m-search-engine-alist
      '(("g" "" utf-8)
        ;; stackoverflow search
        ("q" "" utf-8)
        ;; elisp code search
        ("s" ""  utf-8)
        ;; wikipedia
        ("w" "" utf-8)
        ;; online dictionary
        ("d" "" utf-8)
        ;; javascript search on
        ("j" "" utf-8)))

(defun w3m-google-by-filetype ()
  (unless (featurep 'w3m)
    (require 'w3m))
  (let ((thing (if (region-active-p)
                   (buffer-substring-no-properties (region-beginning) (region-end))
                 (thing-at-point 'symbol)))
        (old-url (w3m-get-url-from-search-engine-alist "s" w3m-search-engine-alist))
    (when buffer-file-name
      (setq new-url (replace-regexp-in-string
                     (concat "filetype:" (file-name-extension buffer-file-name))
      (w3m-set-url-from-search-engine-alist "s" w3m-search-engine-alist new-url))
    ;; change the url to search current file type
    (w3m-search "s" thing)
    ;; restore the default url
    (w3m-set-url-from-search-engine-alist "s" w3m-search-engine-alist old-url)))

Step 3, `M-x w3m-google-by-filetype`. Either the selected region or the symbol under cursor will be searched.

-1:-- Code search in Emacs (Post Chen Bin)--L0--C0--April 08, 2015 01:09 PM

Eric James Michael Ritz: Organizing Key-Bindings in GNU Emacs Using Hydra

Today I want to give you a brief introduce to Hydra. It is a great package for managing groups of key-bindings. The author is Oleh Krehel, known as ‘abo-abo’ in the Emacs community. Don’t be surprised if the name sounds familiar, as he is a prolific Emacs Lisp programmer.

Why Use Hydra?

I like to create groups of key-bindings with a common prefix. For example, all of my keys to change major-modes begin with C-c m. All of my text-mode related commands begin with C-c t. And so on. I find this to be an efficient system, and Hydra exists for people like me, as its documentation says:

This is a package for GNU Emacs that can be used to tie related commands into a family of short bindings with a common prefix – a Hydra.

So if you have similar preferences then I think you’ll like what you’re about to see.

My Example Hydras

Creating a ‘hydra’, a group of bindings, begins with the defhydra macro. Here is an example from my own Emacs configuration:

(defhydra hydra-major (:color blue)
  ("t" text-mode "text")
  ("d" diff-mode "diff")
  ("l" lua-mode "lua")
  ("p" php-mode "php")
  ("m" markdown-mode "markdown"))

(global-set-key (kbd "C-c m") 'hydra-major/body)

Now when I press C-c m I see this in the minibuffer. It’s probably not too hard to work backwards from the result to understand the syntax of defhydra. The first argument, hydra-major, is the name of the key-binding group. The macro uses that name when defining some other functions, like the hydra-major/body function that I bind to my prefix of choice in order to evoke the hydra.

Next are any options. I’ll return to explain :color blue momentarily.

Then comes text to display for the hydra. I use a simple string but you can get pretty fancy.

And finally are the heads of the hydra: the single letter keys which invoke a given major mode. The basic format is (key mode hint-text), but again the package supports more complex definitions if you need or want them.

Now back to :color blue. Notice in my example that the letters for each mode choice are in blue. This is not purely aesthetic; the color indicates what the hydra will do after the choice. Blue options end the hydra choices. In otherwords, once I select a blue option my choices are over and the hydra vanishes from the minibuffer. The default behavior, however, is for the hydra to remain active and allow you to select other heads. This can be useful for toggling multiple minor-modes and/or invoking a series of commands. For example, this is also from my personal configuration:

(defhydra hydra-text ()
  ("f" auto-fill-mode "fill")
  ("a" align-regexp "align" :color blue)
  ("i" ispell-buffer "ispell" :color blue)
  ("l" visual-line-mode "line")
  ("t" typo-mode "typo"))

(global-set-key (kbd "C-c t") 'hydra-text/body)

Here only two commands are explicitly marked as blue. The rest default to red, which means I can invoke them multiple times without cutting off the hydra. For example, after pressing C-c t I can press f to toggle auto-fill-mode, then t to toggle typo-mode, then f again if I changed my mind about using auto-fill-mode, and finally i to spell-check the entire buffer, which would close the hydra since that’s one of the blue commands. Or C-g if I were done with the red commands and didn’t want to use a blue one.

Further Reading

That should give you a nice taste of what’s possible with defhydra. But I have only scratched the surface. At this point you should check out the official project page along with the author’s blog for his articles about how he uses Hydra. I hope you find it as useful as I have for organizing key-bindings.

-1:-- Organizing Key-Bindings in GNU Emacs Using Hydra (Post ericjmritz)--L0--C0--April 07, 2015 04:42 AM

Got Emacs?: Emacs 24.5 third release candidate out

The third (and hopefully last) release candidate for the 24.5 release
of Emacs is out.
-1:-- Emacs 24.5 third release candidate out (Post sivaram ( 06, 2015 04:36 PM

Grant Rettke: key-combo and the Spread of Great Ideas

I love watching great ideas percolate through the file editor ecosystem. My cup of tea is Emacs, so I notice it most there, but it happens all over the place. For example EasyMotion appeared in VIM and jumped to Emacs AceJump and then to IntelliJ (and all its children). If you are an Emacs user then you also see it happen a lot between modes.

For example ESS has this nice feature of evaluating the current line or region and stepping forward. It probably sounds so simple to you that you would question its value. Oh yea, you know LISP, so you get it that simple is powerful. Obviously that idea will spread to every mode for every language, and here is how, eval-in-repl.

Today’s story-unfolding for me has to do with setting up your key bindings in order from least to most disruptive to your hands and arm position. Xah Lee gave me the idea. Here is how I do it. key-chord is what made it possible for me. It was so uplifting to start using it. My personal workflow was so improved and I didn’t think any more about how to make it better or how key-chord might serve other purposes. Then I read about key-combo.

It does what key-chord does. OK, that is great. It does a little more though. It cycles through through symbols, too. Why do I care? In ESS the function `ess-smart-S-assign’ helps you deal with assignments in R. At some point, both R and S used the underscore for assignment. The naming standards in R are OK with using underscores in names as separators, too. So what should happen when you hit underscore in ESS mode? When you hit underscore, it starts cycling through ‘<-' and '_'. It makes total sense and it is totally expected. That is nice. key-combo lets you easily do the same thing wherever you want.

I want to cycle through umlaut-accented vowels. I want to cycle through escaped and non-escaped symbols in LaTeX mode (here is one way in org). I want to cycle through through the different equality functions in our favorite languages (=, eq?, eqv?, and equal?) using only the = key. So, I will.

This thing called EMACS is really a vehicle for fun. This thing called ALEC is really a vehicle for the expression of creativity. What a treat to be here to do so collaboratively with all of you fine human beings!

-1:-- key-combo and the Spread of Great Ideas (Post Grant)--L0--C0--April 04, 2015 04:08 PM