Permalink
Browse files

Site updated at 2012-10-15 11:56:13 UTC

  • Loading branch information...
1 parent cc6e432 commit 0e5bdf25d08792dff3bde80525775183d97e8ec7 @roupam committed Oct 15, 2012
View
@@ -4,7 +4,7 @@
<title><![CDATA[]]></title>
<link href="http://roupam.github.com/atom.xml" rel="self"/>
<link href="http://roupam.github.com/"/>
- <updated>2012-10-14T19:30:32+05:30</updated>
+ <updated>2012-10-15T17:26:12+05:30</updated>
<id>http://roupam.github.com/</id>
<author>
<name><![CDATA[Roupam Ghosh]]></name>
@@ -483,7 +483,37 @@ between .h and .m files. Use Ctrl-C t
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
-</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
+<span class="line-number">11</span>
+<span class="line-number">12</span>
+<span class="line-number">13</span>
+<span class="line-number">14</span>
+<span class="line-number">15</span>
+<span class="line-number">16</span>
+<span class="line-number">17</span>
+<span class="line-number">18</span>
+<span class="line-number">19</span>
+<span class="line-number">20</span>
+<span class="line-number">21</span>
+<span class="line-number">22</span>
+<span class="line-number">23</span>
+<span class="line-number">24</span>
+<span class="line-number">25</span>
+</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="c1">;; --- Obj-C switch between header and source ---</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-in-header-file</span> <span class="p">()</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">extension</span> <span class="p">(</span><span class="nb">car</span> <span class="p">(</span><span class="nb">last</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span> <span class="s">&quot;\\.&quot;</span><span class="p">)))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">string=</span> <span class="s">&quot;h&quot;</span> <span class="nv">extension</span><span class="p">)))</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-to-extension</span> <span class="p">(</span><span class="nv">extension</span><span class="p">)</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">file-components</span> <span class="p">(</span><span class="nb">append</span> <span class="p">(</span><span class="nb">butlast</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span>
+</span><span class="line"> <span class="s">&quot;\\.&quot;</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">list</span> <span class="nv">extension</span><span class="p">))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">find-file</span> <span class="p">(</span><span class="nv">mapconcat</span> <span class="ss">&#39;identity</span> <span class="nv">file-components</span> <span class="s">&quot;.&quot;</span><span class="p">))))</span>
+</span><span class="line">
+</span><span class="line"><span class="c1">;;; Assumes that Header and Source file are in same directory</span>
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
</span><span class="line"> <span class="p">(</span><span class="nv">interactive</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nv">objc-in-header-file</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="nv">objc-jump-to-extension</span> <span class="s">&quot;m&quot;</span><span class="p">)</span>
@@ -496,8 +526,9 @@ between .h and .m files. Use Ctrl-C t
</span></code></pre></td></tr></table></div></figure></notextile></div>
-
-
+<p>
+Thanks to <a href="https://github.com/kirankulkarni">Kiran Kulkarni</a> for this switching code.
+</p>
<p>
Hope you enjoyed this post, and believe me Emacs is
more than you could expect, much much more.
@@ -463,7 +463,37 @@ <h2 id="sec-7">Switching between header (.h) and source (.m) files</h2>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
-</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
+<span class="line-number">11</span>
+<span class="line-number">12</span>
+<span class="line-number">13</span>
+<span class="line-number">14</span>
+<span class="line-number">15</span>
+<span class="line-number">16</span>
+<span class="line-number">17</span>
+<span class="line-number">18</span>
+<span class="line-number">19</span>
+<span class="line-number">20</span>
+<span class="line-number">21</span>
+<span class="line-number">22</span>
+<span class="line-number">23</span>
+<span class="line-number">24</span>
+<span class="line-number">25</span>
+</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="c1">;; --- Obj-C switch between header and source ---</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-in-header-file</span> <span class="p">()</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">extension</span> <span class="p">(</span><span class="nb">car</span> <span class="p">(</span><span class="nb">last</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span> <span class="s">&quot;\\.&quot;</span><span class="p">)))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">string=</span> <span class="s">&quot;h&quot;</span> <span class="nv">extension</span><span class="p">)))</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-to-extension</span> <span class="p">(</span><span class="nv">extension</span><span class="p">)</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">file-components</span> <span class="p">(</span><span class="nb">append</span> <span class="p">(</span><span class="nb">butlast</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span>
+</span><span class="line"> <span class="s">&quot;\\.&quot;</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">list</span> <span class="nv">extension</span><span class="p">))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">find-file</span> <span class="p">(</span><span class="nv">mapconcat</span> <span class="ss">&#39;identity</span> <span class="nv">file-components</span> <span class="s">&quot;.&quot;</span><span class="p">))))</span>
+</span><span class="line">
+</span><span class="line"><span class="c1">;;; Assumes that Header and Source file are in same directory</span>
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
</span><span class="line"> <span class="p">(</span><span class="nv">interactive</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nv">objc-in-header-file</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="nv">objc-jump-to-extension</span> <span class="s">&quot;m&quot;</span><span class="p">)</span>
@@ -476,8 +506,9 @@ <h2 id="sec-7">Switching between header (.h) and source (.m) files</h2>
</span></code></pre></td></tr></table></div></figure></notextile></div>
-
-
+<p>
+Thanks to <a href="https://github.com/kirankulkarni">Kiran Kulkarni</a> for this switching code.
+</p>
<p>
Hope you enjoyed this post, and believe me Emacs is
more than you could expect, much much more.
View
@@ -4,7 +4,7 @@
<title><![CDATA[]]></title>
<link href="http://roupam.github.com/feed" rel="self"/>
<link href="http://roupam.github.com/"/>
- <updated>2012-10-14T19:30:32+05:30</updated>
+ <updated>2012-10-15T17:26:12+05:30</updated>
<id>http://roupam.github.com/</id>
<author>
<name><![CDATA[Roupam Ghosh]]></name>
@@ -483,7 +483,37 @@ between .h and .m files. Use Ctrl-C t
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
-</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
+<span class="line-number">11</span>
+<span class="line-number">12</span>
+<span class="line-number">13</span>
+<span class="line-number">14</span>
+<span class="line-number">15</span>
+<span class="line-number">16</span>
+<span class="line-number">17</span>
+<span class="line-number">18</span>
+<span class="line-number">19</span>
+<span class="line-number">20</span>
+<span class="line-number">21</span>
+<span class="line-number">22</span>
+<span class="line-number">23</span>
+<span class="line-number">24</span>
+<span class="line-number">25</span>
+</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="c1">;; --- Obj-C switch between header and source ---</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-in-header-file</span> <span class="p">()</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">extension</span> <span class="p">(</span><span class="nb">car</span> <span class="p">(</span><span class="nb">last</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span> <span class="s">&quot;\\.&quot;</span><span class="p">)))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">string=</span> <span class="s">&quot;h&quot;</span> <span class="nv">extension</span><span class="p">)))</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-to-extension</span> <span class="p">(</span><span class="nv">extension</span><span class="p">)</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">file-components</span> <span class="p">(</span><span class="nb">append</span> <span class="p">(</span><span class="nb">butlast</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span>
+</span><span class="line"> <span class="s">&quot;\\.&quot;</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">list</span> <span class="nv">extension</span><span class="p">))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">find-file</span> <span class="p">(</span><span class="nv">mapconcat</span> <span class="ss">&#39;identity</span> <span class="nv">file-components</span> <span class="s">&quot;.&quot;</span><span class="p">))))</span>
+</span><span class="line">
+</span><span class="line"><span class="c1">;;; Assumes that Header and Source file are in same directory</span>
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
</span><span class="line"> <span class="p">(</span><span class="nv">interactive</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nv">objc-in-header-file</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="nv">objc-jump-to-extension</span> <span class="s">&quot;m&quot;</span><span class="p">)</span>
@@ -496,8 +526,9 @@ between .h and .m files. Use Ctrl-C t
</span></code></pre></td></tr></table></div></figure></notextile></div>
-
-
+<p>
+Thanks to <a href="https://github.com/kirankulkarni">Kiran Kulkarni</a> for this switching code.
+</p>
<p>
Hope you enjoyed this post, and believe me Emacs is
more than you could expect, much much more.
View
@@ -577,7 +577,37 @@ <h2 id="sec-7">Switching between header (.h) and source (.m) files</h2>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
-</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
+<span class="line-number">11</span>
+<span class="line-number">12</span>
+<span class="line-number">13</span>
+<span class="line-number">14</span>
+<span class="line-number">15</span>
+<span class="line-number">16</span>
+<span class="line-number">17</span>
+<span class="line-number">18</span>
+<span class="line-number">19</span>
+<span class="line-number">20</span>
+<span class="line-number">21</span>
+<span class="line-number">22</span>
+<span class="line-number">23</span>
+<span class="line-number">24</span>
+<span class="line-number">25</span>
+</pre></td><td class="code"><pre><code class="cl"><span class="line"><span class="c1">;; --- Obj-C switch between header and source ---</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-in-header-file</span> <span class="p">()</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">extension</span> <span class="p">(</span><span class="nb">car</span> <span class="p">(</span><span class="nb">last</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span> <span class="s">&quot;\\.&quot;</span><span class="p">)))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">string=</span> <span class="s">&quot;h&quot;</span> <span class="nv">extension</span><span class="p">)))</span>
+</span><span class="line">
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-to-extension</span> <span class="p">(</span><span class="nv">extension</span><span class="p">)</span>
+</span><span class="line"> <span class="p">(</span><span class="k">let*</span> <span class="p">((</span><span class="nv">filename</span> <span class="p">(</span><span class="nv">buffer-file-name</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">file-components</span> <span class="p">(</span><span class="nb">append</span> <span class="p">(</span><span class="nb">butlast</span> <span class="p">(</span><span class="nv">split-string</span> <span class="nv">filename</span>
+</span><span class="line"> <span class="s">&quot;\\.&quot;</span><span class="p">))</span>
+</span><span class="line"> <span class="p">(</span><span class="nb">list</span> <span class="nv">extension</span><span class="p">))))</span>
+</span><span class="line"> <span class="p">(</span><span class="nv">find-file</span> <span class="p">(</span><span class="nv">mapconcat</span> <span class="ss">&#39;identity</span> <span class="nv">file-components</span> <span class="s">&quot;.&quot;</span><span class="p">))))</span>
+</span><span class="line">
+</span><span class="line"><span class="c1">;;; Assumes that Header and Source file are in same directory</span>
+</span><span class="line"><span class="p">(</span><span class="nb">defun</span> <span class="nv">objc-jump-between-header-source</span> <span class="p">()</span>
</span><span class="line"> <span class="p">(</span><span class="nv">interactive</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nv">objc-in-header-file</span><span class="p">)</span>
</span><span class="line"> <span class="p">(</span><span class="nv">objc-jump-to-extension</span> <span class="s">&quot;m&quot;</span><span class="p">)</span>
@@ -590,8 +620,9 @@ <h2 id="sec-7">Switching between header (.h) and source (.m) files</h2>
</span></code></pre></td></tr></table></div></figure></notextile></div>
-
-
+<p>
+Thanks to <a href="https://github.com/kirankulkarni">Kiran Kulkarni</a> for this switching code.
+</p>
<p>
Hope you enjoyed this post, and believe me Emacs is
more than you could expect, much much more.
@@ -253,6 +253,21 @@ Add this to you emacs init file if you would like to jump quickly
between .h and .m files. Use Ctrl-C t
#+begin_src cl
+;; --- Obj-C switch between header and source ---
+
+(defun objc-in-header-file ()
+ (let* ((filename (buffer-file-name))
+ (extension (car (last (split-string filename "\\.")))))
+ (string= "h" extension)))
+
+(defun objc-jump-to-extension (extension)
+ (let* ((filename (buffer-file-name))
+ (file-components (append (butlast (split-string filename
+ "\\."))
+ (list extension))))
+ (find-file (mapconcat 'identity file-components "."))))
+
+;;; Assumes that Header and Source file are in same directory
(defun objc-jump-between-header-source ()
(interactive)
(if (objc-in-header-file)
@@ -265,7 +280,7 @@ between .h and .m files. Use Ctrl-C t
(add-hook 'objc-mode-hook 'objc-mode-customizations)
#+end_src
-
+Thanks to [[https://github.com/kirankulkarni][Kiran Kulkarni]] for this switching code.
Hope you enjoyed this post, and believe me Emacs is
more than you could expect, much much more.
Oops, something went wrong.

0 comments on commit 0e5bdf2

Please sign in to comment.