William Denton: Conforguration

Conforguration is a basic working example of configuration management in Org. I use source code blocks and tangling to make shell scripts that get synced to a remote machine and then download, install and configure R from source.


conforguration.org (that’s a file, not a site) has all the code. It really did work for me, and it might work for you. Is this a reasonable way of doing configuration management? I don’t know, but it’s worth trying. I’ll add things as I come across them.

I don’t know anything about formal configuration management, and I’ve never done literate programming and tangling in Org before. Anyone who’s interested in having a go at conforguring something else is most welcome to do so!

-1:-- Conforguration (Post William Denton)--L0--C0--May 05, 2016 04:09 AM

Irreal: Multiple Org Capture Inputs

David Zuber over at Storax has a useful post on enabling multiple inputs in an Org capture template. Templates are extraordinarily useful. I have several that I use several times a day. They do have a problem, though: you can input data into only one spot in the template.

Zuber is using capture templates to implement a ticketing system for his workflow. He wants to be able to enter a project and incident number and have them replicated elsewhere in the template automatically. While that's not supported directly, it's fairly easy to implement using the custom lisp expressions that the templates do support.

I've used custom lisp expressions in the templates I use to manage my blog queue but I hadn't thought of using them to get keyboard input. It's a nice idea that makes the templates potentially more useful. If you're using capture templates, you should definitely give it a read. If you aren't using capture templates you should consider ways that they might simplify your workflow.

-1:-- Multiple Org Capture Inputs (Post jcs)--L0--C0--May 04, 2016 07:37 PM

Chen Bin (redguardtoo): Swiper/Ivy tip

Please install evil-escape at first.

When Swiper/Ivy candidate window pops up. You can press fd quickly to close the window.

fd is the default key binding from evil-escape. I changed it to kj instead.

I assign hotkey =,ii= to M-x counsel-imenu, and I can press kj to quit imenu popup. As you can see, I don't need move my fingers too much.

-1:-- Swiper/Ivy tip (Post Chen Bin)--L0--C0--May 04, 2016 08:15 AM

Grant Rettke: Why you can’t diminish auto-fill-mode

auto-fill-mode is named by auto-fill-function via magnars.

Diminish auto-fill-function instead.

-1:-- Why you can’t diminish auto-fill-mode (Post Grant)--L0--C0--May 04, 2016 12:54 AM

Irreal: Harry Schwartz on Org Mode

Harry Schwartz, who appears to have moved to Boston from New York, gave a talk at the Boston Emacs Meetup on Getting Started with Org-mode. It's not really a tutorial but a demonstration of many of Org's features and how you can use them.

Schwartz spends a lot of time on the publishing aspects, which in many ways is Org's best feature. One of the things he mentioned in the talk that I didn't know was that Org can export to the Twitter Bootstap framework. That makes it really easy to build a nice looking Web site from the comfort of Emacs and Org mode.

He also mentions Owncloud, a self-hosted file sync and share server. Schwartz describes it as a sort of private Dropbox. It allows you to sync and share files among your different devices. It's probably most useful for, say, a team but like Schwartz you can use it to keep your own machines in sync if you don't want to bother with something like Git.

The talk is about 56 minutes so schedule some time. Even if you're familiar with Org, you may learn something useful from the talk.

-1:-- Harry Schwartz on Org Mode (Post jcs)--L0--C0--May 03, 2016 06:35 PM

sachachua: 2016-05-02 Emacs News

Links from reddit.com/r/emacs, /r/orgmode, Hacker News, planet.emacsen.org, Youtube, the changes to the Emacs NEWS file, and emacs-devel.

Past Emacs News round-ups

The post 2016-05-02 Emacs News appeared first on sacha chua :: living an awesome life.

-1:-- 2016-05-02 Emacs News (Post Sacha Chua)--L0--C0--May 02, 2016 02:48 PM

Endless Parentheses: Disable Mouse only inside Emacs

As laptop touchpads seem to be steadily increasing in size, one unfortunate consequence is that it becomes increasingly harder to avoid touching them by accident while you type. Most systems have safeguards in place that disable the touchpad as you’re typing, but they always seem to fall short for me when it comes to Emacs. While in Emacs, my hands are permanently resting on the keyboard (and over the touchpad), so even if I stop typing for several seconds I don’t want the touchpad to reactivate.

There are ways to permanently deactivate the touchpad with a hotkey, but, so far, the solution that best fits my use-style is to disable it only inside Emacs.

(define-minor-mode disable-mouse-mode
  "A minor-mode that disables all mouse keybinds."
  :global t
  :lighter " 🐭"
  :keymap (make-sparse-keymap))

(dolist (type '(mouse down-mouse drag-mouse
                      double-mouse triple-mouse))
  (dolist (prefix '("" C- M- S- M-S- C-M- C-S- C-M-S-))
    ;; Yes, I actually HAD to go up to 7 here.
    (dotimes (n 7)
      (let ((k (format "%s%s-%s" prefix type n)))
        (define-key disable-mouse-mode-map
          (vector (intern k)) #'ignore)))))

All we do here is define a minor-mode that binds all mouse-related keys to ignore. This is a slight improvement over the code on this StackOverflow answer. Of course, let’s not forget to enable this.

(disable-mouse-mode 1)

Two relevant limitations:

  • This doesn’t distinguish between a touchpad an an actual mouse.
  • It is still possible for modes to define specific buttons that interact with the mouse, but that’s not a huge problem because these buttons take a small portion of the screen so it’s fairly difficult to touch them by accident.

Comment on this.

-1:-- Disable Mouse only inside Emacs (Post)--L0--C0--May 02, 2016 12:00 AM

Pragmatic Emacs: Using the zenburn theme

A few people have asked about the theme I use in Emacs, as seen in the sreenshots and code snippets I use. It is zenburn, and I find it very easy on the eye, but also has good contrast and a nice colour palette for syntax highlighting.

Install and activate the theme by adding the following to your emacs config file

(use-package zenburn-theme
  :ensure t
  (load-theme 'zenburn t))
-1:-- Using the zenburn theme (Post Ben Maughan)--L0--C0--May 01, 2016 08:17 PM

Grant Rettke: Emacs Keyboard Design 31 and 32: Give Emacs More Logical Modifiers

  • Impossible to design and fabricate a custom for a reasonable price in time and money
  • Use a XKE-128 instead

  • Rubber dome switches and caps
    • Disassembled a Dell keyboard
    • Found it had rubber dome switches (obviously, spongy)
    • Good to see and know
    • Been using them for years, and they were fine
    • Mechanical switch probably isn’t required by me
  • N-Key rollover
    • You could quickly hit
      • Control, Meta, Super, Hyper, Shift, j
    • If you designed the keyboard out to make it easy
    • 6 NKRO is probably fine
  • You must choose a keycap style
    • DSA makes it easy to try different layouts so use that
    • Cost is a big topic
    • Maybe a grab bag is a good option?
  • If you want a lot of rows and columns then you need a microcontroller with a lot of connections like the Teensy++
  • You must choose available key sizes
    • The design tools let you make a keycap any size which helps exploration
    • At build time you needs fabricated keycaps in that size
    • Easier to use pre-made caps
    • 3d printing caps is another option, but I don’t want to do that
  • Reality is that doing a custom build
    • Will require 3x iterations
    • Will cost 3x as much
    • Reviewed the Ergodox EZ and it’s not for me
      • Thoughtful ideas about OS-Hyper key
  • Might be best to use the XKE-128 instead
    • Zero fabrication costs
    • Well-built body
    • Rubber-dome is OK
    • Cherry MX compatible stems
    • No way I could built for less
      • Hobby-ish
  • Converting to XKE-128 follows
  • Make power keys 2 wide because they are available from PI or SP
  • Left align QAZ
  • Make PgUp PgDn 1w
  • Moved arrows to bottom right
  • Added CapsLock back under right super
  • Added Ultra* so had to move PgUp to each side of Enter row by shift
  • Added a space down the middle to occupy 8×16


  • Decided that it would be nice to have a space and return that went from C to M so expanded that
  • Move Alt and Gui up to middle because
    • They are important modifiers
      • Alt-Tab is always two-handed, that is OK
    • Their importance doesn’t overlap with Emacs modifiers so you use them in a cognitively different place
  • PgUp PgDn go all the way left
  • Didn’t add back ScrollLk and Break, can add later if needed
  • Swap Super and Shift
    • Muscle memory makes Shift happier as expected location
    • Makes super-shift easy negating opportunity for Super*
  • Every Emacs modifier with * appended includes shift
    • Wherever it isn’t easy to do by hand, and free keys
  • Add Hyper* to left of hyper making it one key
    • This placement of hyper makes sense if you recall the feel of the layout of a typical laptop keyboard after you made CapsLock super. Using your thumb to go to C, M, super with your pinky, and H with your thumb again are natural
    • C-s and M-s are natural
    • H-s is even natural and H*-s is doable
  • Ultra shift is easy now, so U* can go away
  • Added Xtrm key for Emacs
    • C-M-s
    • Ultra below it
  • You an go “all out” with Emacs modifiers if you like
  • H* still makes sense


-1:-- Emacs Keyboard Design 31 and 32: Give Emacs More Logical Modifiers (Post Grant)--L0--C0--May 01, 2016 11:52 AM

emacspeak: Emacspeak 44.0 (SteadyDog) Unleashed

Emacspeak 44.0—SteadyDog—Unleashed!

For Immediate Release:

San Jose, Calif., (May 1, 2016)
Emacspeak: Redefining Accessibility In The Era Of (Real)Intelligent Computing
–Zero cost of Ownership makes priceless software Universally affordable!

Emacspeak Inc (NASDOG: ESPK) --http://emacspeak.sf.net– announces the
immediate world-wide availability of Emacspeak 44.0 (SteadyDog) –a
powerful audio desktop for leveraging today's evolving data, social
and service-oriented Internet cloud.

1 Investors Note:

With several prominent tweeters expanding coverage of
#emacspeak, NASDOG: ESPK has now been consistently trading over
the social net at levels close to that once attained by DogCom
high-fliers—and as of May 2016 is trading at levels close to
that achieved by once better known stocks in the tech sector.

2 What Is It?

Emacspeak is a fully functional audio desktop that provides complete
eyes-free access to all major 32 and 64 bit operating environments. By
seamlessly blending live access to all aspects of the Internet such as
Web-surfing, blogging, social computing and electronic messaging into
the audio desktop, Emacspeak enables speech access to local and remote
information with a consistent and well-integrated user interface. A
rich suite of task-oriented tools provides efficient speech-enabled
access to the evolving service-oriented social Internet cloud.

3 Major Enhancements:

  • Enable playing multiple media streams using mplayer. 🔊
  • Smart Ladspa effects in mplayer, including panning. 🕪
  • Sound theme chimes has been spatialized to create theme pan-chimes. 🕭-
  • Package elpy has been speech-enabled. 🐍
  • Emacspeak now implements automatic soundscapes. 🏙
  • Speech-enables package helm.𝍎
  • Emacs EWW: Consume Web content efficiently. 🕷
  • Updated Info manual 🕮
  • emacspeak-url-templates: Smart Web access. ♅
  • emacspeak-websearch.el Find things fast. ♁
  • And a lot more than wil fit this margin. …

4 Establishing Liberty, Equality And Freedom:

Never a toy system, Emacspeak is voluntarily bundled with all
major Linux distributions. Though designed to be modular,
distributors have freely chosen to bundle the fully integrated
system without any undue pressure—a documented success for
the integrated innovation embodied by Emacspeak. As the system
evolves, both upgrades and downgrades continue to be available at
the same zero-cost to all users. The integrity of the Emacspeak
codebase is ensured by the reliable and secure Linux platform
used to develop and distribute the software.

Extensive studies have shown that thanks to these features, users
consider Emacspeak to be absolutely priceless. Thanks to this
wide-spread user demand, the present version remains priceless
as ever—it is being made available at the same zero-cost as
previous releases.

At the same time, Emacspeak continues to innovate in the area of
eyes-free social interaction and carries forward the
well-established Open Source tradition of introducing user
interface features that eventually show up in luser environments.

On this theme, when once challenged by a proponent of a crash-prone
but well-marketed mousetrap with the assertion "Emacs is a system from
the 70's", the creator of Emacspeak evinced surprise at the unusual
candor manifest in the assertion that it would take popular
idiot-proven interfaces until the year 2070 to catch up to where the
Emacspeak audio desktop is today. Industry experts welcomed this
refreshing breath of Courage Certainty and Clarity (CCC) at a time
when users are reeling from the Fear Uncertainty and Doubt (FUD)
unleashed by complex software systems backed by even more convoluted
press releases.

5 Independent Test Results:

Independent test results have proven that unlike some modern (and
not so modern) software, Emacspeak can be safely uninstalled without
adversely affecting the continued performance of the computer. These
same tests also revealed that once uninstalled, the user stopped
functioning altogether. Speaking with Aster Labrador, the creator of
Emacspeak once pointed out that these results re-emphasize the
user-centric design of Emacspeak; "It is the user –and not the
computer– that stops functioning when Emacspeak is uninstalled!".

5.1 Note from Aster,Bubbles and Tilden:

UnDoctored Videos Inc. is looking for volunteers to star in a
video demonstrating such complete user failure.

6 Obtaining Emacspeak:

Emacspeak can be downloaded from GitHub –see
https://github.com/tvraman/emacspeak you can visit Emacspeak on the
WWW at http://emacspeak.sf.net. You can subscribe to the emacspeak
mailing list — emacspeak@cs.vassar.edu — by sending mail to the
list request address emacspeak-request@cs.vassar.edu. The Emacspeak
is a good source for news about recent enhancements and how to
use them.

The latest development snapshot of Emacspeak is always available via
Git from GitHub at
Emacspeak GitHub .

7 History:

  • Emacspeak 44.0 continues the steady pace of innovation on the
    audio desktop.
  • Emacspeak 43.0 brings even more end-user efficiency by leveraging the
    ability to spatially place multiple audio streams to provide timely
    auditory feedback.
  • Emacspeak 42.0 while moving to GitHub from Google Code continues to
    innovate in the areas of auditory user interfaces and efficient,
    light-weight Internet access.
  • Emacspeak 41.0 continues to improve
    on the desire to provide not just equal, but superior access —
    technology when correctly implemented can significantly enhance the
    human ability.
  • Emacspeak 40.0 goes back to Web basics by enabling
    efficient access to large amounts of readable Web content.
  • Emacspeak 39.0 continues the Emacspeak tradition of increasing the breadth of
    user tasks that are covered without introducing unnecessary
  • Emacspeak 38.0 is the latest in a series of award-winning
    releases from Emacspeak Inc.
  • Emacspeak 37.0 continues the tradition of
    delivering robust software as reflected by its code-name.
  • Emacspeak 36.0 enhances the audio desktop with many new tools including full
    EPub support — hence the name EPubDog.
  • Emacspeak 35.0 is all about
    teaching a new dog old tricks — and is aptly code-named HeadDog in
    on of our new Press/Analyst contact. emacspeak-34.0 (AKA Bubbles)
    established a new beach-head with respect to rapid task completion in
    an eyes-free environment.
  • Emacspeak-33.0 AKA StarDog brings
    unparalleled cloud access to the audio desktop.
  • Emacspeak 32.0 AKA
    LuckyDog continues to innovate via open technologies for better
  • Emacspeak 31.0 AKA TweetDog — adds tweeting to the Emacspeak
  • Emacspeak 30.0 AKA SocialDog brings the Social Web to the
    audio desktop—you cant but be social if you speak!
  • Emacspeak 29.0—AKAAbleDog—is a testament to the resilliance and innovation
    embodied by Open Source software—it would not exist without the
    thriving Emacs community that continues to ensure that Emacs remains
    one of the premier user environments despite perhaps also being one of
    the oldest.
  • Emacspeak 28.0—AKA PuppyDog—exemplifies the rapid pace of
    development evinced by Open Source software.
  • Emacspeak 27.0—AKA
    FastDog—is the latest in a sequence of upgrades that make previous
    releases obsolete and downgrades unnecessary.
  • Emacspeak 26—AKA
    LeadDog—continues the tradition of introducing innovative access
    solutions that are unfettered by the constraints inherent in
    traditional adaptive technologies.
  • Emacspeak 25 —AKA ActiveDog
    —re-activates open, unfettered access to online
  • Emacspeak-Alive —AKA LiveDog —enlivens open, unfettered
    information access with a series of live updates that once again
    demonstrate the power and agility of open source software
  • Emacspeak 23.0 – AKA Retriever—went the extra mile in
    fetching full access.
  • Emacspeak 22.0 —AKA GuideDog —helps users
    navigate the Web more effectively than ever before.
  • Emacspeak 21.0
    —AKA PlayDog —continued the
    Emacspeak tradition of relying on enhanced
    productivity to liberate users.
  • Emacspeak-20.0 —AKA LeapDog —continues
    the long established GNU/Emacs tradition of integrated innovation to
    create a pleasurable computing environment for eyes-free
  • emacspeak-19.0 –AKA WorkDog– is designed to enhance
    user productivity at work and leisure.
  • Emacspeak-18.0 –code named
    GoodDog– continued the Emacspeak tradition of enhancing user
    productivity and thereby reducing total cost of
  • Emacspeak-17.0 –code named HappyDog– enhances user
    productivity by exploiting today's evolving WWW
  • Emacspeak-16.0 –code named CleverDog– the follow-up to
    SmartDog– continued the tradition of working better, faster,
  • Emacspeak-15.0 –code named SmartDog–followed up on TopDog
    as the next in a continuing series of award-winning audio desktop
    releases from Emacspeak Inc.
  • Emacspeak-14.0 –code named TopDog–was

the first release of this millennium.

  • Emacspeak-13.0 –codenamed
    YellowLab– was the closing release of the
    20th. century.
  • Emacspeak-12.0 –code named GoldenDog– began
    leveraging the evolving semantic WWW to provide task-oriented speech
    access to Webformation.
  • Emacspeak-11.0 –code named Aster– went the
    final step in making Linux a zero-cost Internet access solution for
    blind and visually impaired users.
  • Emacspeak-10.0 –(AKA
    Emacspeak-2000) code named WonderDog– continued the tradition of
    award-winning software releases designed to make eyes-free computing a
    productive and pleasurable experience.
  • Emacspeak-9.0 –(AKA
    Emacspeak 99) code named BlackLab– continued to innovate in the areas
    of speech interaction and interactive accessibility.
  • Emacspeak-8.0 –(AKA Emacspeak-98++) code named BlackDog– was a major upgrade to
    the speech output extension to Emacs.
  • Emacspeak-95 (code named Illinois) was released as OpenSource on
    the Internet in May 1995 as the first complete speech interface
    to UNIX workstations. The subsequent release, Emacspeak-96 (code
    named Egypt) made available in May 1996 provided significant
    enhancements to the interface. Emacspeak-97 (Tennessee) went
    further in providing a true audio desktop. Emacspeak-98
    integrated Internetworking into all aspects of the audio desktop
    to provide the first fully interactive speech-enabled WebTop.

8 About Emacspeak:

Originally based at Cornell (NY) —
http://www.cs.cornell.edu/home/raman —home to Auditory User
Interfaces (AUI) on the WWW, - Emacspeak is now maintained on GitHub
https://github.com/tvraman/emacspeak. The system is mirrored
world-wide by an international network of software archives and
bundled voluntarily with all major Linux distributions. On Monday,
April 12, 1999, Emacspeak became part of the Smithsonian's Permanent
Research Collection
on Information Technology at the Smithsonian's
National Museum of American History.

The Emacspeak mailing list is archived at Vassar –the home of the
Emacspeak mailing list– thanks to Greg Priest-Dorman, and provides a
valuable knowledge base for new users.

9 Press/Analyst Contact: Tilden Labrador

Going forward, Tilden acknowledges his exclusive monopoly on
setting the direction of the Emacspeak Audio Desktop, and
promises to exercise this freedom to innovate and her resulting
power responsibly (as before) in the interest of all dogs.

*About This Release:

Windows-Free (WF) is a favorite battle-cry of The League Against
Forced Fenestration (LAFF). –see
http://www.usdoj.gov/atr/cases/f3800/msjudgex.htm for details on
the ill-effects of Forced Fenestration.

CopyWrite )C( Aster, Hubbell and Tilden Labrador. All Writes Reserved.
HeadDog (DM), LiveDog (DM), GoldenDog (DM), BlackDog (DM) etc., are Registered
Dogmarks of Aster, Hubbell and Tilden Labrador. All other dogs belong to
their respective owners.

-1:-- Emacspeak 44.0 (SteadyDog) Unleashed (Post T. V. Raman (noreply@blogger.com))--L0--C0--April 30, 2016 05:51 PM

John Stevenson: Getting Started With Cider Repl for Clojure on Emacs Live

CIDER is the Clojure IDE and REPL for Emacs. It is built on top of nREPL, the Clojure networked REPL server and replaces the direct use of nREPL in Emacs.

In this article we are using CIDER that is packaged in Emacs Live, a very complete, well organised and extensible configuration for Clojure and many other things in Emacs.

CIDER includes the standard interactive code evaluation developers are used to. There are also many other features that I want to explore further, including error and warning highlighting, human-friendly stacktraces, smart code completion, definition & documentation lookup, value inspector & function tracing, interactive macroexpansion, Grimoire integration, clojure.test integration, classpath browser, namespace browser, nREPL session management, scratchpad, minibuffer code evaluation, integration with company-mode and auto-complete-mode

Emacs Live

CIDER is now the default in the latest version of Emacs Live, so there no set up to do if you already have the latest version. If you need to update, or are not sure you are on the latest version of Emacs live, simply run a git pull from within ~/.emacs.d directory:

git pull origin master

If you dont have Emacs Live, you can install it from the Emacs Live Github repository and either clone the repository into ~/.emacs.d (moving or deleting any existing directory) or preferably use the install script that also sets up a ~/.live-packs extension directory.

    bash <(curl -fksSL https://raw.github.com/overtone/emacs-live/master/installer/install-emacs-live.sh)

## Leiningen configuration

CIDER requires the use of [nREPL middleware](https://github.com/clojure-emacs/cider-nrepl) between Emacs and Leiningen. For example, when you run CIDER `M-x cider-jack-in` in Emacs it calls Leiningen to start the REPL. So you need to add a plugin to your Leiningen configuration.

Edit the `~/.lein/plugings.clj` file (or create this file if it does not exist yet) and add the `[cider/cider-nrepl "0.8.1"]` plugin. The `~/.lein/plugings.clj` should look similar to this:

{:user {:plugins [[lein-pprint "1.1.1"]
[cider/cider-nrepl "0.8.1"]]}}

You can find the available versions of the cider-nrepl plugin on Clojars.org. The plugin version should be the same version of CIDER you are using in your Emacs configuration, which at the time of writing was 0.8.1.

Running CIDER in Emacs

Either create a new Clojure project using lein new my-project-name or open an existing project in Emacs (either the project.clj file or a .clj file from src/my-project-name/).

With your cursor in the Clojure file buffer, run CIDER using the keybinding C-c M-j or the emacs command

M-x cider-jack-in

Emacs Live - CIDER jack in - C-c M-j

Alternatively, you could run a REPL using lein repl on the command line and connect to that REPL using C-c M-c or M-x cider. You will be prompted for the connection details of the running repl, ie. host, port.

Using CIDER in Emacs

There are a number of Cider keyboard shortcuts (keybindings) already defined, here are some of the most common ones I use:

  • C-c C-e - evaluates the form immediately before the cursor and shows the result in the minibuffer. So place your cursor right after the closing parentheses ) of your expression, hit the keybinding and see the minibuffer for the result.

Emacs Live - CIDER eval form with result in minibuffer - C-c C-e

  • C-c M-e - the same as above except the result is sent to the REPL

Emacs Live - CIDER eval form with result in the REPL - C-c M-e

  • C-c C-k - evaluate the whole buffer. So with the cursor in a Clojure source file, all the forms / expressions are evaluate as if the code was loaded in from scratch.

  • C-c C-d d - show the documentaion as you would with (doc function-name). Place the cursor over a function name, hit the keybinding and see the documenation for that funtion. This also works inside the REPL buffer, so no need to use (doc), which is not loaded by default.

  • C-c M-n - switch to namespace of current Clojure buffer. So with the cursor in a Clojure source file, hit the keybinding and your REPL buffer will now be in the namespace for that Clojure code.

Emacs Live - CIDER change to namespace of current Clojure code - C-c M-n

Changing into a namespace does not automatically evaluate the code in that namespace, so evaluate the whole buffer C-c C-k or evaluate specific expressions (forms) C-c M-e. Once evaluated, you can evaluate that code in the REPL.

  • M-> or M-x cider-jump-to-var prompts you for a var, a function (defn) or symbol name (def) and moves the cursor to its definition. If the cusor is already on a matching name the the cursor jumps straight to that definition.

  • C-c C-q or M-x cider-quit - close the REPL and its associated buffer.

    There are many more things you can do within Clojure files and the REPL, so take a look at the Cider keyboard shortcuts (keybindings) once you have the basics mastered.

Further reading

Some further reading around CIDER:

Thank you.

-1:-- Getting Started With Cider Repl for Clojure on Emacs Live (Post)--L0--C0--April 28, 2016 12:18 PM

John Stevenson: Github Pages for Reveal.js Slides Created With Emacs Org-Mode

In previous articles I showed how to setup Emacs Org-reveal & Reveal.js to generate your own presentations from Emacs Org-mode files. This time I’ll show you how to publish those presentations on Github Pages as I have done for my own presentations.

Github Pages are a great place for publishing your Reveal.js presentations or any static web content. For existing repositories you simply commit your content to a gh-pages branch or to the master branch of a user or organisation repository.

Github Pages are great for websites that is self-contained, in that there is no reliance on a database or other services running locally. You can even create great looking pages without any coding by using the Github authoring tool.

Existing code repositories

If you already have a repository for your code and want to add web page documentation, then you can simply add a gh-pages branch and commit your web content to that branch.

Content only repositories

If you only have content then you can use a user or organisation repository. This is a specifically named repository in the form of name.github.io where name is the exact name of your Github account or Github organisation you are part of.

In my case I created a repository named jr0cket.github.io, as my Github user account name is jr0cket.

Once created, you can type in the name of this repository into your browser and it will display any content you have committed into the repository and pushed it to Github.

Your user or org repository also forms the entry point for other project, so if you have a project called slides with web content in its gh-pages branch, you can see that content using the address: http://jr0cket.github.io/slides

Separating slide content into their own repository

As I planed to create a number of presentations, I use both an account repository as the home page and created a new repository called slides to host all my presentations.  This allows all my presentations to be easily cloned or forked by others easily without getting content that is only relevant to me on my Github pages home page.

Keeping the presentations all in one repository keeps things simple should I define my own Reveal.js themes or if there are Reveal.js updates.

I added  everything to the gh-pages branch (reveal.js, images, org & generated html files).  Then I generate the Reveal.js slides locally using org-reveal in Emacs, so I can check they look okay.  Once I am happy with the slides I commit the html and .org files to Git and push them up to Github.

Setting up a Github Pages user account repository

Creating an user repository on Github is just the same as for any other repository, except that the name must match the form name.github.io - where name is exactly the same as you Github user name.

I created a new repository called jr0cket.github.io, this has a web address (URL) of http://jr0cket.github.io

I used the Automatic Page Generator from Github to create the site without coding and with a handful of nice templates to choose from.  You can of course add your own HTML, CSS & JavaScript if you wish.  The Automatic Page Generator is in on the Settings page of your repository, under the Github pages section.  This section shows you the repository URL and a button to generate a page for you.

If you are going to use your user or org repository for your slides, then jump to the secion on “Adding Reveal.js to your repository”

Creating a repository for your Reveal.js slides

If you don’t already have a Github repository for your slides (and are not using your user or org repository), go to your account on Github and create a new repository.

git clone https://github.com/username/repository.git

Create an orphaned gh-pages branch

Github pages publishes content only from the branch gh-pages (unless you are using a user or org repository). In your local repository, create a new branch called gh-pages. According to Github, the gh-pages branch should be an orphaned branch.

cd your-local-repository
git checkout --orphan gh-pages

An orphaned branch is one that is not connected to another branch, in this case its not attached to master. Technically I don’t think gh-pages branch needs to be orphaned to publish your content, especially if there is nothing in the master branch, but this is the approach that Github recommends.

Once you have the gh-pages branch you can commit your files to that branch as normal.

git add .
git commit -m "Adding Reveal.js files for presentation"
git push origin gh-pages

Pushing your Reveal.js slides at this point will not give you the desired results, as we haven’t added the Reveal.js files to the repository.  So lets do that next.

Adding Reveal.js to your repository

You need to provide the JavaScript and CSS files from Reveal.js to make your slides display correctly.  I copy the following folders from within the reveal.js folder into the root of my slides project

cd  /path/to/revealjs/css    ~/my-slides
cd  /path/to/revealjs/js     ~/my-slides
cd  /path/to/revealjs/lib    ~/my-slides
cd  /path/to/revealjs/plugin ~/my-slides

You also need to check that the HTML for your web pages references Reveal.js files correctly.  The best way to do this is in the configuration for Emacs Org-reveal.

In my Org-reveal setup, I have defined the root for the Reveal.js files in my live-pack init.el file as follows:

(setq org-reveal-root "")

So long at this org-reveal setting is loaded, it shouldn’t matter which file you add it to in your Emacs configuration.

The HTML you generate with Org-reveal in Emacs should have references to the Reveal.js includes in the <head> section. Here is an example:

<html lang=”en”>
  <meta charset=”utf-8”/>
  <title>(My presentation title)</title>
  <meta name=”author” content=”(John Stevenson)”/>
  <link rel=”stylesheet” href=”./css/reveal.min.css”/>
  <link rel=”stylesheet” href=”./css/theme/jr0cket.cssid=”theme”/>
  <link rel=”stylesheet” href=”./css/print/pdf.csstype=”text/cssmedia=”print”/>
  <meta name=”description” content=”My presentation title“>

The final push

Then push the Reveal.js files to your Github repository (and any updated to your Org & html files)

git add .
git commit -m "Adding Reveal.js files for presentation"
git push origin gh-pages

Browsing your Slides

If you added your slides to a user or org repository, then you should be able to browse to http://name.github.io where name is your Github user or org name (eg. http://jr0cket.github.io).

If, like me, you created a seperate repository for all your slides, you can brows them by going to http://name.github.io/repo-name where name is your Github user name and repo-name is the name of the repository you added Reveal.js and your slides to (eg. http://jr0cket.github.io/slides).

Note that you need to add the html filename to the URL to browse your presentation, or as I have done add links to the page on jr0cket.github.io

Using Hub as an alternative way to create your Github pages repository

Hub is a command line tool for working with git repositories and Github. Hub makes it easy to create and fork repositories on Github without having to visit the Github website.

  • Install Hub
  • Create a folder called name.github.io on your laptop, where name is your Github user name or organisation name
  • Inside that folder, initialise a git repository - git init
  • Rename the master branch to gh-pages - git branch -m gh-pages
  • Use hub to to create the repository on github - hub create -d "optional description of the repository"
    — If you want to specify the repository name using hub, use the command form - hub create account-name.github.io -d "optional description of the repository"

  • Create and commit your content in the local repository on the gh-branch, then push the gh-pages branch to github github push -u origin gh-pages

— The -u option sets origin to be the default remote repository to and the gh-pages the default branch. So next time you do a push or pull you dont need to specify the remote repository or branch, you can simply do git push and git pull

Example Reveal.js presentations on Github pages

See my Github page for my published presentations, created with Emacs Org-mode, Org-reveal and Reveal.js.

Thank you.

-1:-- Github Pages for Reveal.js Slides Created With Emacs Org-Mode (Post)--L0--C0--April 28, 2016 12:18 PM

Wilfred Hughes: Effortless Major Mode Development

It’s now easier than ever to write major modes in Emacs. If you haven’t written a major mode in a while, or you’re just starting out, here are my three top tips:

Use regexp-opt

As of Emacs 24, regexp-opt takes a 'symbols option. You should write your font-lock keywords like this:

(defvar js-mode-font-lock-keywords
       '("var" "for" "function" "if" "else")
     . font-lock-keyword-face)

This has two advantages. By whitelisting keywords, users can quickly spot mistakes when editing:

This also prevents a classic bug where Emacs highlights substrings that happen to be keywords:

(Don’t) use company

Company is excellent, and I highly recommend it. However, not all Emacsers use company. You don’t need to force company on your users.

Instead, you can use completion-at-point-functions. Your completion functionality will work in stock Emacs, and company users will benefit too through company-capf.

Ah, but what about all the extra annotations you can supply to company? We can have our cake and eat it too:

(defun racer-complete-at-point ()
  "Complete the symbol at point."
  (unless (nth 3 (syntax-ppss)) ;; not in string
    (let* ((bounds (bounds-of-thing-at-point 'symbol))
           (beg (or (car bounds) (point)))
           (end (or (cdr bounds) (point))))
      (list beg end
            (completion-table-dynamic #'racer-complete)
            :annotation-function #'racer-complete--annotation
            :company-prefix-length (racer-complete--prefix-p beg end)
            :company-docsig #'racer-complete--docsig
            :company-location #'racer-complete--location))))

Test with assess

Historically, it’s been rather awkward to test major modes. Many authors didn’t bother.

That’s all changed with the release of assess. Assess provides great assertions with readable error messages.

For example, here’s a simple indentation test from cask-mode:

(ert-deftest cask-mode-indent-inside-development ()
  "Ensure we correctly indent inside (development ...) blocks."
  (should (assess-indentation=
           ;; before:
(depends-on \"foo\"))"
           ;; after:
 (depends-on \"foo\"))")))

Highlighting is particularly helped by assess:

(ert-deftest cask-mode-highlight-sources ()
  "Ensure we highlight known values for source."
  (should (assess-face-at=
           "(source melpa)"

If this test fails, we get a helpful message describing which faces were actually used:

#("Face does not match expected value
   Expected: cask-mode-source-face
   Actual: font-lock-keyword-face
   Location: 9
   Line Context: (source melpa)
   bol Position: 1"

These tips are all new things I’ve learnt writing a new major mode for Cask files. If you’re just getting started with Emacs development, check out adding a new language to Emacs. Finally, if I’ve missed your favourite tip, leave a comment on the /r/emacs discussion!

-1:-- Effortless Major Mode Development (Post Wilfred Hughes (me@wilfred.me.uk))--L0--C0--April 28, 2016 12:00 AM

Sebastian Wiesner: Show Magit Status window in fullscreen

When I moved back to my own Emacs configuration from Spacemacs one thing that I missed most was to have Magit’s status window cover the whole frame.

Luckily this feature is easy to reproduce with a simple entry in display-buffer-alist:

(add-to-list 'display-buffer-alist
             `(,(rx "*magit: ")
               (reusable-frames . nil)))

Unfortunately there’s no built-in display function to show a window covering the whole frame but it’s easy enough to write one:

(defun lunaryorn-display-buffer-fullframe (buffer alist)
  "Display BUFFER in fullscreen.

ALIST is a `display-buffer' ALIST.

Return the new window for BUFFER."
  (let ((window (display-buffer-pop-up-window buffer alist)))
    (when window
      (delete-other-windows window))

We simply need to get hold of any arbitrary window for the buffer, and then just delete all other windows, leaving only the window for our buffer.

That’s it. Enjoy and share :)

-1:-- Show Magit Status window in fullscreen (Post)--L0--C0--April 27, 2016 10:00 PM

Marcin Borkowski: fill-single-char-nobreak-p

Since Emacs 24 (or so), Polish-speaking users got a very nice gift: a function called fill-single-char-nobreak-p, which can be put into fill-nobreak-predicate. It prevents Emacs from breaking a line after a one-letter word when filling, which is a rule in Polish typography. Of course, when writing in LaTeX, it doesn’t matter at all, since then you use ties (tildes) to prevent breaks anyway (and there is an Emacs library called sierotki.el, which means “little orphans” in Polish, to insert those ties automatically). When writing emails (with hard line-breaks), however, this is a very useful thing.
-1:-- fill-single-char-nobreak-p (Post)--L0--C0--April 26, 2016 07:34 PM

Endless Parentheses: ANSI-colors in the compilation buffer output

Countless build tools and shell scripts use ANSI escape codes to colorize their output. This provides impressive improvements to readability when running from a terminal that supports them, but tends to cause a catastrophic mess anywhere else. Emacs’ compilation buffer is one such place. It doesn’t support ANSI colors by default, but that’s very easy to fix.

Emacs already has a library for interpreting ANSI escape. All we need is to hook it onto compilation-mode.

(require 'ansi-color)
(defun endless/colorize-compilation ()
  "Colorize from `compilation-filter-start' to `point'."
  (let ((inhibit-read-only t))
     compilation-filter-start (point))))

(add-hook 'compilation-filter-hook

Comment on this.

-1:-- ANSI-colors in the compilation buffer output (Post)--L0--C0--April 26, 2016 12:00 AM

(or emacs: Ivy 0.8.0 is out


Ivy is a completion method that's similar to Ido, but with emphasis on simplicity and customizability.

New package names

Changes on MELPA

Due to multiple requests, in an attempt to simplify things a new package ivy has been released on MELPA. The old package swiper, which used to provide most of the ivy features, now only provides swiper.el and depends on ivy. The third package counsel, which provides most of the goodies using ivy hasn't been changed and is still on MELPA. All three packages have the version 0.8.0 currently.

To reiterate the dependencies:

  • ivy depends on Emacs version larger than 24.1, preferably at least 24.3 (the most common one bundled currently with Linux distributions).
  • swiper depends on ivy and provides basically 3 commands: swiper, swiper-multi and swiper-all.
  • counsel depends on swiper and provides around 50 commands for all kinds of stuff. My favorites are counsel-M-x, counsel-git-grep, counsel-rhythmbox and counsel-grep-or-swiper.

Changes on GNU ELPA

On GNU ELPA, a single package ivy-0.8.0 has replaced the previous stable version swiper-0.7.0. This package provides all the files combined of the three separate MELPA packages.

Release summary

The release consists of 282 commits over 5 months by 15 authors. The detailed Changelog is available here, thanks to the ever useful Org mode export. The raw Org file is in doc/Changelog.org in the main repository.

The detailed documentation is available as an (ivy) Info node and also in HTML form here. If anyone wants to document something that's missing there, I'd appreciate the help: simply edit doc/ivy.org and send me a PR.

Release highlights

Below, I'll highlight some of the new features.

Allow to compose collections

For example, to stack the top 10 elements of recentf on top of counsel-locate, use this code:

(defun small-test ()
  (cl-subseq recentf-list 0 10))


Here, (original-source) represents the async candidates of counsel-locate. All extra sources are static - each function is called once to generate a list of strings, which will be filtered later.

See #373 for more info.

Improved documentation

If you're not yet familiar with Ivy, you can get a quick reference card by pressing C-h m during any completion session. It will pop up an Org-mode buffer that describes most of the minibuffer key bindings.

Additionally, C-o (hydra-ivy/body), which serves a quick reference as well, received a small restructuring and a new binding. Press D to go to the definition of this hydra. This is useful to see what each key does, you might even want to customize some of it.

Completion in region

From now on, ivy-mode will also set completion-in-region-function. This means that functions like:

  • C-M-i complete-symbol in many major modes,
  • TAB while in the M-: (eval-expression) minibuffer,
  • TAB in a shell buffer,

will use ivy for completion.

Many improvements to ivy-occur-mode

You can "permanently" save any completion session by pressing C-c C-o (ivy-occur). This will generate a new buffer in ivy-occur-mode with all your current candidates inserted there. Clicking or pressing f on any of the candidates in that buffer will result in the appropriate action being called with that candidate.


The *ivy-occur ...* buffers can actually be customized per collection type. Specifically for swiper, counsel-git-grep, counsel-grep and counsel-ag, the customizations are already in place that allow you to:

  • Edit the buffer with wgrep by pressing C-x C-q (ivy-wgrep-change-to-wgrep-mode).
  • Refresh the buffer due to the original files being changed by pressing g (ivy-occur-revert-buffer).

The second feature is often useful to me when I want to somehow change a symbol throughout the project. First I make a list of all occurrences via e.g. swiper and ivy-occur. After I went through some of the occurrences, I can press g to refresh the search for the same symbol and see how many I still have left.

Yet another cool feature is to press c (ivy-occur-toggle-calling) to toggle calling the action after each line movement and cycle through candidates by holding either j (ivy-occur-next-line) or k (ivy-occur-previous-line).

ivy-set-action can work on all commands

Here's the code I'm using currently in my config:

(defun ivy-insert-action (x)
    (insert x)))

 '(("I" ivy-insert-action "insert")))

This allows me to press M-o I to insert the current candidate into the buffer. For instance, if I want to quote an Emacs command, I can M-x (counsel-M-x), select the command I want and press M-o I to insert it instead of calling it.

Virtual views in ivy-switch-buffer

Here, "virtual" buffer means something that's close to a buffer but not an actual buffer. If you were using the setting ivy-use-virtual-buffers, you'd have your bookmarks and recentf items available to you as virtual buffers.

The new feature allows to select a whole window configuration with many buffers inside nested horizontal and vertical splits from ivy-switch-buffer.

To use it, set ivy-views, since it's nil by default. For instance, here's what I have in my config:

(setq ivy-views
      '(("dutch + notes {}"
          (file "dutch.org")
          (buffer "notes")))
        ("ivy {}"
          (file "ivy.el")
          (buffer "*scratch*")))))

For a more elaborate and detailed use, see this post by Manuel Uberti.

Magic slash in file name completion

From now on, if you want to enter a directory, simply select a candidate which is a directory and press /. You can still use the old binding C-j (ivy-alt-done), but / is shorter and easier to get used to if you're switching from Ido.

Note that this does not prevent the use of old functionality like:

  • // to enter the root directory,
  • /ssh: RET to connect via TRAMP.

A better way to search with counsel-grep-or-swiper

If you've ever been annoyed with the long start-up time of swiper in huge buffers, switch to this setting:

(global-set-key "\C-s" 'counsel-grep-or-swiper)

This command will use swiper for small buffers, and counsel-grep for large buffers.

Something very similar to this command was highlighted in this post by Karl Voit.

Just to give you an idea of how fast counsel-grep is:

  • It has 0s start-up time, since it's async.
  • For a two million line file weighing 50MB produced by copying org.el a few times, it takes 0.2s to find the 17,664 occurrences of the word hook. It still takes 7.5s to search for org in that file, simply because there are 500,000 candidates and it takes time for Emacs to simply receive that input.

A list of all new commands

The new commands since 0.7.0 are: counsel-tmm, counsel-imenu, counsel-decbinds, counsel-list-processes, ivy-switch-buffer-other-window, counsel-git-stash, counsel-git-log, counsel-pt, counsel-linux-app, counsel-ace-link, counsel-esh-history, counsel-shell-history, counsel-grep-or-swiper.

If any of those sound interesting, go ahead and try them out.


Thanks to all the contributors. Happy hacking!

-1:-- Ivy 0.8.0 is out (Post)--L0--C0--April 25, 2016 09:00 PM

sachachua: 2016-04-25 Emacs News

Links from reddit.com/r/emacs, /r/orgmode, Hacker News, planet.emacsen.org, Youtube, the changes to the Emacs NEWS file, and emacs-devel.

Past Emacs News round-ups

The post 2016-04-25 Emacs News appeared first on sacha chua :: living an awesome life.

-1:-- 2016-04-25 Emacs News (Post Sacha Chua)--L0--C0--April 25, 2016 02:28 PM

Marcin Borkowski: The conditional-save-excursion macro

One day I was writing a library of helper functions for writing messages (I will definitely share them in due time!). One of the things there is (semi-)automatic insertion of salutations and closings. You know, all this “Dear Sir/Sincerely yours” stuff which is basically meaningless (and harmful in term of time spent – on both sides of the wire!) in an email, but many people expect it anyway. I am now in the process of moving to shorter email messages. This is one of the signatures I might recommend – based on http://two.sentenc.es Q: Why is this email so extremely laconic and has no courtesies? A: Because our time is more valuable than our egos. http://two.sentenc.es And one of my goals is to insert such a signature automatically, with the proper sentence count. By the way, don’t get me wrong. I’m all for “slow life”, and not succumbing to the rat race and the “do everything as fast as you can so you can take on even more insane amount of work”. But since the time I’ve been trying to measure time I spend on various things (and optimize it), I noticed that email handling takes up a considerable amount of my time. And even if automating writing emails seems not really worth the time spent on coding it, the linked table does not take into account two factors: first, if I share my code with others, the savings are basically multiplied by the number of people using the code (without the overhead of them coding it!). Then, it is not only the time which is involved: even if do not really save time (because of all time spent on coding), I have some fun doing it, I constantly larn something along the way, I share what I have learned and coded, and I remove the frustrating part from email writing. Coming back. When I launch an Emacs command to insert or change the salutation, I usually wouldn’t want to get distracted, so I don’t want the point to move. The save-excursion form is made for such a purpose. OTOH, sometimes I might want to edit the salutation (e.g., add a name to it). In such a case, I do not want save-excursion.
-1:-- The conditional-save-excursion macro (Post)--L0--C0--April 24, 2016 06:09 AM

Pragmatic Emacs: Quickly move a file to the current directory

Often I’ll download a file in my browser, and then want to move that file to the directory in which I am working in emacs. I wrote a little helper function to streamline this, called bjm/move-file-here, given below or at this github gist. Call the function and it will prompt you with a list of files in your starting directory (defaulting to ~/downloads, but configurable with bjm/move-file-here-start-dir) sorted to have the most recent first. The chosen file will then be moved to the current directory if you are in dired, or else the directory of the current buffer.

The function needs the packages dash.el and swiper installed. Here is the code – comments are welcome.

;; move file here                                                         ;;
(require 'dash)
(require 'swiper)

;; start directory
(defvar bjm/move-file-here-start-dir (expand-file-name "~/downloads"))

(defun bjm/move-file-here ()
  "Move file from somewhere else to here.
The file is taken from a start directory set by `bjm/move-file-here-start-dir' and moved to the current directory if invoked in dired, or else the directory containing current buffer. The user is presented with a list of files in the start directory, from which to select the file to move, sorted by most recent first."
  (let (file-list target-dir file-list-sorted start-file start-file-full)
    ;; clean directories from list but keep times
    (setq file-list
          (-remove (lambda (x) (nth 1 x))
                   (directory-files-and-attributes bjm/move-file-here-start-dir)))

    ;; get target directory
    ;; http://ergoemacs.org/emacs/emacs_copy_file_path.html
    (setq target-dir
          (if (equal major-mode 'dired-mode)
              (expand-file-name default-directory)
            (if (null (buffer-file-name))
                (user-error "ERROR: current buffer is not associated with a file.")
              (file-name-directory (buffer-file-name)))))

  ;; sort list by most recent
  (setq file-list-sorted
        (mapcar #'car
                (sort file-list
                      #'(lambda (x y) (time-less-p (nth 6 y) (nth 6 x))))))

  ;; use ivy to select start-file
  (setq start-file (ivy-read
                    (concat "Move selected file to " target-dir ":")
                    :re-builder #'ivy--regex
                    :sort nil
                    :initial-input nil))

  ;; add full path to start file and end-file
  (setq start-file-full
        (expand-file-name start-file bjm/move-file-here-start-dir))
  (setq end-file
        (expand-file-name (file-name-nondirectory start-file) target-dir))
  (rename-file start-file-full end-file)
  (message "moved %s to %s" start-file-full end-file)))
-1:-- Quickly move a file to the current directory (Post Ben Maughan)--L0--C0--April 21, 2016 10:56 PM

Steven Pigeon: Respace

The two seemingly trivial and unimportant problems of what kind of whitespaces and how to use them are still not solved. Some still use hard-coded tabs in their source code, and because they set tabs to be two spaces wide in their favorite editor, they expect the rest of the planet to have done so. The result is that spacing will break in another person’s editor, and the code will look like it’s been written by a four years old. Also, when tabs and spaces are mixed, and randomly interpreted, the indentation, the general aspect of how the code is presented, is broken.


While marking assignments, I encountered a number of such pieces of code. So I decided to fix that with a simple Emacs command.

The original code looks like this:

Number                             operator+(Number numberToUse1, Number numberToUse2)
  int32_t                          numeratorToSet = numberToUse1.getNumerator() * numberToUse2.getDenominator()
    + numberToUse2.getNumerator() * numberToUse1.getDenominator();
  int32_t                          denominatorToSet = numberToUse1.getDenominator() * numberToUse2.getDenominator();

  Number number3(numeratorToSet, denominatorToSet);

  return (number3);

Maybe its author wrote it like that because he uses Visual Studio, or some other editor that allows collapsing of regions so that it shows only function headers, and with that weird spacing, all function names line up just fine. In every other editor, it’s a big WTF.

Emacs, my favorite editor, allows (relatively) easy programming of your own functions, especially that it already sports an impressive number of primitives. I already use indent-region, bound to a short-cut.

For a function like this to be useful, it should at least offer two variants, one for the whole buffer, and one only for the current function/block/class.

(defun whitespace-respace()
  "Replaces all (non-line changing) series of whitespaces by a single space, then reindent"
    (replace-regexp "[[:space:]]+" " ")
    (indent-region (region-beginning) (region-end) nil)

(defun whitespace-respace-function()
  "Replaces all (non-line changing) series of whitespaces by a single space, then reindent"
    ; from https://www.emacswiki.org/emacs/BasicNarrowing
      ; narrows regexp replace on region
      (narrow-to-region (region-beginning) (region-end))
      (goto-char (point-min))
      (while (re-search-forward "[[:space:]]+" nil t)
        (replace-match " " nil nil)
    (indent-region (region-beginning) (region-end) nil)

Let’s have a look on how it works. The first variant respaces/reindent the whole buffer. save-excursion saves the cursor position, executes the statements listed, then restores it. mark-whole-buffer selects the whole buffer. replace-regexp replaces the regular expression on the whole buffer, without deactivating, or rather, while ignoring, the selection. At last, indent-region reindents the region marked by its region-beginning and its region-end.

The second variant is a bit more difficult: replace-regexp must be limited to the selection, which in turns depend on the function/class/etc, as selected by c-mark-function. I used the Emacs Wiki article on narrowing to get started. Basically, we have to iterate find-and-replace manually over the selection. Everything else is pretty much as in the first variant.

Applying the whitespace-respace-function on the previous code snippet yields:

Number operator+(Number numberToUse1, Number numberToUse2)
  int32_t numeratorToSet = numberToUse1.getNumerator() * numberToUse2.getDenominator()
   + numberToUse2.getNumerator() * numberToUse1.getDenominator();
  int32_t denominatorToSet = numberToUse1.getDenominator() * numberToUse2.getDenominator();

  Number number3(numeratorToSet, denominatorToSet);

  return (number3);

* *

I used the “namespace” whitespace because that’s were I saw I could place it and remember where I placed it. The code also isn’t overly specific. Except for c-mark-function, it can be easily applied to other source languages because indent-function is supposed, I think, to be supplied by your major mode.

Filed under: emacs, hacks Tagged: code, emacs, indent, lisp, tabs, tabs-are-evil, whitespace
-1:-- Respace (Post Steven Pigeon)--L0--C0--April 19, 2016 06:42 PM

Bryan Murdock: Get xpra to work on Ubuntu 14.04

Xpra is like screen or tmux for X apps.  There is a commercial app called Exceed on Demand and xpra seems to work very similarly to that.  Xpra is a very nice alternative to VNC and performs a lot better than forwarding X over ssh.  Here's how I got it to work using Ubuntu 14.04 as a server and windoze (is that joke getting old yet?) as a client.  Xpra says you can run Mac and Linux clients as well, but I haven't tried that yet.

To get it installed and running, dig down from the main Xpra site to the trusty download area, or just click here for 64-bit.  Download the highest version numbered python-rencode and xpra packages there, then do this on your command line:

sudo dpkg -i ~/Downloads/python-rencode_1.0.3-1_amd64.deb
sudo apt-get install python-numpy python-opengl python-lzo python-appindicator python-gtkglext1 xvfb
sudo dpkg -i ~/Downloads/xpra_0.15.10-1_amd64.deb

When you try to install either .deb package it might report other dependencies that are missing. Just sudo apt-get install those and then try the sudo dpkg -i command again. After it's all installed you can run an xpra server like so (the options were suggested to my by xpra the first time I tried to run it):

xpra start :1234 --start-child=xterm --no-notifications --no-pulseaudio

On the windows side, download the xpra installer by clicking the link on the main xpra page. After running that it will offer to run xpra. Go ahead and do that. Choose ssh in the Mode dropdown. Leave all the other fields as they are and enter your ssh login information (what you would use to ssh to the ubuntu machine you just started the server on) and the display number (we used 1234 above when we started the server). You can leave the password field blank, it will prompt you for your ssh password after you click connect. Once you do that an xterm will open up on your windows desktop and you can start any other linux apps you want from there. There will be an xpra tray icon you can use to change settings and disconnect. After you disconnect you can reconnect and all the windows you had open will come right back just like they were when you disconnected. It also saves your state if you are disconnected from the network unexpectedly (like maybe your laptop goes to sleep or something). It's very nice.

One other thing I noticed is that the apps xpra was showing me were a little fuzzy (the text in emacs was hard to read). I had to click on the xpra tray icon and change the desktop scaling option (it was making the windows larger for some reason). You can also edit the C:\Program Files (x86)\Xpra\xpra.conf file and change the desktop scaling option there (along with many other settings, for example, I turned off sound and microphone because I don't need that and I figured it might save some CPU and bandwidth).

I'm glad I found xpra and got it working.   It works so well, I'm really surprised I haven't heard more people talking about it.  Go try it out!
-1:-- Get xpra to work on Ubuntu 14.04 (Post Bryan (noreply@blogger.com))--L0--C0--April 15, 2016 04:25 PM

Alex Schroeder: Atreus, Windows, and Emacs

So, I want to define an interesting layout for my Atreus keyboard. On OSX, I used Ukulele to do it. On Windows, I’m using Microsoft Keyboard Layout Creator 1.4.

+---+---+---+---+---+          +---+---+---+---+---+
|Q  |W <|E >|R (|T )|          |Z {|U }|I [|O ]|P €|
|q 6|w 7|e 8|r 9|t 0|          |z 1|u 2|i 3|o 4|p 5|
+---+---+---+---+---+          +---+---+---+---+---+
|A  |S  |D  |F  |G $|          |H ^|J &|K  |L ×|: ||
|a  |s  |d  |f  |g @|          |h =|j +|k -|l *|. …|
+---+---+---+---+---+          +---+---+---+---+---+
|Y  |X  |C  |V  |B %|          |N ~|M 」|_ —|´ ’|` ”|
|y  |x  |c  |v  |b #|          |n ¨|m 「|- –|' ‘|" “|
+---+---+---+---+---+---+  +---+---+---+---+---+---+
|   |   |   |   |DEL|   |  |   |   |   |; »|? \|   |
+---+---+---+---+---+---+  +---+---+---+---+---+---+

When I switch to my new layout, I still have some problems with it:

  • I was able to define my extra stuff using AltGr, which is the equivalent of Alt+Ctrl at the same time, which means that under Windows, I need to press both of them to access @ on g, for example. Is there a way to make this work for both Mac and Windows? Change the Alt key to Right Alt and it’ll work?
  • When using Emacs, I get A-C-g is undefined. Other programs, like Firefox, will correctly interpret A-C-g as AltGr + g and give me the @. What can I do to fix this?
  • When using Emacs, I want to use the windows key as meta. On my keyboard, that’s SUP (Super). But in this case, I get some Windows action. So I start experimenting.
  (setq w32-lwindow-modifier 'meta ; windows is meta
	w32-pass-lwindow-to-system nil
	w32-rwindow-modifier 'meta ; windows is meta
	w32-pass-rwindow-to-system nil
	w32-recognize-altgr t
	w32-pass-alt-to-system t   ; alt is alt
	w32-alt-is-meta nil)
   ;; w32-phantom-key-code??

Perhaps it would be easier if I changed that key to Meta using the keyboard’s firmware and it would work correctly on both OSX and Windows?

And I’m still not sure how to change bindings for simple keys using the Alt key. Perhaps I need a different utility? A good Microsoft Keyboard Layout Creator alternative…

I guess the alternative would be to use Fn together with these extra keys. But then I can’t bind them to something interesting like “…” because in order to that, I would need access to these keys on Microsoft Keyboard Layout Creator, which I do not.


-1:-- Atreus, Windows, and Emacs (Post)--L0--C0--April 11, 2016 09:27 AM

Chen Bin (redguardtoo): Use general.el to provide multiple leader key in evil-mode

General.el "provides a more convenient way to bind keys in emacs for both evil and non-evil users".

I have been using it for more than one month without any issue. I prefer general.el to evil-leader because I need both comma and space key as leader key.

Minimum setup is simple,

(require 'general)
(general-evil-setup t)
(nvmap :prefix ","
       "bb" 'back-to-previous-buffer
       "ww" 'save-buffer
       "oo" 'compile)

;; all keywords arguments are still supported
(nvmap :prefix "SPC"
       ; save windows layout
       "ss" 'wg-create-workgroup
       ;; load windows layout
       "ll" 'my-wg-switch-workgroup)

My real world setup is more complicated.

-1:-- Use general.el to provide multiple leader key in evil-mode (Post Chen Bin)--L0--C0--April 09, 2016 04:35 AM

Raimon Grau: My mail signatures: 2006 - 2016


Vi is clearly superior to emacs, since "vi" has only two characters
(and two keystrokes), while "emacs" has five.  (Randy C. Ford)


"Emacs saves you time when you work, and takes it back when you play with it"
-1:-- My mail signatures: 2006 - 2016 (Post Raimon Grau (noreply@blogger.com))--L0--C0--April 08, 2016 08:18 PM

Sebastian Wiesner: Spacemacs is still great, folks!

Last week I went back to my own personal Emacs configuration after using Spacemacs for more than six months. When I tweeted about it the reaction absolutely caught me by surprise: Several people asked why and some were even concerned whether they should still be using Spacemacs now that I left.

I’ll not speak about the reasons why I left Spacemacs, not now, at least. These are personal, and more concerned with the community than with the product.

So rest assured, I still think that Spacemacs is a great thing. All of what I said before about Spacemacs still stands: It’s beautiful, it’s well designed, and it’s a great Emacs distribution. I can’t unanimously recommend it anymore, and I won’t, but make your own choice! You make no mistake when you pick Spacemacs.

I’m thankful for the work done in Spacemacs, and I admire the product that it created and the elegance of its design. I learned a lot about Emacs while using Spacemacs, and took a thing or two over to my new configuration. Spacemacs has changed the way I bind keys and how I care about discoverability and documentation in my own editor.

But ultimately, I’m happy to be back at my own configuration. It feels like being back home after a long, long holiday in a far, far away place :)

-1:-- Spacemacs is still great, folks! (Post)--L0--C0--April 06, 2016 10:00 PM

(or emacs: Extended syntax for hydra docstrings

I've been getting more and more organized in tracking my tasks and time with Org-mode. Still using the usual suspects, of course: GTD and Pomodoro, I'm just getting more diligent with them than in the previous years.

So today I wanted to prettify the good old org-agenda-view-mode-dispatch, which is bound to v in org-agenda-mode. Currently, it's just a boring static message and read-char combination. Why not do it with a hydra instead?

Here's the current full code, that uses the newly extended doc syntax:

(define-key org-agenda-mode-map
    "v" 'hydra-org-agenda-view/body)

(defun org-agenda-cts ()
  (let ((args (get-text-property
               (min (1- (point-max)) (point))
    (nth 2 args)))

(defhydra hydra-org-agenda-view (:hint nil)
_d_: ?d? day        _g_: time grid=?g? _a_: arch-trees
_w_: ?w? week       _[_: inactive      _A_: arch-files
_t_: ?t? fortnight  _f_: follow=?f?    _r_: report=?r?
_m_: ?m? month      _e_: entry =?e?    _D_: diary=?D?
_y_: ?y? year       _q_: quit          _L__l__c_: ?l?"
  ("SPC" org-agenda-reset-view)
  ("d" org-agenda-day-view
       (if (eq 'day (org-agenda-cts))
           "[x]" "[ ]"))
  ("w" org-agenda-week-view
       (if (eq 'week (org-agenda-cts))
           "[x]" "[ ]"))
  ("t" org-agenda-fortnight-view
       (if (eq 'fortnight (org-agenda-cts))
           "[x]" "[ ]"))
  ("m" org-agenda-month-view
       (if (eq 'month (org-agenda-cts)) "[x]" "[ ]"))
  ("y" org-agenda-year-view
       (if (eq 'year (org-agenda-cts)) "[x]" "[ ]"))
  ("l" org-agenda-log-mode
       (format "% -3S" org-agenda-show-log))
  ("L" (org-agenda-log-mode '(4)))
  ("c" (org-agenda-log-mode 'clockcheck))
  ("f" org-agenda-follow-mode
       (format "% -3S" org-agenda-follow-mode))
  ("a" org-agenda-archives-mode)
  ("A" (org-agenda-archives-mode 'files))
  ("r" org-agenda-clockreport-mode
       (format "% -3S" org-agenda-clockreport-mode))
  ("e" org-agenda-entry-text-mode
       (format "% -3S" org-agenda-entry-text-mode))
  ("g" org-agenda-toggle-time-grid
       (format "% -3S" org-agenda-use-time-grid))
  ("D" org-agenda-toggle-diary
       (format "% -3S" org-agenda-include-diary))
  ("!" org-agenda-toggle-deadlines)
   (let ((org-agenda-include-inactive-timestamps t))
     (org-agenda-check-type t 'timeline 'agenda)
  ("q" (message "Abort") :exit t))

And here's how it looks like in action, I simply pressed v while in the agenda:


Since many functions that org-agenda-view-mode-dispatch calls are toggles, it makes sense for hydra-org-agenda-view to display the status of these toggles.

And it's actually convenient to toggle a whole lot of things at once, and the default red hydra keys really come in handy here.

Quick explanation of the syntax

Each head of a hydra looks like:

(key cmd &optional doc &rest plist)

The fairly new bit that I'm using here is the ability to use a sexp instead of a plain string in the doc part. This sexp will be evaluated each time the doc is re-displayed. This means that it can represent a changing variable, for instance the state of a minor mode or a variable.

And here's the best part: the doc of each head can be quoted in the hydra's docstring by using the corresponding key, e.g. ?g?. This allows to have very complex docstrings while keeping them easily aligned in a tabular format.

Here is only the hydra's docstring, copied from the above code:

_d_: ?d? day        _g_: time grid=?g? _a_: arch-trees
_w_: ?w? week       _[_: inactive      _A_: arch-files
_t_: ?t? fortnight  _f_: follow=?f?    _r_: report=?r?
_m_: ?m? month      _e_: entry =?e?    _D_: diary=?D?
_y_: ?y? year       _q_: quit          _L__l__c_: ?l?

Doesn't that look simple?

-1:-- Extended syntax for hydra docstrings (Post)--L0--C0--April 03, 2016 09:00 PM

Raimon Grau: TIL: 2 extra comment-dwim features

Today I just learned (by accident) a couple of tricks related to`comment-dwim'. The emacs command is bound to M-; , and it has different behaviours  depending on the line, region, and contents of the selection.

Appart from the ovbious behaviour we all know, today I found that:

  • Called with universal argument in an empty line, it adds ARG comment markers in the line. try C-u M-; in an empty line.
  • In a line with comments, c-u m-; removes the comments. that means deleting the comment, NOT UNCOMMENTING but removing all commentted text and the comment marker itself.

-1:-- TIL: 2 extra comment-dwim features (Post Raimon Grau (noreply@blogger.com))--L0--C0--April 02, 2016 06:18 PM

Julien Danjou: The OpenStack Schizophrenia

When I started contributing to OpenStack, almost five years ago, it was a small ecosystem. There were no foundation, a handful of projects and you could understand the code base in a few days.

Fast forward 2016, and it is a totally different beast. The project grew to no less than 54 teams, each team providing one or more deliverable. For example, the Nova and Swift team each one produces one service and its client, whereas the Telemetry team produces 3 services and 3 different clients.

In 5 years, OpenStack went to a few IaaS projects, to 54 different teams tackling different areas related to cloud computing. Once upon a time, OpenStack was all about starting some virtual machines on a network, backed by images and volumes. Nowadays, it's also about orchestrating your network deployment over containers, while managing your application life-cycle using a database service, everything being metered and billed for.

This exponential growth has been made possible with the decision of the OpenStack Technical Committee to open the gates with the project structure reform voted at the end of 2014.

This amendment suppresses the old OpenStack model of "integrated projects" (i.e. Nova, Glance, Swift…). The big tent, as it's called, allowed OpenStack to land new projects every month, growing from the 20 project teams of December 2014 to the 54 we have today – multiplying the number of projects by 2.7 in a little more than a year.

Amazing growth, right?

And this was clearly a good change. I sat at the Technical Committee in 2013, when projects were trying to apply to be "integrated", after Ceilometer and Heat were. It was painful to see how the Technical Committee was trying to assess whether new projects should be brought in or not.

But what I notice these days, is how OpenStack is still stuck between its old and new models. On one side, it accepted a lot of new teams, but on the other side, many are considered as second-class citizens. Efforts are made to continue to build an OpenStack project that does not exist anymore.

For example, there is a team trying to define what's OpenStack core, named DefCore. That is looking to define which projects are, somehow, actually OpenStack. This leads to weird situations, such as having non-DefCore projects seeing their doc rejected from installation guides. Again, I reiterated my proposal to publish documentation as part of each project code to solve that dishonest situation and put everything on a level playing field

Some cross-projects specs are also pushed without implication of all OpenStack projects. For example, The deprecate-cli spec which proposes to deprecate command-line interface tools proposed by each project had a lot of sense in the old OpenStack sense, where the goal was to build a unified and ubiquitous cloud platform. But when you now have tens of projects with largely different scopes, this start making less sense. Still, this spec was merged by the OpenStack Technical Committee this cycle. Keystone is the first project to proudly force users to rely on openstack-client, removing its old keystone command line tool. I find it odd to push that specs when it's pretty clear that some projects (e.g. Swift, Gnocchi…) have no intention to go down that path.

Unfortunately, most specs pushed by the Technical Committee are in the realm of wishful thinking. It somehow makes sense, since only a few of the members are actively contributing to OpenStack projects, and they can't by themselves implement all of that magically. But OpenStack is no exception in the free software world and remains a do-ocracy.

There is good cross-project content in OpenStack, such as the API working group. While the work done should probably not be OpenStack specific, there's a lot that teams have learned by building various HTTP REST API with different frameworks. Compiling this knowledge and offering it as a guidance to various teams is a great help.

My fellow developer Chris Dent wrote a post about what he would do on the Technical Committee. In this article, he points to a lot of the shortcomings I described here, and his confusion between OpenStack being a product or being a kit is quite understandable. Indeed, the message broadcasted by OpenStack is still very confusing after the big tent openness. There's no enough user experience improvement being done.

The OpenStack Technical Committee election is opened for April 2016, and from what I read so far, many candidates are proposing to now clean up the big tent, kicking out projects that do not match certain criteria anymore. This is probably a good idea, there is some inactive project laying around. But I don't think that will be enough to solve the identity crisis that OpenStack is experiencing.

So this is why, once again this cycle, I will throw my hat in the ring and submit my candidacy for OpenStack Technical Committee.

-1:-- The OpenStack Schizophrenia (Post Julien Danjou)--L0--C0--March 30, 2016 12:22 PM

Jorgen Schäfer: Buttercup 1.5 released

I just released version 1.5 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 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.4

  • The new assume form makes it easier to skip tests when certain assumptions do not hold (thanks to Sebastian Wiesner for the patch!)
  • Buttercup is now available in Debian 9 and Ubuntu 16.10 or later: apt-get install elpa-buttercup (thanks to Sean Whitton!)
  • The describe form now also takes a :var argument to make variables available in the body, removing one level of nesting compared to a let
  • Pending specs are now tracked separately, making test run reports more easily readable
  • And a number bug fixes
-1:-- Buttercup 1.5 released (Post Jorgen Schäfer (noreply@blogger.com))--L0--C0--March 29, 2016 08:59 AM