Begin main content

Have rvm.el set your emacs rvm environment via .rvmrc

rvm has this great feature where you can put stuff into a .rvmrc file per project to ensure when you cd into any subdirectory of a given rails project you will have the right ruby/gem paths etc.

rvm.el enables that same environment to be set (globally) for an emacs process, with functions like rvm-activate-corresponding-ruby.

To get rvm.el to update globally when you cd into a dir in your emacs shell, just add the following to your .rvmrc after the rvm call to set the ruby/gemset:

emacsclient -n --eval '(rvm-activate-corresponding-ruby)'

(which of course assumes that your .emacs has (server-start) or similar).

07:26 AM, 05 Mar 2011 by Mark Aufflick Permalink | Comments (0)

Not in Africa

Toto

Not in Africa

Taken as part of The Daily Shoot project. View all Mark's Daily Shoot photos.

Taken with Canon EOS 400D DIGITAL and 24.0 - 85.0 mm on 2011:03:03 10:57:22

  • Exposure: 1/25
  • Aperture: f4.5
  • ISO speed: 800
  • Exposure program: Program AE
  • Exposure compensation: -1/3
  • Flash: Off, Did not fire
  • File: _MG_4025.JPG

08:46 PM, 02 Mar 2011 by Mark Aufflick Permalink | Comments (0)

Air Display incompatible with DisplayConfigX

I was recently at a client site using a vga cable to connect to a monitor with an unusual resolution, so I fired up trusty DisplayConfigX which lets you add custom resolutions to any Mac monitor config. Worked great as always.

But then back at my desk, Air Display* wouldn't connect to my iPad properly. Taps would reposition the mouse, but no image. The Air Display control panel unhelpfully suggested my router may be blocking UDP.

After rebooting every device involved I had a hunch about DisplayConfigX, and uninstalled all custom display profiles.

Booyah, Air Display back to normal.

Why that is I have no idea. DisplayConfigX doesn't do anything other than alter some config files—in this case, for monitors unrelated to any I run in my office. Because it is so odd I thought I'd post in case I can save anyone else the same confusion.

*Air Display, for those who don't know, is a neat pair of iPad/Mac apps that lets you use one (only) iPad as an extra display on your Mac. Very cool for your Skype/iChat windows, CoverSutra etc. http://avatron.com/apps/air-display

07:37 PM, 02 Mar 2011 by Mark Aufflick Permalink | Comments (0)

Apple Push Notifications Talk—Screen/Audio recording now available

Thanks again to the guys at the Apple University Consortium for inviting me to speak at /dev/world 2010. The screen/audio recordings are now available. I have linked to them (and the rest of the /dev/world presentations) on my APNS talks page:

http://mark.aufflick.com/talks/apns

07:00 PM, 02 Mar 2011 by Mark Aufflick Permalink | Comments (0)

Piping to an emacs buffer with emacsclient

GNU Emacs buffs will know all about emacsclient - it's a commandline program that allows you to open files in a new buffer in an already running emacs instance. It's very handy. What you may not know is you can also evaluate arbitrary Emacs lisp using emacsclient. Using this fact and based on an existing example from EmacsWiki I have written a perl script that you can pipe to, and the piped data will appear in a buffer via emacsclient.

My ultimate aim is for a PAGER script to use instead of less in my emacs shell. While this isn't quite perfect for that use, it's still pretty useful.

NB: The code below is probably out of date by the time you read this - see this gist for the latest version that you can clone, fork etc.

#!/usr/bin/perl
usestrict;
usewarnings;

useIO::Select;

my$emacsclient = "/usr/local/bin/emacsclient";

# This script uses emacsclient, be sure to have a running server session.
# A server-session can be started by "M-x server-start".
exit 1
    if 0 != system("$emacsclient -n --eval '(progn (pop-to-buffer (get-buffer-create \"*piped*\")))'");

my$s = IO::Select->new;
$s->add(\*STDIN);

while (1)
{
    # block until data available
my$data = <STDIN>;

    # exit if STDIN closed
exit(0)
        if!$data;

    # keep reading while data is available, or we have a bunch of lines
my$lines = 0;
    $data .= <STDIN>
        while$lines++ < 100 && $s->can_read(.5);

    $data =~ s/"/\\"/g;
    $data =~ s/'/'\\''/g;
    $data =~ s/\\/\\\\/g;
    system(qq{$emacsclient -n --eval '(with-current-buffer "*piped*" (goto-char (point-max)) (insert "}
            . $data . qq{"))'});
}

06:23 PM, 02 Mar 2011 by Mark Aufflick Permalink | Comments (3)

XML

Blog Categories

software (41)
..cocoa (23)
  ..heads up 'tunes (5)
..ruby (6)
..lisp (4)
..perl (4)
..openacs (1)
mac (21)
embedded (2)
..microprocessor (2)
  ..avr (1)
electronics (3)
design (1)
photography (26)
..black and white (6)
..A day in Sydney (18)
..The Daily Shoot (6)
food (2)
Book Review (2)

Notifications

Icon of envelope Request notifications

Syndication Feed

XML

Recent Comments

  1. Mark Aufflick: Re: the go/Inbox go/Sent buttons
  2. Unregistered Visitor: How do make a button to jump to folder
  3. Unregistered Visitor: Note I've updated the gist
  4. Unregistered Visitor: umbrello is now an available port on macPorts
  5. Unregistered Visitor: Updated version on Github
  6. Unregistered Visitor: Modification request.
  7. Unregistered Visitor: Accents and labels with spaces
  8. Unregistered Visitor: Mel Kaye - additional info
  9. Unregistered Visitor: mmh
  10. Mark Aufflick: Thank you