In Carbon Emacs, I was able to call M-x print-buffer and an OS-X Print Dialog appeared, letting me choose my printer.
Now that I've switched to Cocoa Emacs 23.1, the print-buffer command does not behave the same way. It ends up sending the job directly to the printer, using the last selected printer (which might not even be available).
Is there a way to get the OS X Print Dialog to appear before printing in Cocoa Emacs?
I'm also interested in this. I found Mac Print Mode on emacswiki:
http://www.emacswiki.org/emacs/MacPrintMode
I haven't had a chance to try it out yet, but sounds like what you're looking for.
Related
I’m just trying to create a window in cocoa. I wanted to use this code as a basis but somehow the app menu does not show up (still shows the one from the terminal, un-clickable though).
Can anybody give me a hint what might have changed in cocoa since that article was written? I’m using Yosemite.
It works fine for me, but I had to Cmd-Tab switch away and back again to the running executable before the app menu became active. I tried appending a space and the ampersand symbol to the end of the code, which tells the shell to background the task, thinking it may launch normally then, but to no avail.
You might try appending an AppleScript command such as tell application MinimalistCocoaApp to activate after the command to launch ./MinimalistCocoaApp (separated by a semicolon). I'm not sure the "compile and run" terminal command for AppleScript, but that should be easily Googled.
I use Mac OS X 10.10 and I would like to write a program that looks continuously for a window analyzing all the names of the opened windows. When the windows appear, I would like that the program will look for a button with a specific label and once found it, the app should send it a "pressed message".
I would be able to do it under windows, but I am not so familiar with Mac.
I have found a question related to mine (How do I get a list of the window titles on the Mac OSX?), but I think the most difficult part is finding the button and sending it a "pressed message".
Thank you in advance!
What you are looking for is the Accessibilty APIs. These are mostly Core Foundation style C APIs and typically prefixed with AX.
You might also want to consider additional identifiers beyond window title as window titles are not necessarily unique.
Using the AX APIs is not easy and is extremely verbose. You can use them to explore the UI and find things and interact with them but you might have more limited success observing user interaction. That might require a more fragile combination with event monitoring using NSEvent globalMonitor or CGEventTap depending on the UI widgets involved.
Also note that using the AX APIs to control anything outside your app is not sandbox capable.
I am using two version of emacs. One in terminal, and other from emacsformacosx.com. In terminal I can use non-English keyboard layout and everything fine. But emacs version with gui don't understands these commands. Why it happening? Why I can't just run terminal version with GUI?
update:
For example when I pressed M-x with non-English keyboard layout in minibuffer appear text - M-ч is undefined. ч is a symbol equal to x. Pressing same shortcut in terminal version of Emacs works fine. Emacs running on other OS haven't this problem. I think to solve it needs to run terminal version with gui and use it. It is impossible. But why?
My specific problem is the following: I am using Mac OS X with the Visor app for terminal. This lets me do cool pop-in/out stuff with terminal for quick access. The problem is, I lose the ability to move the window around and re-size it, something that becomes important when I start opening up multiple buffers in emacs and want to view some at the same time in a window larger than 80 wide.
Does anyone know how to duplicate a shell window/instance, so that a new window appears with the same history, current working dir, aliases, etc...? Even more specifically, can this be done in Mac OS X such that the new window is in a different "style", (basic, pro, sands, etc..).
I'm not familiar with Visor, but simply using a terminal emulator such as screen might give you what you need. From a terminal, invoke 'screen'. That will give you a shell prompt. From another terminal, invoke 'screen -x'. Now each terminal will be attached to the same shell, with the same history, etc. See screen(1) for details.
I read the following code in Unix Power Tools on page 117
*VT100.Translations: #override\
Button1 <Btn3Down>: select-end(primary,CUT_BUFFER0,CLIPBOARD)\n\
!Shift <Btn2Up>: insert-selection(CLIPBOARD)\n\
~Shift ~Ctrl ~Meta <Btn2Up>: insert-selection(primary,CUT_BUFFER0)
I have not managed to see any effect of the above code.
How can you use X clipboard in Screen, without your mouse?
Using the mouse. Left-click drag to select and usually the middle mouse button pastes but some terminals may differ (PuTTY uses right-click). If you only have two buttons you click them both together (left mouse button + right mouse button).
In reply to comment below ("Can you do it without your mouse?"):
ctrl-insert : copy
shift-insert : paste
shift-delete : cut
shift-ctrl-C : copy
shift-ctrl-V : paste
Not all applications will support the last three (though Konsole does). In fact most console applications will not allow you to delete text once it's printed.
As far as selecting text without a mouse I'm not sure there's a generic mechanism for that. It's probably terminal and/or application specific (ie, vim has it's own keys for marking and copying text - but only within vim). You could do it with mouse emulation but I'm sure that would be a painful process.
You can't use the traditional Mac/Windows shortcuts in a terminal because they were reserved for different actions long before these OS existed (ie, Ctrl-C terminates the running process).
I'm trying to use Ctrl-C in X
X does not handle these operations directly, they are handled by the application. That's why modern GUI programs like Firefox or Gedit support Ctrl-C for copy but terminals and command-line programs generally do not. As I said, it's a conflict in established conventions and Ctrl-C for kill got in first.
BTW, you could do some key-remapping if it drives you nuts but then you would be learning bad habits when you use a different machine. Best to just get used to it or do most of your editing in a GUI application.
More Information
EDIT: For a Mac, this may help: MacOSX-to-Konsole or This or This. It looks like you need to replace Ctrl with Command on Mac keyboards. It seems like Terminal the mac console has a right-click context menu for copy-paste so to do it the traditional way you me need to install a different console program or change some settings in Terminal.