Emacs talking to XCode - xcode

I use emacs on my mac to program in Xcode. It works really well for the most part. I double click on a file in xcode, and it pulls it up in an existing emacs window. I compile, and get syntax errors, double click, and they come up in the active emacs window. great.
This is all XCode talking to emacs. Does anyone know of a way to get emacs to talk to XCode? For example, I want to be able to set a breakpoint in emacs and have the XCode version of gdb acknowledge it.

You can actually use AppleScript to set breakpoints in XCode from within Emacs by embedding the AppleScript inside of elisp.
This page contains the code you need. It's in Korean, but there's actually not much Korean to understand. The first code block is just a straight AppleScript example that was used to develop the breakpoint code. The second block is the one you want. It embeds the first example in an elisp snippet that you can add to your .emacs file.
Other communication can be done using the same trick. Just figure out how to do what you want in AppleScript and then embed that AppleScript in elisp within Emacs.
BTW, here is the documentation for do-applescript, the lisp function, available on the Mac, that lets you call AppleScript.

Sounds like a job for a new plugin!

Related

How can I turn off the autocompletion when writing applescript in automator?

It's very annoying for me that when I write the script, 3 dots appear and I can't continue to write my code because it jumps here and there.... does anyone know a solution for this? I would like to remove auto-completion from the code
I tried with the settings and keyboard commands, but unfortunately it didn't work!
Maybe using script editor is a better way. It‘s a built-in app, also supports syntax highlight and code running.

How to use Vim in a part of Terminal with Go

I'm trying to create TUI app with Go.
I'll make this app like dashboard.
And I want to use Vim as a part of Terminal(iTerm2) screen.
And I want to use local vim env(NeoVim, Local vimrc and plugins).
How do I use local vim with go?
Or are there go libraries to use local vim?
My English isn't so good so feel free to ask me if there is anything unclear.
Thank you.
What you're trying to do is inordinately difficult to do, and I would advise against it.
The only way to embed a terminal application like you're describing is to essentially implement a terminal emulator within your application and display its output within your application. There are libraries which can make this easier -- like libvterm, which vim uses to implement the :terminal command -- but even so, doing this will be difficult, particularly if you want to support advanced terminal functionality in the embedded editor (like mouse support).
A more common idiom for making an editor available in a terminal application is to launch the editor as a subprocess on demand, allowing it to "take over" the entire terminal while a file is being edited. Once the editor exits, your application can resume.

Documentation for LLDB's GUI

I've been recently been playing around with LLDB's gui feature. (A stackoverflow link about this feature is described here. My current lldb is lldb-320.4.156)
So far, it seems very convenient, especially the ability to view local variables in the current stack frame. But is there any documentation (or tutorial) on how to use the LLDB's GUI mode?
Aside: I specifically have a few questions:
How to show the source code upon going into GUI mode. (Unless I stop at a breakpoint and type gui within LLDB, I can never get source code to show up.)
How to rerun a program while in GUI mode. (There is nowhere to type while in GUI mode.)
Are there colors in GUI mode? I notice if you type lldb --help in the command line, lldb tells you you could invoke it with a --no-use-colors option. (That being said, I've never seen colors with normal lldb mode...)
Is there a way to set breakpoints, prior to running lldb?
The GUI mode in lldb is a feature that Greg Clayton did over a few weeks of nights & weekends -- it's a really cool hack. But it's not completed to product-quality level and there's no documentation short of the command key tips that you can see with its built in help system. The biggest omission is definitely the lack of a console window where you could type arbitrary lldb commands - but adding a console pane like that was where things started to get tricky. :)
Hopefully an interested developer will pick up the gui mode work and add these features. For people who can't use a full IDE, it can be really helpful to have a text mode windowed UI when using a debugger.
But is there any documentation (or tutorial) on how to use the LLDB's GUI mode?
I don't know any official documentation. But this random video was helpful for me. Also, pressing h in TUI gives you a minimal documentation.
1. How to show the source code upon going into GUI mode. (Unless I stop at a breakpoint and type gui within LLDB, I can never get source code to show up.)
As you observed, unless gui command is executed while the program is paused due to a breakpoint or something, nothing happens in TUI.
2. How to rerun a program while in GUI mode. (There is nowhere to type while in GUI mode.)
AFAIK, impossible. Press Esc and execute run again.
3. Are there colors in GUI mode? I notice if you type lldb --help in the command line, lldb tells you you could invoke it with a --no-use-colors option. (That being said, I've never seen colors with normal lldb mode...)
In my environment (M1 Macbook Air), color works with no option (i.e. by default) both in CUI and TUI.
4. Is there a way to set breakpoints, prior to running lldb?
See #Johan's answer. You can also use ~/.lldbinit file if the breakpoint condition is fixed.
Don't have an answer for all your questions, but regarding breakpoints, you can save all your debug session "setup" commands in a file and then just load that file:
lldb -S <filename>
Found this option from here:
https://stackoverflow.com/a/34275770/1345329

run applescript on 2x-click

OK, this feels like an idiot question, but I'm stuck - I don't know the first thing about AppleScript. I have a .scpt file and I want to double-click it and just have it run, but instead every time I click, it opens up the AppleScript Editor. This feels like it should just be an option on the file, but I'm missing something obvious.
Please help me feel less dumb, thank you.
From the “File” menu, choose “Export”; there’ll be a “File Format” dropdown underneath the file browser. To get a double-clickable application instead of a document, choose “Application”. This will produce a .app bundle like ordinary Mac applications (this will also let you package other resources with your script if you need to). You can choose “Run Only” or not; if you do, then anybody with just the .app won’t be able to edit your script further, since it’ll be compiled. (But if you’re saving a copy as the application, that might be what you want.)
Another option, as per an anonymous user on Ask Different, would be to save/export your file as a “Script” (.scpt) or “Script Bundle” (.scptd), save it in ~/Library/Scripts/, and check “Show Script menu in menu bar” in Script Editor’s preferences.
(If you’re running an old version of OS X, the first version of this answer has the information you’re looking for.)
There's more than one way to do it; i have found this to be the simplest:
In sum, you create an Automator application and place your applescript inside it (easier than it sounds, and it's not a hack either--there's actually a specific Automator action for this). Then when you are finished, you select "File" from the menubar, next "Save As Application", then select a location. Now check there and you'll see the newly-created Automator icon (little white robot holding a grenade launcher).
You can do anything that you would ordinarily do with this application icon--double click to open, drag it to your dock, etc.
Appstorm has created an excellent step-by-step tutorial for building an applescript-embedded automator action. On the page i linked to, the tutorial author has also supplied an Automator script that you can download and use as a template.
While it's certainly not the simplest route, one benefit to running your script from Automator, as doug suggested, is that you can set a hotkey or keyboard shortcut to execute your script if you hide it in an Automator Service (OSX 10.6+). See:
http://blog.fosketts.net/2010/08/09/assign-keyboard-shortcut-applescript-automator-service/
When you save a new script, a menu should appear asking what you want the file name to be, where it will be stored, any tags for it, and what script format you want it to be. There should be 4 scripts formats:
Script
Script Bundle
Application
Text
The script format you want to use would be "Application." This will turn it into a double-click application if its not in the dock.

XCode-like auto completion in vim (without tab)?

Greetings. I've been using vim for years, and I've recently started toying with XCode. One of the things I really like about XCode is that it will auto complete words without me hitting <TAB>.
For instance, in this image below I only need to type NSSObj and the rest is filled in automatically, no special keystroke required.
I'd like to reproduce this effect in vim.
To be clear, this question is not about how to get tab/omni-completion working in vim. I've already got tab/omni completion working just fine and that's not a problem. The question is: does anyone know how to get vim to autocomplete as I am typing ?
vimscripts has a plugin called autocomplpop.vim that does what you want.
Another option is a vim script called neocomplcache made by Shougo.

Resources