Thursday, July 31, 2014

Running R with Cocoa Emacs (ESS)

When I tried to run R in Cocoa Emacs on Mac, I encountered this error:

Searching for program: No such file or directory, R

It seems that I used to be able to run it properly.  Anyway, here is how I solved the problem after doing some search (see this page).  I just needed to add the following line to ~/.emacs:

(setq-default inferior-R-program-name "/usr/local/bin/R")

And then R could be run properly again.

Some other notes:
  • I could run R without the above line if I start Cocoa Emacs by running this command "open -a Emacs".  Probably Emacs inherits some environment variables with appropriate values.
  • I couldn't solve the problem by adding the path to R by (setenv "PATH" (concat "/usr/local/bin" ":" (getenv "PATH")))  as reported in some other posts.  I am not sure why.

Wednesday, May 21, 2014

Taking Screenshots on Mac OS X

The keyboard shortcut for taking screenshots of a selected area on Mac OS X is: Cmd-Shift-4.  You may press space after the shortcut to capture a window.
  1. To change the image format to PNG:
    defaults write com.apple.screencapture type png
  2. To change disable the shadow in the screenshot:
    defaults write com.apple.screencapture disable-shadow -bool true
  3. To take effect:
    killall SystemUIServer
More information can be found from Mac Guides.

Tuesday, February 25, 2014

Emacs on Mac OSX

I am using reStructuredText to format some documents.  However, the key binding [ctrl-=] for rst-adjust did not work when I used Emacs using Terminal on Mac OS X.  A workaround is to use the Cocoa version of the Emacs.  The shortcut [C-=] should be ok.