Irreal: An Emacs Lisp Based Common Lisp

Lars Brinkhoff has a really interesting project up at GitHub. It’s emacs-cl, a Common Lisp implemented in Emacs Lisp. This probably isn’t all that useful but it sure is awesome. As far as I can tell, it’s a pretty complete. CLOS and pretty printing are missing but it has lexical closures, packages, multiple values, bignums, adjustable arrays, and other CL features.

This is one of those things that is noteworthy not because it’s going to change your life or be particularly useful but because it shows what a tool you already have can do. It’s often said that Emacs Lisp is crippled and not powerful enough to do real work. Guys like Nic Ferrier and Kris Jenkins have already put the lie to that notion but here is yet another example of what Emacs Lisp can do.

I’ve said several times that Emacs is the closest thing we have to a Lisp machine but mostly we don’t pursue that aspect of Emacs. Brinkhoff’s project reminds us that Emacs really does provide a Lisp environment and that the Lisp it provides is far from toothless.

-1:-- An Emacs Lisp Based Common Lisp (Post jcs)--L0--C0--April 17, 2014 12:20 PM

Grant Rettke: Indenting new curly bracket blocks with smartparens for R

Emacs speaks statistics handle indentation for curly bracket blocks quite well. My preference was to have, after inserting matching opening and closing curly brackets, a newline with the cursor indented one block in. This post in particular describes the solution; it worked fine as of today.

Addendum: 2014-04-17

Here is the code snippet from the above link:

(sp-local-pair 'c++-mode "{" nil :post-handlers '((my-create-newline-and-enter-sexp "RET")))
 
(defun my-create-newline-and-enter-sexp (&rest _ignored)
  "Open a new brace or bracket expression, with relevant newlines and indent. "
  (newline)
  (indent-according-to-mode)
  (forward-line -1)
  (indent-according-to-mode))
-1:-- Indenting new curly bracket blocks with smartparens for R (Post Grant)--L0--C0--April 16, 2014 10:00 PM

Irreal: Emacs 24.4 Pretest

The first pretest of Emacs 24.4, Emacs 24.3.90, is available via FTP at the GNU Emacs archive. This the first of an expected 6 or so pretest releases leading up to Emacs 24.4.

The Emacs devs are now in bug quashing mode so if you don’t mind life on the bleeding edge, download the pretest and help find the remaining bugs.

-1:-- Emacs 24.4 Pretest (Post jcs)--L0--C0--April 16, 2014 12:22 PM

Got Emacs?: Emacs 24.4 first pretest released

From the emacs-devel list, the first emacs pretest is out for testing.  Please do take it for a spin.  The Win binaries will come in a few days.
-1:-- Emacs 24.4 first pretest released (Post sivaram (noreply@blogger.com))--L0--C0--April 14, 2014 04:22 PM

sachachua: Emacs beginner resources

Sometimes it’s hard to remember what it’s like to be a beginner, so I’m experimenting with asking other people to help me with this. =) I asked one of my assistants to look for beginner tutorials for Emacs and evaluate them based on whether they were interesting and easy to understand. Here’s what she put together! – Sacha

Emacs #1 - Getting Started and Playing Games by jekor
Probably the most helpful Emacs tutorial series on YouTube. Goes beyond the “what to type” how-tos that other tutorials seem bent on explaining over and over. Emphasizes games and how they help users familiarize themselves with the all-keyboard controls. 5/5 stars

Org-mode beginning at the basics
What it says on the tin. Essential resource for those who are new to Emacs and org-mode. Provides steps on how to organize workflow using org-mode written in a simple, nontechnical, writing style. 5/5 stars

Xah Emacs Tutorial
Though the landing page says that the tutorial is for scientists and programmers, beginners need not be intimidated! Xah Emacs Tutorial is very noob-friendly. Topics are grouped under categories (e.g. Quick Tips, Productivity, Editing Tricks, etc.) Presentation is a bit wonky though. 4.5/5 stars

RT 2011: Screencast 01 – emacs keyboard introduction by Kurt Scwehr
Keyboard instruction on Emacs from the University of New Hampshire. Very informative and also presents some of the essential keystrokes that beginners need to memorize to make the most out of the program. But at 25 mins, I think that the video might be too long for some people. 4/5 stars

Emacs Wiki
Nothing beats the original- or in this case, the official- wiki. Covers all aspects of Emacs operation. My only gripe with this wiki is that the groupings and presentation are not exactly user-friendly (links are all over the place!), and it might take a bit of time for visitors to find what they are looking for. 4/5 stars

Mastering Emacs: Beginner’s Guide to Emacs
The whole website itself is one big tutorial. Topics can be wide-ranging but it has a specific category for beginners.
whole website itself is one big tutorial. Looks, feels, and reads more like a personal blog rather than a straightforward wiki/tutorial. 4/5 stars

Jessica Hamrick’s Absolute Beginner’s Guide to Emacs
Clear and concise. Primarily focused on providing knowledge to people who are not used to text-based coding environments. It covers a lot of basic stuff, but does not really go in-depth into the topics. Perfect for “absolute beginners” but not much else. 3/5 stars

Jim Menard’s Emacs Tips and Tricks
Personal tips and tricks from a dedicated Emacs user since 1981. Not exactly beginner level, but there’s a helpful trove of knowledge here. Some chapters are incomplete. 3/5 stars

Emacs Redux
Not a tutorial, but still an excellent resource for those who want to be on the Emacs update loop. Constantly updated and maintained by an Emacs buff who is currently working on a few Emacs related projects. 3/5 stars

Jeremy Zawodny’s Emacs Beginner’s HOWTO
Lots of helpful information, but is woefully not updated for the past decade or so. 2/5 stars

This list was put together by Marie Alexis Miravite. In addition, you might want to check out how Bernt Hansen uses Org, which is also pretty cool.

The post Emacs beginner resources appeared first on sacha chua :: living an awesome life.

-1:-- Emacs beginner resources (Post Marie Alexis Miravite)--L0--C0--April 14, 2014 12:00 PM

sachachua: Emacs Chat: Tom Marble

Emacs Chat: Tom Marble – Invoicing with Org and LaTeX; Clojure

Guest: Tom Marble

Tom Marble’s doing this pretty nifty thing with Org Mode, time tracking, LaTeX, and invoice generation. Also, Clojure + Emacs, and other good things. Enjoy!

For the event page, you may click here.

Want just the audio? Get it from archive.org: MP3

Check out Emacs Chat for more interviews like this. Got a story to tell about how you learned about or how you use Emacs? Get in touch!

The post Emacs Chat: Tom Marble appeared first on sacha chua :: living an awesome life.

-1:-- Emacs Chat: Tom Marble (Post Sacha Chua)--L0--C0--April 11, 2014 01:26 AM

Mickey Petersen: Dired Shell Commands: The find & xargs replacement

If you’re a Linux/BSD user you probably do most of your bulk operations on files with the command line tools find ... -exec or find ... | xargs — but there’s a much better way. Dired (M-x dired or C-x d), Emacs’s DIRectory EDitor, can do the same but in a very intuitive way. I’ve talked about Dired before: how to work with files spread out across many directories and editable dired buffers that will persist the changes made to filenames and permissions in the buffer.

Of all the hidden gems in Dired, this is one of my favourites: the ability to run arbitrary shell commands on marked files — and if it’s a file extension known to Dired, it will suggest a default action: untarring .tar.gz files; displaying .pdf files; and much more!

Installing Dired-X

The latter functionality is buried in dired-x, an add-on for Dired that… ships with Emacs but isn’t enabled by default.

To use dired-x you must load it first.

(add-hook 'dired-load-hook
          (lambda ()
            (load "dired-x")))

You can also just (require 'dired-x) somewhere in your init file.

Using Emacs’s Guess Shell Command functionality

To apply a shell command to marked files press !. If you have no marked files Dired will apply the shell command to the file or directory point is on. Dired will suggest a list of defaults (navigate the choices with M-n and M-p) and if Dired-x is loaded it will set a default action so you just press enter to apply it.

Dired-x ships with a fairly large repository of common operations on files and you can add your own by modifying the alist dired-guess-shell-alist-user.

Running Arbitrary Shell Commands

Another little-known feature of Dired’s shell command functionality is that you can write your own one-off commands but run each command per marked file or collect (and separated by whitespace, like in the shell) them all and pass them to a single instance of the command.

Some shell commands accept many files per command and others just one. You can use two wildcard operators (* and ?) in a Dired shell command and that will determine how Dired constructs the external shell command(s).

Let’s say I want to call the external script foo.py. My shell command can be constructed in two ways. And let’s assume I have two files marked in Dired: hello.txt and world.txt.

If the command foo.py only accepts a single file argument I can use ? as the substitution variable. So foo.py ? will give us the following expanded commands:

foo.py hello.txt
foo.py world.txt

If I had used * in lieu of the ? substitution variable then the entire list of marked files would have been inserted with whitespaces separating each file, like so:

foo.py hello.txt world.txt

Note: You must separate the substitution variable with spaces or it won’t work right!

If you want your calling shell to expand the * as a globbing wildcard you must type *"" instead.

Finally, you can dictate whether the shell commands should be executed synchronously or asynchronously.

By default the commands are called synchronously unless you append &, ; or ;&. However, they are not all alike. If you are operating on multiple files (that is, you are using the ? substitution variable) then & will make the shell commands execute in parallel as well! If the command ends in ; or ;& then the commands are executed sequentially, one after another but still asynchronously.

Dired’s shell command functionality is particularly powerful if you want to apply the shell commands on files spread out across multiple directories as it eliminates the need for find in all but the most complex searches. My article on how to work with files spread out across many directories shows you how you can find files across directories and display them in a “merged” dired buffer. Combined with the Dired shell command I just talked about and you can replace most external find ... -exec command patterns. If you think find is painful to use simply use Dired’s extremely powerful file marking functionality and off you go.

Share

-1:-- Dired Shell Commands: The find & xargs replacement (Post mickey)--L0--C0--April 10, 2014 04:30 PM

Chen Bin (redguardtoo): popup function your cursor is in

Which Func Mode will display the current function name in the mode line.

But I can’t use it.

It’s because I reduce my mode-line into minimum to make it work with my tiny netbook.

Showing the function in header is also not possible because it conflicts with my color theme.

So I choose to display the function name in a popup.

Insert below code into ~/.emacs,

(autoload 'which-function "which-func")
(autoload 'popup-tip "popup")

(defun copy-yank-str (msg)
  (kill-new msg)
  (with-temp-buffer
    (insert msg)
    (shell-command-on-region (point-min) (point-max)
                             (cond
                              ((eq system-type 'cygwin) "putclip")
                              ((eq system-type 'darwin) "pbcopy")
                              (t "xsel -ib")
                              ))))

(defun popup-which-function ()
  (interactive)
  (let ((msg (which-function)))
    (popup-tip msg)
    (copy-yank-str msg)
    ))

The extra bonus is “popup-which-function” will also insert the function name into clipboard and kill ring.

The above code need package “popup.el” to be installed.

Screen shot: http://blog.binchen.org/wp-content/uploads/2014/04/wpid-pop-which-func-nq8.png

-1:-- popup function your cursor is in (Post chenbin0)--L0--C0--April 08, 2014 12:59 PM

Chen Bin (redguardtoo): paste string from clipboard into minibuffer in Emacs

First, I find “Alt-Y” is easier to press when paste string into minibuffer than old “Shift+Insert”. “Ctrl-V” is not supported in some terminals.

Second, intergrating some command line clipboard tool into Emacs is better than Emacs X clipboard. Command line tool works in any environment. For example, when you log into a remote server with ssh, your local computer could share clipboard with your Emacs in remote shell. Please note in this example, you need using X11 forward over ssh, usually it’s already set up on server.

Here is the code:

(defun paste-from-x-clipboard()
  (interactive)
  (shell-command
   (cond
    (*cygwin* "getclip")
    (*is-a-mac* "pbpaste")
    (t "xsel -ob")
    )
   1)
  )

(defun my/paste-in-minibuffer ()
  (local-set-key (kbd "M-y") 'paste-from-x-clipboard)
  )

(add-hook 'minibuffer-setup-hook 'my/paste-in-minibuffer)
-1:-- paste string from clipboard into minibuffer in Emacs (Post chenbin0)--L0--C0--April 08, 2014 12:17 PM

Alex Schroeder: Homebrew Problems

I’ve been using Homebrew on our Mac for a while now. I like it very much. I’ve recently run into an issue, though. Sending emails from Emacs stopped working. I was getting was this:

Opening STARTTLS connection to `fencepost.gnu.org:25'...failed
network-stream-get-response: Wrong type argument: processp, nil

The important setting to remember to learn more is this:

(setq smtpmail-debug-info t)

Resent the mail and switch to a buffer called *trace of SMTP session to fencepost.gnu.org*.

There:

220 fencepost.gnu.org ESMTP Exim 4.71 Mon, 07 Apr 2014 01:00:52 -0400
250-fencepost.gnu.org Hello 178-83-163-103.dynamic.hispeed.ch [178.83.163.103]
250-SIZE 52428800
250-PIPELINING
250-AUTH CRAM-MD5
250-STARTTLS
250 HELP

Process smtpmail deleted
dyld: Library not loaded: /usr/local/lib/libnettle.4.7.dylib
  Referenced from: /usr/local/bin/gnutls-cli
  Reason: image not found

Process smtpmail trace/BPT trap: 5

Oops, it seems that I uninstalled something that gnutls required!

Time to check things:

alex@Megabombus:/usr/local/bin (master)$ brew update
...
alex@Megabombus:/usr/local/bin (master)$ brew upgrade nettle
Error: nettle-2.7.1 already installed
alex@Megabombus:/usr/local/bin (master)$ brew upgrade gnutls
Error: gnutls-3.2.12.1 already installed
alex@Megabombus:/usr/local/bin (master)$ ls /usr/local/lib/libnettle.*
/usr/local/lib/libnettle.4.5.dylib /usr/local/lib/libnettle.a
/usr/local/lib/libnettle.4.dylib   /usr/local/lib/libnettle.dylib
alex@Megabombus:/usr/local/bin (master)$ brew reinstall gnutls
==> Reinstalling gnutls
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gnutls-3.2.
Already downloaded: /Library/Caches/Homebrew/gnutls-3.2.12.1.mavericks.bottle.tar.gz
==> Pouring gnutls-3.2.12.1.mavericks.bottle.tar.gz
🍺  /usr/local/Cellar/gnutls/3.2.12.1: 931 files, 8,4M
alex@Megabombus:/usr/local/bin (master)$ brew reinstall nettle
==> Reinstalling nettle
Warning: nettle-2.7.1 already installed, it's just not linked
alex@Megabombus:/usr/local/bin (master)$ brew link  nettle
Linking /usr/local/Cellar/nettle/2.7.1... 16 symlinks created
alex@Megabombus:/usr/local/bin (master)$ gnutls-cli --version
gnutls-cli 3.2.12
Copyright (C) 2000-2014 Free Software Foundation, and others, all rights reserved.
This is free software. It is licensed for use, modification and
redistribution under the terms of the GNU General Public License,
version 3 or later <http://gnu.org/licenses/gpl.html>


Please send bug reports to:  <bugs@gnutls.org>

That seems to have fixed it!

I wonder how this happened in the first place.

Tags: RSS RSS

-1:-- Homebrew Problems (Post)--L0--C0--April 07, 2014 05:40 AM

Julien Danjou: Doing A/B testing with Apache httpd

When I started to write the landing page for The Hacker's Guide to Python, I wanted to try new things at the same time. I read about A/B testing a while ago, and I figured it was a good opportunity to test it out.

A/B testing

If you do not know what A/B testing is about, take a quick look at the Wikipedia page on that subject. Long story short, the idea is to serve two different version of a page to your visitors and check which one is getting the most success. When you found which version is better, you can definitely switch to it.

In the case of my book, I used that technique on the pre-launch page where people were able to subscribe to the newsletter. I didn't have a lot of things I wanted to test out on that page, so I just used that approach on the subtitle, being either "Learn everything you need to build a successful Python project" or "It's time you make the most out of Python".

Statistically, each version would be served half of the time, so both would get the same number of view. I then would build statistics about which page was attracting the most subscribers. With the results I would be able to switch definitively to that version of the landing page.

Technical design

My Web site, this Web site, is entirely static and served by Apache httpd. I didn't want to use any dynamic page, language or whatever. Mainly because I didn't want to have something else to install and maintain just for that on my server.

It turns out that Apache httpd is powerful enough to implement such a feature. There are different ways to build it, and I'm going to describe my choices here.

The first thing to pick is a way to balance the display of the page. You need to find a way so that if you get 100 visitors, around 50 will see the version A of your page, and around 50 will see the version B of the page.

You could use a random number generator, pick a random number for each visitor, and decides which page he's going to see. But it turns out that I didn't find a way to do that with Apache httpd at first sight.

My second thought was to pick the client IP address. But it's not such a good idea, because if you got visitors from, for example, people behind a company firewall, they are all going to be served the same page, so that kind of kills the statistics.

Finally, I picked time based balancing: if you visit the page on a second that is even, you get version A of the page, and if you visit the page on a second that is odd, you get version B. Simple, and so far nothing proves there are more visitors on even than odd seconds, or vice-versa.

The next thing is to always serve the same page to a returning visitor. I mean that if the visitor comes back later and get a different version, that's cheating. I decided the system should always serve the same page once a visitor "picked" a version. To do that, it's simple enough, you just have to use cookies to store the page the visitor has been attributed, and then use that cookie if he comes back.

Implementation

To do that in Apache httpd, I used the powerful mod_rewrite that is shipped with it. I put 2 files in the books directory, named either "the-hacker-guide-to-python-a.html" and "the-hacker-guide-to-python-b.html" that got served when you requested "/books/the-hacker-guide-to-python".

RewriteEngine On
RewriteBase /books
 
# If there's a cookie called thgtp-pre-version set,
# use its value and serve the page
RewriteCond %{HTTP_COOKIE} thgtp-pre-version=([^;])
RewriteRule ^the-hacker-guide-to-python$ %{REQUEST_FILENAME}-%1.html [L]
 
# No cookie yet and…
RewriteCond %{HTTP_COOKIE} !thgtp-pre-version=([^;]+)
# … the number of seconds of the time right now is even
RewriteCond %{TIME_SEC} [02468]$
# Then serve the page A and store "a" in a cookie
RewriteRule ^the-hacker-guide-to-python$ %{REQUEST_FILENAME}-a.html [cookie=thgtp-pre-version:a:julien.danjou.info,L]
 
# No cookie yet and…
RewriteCond %{HTTP_COOKIE} !thgtp-pre-version=([^;]+)
# … the number of seconds of the time right now is odd
RewriteCond %{TIME_SEC} [13579]$
# Then serve the page B and store "b" in a cookie
RewriteRule ^the-hacker-guide-to-python$ %{REQUEST_FILENAME}-b.html [cookie=thgtp-pre-version:b:julien.danjou.info,L]


With that few lines, it worked flawlessly.

Results

The results were very good, as it worked perfectly. Combined with Google Analytics, I was able to follow the score of each page. It turns out that testing this particular little piece of content of the page was, as expected, really useless. The final score didn't allow to pick any winner. Which also kind of proves that the system worked perfectly.

But it still was an interesting challenge!

-1:-- Doing A/B testing with Apache httpd (Post Julien Danjou)--L0--C0--April 06, 2014 10:20 PM

Emacs Redux: which-function-mode

Every developer is sometimes in the following situation - you’re inside the definition of something like a class or method, but the name of the class or method is not currently into view, but you’d very much like to know/see it. You can obviously scroll up and see what you need to, but there’s a simpler way to see the name you’re looking for - the built-in mode which-function-mode.

When which-function-mode is active you’ll see in the center of your modeline the name of the definition your cursor is currently in. Here’s the mode in action:

And here’s how to enable it:

1
(which-function-mode)

That way which-function-mode will be active in all major modes that support it. If you want to enable it only in specific modes you can do so like this:

1
2
(add-to-list 'which-func-modes 'ruby-mode)
(add-to-list 'which-func-modes 'emacs-lisp-mode)

By default ??? will be displayed when which-function-mode cannot determine the name (perhaps because you’re not actually in a definition or due to implementation limitations). You can change this to something else like this:

1
(setq which-func-unknown "n/a")

And what if you don’t like to have the definition name displayed in the mode-line? There’s a solution for you as well (suggested by Sebastian Wiesner). Use the following bit of code:

1
2
3
4
5
6
7
8
;; Show the current function name in the header line
(which-function-mode)
(setq-default header-line-format
              '((which-func-mode ("" which-func-format " "))))
(setq mode-line-misc-info
            ;; We remove Which Function Mode from the mode line, because it's mostly
            ;; invisible here anyway.
            (assq-delete-all 'which-func-mode mode-line-misc-info))

And you’ll get the following result:

That’s all for today, folks! Hack Emacs Lisp & prosper!

-1:-- which-function-mode (Post)--L0--C0--April 05, 2014 12:33 PM

Got Emacs?: Some interesting Emacs threads and LaTeX news

C K Kashyap posited some new requirements on code folding and there were a number of interesting responses culminating with a link to HideRegion.  You probably should stick to hide-show or OutlineMode and venture into these solutions only if there is a use case that is not met by hide-show. :)

Did you forget to enable auto-fill while writing text?  No worries, you can fix the written text with a simple C-x h M-q .

Have some file and project management stuff that you want Emacs to handle?  Here's a thread on what one user would like to see as project management that he wants emacs to do some heavy lifting. Might be worth your time to check it out.

BTW, there's a new site pgfplots.net for fantastic LaTeX plotting by the LaTeX guru Stefan Kottwitz.  You should check it out and contribute your pgfplots to it.
-1:-- Some interesting Emacs threads and LaTeX news (Post sivaram (noreply@blogger.com))--L0--C0--April 01, 2014 05:48 PM

Ben Simon: Getting Back In Touch With My E-mail Roots - A Little Gmail Integration With Emacs

For the majority of my e-mail consuming life, I lived in emacs. First RMAIL, then Gnus. I was threading conversations before Gmail was a glint in anyone's eye. These days, though, I live in the Gmail universe (whether it's Google Apps for business or plain old Gmail for personal). And for the most part, life is good. Every once in a while I'll consider switching back to using emacs full time, but it just doesn't seem like the benefits are there (heresy, I know).

Then it hit me: maybe I can get some benefits of e-mail from emacs (mainly, super quick access without having to lift my fingers off the keyboard) without doing a big switch. That is, configure emacs for sending of e-mail and not worry about the reading side of things.

A quick Google search turned up this configuration, and I thought my setup was going only require a few seconds of work. Alas, it wasn't so simple.

I ran into a number of issues: First, Google requires either SSL or TLS encryption for sending of e-mail. I spent a bunch of time trying to get GnuTLS to run on my Windows environment. It seems like all the pieces are there, but I kept running into issues. While I was fiddling with this, I ran into another problem: Verizon FIOS blocks outgoing port 25. Not a huge deal, as you can switch to port 587, but it did cause me to scratch my head as to why my connection was just timing out.

Finally, as I was just about to give up on my dreams of emacs e-mail, I remembered that I've got a second option for encryption: SSL. I went ahead and installed stunnel as a Cygwin package and setup the following configuration:

# Inspired by: https://www.stunnel.org/pipermail/stunnel-users/2012-April/003695.html 
client = yes
output = stunnel-log.txt
debug = 7
options = NO_SSLv2
options = NO_SSLv3

# SERVICE-LEVEL OPTIONS
[SMTP Gmail]
 accept = 465
 connect = smtp.gmail.com:465

I then kicked off stunnel and set the following up in emacs:

(setq send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "localhost")
(setq smtpmail-smtp-service 465)
(setq user-mail-address "ben@ideas2executables.com")

I was then able to hit Control-x m, type a message and hit Control-c Control-c to send it off. Emacs prompted me for my SMTP credentials (which is my gmail login) and to my shock and amazement, it worked.

I can now tap out quick message from emacs, all without messing with my existing e-mail setup. It may not be as exciting as the day I finally got Gnus setup the way I wanted it, but it's a step in the right direction.

-1:-- Getting Back In Touch With My E-mail Roots - A Little Gmail Integration With Emacs (Post Ben Simon)--L0--C0--April 01, 2014 12:18 PM

Dev and Such [Emacs Category]: Emacsagist

I recently released Emacsagist, an Emacs front-end for searching Packagist.

You can download Emacsagist via the MELPA repository with M-x list-packages or Cask. From there, you can run M-x emacsagist-search, type in a search term, and Emacsagist will give you search results. You can press return on any package name to get full details.

Now there's one less reason to leave Emacs for PHP developers.

-1:-- Emacsagist (Post)--L0--C0--March 31, 2014 08:06 PM

Grant Rettke: Org Manual

The org-mode manual lives here.

-1:-- Org Manual (Post Grant)--L0--C0--March 31, 2014 07:25 PM

Chmouel: Announcing the (Paris (Emacs) Meetup) Group

I am lucky to sit in front of Julien Danjou at work and as the sole Emacs users on the side of our office it was come to our attention that we needed as emacsian to unite ourselves to preach the good parole of the church of Emacs and sexy mens.

It was quite obvious that the only way to convince those in the unkown was to find an excuse for drinks good food between good people and set-up a meetup.

And since eNovance have now a very new fancy office with a large room to organise geeky (or not) oriented meetups, it was just a perfect time.

Within three clicks, three steps of dancing and after 10 minutes trying to do that straight from Emacs before coming back to a modern web browser (Emacs users are pragmatic) the Parisian OpenStack User Group
opened.

This is with great success, In less than 5 days we had already 50 members and an informal drink-up organised for thursday.

So if you are based in Paris and you have a love for Emacs or just want to discover what’s that all about come join the group.

-1:-- Announcing the (Paris (Emacs) Meetup) Group (Post chmouel)--L0--C0--March 31, 2014 06:22 PM

emacspeak: Emacspeak Webspace: Glancing At Information On The Audio Desktop

A Web News Ticker For Emacs

1 WebSpace: A Web News Ticker For Emacs

Module Emacspeak-Webspace provides a rolling ticker of information that is automatically retrieved, cached and maintained by Emacspeak. Using this functionality, you can set up specific buffers to have interesting tidbits of information displayed automatically in the header-line; Emacspeak speaks these items of information as you switch contexts. This article explains the usage model and underlying design of Emacspeak Webspaces.

1.1 Background

The Emacspeak Webspace module was originally created in early Interaction Free Information Access (2008) because I wanted the audio equivalent of being able to quickly glance at information. Here are some aspects of visual interaction that I wanted to emulate:

  • You can quickly glance at something while switching contexts, and ignore it if it is not important.
  • The object that you glance at while switching contexts does not become an object of attention ie, the casual task remains casual, as opposed to becoming the primary task. Email is the antithesis to this model — where if you start glancing at email, it's a sufficiently strong distraction that you'll start doing email — as opposed to what you were supposed to be doing.
  • If the item you glanced at deserves further attention, you can come back to it later — and the system gives you sufficient confidence in your ability to come back to it later — note that this is essential to ensure the previous requirement.
  • Items are cached but get pushed out by newer items — this makes sure you dont feel pressured to read everything or have to explicitly catch-up — in prior systems including email and Google Reader, I always found the task of hitting catch-up without reading everything a fairly stressful experience.
  • Applied to information updates, think hallway conversations outside your office — you mostly ignore them, but sometime get drawn because you hear some specific keywords and/or concepts that draw your attention.

1.2 Early Implementation In 2009

I used the WebSpace functionality in Emacspeak for news and weather updates starting 2009; at some time in late 2009, I cut it over to get updates from my Google Reader stream. It was extremely effective for my usage pattern — I typically activated the functionality in all shell buffers. In my work style where I switch among the primary tasks of engineering (writing/reviewing code), writing/reviewing design documents, and doing email to facilitate the previous two tasks, the shell buffer is where I switch to while context-switching e.g., launching a build after writing code as an example. Having the Webspace functionality say something interesting at those times was optimal.

1.3 Initial Implementation And Design

The information to be pulled in the rolling header line is pulled from a cache — in 2009, this cache was populated from my Google Reader stream. The cache was maintained in a ring with older items falling off the end. You could optionally switch to a buffer displaying all of the currently cached items — this functionality assured me that I could always later find an item that had caught my attention while I was in the process of context switching amongst tasks. Notice that if I didn't go back and check for that item within a day, it would fall off the ring-buffer cache — and this usually would mean that it likely wasn't that important after all.

1.4 Life After Google Reader

With the passing of Google Reader last year, I started implementing the feed-reading functionality I needed in Emacspeak independent of Google Reader; see the earlier article in this blog titled Managing And Accessing Feeds On The Emacspeak Audio Desktop. Next, I updated the Emacspeak WebSpace functionality to build its cache from the set of feeds in emacspeakfeeds.

1.5 Usage Pattern

This section details my own usage pattern and set-up — this is by no means the only way to use this functionality.

  1. Emacspeak binds Webspace functionality to Hyper Space as a prefix key.
  2. Hyper Space h invokes command emacspeak-webspace-headlines — this command initializes the feed-store cache, and sets up the header-line in the current buffer to display a rolling ticker. Note that you can invoke this command in multiple buffers; those buffers will share a common headlines cache.
  3. The feed-store is updated during Emacs idle-time; I often invoke the elisp form (emacspeak-webspace-headlines-populate) to populate the cache initially. Note that depending on your network, and the number of feeds you have in emacspeak-feeds, this can block emacs for a couple of minutes.
  4. Command emacspeak-webspace-headlines-browse displays an interactive buffer containing the current set of cached headlines — this is where you go to track down a headline you heard in passing. I bind this to Super h by customizing emacspeak-super-keys.
  5. You can set up other types of information in your rolling header — something I initially used it for was weather — see command emacspeak-webspace-weather personally, I 've not found this as useful in CA given how consistently good the weather is here.
  6. For related work in Emacs, see Emacs package newsticker. That package works well with Emacspeak, but in using it earlier, I found that I could not prevent myself from starting to read content i.e., it failed to meet the glance and continue requirement.

Date: <2014-03-24 Mon>

Author: T.V Raman

Created: 2014-03-24 Mon 18:00

Emacs 24.3.50.2 (Org mode 8.2.5c)

Validate

-1:-- Emacspeak Webspace: Glancing At Information On The Audio Desktop (Post T. V. Raman (noreply@blogger.com))--L0--C0--March 26, 2014 02:40 AM

Julien Danjou: The Hacker's Guide to Python released!

And done! It took me just 8 months to do this entire book project around Python. From the first day I started writing to today, where I finally publish and sell – almost entirely – myself this book. I'm really proud of what I've achieved so far, as this was something totally new to me.

Doing all of that has been a great adventure, and I'll promise I'll write something about that later on. A making of.

For now, you can enjoy reading the book and learn a bit more about Python. I really hope it'll help you bring your Python-fu to a new level, and help you build great projects!

Go check it out, and since this is first day of sale, enjoy 20% off by using the offer code THGTP20.

-1:-- The Hacker's Guide to Python released! (Post Julien Danjou)--L0--C0--March 25, 2014 10:20 PM

Timo Geusch: I didn’t realise Emacs has an elisp repl

When it comes to Emacs, I am an amateur at best, but part of the fun is that I keep discovering new useful functionality. Thanks to a post over at Mastering Emacs, I’m now aware of ielm, which came in very handy when I was trying to build an elisp function that would automatically pull […]
-1:-- I didn’t realise Emacs has an elisp repl (Post Timo Geusch)--L0--C0--March 22, 2014 05:25 PM

Emacs Redux: A peek at Emacs 24.4: Variadic Numeric Comparison Functions

In most Lisps numeric comparison functions like =, <, >, <= and >= are variadic - meaning they accept variable number of arguments (as do functions like +, -, *, etc). Here’s an example:

1
2
3
;; let's assume that all those are numeric variables
(= x y z)
(< a b c d)

This is pretty cool and save you from writing code like:

1
2
(and (= x y) (= y z))
(and (< a b) (< b c) (< c d))

Prefix function position for the win!

In Emacs Lisp, however, all these comparison functions (unlike +, -, etc) accept just two arguments, which is somewhat unlispy. Luckily this is one of the things that’s going to change with Emacs 24.4. Emacs Lisp takes another small step to becoming a good Lisp dialect!

-1:-- A peek at Emacs 24.4: Variadic Numeric Comparison Functions (Post)--L0--C0--March 22, 2014 02:48 PM

Timo Geusch: Running Emacs from a Windows Explorer context menu

It’s one of those days, thanks to a hard disk going south I ended up having to rebuild the system drive on one of my machines. After putting the important software back on there – “Outlook and Emacs”, as one of my colleagues calls it – I had to reapply some of the usual tweaks […]
-1:-- Running Emacs from a Windows Explorer context menu (Post Timo Geusch)--L0--C0--March 21, 2014 03:16 AM

Johan Andersson: Cask v0.6

It’s time for a new Cask release. I began working on Cask v0.6 around christmas and now, over 200 commits later, it’s finally ready.

To upgrade, run:

$ cask upgrade

This release includes a lot of new features, which I will describe below.

Public API

We want to allow other packages to build upon Cask, such as Pallet. Now Cask has a nice API for that purpose.

See http://cask.github.io/api.html for more information.

Files directive

There is a new directive, called files. It specifies what files should be included when building the packages. For example:

(files "foo.el" "foo-core.el")

If the files directive is not used, it will use the default patterns from the package-build.el package.

This directive is used for two new commands build and package, see more information below.

Help for specific command

Cask has always had a cask help command to list information about each command and option. Now you can do it for a specific command, for example: cask help exec

New commands

Here are the new commands:

Improved and updated documentation

Cask has a new and improved website. See http://cask.github.io.

Fetcher dependencies

This feature allow you to install dependencies from VCS sources. I use this for my yasnippets collection. I want to use a separate repository and I don’t want to release an ELPA package for it. I’ve used a submodule for this previously, but now I simply do:

(depends-on "yasnippets" :git "https://github.com/rejeep/yasnippets.git" :files ("*" (:exclude ".git")))

See http://cask.github.io/dsl.html#depends-on for more information.

Linking

Linking is a new functionality that allow you to link a Cask dependency to a local directory.

This is useful when you want to test changes to a package. Let’s say I make changes to my f.el package, then I can link that package in another package that use f.el to make sure it really works. For example:

$ cask link f ~/Code/f.el

Run cask help link for more information about linking.

More quiet than before

Emacs is not optimal for CLI programs. It prints a lot of messages when you don’t want it. Cask now uses the shut-up package to be a bit more quiet. Unfortunately, it’s not possible to hide all output. We have reported this as an issue to the Emacs developers and hopefully they will do something about it.

If you want full output, use the --verbose option.

Path and load path pollution

Previously, the path and load-path commands included every directory in the .cask/EMACS-VERSION/elpa directory. Now it only includes package directories.

Loading only packages

Previously, if you removed a package from the Cask-file it would still be loaded when you started Emacs. Now, only the packages specified in the Cask-file are loaded.

Breaking changes

This release adds a lot of functionality, but does not break a lot of old functionality. The only thing breaking, is that the old command called package is now called pkg-file.

That’s it folks, enjoy!

-1:-- Cask v0.6 (Post)--L0--C0--March 19, 2014 07:00 AM

Chris Ball: A Robot for Timo

Here at FlightCar Engineering we’re a very small team, and one of us — Timo Zimmermann — works remotely from Heidelberg, Germany. Timo’s an expert in the web framework we use, Django, and is awesome to work with: mixing together good humour, an enjoyment of teaching and learning, and deep technical expertise.

One day a link to Double Robotics got passed around our internal chat room — it’s an unexpected use of Segway technology, putting an iPad on top of a mobile robot and letting a remote participant drive the robot around while video chatting. We keep a video chat with Timo open while at work, so we were pretty interested in this.

There wouldn’t be much point in FlightCar buying one of these robots; our local developers fit around a single desk. Still, it would be useful to be able to video chat with Timo and have him be able to choose which of us to “look” at, as well as being able to join in with office conversations in general. Could we come up with something much simpler that still has most of the advantages of the Double robot in our situation?

I have a little electronics experience (from my time at One Laptop Per Child, as well as a previous fun personal project) and recently received a Kickstarter backer RFduino. Alex Fringes and I decided to go ahead and build a basic, stable/unmoving telepresence device as a present for Timo. Here’s what we did:

Parts list

$140 Bescor MP-101 pan head with power supply and remote control
$68 RFduino “teaser kit” + prototyping shield + single AAA battery shield
$29 Rosco 8″ Snake Arm
$13 Rotolight Male 1/4″ to 1/4″ adapter
$15 Grifiti Nootle iPad mini Tripod Mount

Total: $265 USD

I’m not counting the cost of the iPad (the Double Robotics robot costs $2500 and doesn’t include an iPad either), or the tripod we’re putting the Bescor pan head on top of (I had a monopod already, and basic tripods are very cheap), but everything else we used is listed above. Here’s the final result:

How it works

The pan head is easy to control programmatically. It has a 7-pin port on the back, and four of the pins correspond directly to up/down/left/right — to move in a direction, you just apply voltage to that pin until you want to stop. This is a perfect match for an Arduino-style microcontroller; Arduino is a hobbyist electronics platform that makes it easy to cheaply prototype new hardware creations, by giving you I/O pins you can attach wires to and a simple programming interface. Local electronics hacker and Tiny Museum-cofounder Steve Pomeroy helped out by determining the pinout and soldering between the remote control port’s pins and our RFduino’s prototyping board, and Alex set to work writing the code that would run on the RFduino and iPads. We ended up with an architecture like this:

So, to expand on the diagram: Timo moves his iPhone, the orientation is sensed and passed on to our local iPad via the nodejs bridge (which exists just to proxy through NAT), which converts it into a single letter “r”, “l”, “u”, “d”, or “s” (for stop) and then the RFduino reads a character at a time over Bluetooth Low Energy and sends a voltage pulse to the appropriate pin. We chose iPhone orientation sensing as the control mechanism at Timo’s end, but you could also use explicit direction buttons, or even something like face detection.

We decided to hide the fact that we were building this from Timo and introduced it to him as a surprise, coincidentally on Valentine’s Day. We love you Timo!

Finally, we’ve put all of the code we wrote — for the RFduino, the nodejs bridge, and the local and remote iOS apps — under an open source license on GitHub, so we’ve shared everything we know about how to build these devices. We’d be very happy if other people can help improve the features we’ve started on and find a cheaper way to build more of these!

(By the way, we’re hiring for a Lead Front End Engineer in Cambridge, MA at the moment!)

-1:-- A Robot for Timo (Post cjb)--L0--C0--March 18, 2014 01:52 AM

Ivan Kanis: Messing with xterm

I spent all morning messing with xterm. It started with an innocent question that I sent to the vim mailing list. When I pressed mf in the netrw buffer I was not getting any cue that the file was marked.

Charles told me it was turning the file bold on his setup. I realized I turned off bold font in xterm because I find them ugly. In Emacs I display bold as yellow. Wouldn't it be nice if xterm did the same?

Here is how I did it:

% mkdir .terminfo
% cd .terminfo
% infocmp -I screen-256color > screen-ivan

No I can hack the escape sequence of the terminal. I replaced the bold sequence \E[1m with \E[0;33m. Vim is displaying underline in the netrw and it's not pretty. For fun I display purple instead of underline by setting smul to \E[0;35m and rmul to \E[0;37m.

Next I compile my terminfo and set my terminal:

tic screen-ivan
export TERM=screen-ivan

And here is the result on man page:

Now that I could see bold font I was surprised that vim open a plain text all in bold. Well it's due to the following setting:

hi Normal ctermfg=white

It seems straightforward but it implies that the bold font will be used. The default white in xterm is grey (color7). That is so you can see a 'bold' white with color15. Xterm implies that bold font are brighter. Since I don't care for the dull color I have set the color I want by editing ~/.Xresources like so:

XTerm*color0: black
XTerm*color1: red
XTerm*color2: green
XTerm*color3: yellow
XTerm*color4: blue
XTerm*color5: magenta
XTerm*color6: cyan
XTerm*color7: white
Xterm*colorMode: false

Now I have to redo how I specify colors in ~/.vimrc:

" colors

" (black 0) (red 1) (green 2) (yellow 3) (blue 4) (magenta 5) (cyan 6)
" (white 7) (orange 220)

" Tone down the fruit salad
hi Normal ctermfg=7
hi Comment ctermfg=2
hi Function ctermfg=6
hi Statement ctermfg=5
hi Identifier ctermfg=7
hi Number ctermfg=7
hi Operator ctermfg=7
hi PreProc ctermfg=7
hi Statement ctermfg=5
hi Special ctermfg=7
hi String ctermfg=220
hi Type ctermfg=7

Note that I am using 220 for strings. This gives me the color orange for strings. I had to compile strings with 256 colors:

./configure --prefix=/home/ivan/local --enable-colors256
make install

There is a script called 256colors2.pl that will display all the available colors. I modified it a tiny bit to display the number of the color:

And I finally fixed the highlighting of the netrw directory file with the following line in ~./vimrc

hi TabLineSel ctermfg=3
-1:-- Messing with xterm (Post Ivan Kanis)--L0--C0--March 17, 2014 12:00 AM

Jorgen Schäfer: Elpy moves to its own ELPA

Due to a long-standing bug in the Marmalade software, I was unable to upload the 1.3.0 release of Elpy to that repository in the last two weeks. For a discussion of this problem, see issue #196. To solve this problem, I have created a package archive specific to Elpy with the required packages that are not on GNU ELPA. To use this archive, add the following to your .emacs:

(require 'package)                                                              
(add-to-list 'package-archives
'("elpy" . "http://jorgenschaefer.github.io/packages/"))

This is intended as a temporary solution, but I am not sure when I have the time to work on a longer-term one. I am sorry for the inconvenience in the last weeks.

-1:-- Elpy moves to its own ELPA (Post Jorgen Schäfer (noreply@blogger.com))--L0--C0--March 16, 2014 08:26 AM

Chmouel: How do I manage my copyright headers in Emacs

My day to day being work or personal is to create OpenSource code. As an habit I have taken lately I am adding licenses to all new files I am creating.

I have historically used the `auto-insert-mode with a default template. For example for my newly created python files I would have this for configration :


;AutoInsert
(auto-insert-mode 't)
(setq auto-insert-alist '((python-mode . "python.py")))

and in my `auto-insert-directory directory there would be a python.py template with my license files.

But that’s not so smart, since I wanted to find a mechanism to switch between work email and personal emails for my copyright I needed those templates to be more dynamic.

Things with auto-insert templates taken from a directory they are not so dynamics and reading through the always excellent emacswiki page it seems that you need to `define-auto-insert the templates to get dynamic variables.

I didn’t want to go to the define-auto-insert because I am always using the yasnippet package for my snippets which has a great expansion support and a nice templating language.

As it’s mostly always the case if you have a problem you can be sure it’s already resolved by others, so a quick search on the internet leaded me to a gist file written by a guy three years ago that does exactly what I wanted :

So now that I had my header loaded from yasnippet I could add some smartness into it. I have first written this function :


(defun yas--magit-email-or-default ()
  "Get email from GIT or use default"
  (if (magit-get-top-dir ".")
      (magit-get "user.email")
    user-mail-address))

this function would check if we are in a git directory and get the user.email git configuration, if we are not it would just reply by the standard emacs variable `user-mail-address.

I have just to plug that in my template like this :


# -*- mode: snippet -*-
# name: header
# --
# -*- coding: utf-8 -*-
# Author: Chmouel Boudjnah < `(yas--magit-email-or-default)`>

and depending of my local configuration of my git repo it will add my license email according to that.

If I really needed to override the user-mail-address without using git I could always just drop a .dir-locals.el with something like this :


((nil . ((user-mail-address . "chmouel@othercompany.com"))))

which would override the default user-mail-address to whatever I want.

-1:-- How do I manage my copyright headers in Emacs (Post chmouel)--L0--C0--March 14, 2014 07:07 AM

John Sullivan: Drupal UI win

Cancel button next to Cancel link

-1:-- Drupal UI win (Post)--L0--C0--March 11, 2014 11:11 PM

Ivan Kanis: Gnus simple split unexpected feature

I used to use the fancy split. Some months ago I reduced my inboxes a lot and felt fancy split wasn't needed anymore. I ended up with something like this:

(setq nnmail-split-methods
     '(("linux-nantes" "\\([tT]o\\|[cC]c\\):.*linux-nantes@univ-nantes\\.fr")
       ("bbdb" "\\([tT]o\\|[cC]c\\):.*bbdb-info@lists\\.sourceforge\\.net")
       ("stumpwm" "\\([tT]o\\|[cC]c\\):.*stumpwm-devel@nongnu\\.org")
       ("interesting" private-is-email-in-bbdb)
       ("spam" "X-Spam-Flag: YES")
       ("boring" "")))

The idea is to put each mailing list in its separate boxes. Interesting e-mail are based on my bbdb database queried by the function private-is-email-in-bbbd.

It worked as I expected except when they were more than one positives. For example, I had someone I know in my bbdb post to the Linux Nantes mailing list. What happened is that Gnus will create an e-mail on each inbox! Clearly that's not what I want.

So I am using again the fancy splitter which does exactly what I expect. The (| statement indicates to stop a the first positive.

(setq nnmail-split-methods 'nnmail-split-fancy
      nnmail-split-fancy
      '(| (to "linux-nantes@univ-nantes\\.fr" "linux-nantes")
          (to "bbdb-info@lists\\.sourceforge\\.net" "bbdb")
          (to "stumpwm-devel@nongnu\\.org" "stumpwm")
          (: private-is-email-in-bbdb)
          ("X-Spam-Flag" "YES" "spam")
          "boring"))

Note that the syntax is much easier to read. There is no hairy regexp to match To and Cc, all that is handled by the to symbol. I had to modify private-is-email-in-bbdb to return "interesting" instead of t on success.

-1:-- Gnus simple split unexpected feature (Post Ivan Kanis)--L0--C0--March 09, 2014 12:00 AM

Raimon Grau: smart-browser

Since I discovered conkeror, I'm not using w3m that much, because conkeror works great :)

The issue is that doing any kind of web dev in conkeror is suboptimal. Its support for firebug is quite basic. One option is opening different browsers depending on the url. That makes sense, and I used this technique when I was using w3m.

But I wanted to explore a different approach. My problem is the following. Usually I want to open a url in conkeror, but if chromium is already opened, it's probably that I'm using some of the devtools, and I want to keep using it during this 'session'.

What I don't want is to have 2 browsers opened.Unless I open them manually, then, follow the preferences. Although being complex to explain, it just feels right when I use it.

So I hacked some elisp to give priorities to browsers, and use a default one when there's nothing opened.

The idea is quite simple: Just look for the browsers in order of preferences, and open the first one that is already opened. The last one is a hack, to open conkeror by default.

It's an ugly hack, but hopefully you'll learn some elisp API you didn't know :)

-1:-- smart-browser (Post Raimon Grau (noreply@blogger.com))--L0--C0--March 05, 2014 06:06 PM