This post is primarily for iOS developers who are already familiar with Emacs and Xcode, yet want to code their objective-c applications in a distraction-free environment via Emacs.
In this post, I will be going over how to use Emacs as your primary editor for iOS Development. For reference, here is a link to my .emacs file.
Before we begin, I am going to assume you already have the installed following:
- Xcode (latest stable)
- Emacs v24.3
First, you will need to build your project in Xcode.
Open Xcode and create a new Xcode project. Next, choose template: iOS > Application > Empty Application.
Finally, name the product my_app.
Next, add the following to your .emacs file:
(add-to-list 'auto-mode-alist '("\\.mm\\'" . objc-mode))
(and (string= (file-name-extension buffer-file-name) "h")
(require 'find-file) ;; for the "cc-other-file-alist" variable
(nconc (cadr (assoc "\\.h\\'" cc-other-file-alist)) '(".m" ".mm"))
(defadvice ff-get-file-name (around ff-get-file-name-framework
"Search for Mac framework headers as well as POSIX headers."
(if (string-match "\\(.*?\\)/\\(.*\\)" fname-stub)
(let* ((framework (match-string 1 fname-stub))
(header (match-string 2 fname-stub))
(fname-stub (concat framework ".framework/Headers/" header)))
(ad-enable-advice 'ff-get-file-name 'around 'ff-get-file-name-framework)
(setq cc-search-directories '("." "../include" "/usr/include" "/usr/local/include/*"
Next, type “M-x load-file ~/.emacs” and press enter. Alternatively, exit Emacs and log back in.
That concludes this post, if you are interested in utilizing some of Apple’s commandline tools to build out your project using Eshell or terminal check out the sources below. Also, feel free to send me an email or comment below if I have made any mistakes in this post! Thanks for reading!
[01 July 2014]
Its been quite a long time since I’ve updated my blog with a new post. So here it goes, I’ve been extremely focused on school and family as of this last year. I have about one more year left of school and am looking forward to graduating with a Bachelors of Science in Computer Science from the University of South Florida. I’ve been programming practically every day, where I’ve gained a lot of interest in learning mobile development. My current developer setup: Emacs, iTerm (w/zsh), and Firefox. I also enjoy listening to music on Soundcloud.
Things I’m learning/doing over the next few months:
[23 May 2014]
- Python (web development, basic scripting, and more).
- iOS development (have an app in the app store by the end of Summer).
- Spend more time exercising.
- Ace my Summer classes!
This is a quick guide to setting up F# in Emacs on OSX! The goal of this guide is to make setting up F# in Emacs on OSX an easy experience.
Before we begin, I am assuming you have the following already installed:
- Emacs v24.3
- brew install mono
- brew install fsharp
Add the following lines to your .emacs file:
(add-to-list 'load-path "~/.emacs.d/fsharp-mode/")
(autoload 'fsharp-mode "fsharp-mode" "Major mode for editing F# code." t)
(add-to-list 'auto-mode-alist '("\\.fs[iylx]?$" . fsharp-mode))
(setq inferior-fsharp-program "/usr/local/bin/fsharpi --readline-")
(setq fsharp-compiler "/usr/local/bin/fsharpc")
Restart emacs and use the following commmands:
- C-C C-S, for REPL interactive program.
- C-C C-C, fsharpc filename.fs, to compile a F#(.fs) file to an executable.
- Type command, fsharpi, and enter for REPL interactive program.
- Type command, fsharpc filename.fs, and enter to compile a F#(.fs) file to an executable.
- Type command, mono filename.exe, and enter to execute F# program.
Lets test our setup!
- Open Emacs and create a new fsharp file called Program.
- Copy this sample code:
// Code found at http://msdn.microsoft.com/en-us/library/dd233160.aspx
// file: Program.fs
let number = 5
let rec factorial n =
if n = 0
else n * factorial (n - 1)
- Save the file with C-X C-S.
- Compile the file with C-C C-C.
- Go into eshell (M-x eshell).
- Type 'mono Program.exe' and press enter.
If you get lost, here is a link to my emacs config file. Also, checkout the F# Documentation for setting up F# on OSX!
[31 March 2014]