{"id":11730,"date":"2023-10-27T11:29:54","date_gmt":"2023-10-27T15:29:54","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=11730"},"modified":"2023-10-27T11:29:54","modified_gmt":"2023-10-27T15:29:54","slug":"open-xcode-from-emacs-at-the-same-line","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=11730","title":{"rendered":"Open Xcode From Emacs At The Same Line"},"content":{"rendered":"<p>\u00c1lvaro Ram\u00edrez has a nice post on opening a file in the macOS Xcode editor from Emacs. There&rsquo;s nothing unusual about that, of course, but Ram\u00edrez&rsquo;s wrinkle is that he wants Xcode to open at the same line the Emacs point is on.<\/p>\n<p>It&rsquo;s reasonable to ask why a devoted Emacser like Ram\u00edrez would want to open Xcode at all. The answer is that he&rsquo;s more pragmatic than I am. I consider leaving Emacs a fail; something that I should try to find a fix for. Ram\u00edrez, as I say, is more pragmatic. Although he much prefers working in Emacs, he&rsquo;s willing to use other tools if they&rsquo;re more appropriate. Although he mostly uses Emacs for his iOS development, there are certain situations\u2014debugging, for instance\u2014where he feels Xcode is a better solution.<\/p>\n<p>He&rsquo;s long used Bozhidar Batsov&rsquo;s <a href=\"https:\/\/github.com\/bbatsov\/crux\">crux<\/a> to open the file he&rsquo;s working on in Emacs in the Xcode editor. The problem was that it opened at the top of the file rather than at the line he was looking at in Emacs. It turns out, though, that you can call Xcode from the command line and specify the line to open the file at.<\/p>\n<p>Ram\u00edrez, of course, used his <a href=\"https:\/\/github.com\/xenodium\/dwim-shell-command\">dwim-shell-command<\/a> framework to <a href=\"https:\/\/xenodium.com\/open-in-xcode-at-line-number\/\">implement this<\/a> but it would be trivial to adopt to plain Elisp if you&rsquo;re not a dwim-shell-command user. You should also check out the comments in the <a href=\"https:\/\/www.reddit.com\/r\/emacs\/comments\/17fj16p\/emacs_open_file_in_xcode_at_same_line\/\">reddit post<\/a> about the method. There are some other useful ways of integrating Emacs and Xcode workflows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c1lvaro Ram\u00edrez has a nice post on opening a file in the macOS Xcode editor from Emacs. There&rsquo;s nothing unusual about that, of course, but Ram\u00edrez&rsquo;s wrinkle is that he wants Xcode to open at the same line the Emacs &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=11730\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18,194],"class_list":["post-11730","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs","tag-macos"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11730","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11730"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11730\/revisions"}],"predecessor-version":[{"id":11731,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11730\/revisions\/11731"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}