从 Emacs 过渡到 Xcode 的技巧

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1275847/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:44:08  来源:igfitidea点击:

Tips for transitioning from Emacs to Xcode

xcodemacosemacs

提问by Rob Jones

I'm a developer making the transition from Linux/Emacs to OSX/Xcode. Does anyone have any tips or recommendations for smoothing this transition with regard to text editing? Specifically:

我是一名开发人员,正在从 Linux/Emacs 过渡到 OSX/Xcode。有没有人有任何关于文本编辑平滑过渡的提示或建议?具体来说:

What Emacs habits caused the most heartburn upon switching, i.e. what errors did you make repeatedly that were a result of an Emacs background?

哪些 Emacs 习惯在切换时引起了最多的胃痛,即您重复犯了哪些由于 Emacs 背景而导致的错误?

Was there a way to make Xcode work similarly, or did it require a change in behavior?

有没有办法让 Xcode 以类似的方式工作,或者是否需要改变行为?

Is there anything you miss from Emacs that you can't get in Xcode?

Emacs 中是否有您在 Xcode 中无法获得的东西?

I'm mostly interested in the text editor portion of this, e.g. key bindings, split windows, moving between buffers, etc... I never used Emacs in the IDE sense. It was always a pure text editor to me. Compiles happened in another shell. Ditto for SCM stuff.

我最感兴趣的是其中的文本编辑器部分,例如键绑定、拆分窗口、在缓冲区之间移动等……我从未在 IDE 意义上使用过 Emacs。对我来说,它始终是一个纯文本编辑器。编译发生在另一个 shell 中。SCM 的东西也是如此。

回答by Carmine Paolino

Don't fullyswitch to Xcode, just use Emacs for editing and Xcode for the rest (UI design, compilation, debugging, etc.). It seems to be a better compromise for you (and for me, because I use Xcode this way :-).

不要完全切换到 Xcode,只需使用 Emacs 进行编辑,其余部分(UI 设计、编译、调试等)使用 Xcode。这对你来说似乎是一个更好的妥协(对我来说,因为我以这种方式使用 Xcode :-)。

The best part is that Xcode will let you change the default editor to anything! Just set the "text -> sourcecode" editor to Emacs.app (or lowercased emacsif you wish to use the terminal version) in the "File Types" tab of Xcode's preferences and your life will be happier :-)

最好的部分是 Xcode 可以让您将默认编辑器更改为任何内容!只需emacs在 Xcode 首选项的“文件类型”选项卡中将“文本 -> 源代码”编辑器设置为 Emacs.app(或小写,如果你想使用终端版本),你的生活就会更快乐:-)

Just in case: when opening a file from OSX (dragging it in the Dock icon, open it from the Finder, ..., and even open it from Xcode), the default behavior of Emacs.app 23.1 is to open a new frame. If you don't like it, just add

以防万一:当从 OSX 打开文件时(在 Dock 图标中拖动它,从 Finder 打开它,...,甚至从 Xcode 打开它),Emacs.app 23.1 的默认行为是打开一个新框架. 如果你不喜欢它,只需添加

(setq ns-pop-up-frames 'nil)

to your emacs' configuration file.

到你的 emacs 的配置文件。

回答by Pinochle

The transition isn't all that rough, once one discovers all that XCode has to offer.

一旦你发现了 XCode 所提供的一切,过渡并不是那么艰难。

Most of the Emacs text editing keybindings are in XCode (and Cocoa apps in general) so there isn't as much pain there as one might think.

大多数 Emacs 文本编辑键绑定都在 XCode(以及一般的 Cocoa 应用程序)中,因此那里没有人们想象的那么痛苦。

You can even extend Xcode in the language of your choice (you could even use elisp in script mode, now that I think of it; I'll have to try that out), though you will always be forced to use Applescript in most scripts and extensibility is not nearly as good as in Emacs, nor is there a big "user script" community to get extensions from easily. You can usually get some simulacrum of the IDE aspects of Emacs going XCode, for instance I set aside some time a while ago and wrote some scripts and that integrate XCode with Git, which isn't officially supported by the SCM functionality of XCode.

您甚至可以使用您选择的语言扩展 Xcode(您甚至可以在脚本模式下使用 elisp,现在我想到了它;我必须尝试一下),尽管您将始终被迫在大多数脚本中使用 Applescript并且可扩展性不如 Emacs 好,也没有大型“用户脚本”社区可以轻松获取扩展。你通常可以得到一些 Emacs 使用 XCode 的 IDE 方面的模拟,例如我前段时间写了一些脚本并将 XCode 与 Git 集成,XCode 的 SCM 功能并未正式支持这些脚本。

I will always miss ido-modewhen working in XCode, I miss using word forward and word back in XCode and I do use the mouse a lot more than I do in Emacs. One small thing that ends up being quite annoying to me is that parenthesis matching is only cued off when you pass the cursor over the closing parenthesis from left to right. You can't see the match if you keep the cursor on the right side of the closing parenthesis.

ido-mode在 XCode 中工作时,我总是会想念,我会想念在 XCode 中使用 word forward 和 word back,而且我确实比在 Emacs 中使用鼠标更多。最终让我很恼火的一件小事是,只有当您将光标从左到右移过右括号时,才会提示括号匹配。如果将光标保持在右括号的右侧,则无法看到匹配项。

The things that you miss will be more than made up for by the fact that XCode is well-tailored to development in Objective-C and Cocoa. That being said, I only use it for Objective-C and Cocoa. Anything else, including user scripts, I write and test in Emacs first and then XCodeize them (for I/O etc) as a last step.

XCode 非常适合 Objective-C 和 Cocoa 的开发,这一事实可以弥补您错过的一切。话虽如此,我只将它用于 Objective-C 和 Cocoa。其他任何东西,包括用户脚本,我首先在 Emacs 中编写和测试,然后将它们(用于 I/O 等)XCodeize 作为最后一步。

I found that the most important thing in making the transition was to stop lamenting that XCode wasn't Emacs and start putting that energy into figuring out how to get XCode to do what I wanted to do. As long as you are using XCode for Objective-C/Cocoa, you will be able to get what you want to do done (you won't be able to "easily" turn XCode into a personal organizer and timetable app, like has been done with Emacs for example).

我发现进行转换的最重要的事情是停止哀叹 XCode 不是 Emacs,并开始将精力投入到弄清楚如何让 XCode 做我想做的事情上。只要您将 XCode 用于 Objective-C/Cocoa,您就可以完成您想做的事情(您将无法“轻松”将 XCode 变成一个个人管理器和时间表应用程序,就像已经例如用 Emacs 完成)。

Here's a list of good info for those just coming to XCode: XCode tips that you wished you knew 2 years ago.

这里有一份适合刚接触 XCode 的人的好信息列表:2 年前你希望自己知道的 XCode 技巧

回答by Andrew Johnson

Don't.

别。

I switched from emacs to XCode (aquamacs even) for my first iPhone project. On my next iPhone project, I'll be using emacs.

我的第一个 iPhone 项目从 emacs 切换到 XCode(甚至是 aquamacs)。在我的下一个 iPhone 项目中,我将使用 emacs。

If you're the type that likes the Visual Basic thing, you're in for a treat using emacs. But if you just like to write code, there's really no reason to use XCode. You can get all the objective C love in emacs.

如果您喜欢 Visual Basic 的东西,那么您可以使用 emacs。但如果你只是喜欢写代码,真的没有理由使用 XCode。你可以在 emacs 中获得所有客观的 C 爱。