Irreal: Killing dired Buffers

Here's a nice tip on how to get rid of a dired buffer by killing it rather than burying it.

-1:-- Killing dired Buffers (Post jcs)--L0--C0--March 29, 2015 06:41 PM

Got Emacs?: Emacs 24.5 first release candidate is out

The first release candidate of 24.5 is out for testing.
-1:-- Emacs 24.5 first release candidate is out (Post sivaram ( 29, 2015 07:13 AM

Bozhidar Batsov: Projectile 0.12 released

Projectile 0.12 is finally out!

A lot of time has passed since the previous stable release, for which I’m truly sorry. I kept delaying and delaying the release for various reasons, but it’s finally here and it’s pretty big. Please, consult the CHANGELOG for some of the more interesting changes. Note that some changes and new features are totally undocumented, as I haven’t been as demanding to contributors as I’m usually on my other projects (meaning I didn’t ask everyone to update the changelog or the readme).

It’s funny how open-source works – I never expected that Projectile would have any users except me, but today it’s one of the most popular 3rd party Emacs extensions. Unfortunately I’m involved with many other projects and have a pretty demanding day job, so issues and feature requests have been piling up lately. 80 open issues – that’s depressing! I guess I’m a pretty lame maintainer! :–)

If you like the project, I’d appreciate your assistance to bring their number down. Many of the requests are relatively easy to implement, some don’t make sense and should be simply closed (or might have been fixed accidentally). Same goes for the open PRs.

Alternatively, you can support Projectile’s continued development via gratipay or PayPal.

Support via Gratipay


That’s all for me now, folks! I’ll try to deliver stable releases faster in the future, but I won’t make any promises. Thanks for all your help and support! I really appreciate them!

P.S. I’d love for Projectile to have a cool logo. Maybe someone can help out with that as well?

-1:-- Projectile 0.12 released (Post)--L0--C0--March 29, 2015 07:11 AM

(or emacs: recenter-positions, that's not how gravity works!

Yesterday, I've added a new binding to swiper-map: C-l will now call swiper-recenter-top-bottom. The implementation is really easy, almost nothing to write home about:

(defun swiper-recenter-top-bottom (&optional arg)
  "Call (`recenter-top-bottom' ARG) in `swiper--window'."
  (interactive "P")
  (with-selected-window swiper--window
    (recenter-top-bottom arg)))

An interesting thing that I want to mention though is the customization of the default recenter-top-bottom behavior. This is the default one:

(setq recenter-positions '(middle top bottom))

And this is the logical one that I'm using:

(setq recenter-positions '(top middle bottom))

Try it out, and see if it makes sense to you. For me, when I've just jumped to a function definition, which usually means that the point is on the first line of the function, the first recenter position has to be top, since that will maximize the amount of the function body that's displayed on the screen.

Another use-case is when I'm reading an info or a web page. After a recenter to top, all that I have read is scrolled out of view, and I can continue from the top.

-1:-- recenter-positions, that's not how gravity works! (Post)--L0--C0--March 27, 2015 11:00 PM

Jorgen Schäfer: Buttercup 1.0 released

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

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

Installation and Use

Buttercup is available from Marmaladeand MELPA Stable.

Example test suite:

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

See the package homepage above for a full description of the syntax for test suites and specs.

If placed in a file named like my-test.el, this command executed in the same directory will run the suite:

emacs -batch -l buttercup.el -f buttercup-run-discover
-1:-- Buttercup 1.0 released (Post Jorgen Schäfer ( 27, 2015 08:12 PM

Irreal: How to Install an Info File

I just wrote about implementing abo-abo's solution for having multiple Info buffers and in particular his using the gcl Info file as a substitute for the Common Lisp HyperSpec. I really wanted to try that out so I downloaded the tar file from the link that he provided and installed it in my .emacs.d directory. Then, as abo-abo explained, I added ~/.emacs.d/info to the Info-additional-directory-list variable.

Sadly, it didn't work. I asked abo-abo for his wisdom on the matter and he suggested that I just push the .emacs.d/info directory directly onto the Info-directory-list. I tried that and it didn't work either. I could get to it with the standalone Info reader by using the -f option but couldn't get to it from Emacs.

The problem was that the gcl file was not being added to the dir file that serves as the top node for Info. The proper way to do that is to run install-info. In my case

sudo install-info /usr/share/info/dir

Annoyingly, it still didn't work. It turns out that install-info extracts data from the Info file you're installing to update the dir file. For some reason the file didn't have the required information. I adapted the information from the file, added it do, reran install-info, and everything worked fine. Unless you're trying to use the that abo-abo linked to, you don't have to worry about that; just run install-info.

If you're trying to install the gcl file, here is what you need to add to the top of

INFO-DIR-SECTION Software development
* gcl: (gcl).           The GNU Common Lisp compiler
-1:-- How to Install an Info File (Post jcs)--L0--C0--March 27, 2015 12:44 PM

Flickr tag 'emacs': 2010-11-14%2013.09.53

rbanffy posted a photo:


-1:-- 2010-11-14%2013.09.53 (Post rbanffy ( 26, 2015 11:53 PM

sachachua: The balance between doing and improving – evaluating yak-shaving

A reader wrote:

… I came to realize that many Emacs users seem to spend a great deal of time learning about Emacs, tweaking it, and writing new extensions, rather than getting non-Emacs-related work done. Sometimes it feels as though heavy Emacs users actually get less done overall, if you consider only non-Emacs-related tasks. My question is, is it possible to get work done in Emacs, without most of that work being Emacs-related?

It got me thinking about skills or tools that can be used to improve themselves, and the balance between using and improving tools.

2015-03-15c Skills or tools that can be used to improve themselves -- index card #learning #bootstrapping

2015-03-15c Skills or tools that can be used to improve themselves – index card #learning #bootstrapping

Not all skills or tools can be used to improve themselves. I’m learning how to sew, but that doesn’t lead to making my sewing machine better (aside from fiddling with the dials).

Here are some skills that can be used reflexively:

  • Philosophy asks questions about good questions to ask
  • Learning about learning helps you learn more effectively
  • Woodworkers and machinists have a tradition of making their own tools
  • 3D printers can print parts for their own models
  • You can program tools to help you program better: testing, version control, project management, etc.

Although making your own tools takes time, here are some advantages of doing so instead of buying them off the shelf:

  • You understand the internals better, and you can appreciate the subtleties
  • You can customize it to fit the way you work
  • You can create different variants for greater flexibility. Mass customization can’t anticipate or cost-effectively provide all the different types of things people may want.
  • As your skills and needs increase, you can create better and better tools for yourself.

Many programmers spend time deliberately improving their toolkits; if they don’t, they stagnate. At the basic level, people try programs or frameworks that other people have created. The next level might be scripting things to work together. A third level might be writing customizations or extensions, and a fourth level might be creating entirely new tools or frameworks. Beginner programmers might start at the first level of reusing other people’s code, but wizardly performance often involves a mix of the other levels.

So the question is: How can we balance doing things and improving things?

No one can answer this for you.

Me, I tend to avoid hard deadlines and I do things faster than people expect them to be done, so I have plenty of leeway to improve my tools – which helps me be even more effective, so it’s a virtuous cycle.

You’ll need to find your own balance. You might get urgent stuff out of the way first, and then figure out how to balance smaller requests with investing in capabilities.

Here’s something I put together to help you figure out where you might be in terms of balance. Alternatively, if you’re thinking about whether to pick up a skill or tool that can be used to improve itself, you can use this to evaluate what you read from people sharing their experiences with the tool. Can they find a good balance for themselves, or are they frustrated by the challenges of getting something to work?

2015-03-16a The balance between using and improving tools -- index card #learning #bootstrapping

2015-03-16a The balance between using and improving tools – index card #learning #bootstrapping

  • “I have what I need in order to work.” This is the basic scenario. People focus on doing things instead of improving things.
  • I can keep pushing, but performance is dropping, so I should invest time in maintenance.” It’s like the way a knife or a saw dulls over time. When you notice diminishing returns, it might be good to invest some time in maintenance. It’s not an urgent need, but it can pay off.
  • I’d better take care of this now before it becomes a problem.” This is like maintaining a car or taking care of your health. A little time now can avoid big problems later.
  • Grr, it’s broken. I have to fix it before I can work.” If you let things go for too long, or if you’re working with something finicky, you’ll be forced into maintenance mode. For example, some 3D printers require a lot of fiddling. Watch out for this scenario.
  • It’s fine the way it is, but I know I can make it better.” The way you’re currently doing things is okay, but you know (from your experience or from what you’ve read of other people) that you can invest a little time to work more effectively. You might even know the return on investment. It’s easy to decide whether you should just go ahead with the status quo or invest the time in improving.
  • It’s fine the way it is, but I think I can make it better.” The way you’re currently doing things is okay, but you have some ideas that might make it even better. If you think those ideas might be worth it, it might be good to give yourself a time limit for exploring those ideas so that you don’t get distracted. Alternatively, you can save it for a slower time.
  • I’m waiting or stuck, so I might as well work on tools.” Maybe you’re waiting for feedback from someone else. Maybe you’re waiting for programs to compile or tests to pass. Why not spend a little time exploring how to make your tools a little better?
  • I’m doing this for fun/learning.” Tool improvement can become more enjoyable than some of the other ways you used to like spending time. For example, you might find yourself wanting to watch a screencast or try out a tweak instead of watching TV or browsing random sites on the Internet. You don’t have to completely replace other activities, you just have to shift a little time from things that have less value to you.
  • I can’t write about my actual work, but I can write about this.” If you’re wondering about yak-shaving propensity based on the blog posts you’re reading, consider: do people write about their improvements instead of the work that they’re doing because their work is confidential or hard to explain? Maybe they think blog posts about improvements are more interesting. Maybe they’re writing about improvements in the process of figuring things out (which in an excellent process, by the way). All these things can skew your perception of how much time people spend doing things versus improving things, and how much they accomplish within that time.

In terms of Emacs, these things mostly apply to me:

  • “I’m doing this for fun/learning” – Emacs tickles my brain, and the community is wonderful.
  • “I can’t write about my actual work, but I can write about this” – I suppose I could write more about the other stuff I’m interested in (sewing? cooking?), so there’s that. However, the consulting stuff is covered by agreements, and that’s a small fraction of my life anyway.

I assume other geeks are rational, especially if they have a lot of experience with it and other tools. Therefore, if people spend time tweaking (while avoiding the consequences of low performance), I assume it’s because they see the value of doing so (whether the pay-off is certain or not). On the surface, an effective person’s behaviour might resemble an ineffective person’s behaviour – six hours sharpening the saw for two hours of work, or six hours procrastinating and two hours of cramming? But if you look at:

  • if they get stuff done
  • whether other people are happy with their performance, or if they generally appear successful in their endeavours
  • how happy they are about the process

then you can get a better idea of whether it’s working for them.

As you think about your own balance or read other people’s blogs, can you identify what scenarios you and other people might resonate with? Am I missing any that I should add to the list? Please comment below!

The post The balance between doing and improving – evaluating yak-shaving appeared first on sacha chua :: living an awesome life.

-1:-- The balance between doing and improving – evaluating yak-shaving (Post Sacha Chua)--L0--C0--March 26, 2015 12:00 PM

(or emacs: A Hydra for ivy/swiper

Today I'll share a Hydra that I've been working on that's similar to Lit Wakefield's original idea for a helm hydra.

The Code

(defhydra hydra-ivy (:hint nil
                     :color pink)
^^^^^^          ^Actions^    ^Dired^     ^Quit^
^ ^ _k_ ^ ^     _._ repeat   _m_ark      _i_: cancel
_h_ ^✜^ _l_     _r_eplace    _,_ unmark  _o_: quit
^ ^ _j_ ^ ^     _u_ndo  
  ;; arrows
  ("h" ivy-beginning-of-buffer)
  ("j" ivy-next-line)
  ("k" ivy-previous-line)
  ("l" ivy-end-of-buffer)
  ;; actions
  ("." hydra-repeat)
  ("r" ivy-replace)
  ("u" ivy-undo)
  ;; dired
  ("m" ivy-dired-mark)
  ("," ivy-dired-unmark)
  ;; exit
  ("o" keyboard-escape-quit :exit t)
  ("i" nil))

Here's how I bind it:

(define-key ivy-minibuffer-map (kbd "C-o") 'hydra-ivy/body)

And here are the auxiliaries:

(defun ivy-dired-mark (arg)
  (interactive "p")
  (dotimes (_i arg)
    (with-selected-window swiper--window
      (dired-mark 1))
    (ivy-next-line 1)

(defun ivy-dired-unmark (arg)
  (interactive "p")
  (dotimes (_i arg)
    (with-selected-window swiper--window
      (dired-unmark 1))
    (ivy-next-line 1)

(defun ivy-replace ()
  (let ((from (with-selected-window swiper--window
                (move-beginning-of-line nil)
                (when (re-search-forward
                       (ivy--regex ivy-text) (line-end-position) t)
                  (match-string 0)))))
    (if (null from)
        (user-error "No match")
      (let ((rep (read-string (format "Replace [%s] with: " from))))
        (with-selected-window swiper--window
          (replace-match rep t t))))))

(defun ivy-undo ()
  (with-selected-window swiper--window

The dired operations

There's actually an outstanding issue to make the hydra heads appear conditionally. This would be quite useful for the m and , bindings, since they don't work outside a dired buffer. Maybe I'll get to it on the weekend. Meanwhile, here's a screenshot for marking files in dired using swiper:


Since the input is "mar 10", swiper transforms it into the regex "(mar).*(10)". What I do next:

  • C-o to get into the hydra state.
  • 99m to mark everything. Normally, it would mark 99 candidates, but since there are only 17, that means all of them.
  • h to go to the first candidate.
  • j, to to skip one candidate and unmark, then unmark some more, using this method.

If I wanted to move two candidates down at once, I could press 2j...... The . will repeat the previous command with the previous argument. You can also set the argument later, e.g. j.2.3.. etc.

The exit points

There are two:

  • i will bring you back to ivy, so that you can edit the input.
  • o will quit everything and bring you to the dired buffer.

So you could first mark Mar 10, exit with i, edit the input to Mar 17, press C-o and mark some more. Then finally exit with o.

The replace and undo operations

These two I've added the latest, so they are still a bit off. The ivy-replace option is similar to vim's r (I did vimtutor yesterday). It lets you replace the selected candidate. And u simply calls undo. Strangely, at the moment it will undo several ivy-replace operations at once, even though I call undo-boundary in ivy-replace.


I think ivy and the hydra docstring blend in together quite nicely, like old dogs and new tricks. I don't know which is which.

-1:-- A Hydra for ivy/swiper (Post)--L0--C0--March 25, 2015 11:00 PM

Ben Simon: gdget: Inching Towards a more Linux Friendly Google Drive Solution

My default document strategy is to stash everything in Google Drive. If a client sends me a Word Doc, it's getting uploaded and converted to a Google Doc so we can both discuss it as well as have a reliable permanent record. This especially makes senses on Windows where I gravitate towards browser friendly solutions. On Linux, however, I'd prefer an emacs / command line friendly solution; and while Google Docs and Google Drive are accessible from Linux, the situation isn't exactly ideal.

What I truly want is ange-ftp for Google Docs. If you've never used emacs's remote file editing capability, you're missing out. It's like magic to pull in and edit a file on some random Linux box halfway across the world.

But I digress. While full editing support of Google Docs from within emacs woulds be ideal, a much simpler solution would suffice: if I could export a snapshot of various documents from Google Drive and store them locally, I could use emacs and other command line tools (I'm looking at you grep) to quickly access them. In other words, I'd gladly trade the browser and rich formatting for a simple, yet occasionally out of date, text file. And for the times when I need rich formatting, I'm glad to access Google Drive using a browser.

The good news is that the Google Drive API offers a download option which does this conversion to basic text. I just needed a tool that would execute this API. Google CL was a very promising initial solution. I was easily able to build a wrapper script around this command to pull down a subset of docs and store them locally. The big catch I found was that Google CL's title matching algorithm meant that attempts to download a specific file pulled down more than I wanted (trying to download "Foo" also pulled down "Foo Status" and "Foo Report"). More than that, it only worked with Google Docs; spreadsheets and other resources weren't accessible.

So I decided to try my hand at writing my own little client. The Google Drive API is actually quite HTTP GET friendly. The only catch (as usual) is authentication. Gone are the days where I could even consider being sloppy and putting my username and password in a shell script (I suppose a Thank You is in order for this). I was going to have to go the route of oauth.

I followed the instructions for an installed app (including setting up an app in my Google Developer's console) and while they initially looked daunting, everything came together without issue. I ended up hacking together 3 scripts:

  • gdauth - This script sets up the initial Google OAuth authentication. It also supports providing the access_token as needed.
  • gdget - This is a very thin wrapper around curl. It essentially adds the correct Authorization header to an arbitrary request and lets curl do the rest of the work
  • gdocs - A simple shell script for pulling down various docs and sheets and storing them locally. It works by associating various names (Foo) to document ID's (which is visible while editing a document within Google Docs).

gdauth and gdget both take a -c flag which sets a context. The context allows you to access multiple Google accounts. For example, you may authenticate with your work account using -c work or your personal account as -c personal. This way you can access various Google Drive accounts with a minimum of hassle.

You can use the low level tools like so:

$ gdauth -c blog init
Code? [enter code shown after visiting the above URL]

$ gdget -c blog '' | head -4
,1,for writing,,<li>for writing</li>
,2,as a straw,,<li>as a straw</li>
,3,"as a toy ""telescope"" for kids",,"<li>as a toy ""telescope"" for kids</li>"

For regular usage, I invoke gdocs pull from cron every few hours and I'm good to go.

Note that you're not limited to using the above tools to only download snapshots of files. You can access any part of the Google Drive REST API. For example:

 gdget -c blog ''
 gdget -c blog ''
 gdget -c blog ''

Below are all three scripts. Hopefully you'll find them inspirational and educational. Better yet, hopefully someone will point me to an emacs or command line solution that makes this script look like the toy that it is. For now though, it's one heck of a useful toy.

# ------------------------------------------------------------------------
# gdauth
# ------------------------------------------------------------------------

## Authenticate with Google Drive
USAGE="`basename $0` {auth|refresh|token} ctx"


function usage {
  echo "Usage: `basename $0` [-h] [-c context] {init|token}"

function age {
  modified=`stat -c %X $1`
  now=`date +%s`
  expr $now - $modified

function refresh {
  refresh_token=`cat $CTX_DIR/$ctx.refresh_token`
  curl -si \
       -d client_id=$CLIENT_ID \
       -d client_secret=$CLIENT_SECRET \
       -d refresh_token=$refresh_token \
       -d grant_type=refresh_token \ > $CTX_DIR/$ctx.refresh
  grep access_token $CTX_DIR/$ctx.refresh | sed -e 's/.*: "//' -e 's/",//' > $CTX_DIR/$ctx.access_token

while getopts :hc: opt ; do
  case $opt in
    c) ctx=$OPTARG ;;
    h) usage ;;
shift $(($OPTIND - 1))

cmd=$1 ; shift

mkdir -p $CTX_DIR
case $cmd in
    url=`curl -gsi \
         -d scope= \
         -d redirect_uri=urn:ietf:wg:oauth:2.0:oob \
         -d response_type=code \
         -d client_id=$CLIENT_ID\ | \
      grep Location: | \
      sed 's/Location: //'`
    echo $url | xclip -in -selection clipboard
    echo $url
    echo -n "Code? "
    read code
    curl -s \
         -d client_id=$CLIENT_ID \
         -d client_secret=$CLIENT_SECRET \
         -d code=$code \
         -d grant_type=authorization_code \
         -d redirect_uri=urn:ietf:wg:oauth:2.0:oob \ > $CTX_DIR/$ctx.init
    grep access_token $CTX_DIR/$ctx.init | sed -e 's/.*: "//' -e 's/",//' > $CTX_DIR/$ctx.access_token
    grep refresh_token $CTX_DIR/$ctx.init | sed -e 's/.*: "//' -e 's/"//' > $CTX_DIR/$ctx.refresh_token
    echo "Done"
    if [ ! -f $CTX_DIR/$ctx.access_token ] ; then
      echo "Unknown context: $ctx. Try initing first."
    age=`age $CTX_DIR/$ctx.access_token`
    if [ $age -gt 3600 ] ; then
    cat $CTX_DIR/$ctx.access_token

# ------------------------------------------------------------------------
# gdget
# ------------------------------------------------------------------------


## Run a GET request against an authorized Google
## URL.

function usage {
  echo "Usage: `basename $0` [-c ctx] [-h] url"

while getopts :hc: opt ; do
  case $opt in
    c) ctx=$OPTARG ;;
    h) usage ;;
shift $(($OPTIND - 1))

if [ ! -f $CTX_DIR/$ctx.access_token ] ; then
  echo "Unknown context: $ctx. Try init'ing first."

token=`gdauth -c $ctx token`

curl -s -H "Authorization: Bearer $token" $*
# ------------------------------------------------------------------------
# gdocs
# ------------------------------------------------------------------------

## A tool for experimenting with Google Docs


function grab_all {
  url=$1    ; shift
  fmt=$1    ; shift
  for t in $* ; do
    name=`echo $t | cut -d: -f1`
    docid=`echo $t | cut -d: -f2`
    echo "$name.$fmt"
    u=`printf $url $docid $fmt`
    gdget -c i2x $u > $GDOCS/$name.$fmt

## docs and sheets have the format:
##  LocalFileName:Docid
## Ex:
##  StatusReport:14SIesx827XPU4gF09zxRs9CJF3yz4bJRzWXu208266WPiUQyw
##  ...

docs=" ... "
sheets=" ... ""

cmd=$1 ; shift

case $cmd in
    grab_all "" txt $docs
    grab_all "" csv $sheets
    echo "Usage: `basename $0` {$commands}"
-1:-- gdget: Inching Towards a more Linux Friendly Google Drive Solution (Post Ben Simon)--L0--C0--March 24, 2015 07:52 AM

Flickr tag 'emacs': 2015-03-

Thiago Perrotta posted a photo:


-1:-- 2015-03- (Post Thiago Perrotta ( 24, 2015 02:40 AM

Ryan Rix: Weekly Review 20 Mar 2015

No Description
-1:-- Weekly Review 20 Mar 2015 (Post)--L0--C0--March 23, 2015 12:00 AM

Ryan Rix: Emacs San Francisco Meetup Group

No Description
-1:-- Emacs San Francisco Meetup Group (Post)--L0--C0--March 23, 2015 12:00 AM

Endless Parentheses: New on Elpa and in Emacs 25.1: seq.el

Thanks to Nicolas Petton, Emacs is getting a new built-in sequence library in 25.1, and it’s already available on GNU Elpa for everyone. There’s not much to be said about this besides the obvious “it’s about time”.

The popularity of dash.el speaks volumes about the need for this feature. Combined with the recent inclusion of if-let, when-let, and the threading macros into Emacs core, this should eventually allow most packages to phase out that extra dependency. Not that there’s anything wrong with dash, of course, but it’s nice to retire an external dependency if a built-in one becomes available.

Still, in the field of sequence-processing, there are some noteworthy differences that may lead you to prefer one over the other.

  • seq provides a unified interface for lists, vectors, and strings (i.e., sequences).
  • At least for now, dash still covers a range of operations that seq doesn’t. Paradox, for instance, still uses dash because of -difference and -intersection.
  • Some functions take arguments in a different order, such as (-take n list) versus (seq-take list n).

Are there any operations you feel ought to be added to this arsenal? What about other utility libraries that really should be built-in?

Comment on this.

-1:-- New on Elpa and in Emacs 25.1: seq.el (Post)--L0--C0--March 23, 2015 12:00 AM

Raimon Grau: Corgfiguring

Org is a beast, you probably already know it, whether you use it or not.

I've been using it on and off for a few years (at least 5), but never settling with it. Now it seems it's changing. But I digress.

Something that in the beginning was disturbing me was the many many ways you had to configure its behaviour. there were these #+FOO BAR , and these :PROPERTIES:,  but you never knew which one to use, and in fact, I didn't even try to remember them.

But there's an absolutely coherent logic behind it. I'll try to explain.

If you use org as a way to manage your life, you can store different info in different files. One for calendar related things (that come from google calendar, or some rss feed), captures, captures from your browser, or from different areas of your life (work, home, fun).  Some of them could live in the same file, but you can decide to use different files (One of my biggest questions to date is what should be a file, a heading, or a tag).

So it makes sense to be able to have global configurations for everything.  For example org-startup-folded . this variable defines in which folding state will be your org files opened.

BUT!  There might be a file, which you want different settings.

     #+STARTUP: overview
#+STARTUP: content
#+STARTUP: showall
#+STARTUP: showeverything

Put one of those in the beginning of your file, and this option will override the global variable.

AND! You may want one of the trees/subtrees in that file to be ruled by a different rule.  Then is when you put a property in that given subtree.  In this case, the property is called "VISIBILITY", and the allowed values are folded, children, content, and all.

So after all, it makes sense that things can be configured at so many levels.

Usually, there's a global var and a file setting for most of the options. The subtree level one is not so common, but you get the idea already.

-1:-- Corgfiguring (Post Raimon Grau ( 19, 2015 12:38 PM

sachachua: Emacs Hangout 2015-03-18 show notes

We chatted about Org coolness and workflows; learning Emacs and deliberate practice; speech recognition; alternate layouts.

Event page:

What’s this Emacs Hangout thing about? This is an informal way for Emacs geeks to get together and swap tips/notes/questions. You can find the previous Hangouts or sign up for the mailing list at . The next Emacs Hangout will be on April 15, 2015, at 8 PM Toronto time (12 midnight GMT): Want to get notified about upcoming hangouts? You can sign up for notifications at .

Experimenting with org-timer. Times are approximate, despite the seeming precision. =)

  • 0:00:12 Intros
  • 0:04:22 Howard – Prettify Your Quotation Marks
  • 0:06:37 Org Mode Spreadsheets
  • 0:12:44 org-aggregate
  • 0:12:50 summing up tables
  • 0:15:38 Hiding things from export with :PRIVATE: .. :END:
  • 0:16:30 Navigation
  • 0:17:10 Relative line numbers
  • 0:19:32 Org prettiness: org-bullets
  • 0:20:51 EMagicians Starter Kit
  • 0:26:23 More table stuff
  • 0:27:32 Org Mode workflows, reasons to use Org
  • 0:28:16 Org to replace Markdown, executable code samples, etc. Literate programming. Attachments.
  • 0:29:34 Org tables
  • 0:30:11 Literate programming, technical notes
  • 0:30:49 Links
  • 0:31:54 Keeping all your notes, reference information, and so forth
  • 0:32:25 As a simple database
  • 0:34:59 Leo’s demo: Org task management, scheduling, linking, refiling, org-pomodoro (with sound and tweaks) and time reporting
  • 0:44:47 clock reports, clocktable
  • 0:46:09 C-u org-refile
  • 0:47:53 tagging strategies (prefixes, @ for contexts, etc.), search
  • 0:49:45 using org-drill
  • 0:51:19 scheduling vs using agendas
  • 0:51:34 org-habits for visualizing consistency
  • 0:54:34 erc and other IRC clients
  • 0:55:20 devices
  • 0:56:47 Other apps like Wunderlist – tasks to synchronize; work/home separation
  • 0:59:44 org-trello – close, but no cigar
  • 1:00:26 orgzly
  • 1:01:44 MobileOrg =( hasn’t been updated in a long time, etc.
  • 1:03:15 org-timer, meeting notes, colouring neato
  • 1:05:37 spacemacs as a way for Vi converts to try Emacs out
  • 1:06:47 keybindings – rebind lots, or not? a few frequently used ones? ErgoEmacs?
  • 1:10:23 hydra, key-chord, prefixes, see Sacha’s config for making key-chord more specific
  • 1:12:52 pair-programming? tmux and different modes?
  • 1:13:09 httpd, impatient-mode, multi-tty?
  • 1:18:04 deliberate practice and learning new things
  • 1:18:41 putting new things in a temporary section (1 month)
  • 1:19:02 reading blog posts (ex:, reading configs,
  • 1:21:29 cheat sheet
  • 1:22:14 another vote for a staging area (experimental.el)
  • 1:24:35 blogging is awesome, org2blog, etc.
  • 1:28:59 edebug is a great way to explore how things work
  • 1:31:39 watching over people’s shoulders when it comes to Emacs; Hangouts, virtual conference? Moderators are helpful. Handing a virtual microphone out – moderator names someone who can then check in, ask the question, etc. monitoring comments. (Could use help reaching out to speakers, organizing schedule, etc.)
  • 1:34:55 Speech interface: less navigation, just commands. Better speech integration – requires C, or can be done with Emacs Lisp? What you’re operating on is different. Intent (what has to happen) vs action (what to do), audio wizards with contextual grammar. Pretty far out still. Translating dictation-friendly names to code-friendly names and vice versa.
  • 1:42:02 Quick wins: accelerators, focusing on intent
  • 1:44:19 Context
  • 1:46:03 LaTeX for math notes? Export to LaTeX or HTML with images, inline images. LyX if you need WYSIWYG? Snippets can help you work at a higher level (instead of memorizing a lot)
  • 1:48:52 Alternative keyboard layouts and keybindings; also, typing less (abbreviations, expansions, thinking, etc.), Kinesis
  • 1:53:57 Speech recognition. Saying things again instead of editing.
  • 1:58:06 Suggestions – more Org workflows, chatting leading up to the next Hangout, asking for help

Text chat:

Philip Stark 8:04 PM This one?
Cameron Desautels 8:04 PM yup
Howard Abrams 8:04 PM Yes!
Cameron Desautels 8:04 PM If you guys haven’t seen this, we should all try to contribute and help out:
me 8:08 PM (Dan: I muted you because of background noise, but you can always unmute yourself when you’re ready to ask a question )
Jonathan Hill 8:10 PM does anybody know how to full screen the hang out? I guess I could just full-screen chrome on the mac..
me 8:10 PM If you reduce your font size a lot, the main screen gets bigger, but let me just ask Howard to increase his text scale
Leo Ufimtsev 8:11 PM Btw, I came across an aggregator module: allows sql-like aggregation for tables
Jonathan Hill 8:14 PM Howard, I’ve got a sidebar question about how you’re jumping around with the cursor seemingly arbitrarily when you can find a convenient spot to answer.
me 8:15 PM He might not see the chat while screensharing, so maybe you can ask out loud when there’s a gap
Cameron Desautels 8:15 PM Could be the mouse Though it took me a minute to realize that.
me 8:16 PM By the way, the nifty bullets on the headings are probably because of org-bullets.el, if you like that effect
Jonathan Hill 8:16 PM his modeline is gorgeous
Cameron Desautels 8:16 PM That’s likely powerline. (Busted!)
me 8:17 PM &lt;laugh&gt; Ooh, relative line numbers
Cameron Desautels 8:19 PM I think I have some bad lag. Sorry about that. My ISP is terrible.
jason Peak 8:22 PM hi everyone, sorry I’m late
Leo Ufimtsev 8:23 PM I don’t think I’ll have time to prepare org-aggregator in this hangout. I can show a org-dot-emacs setup thou. Or some stuff on time-reporting
me 8:23 PM No worries!
jason Peak 8:24 PM yep
Philip Stark 8:26 PM how do you increase the font quickly?
Cameron Desautels 8:26 PM C-x C-=
Philip Stark 8:26 PM and decrease would be C-x C–?
Cameron Desautels 8:27 PM (text-scale-adjust) yep!
Philip Stark 8:27 PM great, thanks.
Will Monroe 8:28 PM I spend most of my time in emacs in org-mode FWIW
Leo Ufimtsev 8:30 PM I’m on twice. My hangouts crashed on my phone, (black screen). @Sacha would you be able to kick out my 2nd instance? (the one with black screen, not the one with picture)
Leo Ufimtsev 8:31 PM thanks
jason Peak 8:31 PM Complete beginner – I like the idea of using org as an organically developing a database of My stuff
Cameron Desautels 8:32 PM Will: that’s interesting. Do you want to speak about your uses? You might have a unique perspective.
Jonathan Hill 8:32 PM WOW That’s absurdly powerful, S
Will Monroe 8:33 PM Cameron: I’d be glad to. Very much a beginner though! ; )
Cameron Desautels 8:33 PM There are other beginners here—it’s probably exactly what they’d need!
Philip Stark 8:34 PM yeah
Leo Ufimtsev 8:35 PM I could show some things if folks are interested.
Howard Abrams 8:40 PM Can’t believe that Chrome crashed and I lost the chat history… I’ll try to catch up.
Philip Stark 8:41 PM chat history so far.
Will Monroe 8:45 PM Is that ticking?
Howard Abrams 8:46 PM The problem with demonstrating org-mode is not revealing too much about ourselves. Good thing we’re among friends, eh?
Cameron Desautels 8:46 PM haha, indeed
Philip Stark 8:46 PM indeed. and on youtube :S
Cameron Desautels 8:46 PM Just don’t read the comments. :p
Will Monroe 8:46 PM Ha!
jason Peak 8:47 PM how many tags is too much ?
me 8:47 PM Heh. Should I redact this text chat segment from the show notes?
jason Peak 8:47 PM how many tags are too many ?
Will Monroe 8:48 PM That’s a great question.
jason Peak 8:48 PM loaded question; just curious about others no mic, Sacha thanks, Will!
Jonathan Hill 8:49 PM someone has a lot of static on their mic
me 8:50 PM That’s Leo’s background noise, oh well.
Philip Stark 8:50 PM That’s Leo, I think. he’s probably on a phone.
me 8:50 PM &lt;laugh!&gt;
jason Peak 8:51 PM I’ve wondered about namespacing tags; org does not support namespaces as part of its tag data structure, though? Maybe I need to make it ?!!
me 8:51 PM I recognize that technique
jason Peak 8:51 PM thank you! yes
me 8:51 PM jason: You can probably combine a tag with other search filters, like the category (file)
Cameron Desautels 8:52 PM org-habit
jason Peak 8:53 PM sacha: thank you, I will exploreit
me 8:53 PM
Cameron Desautels 8:54 PM His setup minds me of mine from a couple years back…these days I use org-mode less because I want my tasks and calendar notifications on all of my devices. *reminds me
Will Monroe 8:54 PM I would love to hear about simple setups for erc
Philip Stark 8:55 PM What is erc?
Will Monroe 8:55 PM or any other emacs irc client
Howard Abrams 8:56 PM I like circe.
Jonathan Hill 8:58 PM Cameron, what about a cloud-based sort or read-only solution like syncing your stuff on dropbox or google drive or something? s/sort or/sort of/
Cameron Desautels 8:59 PM Yeah, I’ve actually tried that sort of thing, exporting an HTML version of my list into Dropbox so I could read it on any of my devices.
Howard Abrams 8:59 PM
Cameron Desautels 8:59 PM But I’d really like r/w access on multiple platforms.
Cameron Desautels 9:00 PM And more ability to filter on the go.
Leo Ufimtsev 9:01 PM Sorry about vacum cleaning noise &gt;_&lt;
jason Peak 9:01 PM trello is great! not sure about the integration
Cameron Desautels 9:02 PM
Jonathan Hill 9:02 PM There’s MobileOrg in the App Store for IOS
Leo Ufimtsev 9:04 PM I was wondering about that. Nifty.
jason Peak 9:04 PM very nice!
Jonathan Hill 9:04 PM does org-calendar interface with Exchange calendar with a tolerable level of setup pain?
Will Monroe 9:05 PM Jonathan: someone recently released an interface for Exchange.
Cameron Desautels 9:05 PM
Will Monroe 9:06 PM It was announced on the listserv…can’t recall the name. But it was within the last few weeks.
Leo Ufimtsev 9:09 PM I use a different keyboard layout “Colemak” (like modern Dvorak). I found emacs was more friendly for non-standard keyboard layouts like colemak.
jason Peak 9:09 PM I’m back, but only to say goodbye for now; Sacha, everyone, thanks for all you’ve shared; I look forward to being back here soon…
Leo Ufimtsev 9:09 PM take care
Will Monroe 9:09 PM bye jason!
Will Monroe 9:14 PM Leo: thanks for mentioning that. I’ve wondered about other keyboard layouts being more /less appropriate for emacs too.
Howard Abrams 9:17 PM I need to run, but I wanted to point out this gist that I wrote today …
me 9:19 PM (I use Dvorak, and haven’t remapped extensively – I mostly keep things the same, although my key-chords are Dvorak-friendly)
Leo Ufimtsev 9:20 PM &lt;&lt;&lt; very good place for asking for help &lt;&lt; organise your .emacs in orgmode
Cameron Desautels 9:26 PM ^ That’s how I add my experiments. Nothing fancy, but it gets the job done. If you use org-mode you could use capture targets for something similar.
Will Monroe 9:29 PM Thanks, Cameron! That’s a great idea. I like the idea of keeping new and potentially unstable functions in a separate file…and the idea of commenting on them could lead to a nice diary of sorts.
Cameron Desautels 9:30 PM Exactly. Plus I don’t commit this so I don’t have to be embarrassed about pushing gross code to my public config.
me 9:30 PM Cameron: Hah! That’s a great idea. Although maybe I’ll keep the weird area in my config, just because
Cameron Desautels 9:31 PM Oh, and I load it like this so someone can pull down my config and have it still work whether or not the file exists: (load camdez/experiments-file ‘no-error)
Will Monroe 9:34 PM Thanks!
Jonathan Hill 9:35 PM @cameron I didn’t know about ‘no-error. neat trick
Leo Ufimtsev 9:35 PM Use trello lol
Cameron Desautels 9:39 PM Jonathan: really that argument can be anything non-nil, I just use that symbol name so it’s self-explanatory.
Jonathan Hill 9:39 PM Thinking Miserable? was that the phrase?
Cameron Desautels 9:40 PM ¯\_(ツ)_/¯ I’m not entirely sure how we got here.
me 9:41 PM It’s a thread from near the beginning of the Hangout in a Q&amp;A question (Eric said he might have something to demo), so it’s not quite connected to the conference conversation
Leo Ufimtsev 9:41 PM Is the voice recognition business cross-platform or specific to windows/mac/linux?
me 9:41 PM (Although we can continue that in the backchannel if people have ideas/suggestions)
Cameron Desautels 9:42 PM Ah! Ok. I must have missed the thread.
Eric S. Johansson 9:42 PM
Leo Ufimtsev 9:46 PM Btw, does anyone use Emacs with Latex.&gt;? for math notes..?
Will Monroe 9:50 PM Sacha (or anyone): this is a much earlier comment you made, but I’d be interested in hearing about your experience using the “standard” Emacs keybindings with Dvorak some time. Maybe during the next Emacs Meetup!
Jonathan Hill 9:54 PM /me E I gather that’s likely not what you actually said. I seem to have gotten stuck on it, though
Will Monroe 9:56 PM Thanks for the advice, everyone. This was the first time I’ve been able to interact with so many Emacs users. Hope to return next month and perhaps again at the possible conference. All the best!
Cameron Desautels 9:57 PM Take care, Will. Nice to meet you.
me 9:57 PM See you!
Leo Ufimtsev 9:57 PM See you next time :-=
Will Monroe 9:57 PM You too! Mabye next time I’ll have something to share.
Jonathan Hill 9:58 PM /me C let me get your info before we go if you don’t mind oops

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

-1:-- Emacs Hangout 2015-03-18 show notes (Post Sacha Chua)--L0--C0--March 19, 2015 12:00 PM

Sean Miller: The Wandering Coder: Emacs Org-mode Styling, Non-smart Quotes, Zero-width-space, and TeX Input Method

In org-mode we can style inline elements with *bold* (bold), /italic/ (italic), _underlined_ (_underlined_, which won’t show up in html), =verbatim= (verbatim), and ~code~ (code).

But this breaks if the character just inside the styling code is a non-smart single or double quote. =C-c ;= is styled (C-c ;); =C-c '= is not (=C-c '=).

We can fix that by inserting a zero-width space between the apostrophe and the = . The first time, we can put the cursor between the apostrophe and the = and enter C-x 8 RET ZERO WIDTH SPACE RET, at which point =C-c '​= will display as C-c '.

The ZERO WIDTH SPACE part of insert-char (C-x 8) is autocompleting, so we won’t need to type the whole thing, but we’ll probably still want a shortcut if it we find ourselves doing it more than once or twice. Here’s the simplest thing we could do:

(defun my/insert-zero-width-space ()
  (insert-char ?\u200B)) ;; code for ZERO WIDTH SPACE
(global-set-key (kbd "C-x 8 s") 'my/insert-zero-width-space)

After which, if we find ourselves adding inline styles which don’t work because the styled section starts or ends with a quotation mark, we can go to just before or just after the quotation mark, type C-x 8 s, and watch the styles apply as expected.

Thanks, as usual, to Sacha Chua, who explained this in passing. Her .emacs has a more flexible solution which I will probably switch to the moment I need to insert more than one unicode character.

Note that while you can use insert-char to get accented characters (C-x 8 ' e produces é, for instance), and I used to do that, I have since set the input method to TeX (M-x set-input-method RET TeX RET), and now I type \​'e for é, \​th for þ, \​Mu\​epsilon\​nu for Μεν, and so on and so forth.

-1:-- Emacs Org-mode Styling, Non-smart Quotes, Zero-width-space, and TeX Input Method (Post smiller)--L0--C0--March 19, 2015 02:54 AM

Wilfred Hughes: Adding A New Language to Emacs

Writing a major mode is a rite of passage for elisp hackers. Sooner or later, you will find a programming language or configuration format that is too new or obscure to have Emacs support.

You decide to roll up your sleeves and plug this hole in the Emacs ecosystem. How do you write a major mode? What will make your major mode great?

1: Getting Started

The bare minimum for a major mode is a syntax table. If you can highlight comments and strings, your mode is useful.

Here’s how we’d write a minimal JS mode:

(defconst my-js-mode-syntax-table
  (let ((table (make-syntax-table)))
    ;; ' is a string delimiter
    (modify-syntax-entry ?' "\"" table)
    ;; " is a string delimiter too
    (modify-syntax-entry ?\" "\"" table)

    ;; / is punctuation, but // is a comment starter
    (modify-syntax-entry ?/ ". 12" table)
    ;; \n is a comment ender
    (modify-syntax-entry ?\n ">" table)

(define-derived-mode my-js-mode prog-mode "Simple JS Mode"
  :syntax-table my-js-mode-syntax-table

Here’s the result:

This might not seem like much, but it’s often sufficient for config file formats.

Congratulations, you’re an elisp hacker! Add your major mode to MELPA so others can use and contribute to your new mode.

2: Full syntax highlighting

From here, there’s huge scope to expand. You’ll want to look at sophisticated syntax highlighting to cover the entire syntax of the language.

As your major mode becomes more sophisticated, you should think about testing it. Many major modes have no tests, but a self-respecting hacker like you likes bugs to stay fixed.

The first step is to create a sample file of syntax corner-cases and just open it. This becomes repetitive, so you will eventually want programmatic tests. Fortunately, puppet-mode has some great examples.

3: Indentation

Next, you’ll want to tackle indentation. Users expect Emacs to indent code correctly regardless of its current state. You’ll need to examine the syntax around point to calculate the current nesting level.

This is usually a matter of searching the buffer backwards from point, counting instances of { (or equivalent scope delimiter). You then adjust the current line to be indented (* my-mode-tab-width count). Provided you’re careful with { in strings and comments, this works.

Alternatively, Emacs provides the Simple Minded Indentation Engine (SMIE). You write a BNF grammar and you get basic indentation and movement commands for free.

You could be a total lunatic, and Emacs has to make you happy.

Steve Yegge on indentation

In practice, users will disagree on what the ‘correct’ indentation is, so you will have to provide settings for different styles. If you get it right, you should be able to open a large file from an existing project, run (indent-region (point-min) (point-max)) and nothing should change.

Indentation logic is very easy to test, and you can see some examples in julia-mode. You will also need to test that indentation is quick in large files, because it’s easy to end up with a slow algorithm.

4: Flycheck

You’ll want probably want to set up a linter with flycheck. Even if there aren’t any sophisticated lint tools available, highlighting syntax errors as-you-type is very helpful.

flycheck-pyflakes showing an unused variable

5: Completion

Great major modes provide autocompletion. You can provide completion by writing a company backend. Here are some examples to inspire you:

company-clang (part of company) uses Clang to discover struct members
company-c-headers inspects the local filesystem to suggest C headers
pip-requirements accesses the internet to find out what packages are available

6: Eldoc

Eldoc is a minor mode that displays information in the minibuffer about the thing at point. It’s typically used for function signatures or types, but you can use it for anything.

Assuming you have some sort of static analysis available for your major mode, eldoc provides a great way of providing relevant contextual information.

eldoc showing docstrings in elisp
c-eldoc showing the function prototype for the function at point

7: REPL integration

Finally, the best major modes let you run code interactively from inside Emacs.

Emacs provides comint-mode, which allows you to define your interpreter and start interacting with it. Many major modes, especially inside Emacs core, derive from comint-mode.

Projects like cider and sly offer even more sophisticated REPL integration. They allow allowing you to query the interpreter process for docstrings, autocompletion, macroexpansion, and much more.

cider offers deep integration between Emacs and a Clojure REPL

∞: Polish

Emacs core has supported programming in C since the beginning, yet it’s still being improved in 2015! Release early, release often, and you’ll create something wonderful.

-1:-- Adding A New Language to Emacs (Post Wilfred Hughes ( 19, 2015 12:00 AM

Phillip Lord: Lentic Doc — self documenting source for emacs

Emacs, of course, has always described itself as self-documenting because it has an integrated documentation system. With my new creation, lenticular text, [1] though the world changes slightly. I can now write rich documentation embedded into the code base of my package, and can do this without comprimising either the documentation or coding environment.

For the 0.7 release of lentic [2], I added support for generating this documentation automatically on the fly from the source code. This can be viewed either internally in Emacs with EWW, or externally with a browser. In the latter case, I have used org-info.js [3] which gives an info-like and navigable experience to the manual.

As yet, this process is not perfect, and the output is not ideal, but it still seems to me to be very nice. It is certainly something that I wanted to use for m-buffer [4]. So I’ve extended lentic so that its documentation system can work for any package. Much to my amazement, it’s already is use by others [5], which has to be a good sign after such a short time span.

The main issue in making lentic-doc generic is working out how to compile the completed org-mode files into HTML. I had already considered trying to the “main” file for a package (so, lentic.el for lentic or m-buffer.el for m-buffer). But, as I discovered with lentic this does not work that well; instead I use a single top level file which imports everything else. To enable this lentic-doc uses the following technique: first it looks for a variable called package-doc describing how to compile the package documentation; if that fails, lentic looks for a file called in which case that is used. The main entry points are two functions lentic-doc-external-view or lentic-doc-eww-view which show the documentation in the respective browser.

There has been a lot of discussion about documentation format on the Emacs-devel mailing list recently. One common complaint was that texinfo 5 is rather too slow, taking a considerable time to compile for Emacs. Now, at first sight it would appear that moving to a lentic/org mode solution would make this worse, as the combination of the two will be much slower than even texinfo. However, lentic and org have one advantage over texinfo — they are entirely implemented in Emacs lisp, so anyone using Emacs also has the ability to generate the documentation from source; this means that the documentation can be built up lazily, on-the-fly as it is requested.

This works straighforwardly for a single package at a time — on request Emacs generates the documentation for lentic or m-buffer and displays. This still leaves the problem of cross-links between the different packages, of course. If I want to hyperlink from lentic to m-buffer, then I need to ensure that the m-buffer documentation is generated. Not so easy if the documentation is being viewed inside a browser.

Fortunately, Emacs provides a solution. Actually, two, as there are now two packages implementing a webserver for Emacs. By using an Emacs web server, I can handle any requests for package documentation, generating them on-the-fly if necessary. It turns out to be relatively simple too, as you can see here:

Of course, lentic-server is just a work in progress and far from complete, but it is pleasing none the less. The use of lentic has allowed me to tie together Org and Emacs-lisp, and to make rich documentation environment from technology that already exists.

The versions of lentic and lentic-server described here are available on MELPA [6].


  1. P. Lord, "Lenticular Text: Looking at code from different angles", An Exercise in Irrelevance, 2015.
  2. P. Lord, "Lentic 0.7", An Exercise in Irrelevance, 2015.
  3. S. Rose, "EMACS ORG-INFO.JS"
  4. . phillord, "phillord/m-buffer-el", GitHub
  5. . tumashu, "tumashu/chinese-pyim", GitHub
  6. "MELPA", MELPA package updates
-1:-- Lentic Doc — self documenting source for emacs (Post Phillip Lord)--L0--C0--March 18, 2015 04:50 PM

Daniel Gempesaw: Imitating live reload in Emacs for Perl (or any) project :)

One of my favorite parts about my frontend JS workflow is using Live Reload with Grunt/Gulp. Saving a few keystrokes a couple times a minute is pretty great, especially if I can stay on the home keys. Grunt and Gulp have a task that watches the files in your project and then you kick can off certain tasks when they change, like refreshing your display and re-running all the unit tests. In Scala, you can get a similar thing by invoking your sbt command prefixed with a ~, but I didn’t have anything for my Perl projects (not to mention a general solution!).

At first, I looked for a similar tool that would watch files for changes and let me hook into that action. I found App::Prove::Watch which was a Perl-only solution. It worked swimmingly after a quick PR, but it only solved the problem for Perl projects. It wasn’t until a few days later that I realized I could leverage Emacs to get a reasonably general solution, only depending on use of the *compilation* buffer (no idea why it didn’t occur to me earlier!).

Of course, Emacs knows exactly when my files change, as we always eventually invoke (save-buffer) - even if it’s advised with with whitespace cleanup, or if it’s invoked via some sort of autosave. Instead of watching files on disk for changes, we can just use Emacs to have the (save-command) trigger our tasks - aka re-compiling the *compilation* buffer.

I used a global variable ar-auto-recompile to turn autocompilation on and off, and made a function to handle the toggling for me:

(setq ar-auto-recompile nil)
(defun ar-auto-re-compile ()
  (setq ar-auto-recompile (not ar-auto-recompile))
  (message (format "Auto recompile is now %s"
                   (if ar-auto-recompile "ON" "OFF"))))

It just toggles the variable and messages us about it. Next, our advice to save-buffer should check whether the user wants auto-recompilation. I also decided I only wanted it to re-compile if the *compilation* buffer was in a visible window, which (get-buffer-window) happily tells us.

(defadvice save-buffer (after ar-auto-recompile activate)
  (when (and ar-auto-recompile
             (get-buffer-window "*compilation*"))
    (set-buffer compilation-last-buffer)
    (revert-buffer t t)))

This solution isn’t quite the same as the watch behavior of the other tools, as they smartly only respond to changes in files in their own project. When turned on, this would blindly recompile any time a buffer is saved and the *compilation* buffer is open. But, I don’t really mind - a few extra compilations probably won’t hurt anything unless the compilation wasn’t safe to repeat in the first place.

So, my workflow is now to open up my test file, toggle on the recompilation with (ar-auto-re-compile), run a test to bring up the *compilation* buffer. I keep that buffer visible and then do edits and such as usual, saving with M-s, which automatically re-runs the test. And, if I need a more complicated compilation command, it’s just a C-u M-x compile away, and then that can get repeated for me. As an extra bonus, this works perfectly with projectile's compilation and test running commands (by default on C-c p c and C-c p P), as they utilize the *compilation* buffer as well. I also made a key-chord to switch the current buffer over to the compilation one, as I often accidentally close it:

(key-chord-define-global "vv" (lambda () (interactive)
                                (switch-to-buffer "*compilation*")))

Finally, if you don’t want to use advice, it’s simple enough to use a wrapper around (save-buffer) and update your save keybinding to use your own function. And as usual, the whole snippet is in my github somewhere.

-1:-- Imitating live reload in Emacs for Perl (or any) project :) (Post danzorx)--L0--C0--March 18, 2015 12:01 PM

Ben Simon: More Miva Merchant for Geeks: Pulling in an admin controlled template to custom MivaScript code

I've got to say, I'm thoroughly enjoying my snippet approach to Miva, whereby I can embed MivaScript code in arbitrary Miva Merchant templates. To recap, I can put code similar to the following in a Miva template:

    <mvt:item name="ads-extfile"

and the MivaScript code in /mm5/snippets/seo/ gets executed and the output included on the page. I can trivially maintain these snippet files using emacs, and track them in subversion.

Recently I found myself wanting to push this setup further. Specifically, I'd like to allow my customers to customize parts of the snippet content. This will make far more sense with an example.

Suppose I've got the attribute packaging type, and I want to allow shoppers to choose between Stress Free and Stress Inducing. Miva Merchant allows me to create such an attribute, but doesn't provide an easy way to include instructions for the attribute. I've got a snippet that generates the HTML for the attribute in question. What's the best way to get customized text inserted before the radio buttons associated with the attribute?

The easiest solution is to ask my client for the text and hard code it in the snippet. But this is asking for trouble, as no doubt this text will need to get tweaked over time. Furthermore, if I had a general purpose method of pulling in customized text, I'd be able to find all sorts of uses for this capability.

Not quite sure which approach take, I created a new page in Miva with the code Packaging-Type-Info. For the page's content I put some place holder text ("Sending a gift to your Mom? Choose stress free. Sending a gift to a frenemy? Select Stress Inducing!").

I confirmed that I could pick up that text by visiting:

One option then, is to embed an invocation of MvCALL in my snippet with the above URL. That's terribly inefficient though, as it means every call to my snippet will result in an additional HTTP request. I kept digging around. I finally caught a break when I realized that the template was being written out to the following .mvc file:


Now all I needed to do was to read in that .mvc file and hopefully include the contents of the template in my snippet.

My first attempt was to add the following to my snippet:

  <MvDO FILE="/mm5/5.00/templates/s01/packaging-preference-info.mvc" />

While that didn't generate an error, it also didn't include the text within the template. I looked all over the MivaScript documentation for a function that would pull in my template contents. I could find none. Luckily, I stumbled onto the docs for miva_template_compile, which actually cleared the whole situation up. Specifically, the docs contain this tidbit:

Compiled templates contain a single function Template_Render(). Execute the template by calling that function, not by executing the compile template .mvc file directly

In other words, there's no function to pull in a template because templates are self executing. Including my template file is as simple as saying:

 <MvASSIGN NAME="l.path" VALUE="/mm5/5.00/templates/s01/packaging-preference-info.mvc"/>
 <MvEVAL EXPR="{ [ l.path ].Template_Render(, l.settings) }"/> is unset, and l.settings is passed through from the settings variable provided to the snippet.

The above is awfully close to what I want, but it still hard codes the path to the particular template. Furthermore, the snippet I'm working on is used to render all option based templates, not just the packaging one that has instructions. My final code, therefore, looks like so:

  <MvASSIGN NAME="l.info_template" VALUE="{ g.store_template_path $ tolower(l.attr:code) $ '-info.mvc' }"/>
  <MvIF EXPR="{ sexists(l.info_template) EQ 1 }">
    <div class='att-info leading'>
      <MvEVAL EXPR="{ [ l.info_template ].Template_Render(, l.settings) }"/>

g.store_template_path is that ugly path to where templates are stored on disk, and sexists() allows me to check for the existence of the template before I attempt to load it. This allows for some attributes to have info blocks and some to skip this feature.

I've now got the best of all worlds: a snippet to cleanly maintain the code of the site, and the ability to efficiently pull in arbitrary content maintained in the UI.

Now if I could just get rid of the silly dependency on the admin UI for maintaining site templates, and perhaps come up with a far terser way to write MivaScript I'd be all set. Stay tuned...

-1:-- More Miva Merchant for Geeks: Pulling in an admin controlled template to custom MivaScript code (Post Ben Simon)--L0--C0--March 17, 2015 09:37 AM

Endless Parentheses: Easily Create Github PRs from Magit

In contrast with fetching pull requests, which either requires a minor-mode or some long-named branches, creating pull requests is as easy as a one-key deal.

Because sx.el (a package which I really ought to blog about) was developed as a group effort, Sean and I decided early on to use PRs for everything. Predictably, the need arose for a quick way to create them, and I promptly asked Emacs.StackExchange for help. The solution below is a courtesy of Constantine.

(defun endless/visit-pull-request-url ()
  "Visit the current branch's PR on Github."
   (format ""
      "\\`.+github\\.com:\\(.+\\)\\.git\\'" "\\1"
      (magit-get "remote"

(eval-after-load 'magit
  '(define-key magit-mode-map "V"

After hitting V, you just need to press the big green button at the Github page.

Comment on this.

-1:-- Easily Create Github PRs from Magit (Post)--L0--C0--March 17, 2015 12:00 AM

Phillip Lord: m-buffer.el 0.10

I have just released m-buffer version 0.10. A pretty minor point release, but I thought I would post about it, as I have not done so far.

Interacting with the text in an Emacs buffer can be a little bit painful at times. The main issue is that Emacs makes heavy use of global state its functions, something which has just rather gone out of fashion since Emacs was designed, and probably for good reason. I know that I am not the only to find this painful [1]. Perhaps, most obvious, is that many functions work on the current-buffer buffer, or at point. As a result, Emacs code tends to have lots of save-excursion and with-current-buffer calls sprinkled throughout.

We see the same thing in the regexp matching code. So for instance, the Emacs Lisp manual suggests the following:

(while (re-search-forward "foo[ \t]+bar" nil t)
   (replace-match "foobar"))

to replace all matches in a buffer. As you should be able to see, the call to replace-match contains no reference to what match is to be replaced. This is passed through the use of the global match data. Again, this made managable through the use of macros to save and restore the global state, in this case save-match-data. So, you end up with:

    (while (re-search-forward "foo[ \t]+bar" nil t)
      (replace-match "foobar"))))

If you want to see this taken to extreme, have a look at the definition of m-buffer-match which is a good demonstration of the problem to which it is a solution.

The use of while is also less than ideal. It may not be obvious, but the code above contains a potential non-termination. For instance, the following should print out the position of every end-of-line in the buffer. Try it in an Emacs you don’t want.

(while (re-search-forward "$" nil t)
  (message "point at: %s" (point)))

It fails (and hangs) because the regexp $ is zero-width in the length. So, the re-search-forward moves point to just in front of the first new line, reports point, and then never moves again. This problem is a real one, and happens in real code.

m-buffer.el is my solution. Inspired partially by dash.el it provides (nearly) stateless, list orientated operations of buffer contents. So:

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

returns a list of match-data to every occurrence of “buffer” in the current-buffer. There are also many, many convienience functions. So to match the end of the line, you could do:

  "$" :post-match 'm-buffer-post-match-forward-char)

which avoids the zero-width regexp problem, but it’s even easier to do.

(m-buffer-match-line-end (current-buffer))

Or to print to mini-buffer as before, you can instead combine with dash.el.

  (message "point at: %s" it)
 (m-buffer-match-line-end (current-buffer)))

m-buffer has been written for ease of use and not performance. So, by default, it uses markers everywhere which can potentially cause slowdowns in Emacs.I have started to add some functions for dealing with markers which need explicitly clearing explicitly; a traditional use for macros in lisp of closing existing resources. So

   ((end (m-buffer-match-line-end (current-buffer))))
    (message "point at: %s" it)

leaves the buffer free of stray markers. The m-buffer-with-markers macro behaves like let* with cleanup.

I am now working on stateless functions for point — so m-buffer-at-point does the same as point but needs a buffer as an argument. Most of the code is trivial in this case, it just needs writing.

I am rather biased, but I like m-buffer very much. It massively simplified the development of lentic [2]. Writing that with embedded while loops would have been painful in the extreme. I think I saved more time in using m-buffer than it took to write it. I think it could simplify many parts of Emacs development significantly. I hope others think so to.

m-buffer is available on MELPA and github


  1. "Essential Elisp Libraries | Wilfred Hughes :: Blog", 2013.
  2. P. Lord, "Lentic 0.7", An Exercise in Irrelevance, 2015.
-1:-- m-buffer.el 0.10 (Post Phillip Lord)--L0--C0--March 13, 2015 03:27 PM

Grant Rettke: Nice HTML Slide Export in Org-Mode with org-ioslide

Here is the project.

Link via reddit.

-1:-- Nice HTML Slide Export in Org-Mode with org-ioslide (Post Grant)--L0--C0--March 10, 2015 03:16 PM

Got Emacs?: Second Emacs pretest 24.4.90 available

The second Emacs pretest is now available for testing at the usual places.
-1:-- Second Emacs pretest 24.4.90 available (Post sivaram ( 10, 2015 01:50 AM

emacspeak: Emacspeak Development Is Moving To GitHub

Emacspeak Development Is Moving To GitHub

1 Summary:

Emacspeak development is moving from Google Code Hosting to GitHub. If you have been running from the SVN repository, I recommend you switch to the GitHub version by executing:

git clone 
make config 
make -j 
  • If using Outloud TTS:
cd servers/linux-outloud  &&  make 
  • If using Espeak TTS:
cd servers/linux-espeak && make 
  • After this, all you should need to stay up to date is a periodic
git pull; make config; make  

2 A Brief History

  • The first five years of Emacspeak development used a local RCS repository on my home machine (1994 –1999).
  • The first few releases of Emacspeak were distributed through the Web site and FTP server at Digital Research; they were also mirrored at Cornell.
  • After moving to Adobe Systems in the fall of 1995, Emacspeak was distributed exclusively through my Web page on the Cornell CS Department Web server, which also hosted my personal Web site.
  • In 2000, I created Emacspeak On SourceForge

and used that site for both hosting the Emacspeak source code as well as the Web site — coincidentally, I lost the ability to update my Web site at Cornell CS around the same time.

  • Over time it became harder and harder to publish new Emacspeak releases through the SourceForge interface. Luckily, Google Code Hosting came along a few months after I joined Google, and moving the source code repository to Google Code SVN was a no-brainer.
  • My friend and colleague Fitz helped me migrate the 5+ years of CVS history to SVN; this meant that the source code repository on Google Code also recorded all of the development history that had been built up on Sourceforge.
  • Now, it's time to move to GitHub. I've been using Git for most of my work the last few years, but was simply too lazy to move Emacspeak development from SVN to Git on GoogleCode.
  • But over time, the advantages present in Git as a source control system and GitHub as a hosting service have increased — primary among these — a rich set of Emacs tools that have been written to leverage the GitHub API.
  • For Git integration in Emacs, my personal preference is package Magit available through Elpa —
M-x package-install magit in Emacs. 
  • The GitHub Web site itself is fairly heavy-weight in terms of its use of scripting, i.e. performing all operations through the Web site from within Emacs is fairly unpleasant. But the afore-mentioned GitHub API makes this a non-issue at this point with respect to the type of workflow I prefer.
  • So this week, I did the work to migrate Emacspeak development to Emacspeak On GitHub.

3 Status Of Migration

  • With help from some of the kind folk at Google Code Hosting, I've successfully migrated the source code repository including all release tags to GitHub.
  • I am now checking in changes into GitHub; the SVN repository on Google Code Hosting is now frozen, and I do not plan to make any commits there.
  • I presently have no immediate plans to start using features of GitHub like the Issue Tracker; for now we will continue to use the Emacspeak mailing list which has served us well for 20 years.
  • I have also taken this opportunity to prune out legacy portions of the Emacspeak codebase by moving modules to obsolete at each level of the directory tree.
  • Since starting the Emacspeak Blog in late 2005, I have published a sequence of articles describing Emacspeak features and usage patterns; I felt that having these articles for local reference made a useful supplement to the emacspeak online documentation. Toward this end, I have downloaded all articles published so far and checked in both XML and HTML versions into sub-directory blogs.
  • Note that newer articles are also available as .org files under sub-directory announcements.

4 Next Steps

  • I still need to learn how to do software releases on GitHub.

Share And Enjoy!

Date: <2015-03-06 Fri>

Author: raman

Created: 2015-03-07 Sat 08:12

Emacs (Org mode 8.2.10)


-1:-- Emacspeak Development Is Moving To GitHub (Post T. V. Raman ( 09, 2015 03:39 PM

Sean Miller: The Wandering Coder: Automating Boilerplate in Org-mode Journalling

The Problem

My main org-mode files have a header structure like this:

* 2015
** March
*** Friday 6 March 2015
**** 10:00. Emacs coaching with Sacha  :emacs:
<2015-03-06 10:00-11:00>
**** 23:37. Emacs progress note
[2015-03-06 23:37]
*** Saturday 7 March 2015
**** 12:55. Stratford King Lear in cinemas   :wcss:
<2015-03-07 12:55-15:55>

The two things I do most often are start writing notes in the present, and set up scheduled events in the future. Scheduled events need active timestamps so that they show up in the agenda view:

Week-agenda (W10):
Monday      2 March 2015 W10
Tuesday     3 March 2015
Wednesday   4 March 2015
Thursday    5 March 2015
Friday      6 March 2015
  10:00. Emacs Coaching with Sacha   :emacs:
Saturday    7 March 2015
  12:55. Stratford King Lear in cinemas   :wcss:
Sunday      8 March 2015

[How to get the agenda view? Make sure the file you’re in is in org-agenda-files by pressing C-c [, then run org-agenda either by M-x org-agenda or the common (but not out-of-the-box) shortcut C-c a, then press a to get the agenda for the week.]

[Active timestamps are in < >; inactive timestamps are in [ ]. If we want to promote an inactive timestamp to be active and show up in the agenda view, we can run M-x org-toggle-timestamp-type from the inactive timestamp.]

[Start time is duplicated between header and timestamp deliberately: sometimes I review the file in org-mode outline with only the headers. If not for that use-case it would make sense to leave the start time out of the header.]

What I’d like to be able to do is open the file, and then with as little ceremony or setup as possible, start typing.

Adding a New Note

When I’ve already got a date header for the current date, this is trivially simple: I can put my cursor under that date and call M-x my note, having previously defined

(defun my/note ()
  (insert "\n\n**** " (format-time-string "%H:%M") ". ")
    (insert "\n" (format-time-string "[%Y-%m-%d %H:%M]") "\n\n")))

… and it does pretty much what it says.

The values passed into format-time-string (%Y, %m, %d etc.) will be the values for the current date and time.

save-excursion means “do what’s inside here and then return the point (cursor) to where it was before the block was called”, so it fills in the timestamp and then returns the cursor to the end of the header line, ready for the title to be filled in.

Since after that I’d need to move the cursor back down to below the timestamp, I can be even lazier and prompt for the title and the tags (if any) and fill them in and move the cursor down to where the text should start:

(defun my/note-2 (title tags)
  (interactive (list
		 (read-from-minibuffer "Title? ")
		 (read-from-minibuffer "Tags? ")))
  (insert "\n\n**** " (format-time-string "%H:%M") ". " title)
  (unless (string= tags "")
    (insert "  :" tags ":")
  (insert "\n" (format-time-string "[%Y-%m-%d %H:%M]") "\n\n"))

If we were just setting one argument, say title, this would be simpler:

(defun my/note-2-eg (title)
  (interactive "MTitle? ")

But since we want two, we need to tell interactive it’s getting a list, and then the arguments are set in order.

(defun my/note-2 (title tags)
  (interactive (list
		 (read-from-minibuffer "Title? ")
		 (read-from-minibuffer "Tags? ")))

Just as we can create an inactive timestamp by inserting a formatted date with [ ], we can add tags by inserting a string surrounded by : :. We don’t want to do this if the tag argument was left blank, of course, so we surround it with an unless:

(unless (string= tags "")
  (insert "  :" tags ":")

[Side-note: if you’re doing anything more complicated than this with strings, you probably want Magnar Sveen’s s.el (string manipulation library), which here would let you do (unless (s-blank? tags)… instead.]

At the end of which, because we took out the save-excursion, the cursor is below the timestamp and I’m ready to type.

All good. What if we don’t already have a date header for the current date? Can we auto-generate the date header?

Auto-generating Date Headers

Org-mode has a function called org-datetree-find-date-create. If you pass it in a list of numbers (the month, the day, and the year), and if your header structure is

* 2015
** 2015-03 March
*** 2015-03-06 Friday

then if you called that function passing in (3 7 2015), it would automatically add:

*** 2015-03-07 Saturday

For that matter, if you called it passing in (4 1 2015), it would automatically add

** 2015-04 April
*** 2015-04-01 Wednesday

If you call it passing in a date which is already there, it moves the cursor to that date. So, we could change the format of the org file headers, update our new note function to call the function, and be done.

(defun my/note-3 (title tags)
  (interactive (list
		 (read-from-minibuffer "Title? ")
		 (read-from-minibuffer "Tags? ")))
  (org-datetree-find-date-create (org-date-to-gregorian
				   (format-time-string "%Y-%m-%d")))
  (insert "\n\n**** " (format-time-string "%H:%M") ". " title)
  (unless (string= tags "")
    (insert "  :" tags ":")
  (insert "\n" (format-time-string "[%Y-%m-%d %H:%M]") "\n\n"))

In the new bit:

(org-datetree-find-date-create (org-date-to-gregorian
				 (format-time-string "%Y-%m-%d")))

format-time-string “%Y-%m-%d” will return “2015-03-07”, and org-date-to-gregorian will turn that into (3 7 2015), which is the format that org-datetree-find-date-create expects. Determining this involved looking at the source for org-datetree-find-date-create to see what arguments it expected (C-h f org-datetree-find-date-create takes you to a help buffer that links to the source file, in this case org-datetree.el; click on the link to go to the function definition) and a certain amount of trial and error. At one point, before org-date-to-gregorian, I had the also working but rather less clear:

(org-datetree-find-date-create (mapcar 'string-to-number
				 (split-string (format-time-string "%m %d %Y"))))

org-end-of-subtree just takes the cursor to the bottom of the section for the date.

And that then works. What about adding new events in the future?

Adding a New Event

org-datetree-find-date-create makes it easier to fill in missing month and date headers to create a new future event:

(defun my/event (date end-time)
  (interactive (list
		 (read-from-minibuffer "end time (e.g. 22:00)? ")))
  (org-datetree-find-date-create (org-date-to-gregorian date))
  (goto-char (line-end-position))
  (setq start-time (nth 1 (split-string date)))
  (if (string= start-time nil)
    (setq start-time ""))
  (insert "\n\n**** " start-time ". ")
    (if (string= end-time "")
      (setq timestamp-string date)
    (setq timestamp-string (concat date "-" end-time)))
    (insert "\n<" timestamp-string ">\n\n")))

There’s a problem I haven’t solved here, which is that org-read-date brings up the date prompt and lets you select a date, including a time or time range. If you select a time, it will be included in the date. If you select a time range, say 19:30-22:30, it ignores the time and the date object returned uses the current time. That’s not what we want.

So when the date prompt comes up:

Date+time [2015-03-07]: _  => <2015-03-07 Sat>

I can put in a new date and start time, say “2015-04-01 11:00”:

Date+time [2015-03-07]: 2015-04-01 11:00_ => <2015-04-01 Wed 11:00-14:00>

and then press enter and that gives me the date and the start time in a single string. We extract the start time and put it into the header like so:

(setq start-time (nth 1 (split-string date)))
(if (string= start-time nil)
  (setq start-time ""))
(insert "\n\n**** " start-time ". ")

Where split-string splits the date “2015-04-01 11:00” into a two-element list (“2015-04-01” “11:00”) {n}, and nth 1 returns the second element (list elements, here as elsewhere, are numbered starting from 0), or “11:00” {n}.

If the date had been “2015-04-01” without a start time, line 1 would have set start-time to nil, which would have blown up as an argument to insert (with a “Wrong type argument: char-or-string-p, nil”), so we check for a nil and set it to an empty string instead.

For the agenda view we’ll need the end-time as well, so we grab that as a second argument, and reassemble the date, say “2015-04-01 11:00”, and end-time, say “14:00”, into the active timestamp:

(if (string= end-time "")
  (setq timestamp-string date)
(setq timestamp-string (concat date "-" end-time)))
(insert "\n<" timestamp-string ">\n\n"))

though here again, if we had just pressed enter when prompted for end time we would end up with an empty string and an invalid active timestamp, like “<2015-04-01->”, so check whether end-time has been set and build the timestamp string accordingly.

And since this is a future event and we’re probably only filling in the title, we’ll use save-excursion again to fill in the active timestamp and then go back and leave the cursor on the header to fill in the title.

The End

And we’re done. Or we would be, but I would really prefer the header to read “March” instead of “2015-03 March”, and “Saturday 7 March 2015” instead of “2015-03-07 Saturday”. We might need to come back to that.

-1:-- Automating Boilerplate in Org-mode Journalling (Post smiller)--L0--C0--March 07, 2015 04:19 PM

Jorgen Schäfer: Circe 1.6 released

We just released version 1.6 of Circe, a Client for IRC in Emacs.

The package is available from github, Marmalade, MELPA stable and MELPA unstable, even though the latter will track further development changes, so use at your own risk.


  • The auto-join-channels setting now also accepts an :after-cloak specifier to join channels only after the user’s hostname was successfully cloaked.
  • Scrolling behavior now tries to keep the input line at the bottom of the window via various methods by default. See the docstring for lui-stroll-behavior for details.
  • A channel buffer is now created already when a /JOIN command is issued. This makes new buffer behavior less confusing.
  • Tab completion now excludes your own nick. Sorry, talking to yourself has become more complicated.
  • Circe’s various modes now include separate keymaps so you can easily specify keys that work in all chat modes or even in all Circe modes the same way.
  • Logging can now create subdirectories, allowing for formats like "{buffer}/%Y-%m-%d.txt".
  • The circe-color-nicks module won’t highlight Nicks anymore after they have left the channel. It also now includes a way of excluding nicks from highlighting, to avoid common-word nicks polluting normal messages. Various other bugfixes were included, too.

Thanks to defanor, Taylan Ulrich Bayırlı, and Vasilij Schneidermann for making this release possible!

-1:-- Circe 1.6 released (Post Jorgen Schäfer ( 06, 2015 01:26 PM

Timo Geusch: Setting up Emacs spell checking on OS X

Setting up flyspell with hunspell on a Mac OS X Emacs install

The post Setting up Emacs spell checking on OS X appeared first on The Lone C++ Coder's Blog.

-1:-- Setting up Emacs spell checking on OS X (Post Timo Geusch)--L0--C0--March 04, 2015 05:16 AM

Tassilo Horn: Swapping Emacs windows using drag’n’drop

When using Emacs on a larger screen where Emacs’ frame is split into multiple windows, you sometimes wish there was some simple way to rearrange which buffer is shown in which window.  Of course, you can do that by moving through your windows and using switch-to-buffer and friends but that’s not really convenient.

So here’s a command which lets you use drag one buffer from one window to the other. The effect is that the buffers of the start and target window are swapped.

(defun th/swap-window-buffers-by-dnd (drag-event)
  "Swaps the buffers displayed in the DRAG-EVENT's start and end
  (interactive "e")
  (let ((start-win (cl-caadr drag-event))
        (end-win   (cl-caaddr drag-event)))
    (when (and (windowp start-win)
               (windowp end-win)
               (not (eq start-win end-win))
               (not (memq (minibuffer-window)
                          (list start-win end-win))))
      (let ((bs (window-buffer start-win))
            (be (window-buffer end-win)))
        (unless (eq bs be)
          (set-window-buffer start-win be)
          (set-window-buffer end-win bs))))))

Bind it to some mouse drag event and have fun. For example, I use (global-set-key (kbd "<C-S-drag-mouse-1>") #'th/swap-window-buffers-by-dnd) so that drag’n’drop with the left mouse button and control and shift pressed is bound to the command above.

-1:-- Swapping Emacs windows using drag’n’drop (Post tsdh)--L0--C0--March 03, 2015 01:55 PM