From the 8956 release notes:
"Introduced callback.application.did-activate and callback.application.did-deactivate as two new semantic classes. A command with this class will be executed when the application gain/lose focus. The scope selector is matched against the “current scope” of the visible document (in each window). This allows creating a command with “Save” set to “Modified Documents” and thereby recreating TextMate 1.x’s ability to save modified documents on lost focus."
Has anyone gotten this to work? In my personal bundle, I created a new command called "Save files when focus is lost", set the Semantic Class to "callback.application.did-deactivate", set Save to "Modified Documents", and Input to "Nothing". But the files never save. Can't think what I'm doing wrong.
By the way, the command shows up in the Bundles menu, even though there's no point to having it there. Is there a way to keep the command enabled and active but off the menu?
Thanks,
Trevor
On 21 Dec 2011, at 10:52, Trevor Harmon wrote:
[…] callback.application.did-activate […]
Has anyone gotten this to work? […]
Switch to beta/nightly builds — it didn’t work in r8956.
[…] Is there a way to keep the command enabled and active but off the menu?
You can edit the command’s property list on disk and add:
<key>hideFromUser</key> <true/>
It then shows in the bundle editor under Other Actions.
On Dec 21, 2011, at 2:02 AM, Allan Odgaard wrote:
On 21 Dec 2011, at 10:52, Trevor Harmon wrote:
[…] callback.application.did-activate […]
Has anyone gotten this to work? […]
Switch to beta/nightly builds — it didn’t work in r8956.
Works now, thanks! Would be nice if this were somehow built-in to TextMate, even if it were disabled by default.
Trevor
On 22 Dec 2011, at 00:48, Trevor Harmon wrote:
[…] callback.application.did-activate […]
[…] Would be nice if this were somehow built-in to TextMate, even if it were disabled by default.
Doing it as a bundle item is more flexible, e.g. you can enable the feature only when switching away from HTML files, only when working on a certain project, have the command reload the switched-to browser / all browsers, etc.
But it could go into a default bundle, that’s part of the motivation behind the (proof-of-concept) per-item “enable” check box for individual bundle items. This will allow us to introduce some requested features as bundle items which the user simply enable, another candidate being “Strip Whitespace on Save”.
Is there an official list of semantic classes/callbacks in TM2? Either the ones which are currently implemented or maybe a roadmap with status?
If not could there be one?
On 22 Dec 2011, at 15:54, Rick DeNatale wrote:
Is there an official list of semantic classes/callbacks in TM2? […]
* `callback.document.did-save` * `callback.document.binary-import` * `callback.document.binary-export` * `callback.document.import` * `callback.document.export` * `callback.file-browser.action-menu` * `callback.mouse-click`
For the import/export callbacks input/output must be document/replace document. Binary means before/after TextMate converts to/from UTF-8/LF.
For the mouse-click callback you can limit this to a modifier by using any of the following in the scope:
* `dyn.modifier.shift` * `dyn.modifier.control` * `dyn.modifier.option` * `dyn.modifier.command`
The above should be considered subject to change.
I'd like to create something (a-la plugin maybe) that will call `Remove Trailing Spaces...` on `callback.document.did-save`... Can somebody points me a direction? Any docs/help about that kind of stuff?
--- Alexey
On Dec 26, 2011, at 00:40, Allan Odgaard wrote:
On 22 Dec 2011, at 15:54, Rick DeNatale wrote:
Is there an official list of semantic classes/callbacks in TM2? […]
- `callback.document.did-save`
- `callback.document.binary-import`
- `callback.document.binary-export`
- `callback.document.import`
- `callback.document.export`
- `callback.file-browser.action-menu`
- `callback.mouse-click`
For the import/export callbacks input/output must be document/replace document. Binary means before/after TextMate converts to/from UTF-8/LF.
For the mouse-click callback you can limit this to a modifier by using any of the following in the scope:
- `dyn.modifier.shift`
- `dyn.modifier.control`
- `dyn.modifier.option`
- `dyn.modifier.command`
The above should be considered subject to change.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 26 Dec 2011, at 17:13, Gerd Knops wrote:
On Dec 25, 2011, at 2:40 PM, Allan Odgaard wrote:
- `callback.file-browser.action-menu`
- `callback.mouse-click`
Is there some documentation somewhere, or could you say a few words about these?
These are really just proof-of-concept.
The first makes the command show in the action menu of the file browser — if you run the command it should setup the TM variables and the command can also get the file’s content on stdin, have output set to e.g. New Window / HTML etc.
The last one is just like regular commands but activated via mouse click instead of key / tab trigger.
On 27 Dec 2011, at 13:18, Allan Odgaard wrote:
- `callback.file-browser.action-menu`
The “Compress Selected Items” and “Show Images” are example commands using this class.
Presently all commands are always shown — i.e. even specifying ‘attr.rev-path.png’ will not limit it to files with ‘png’ extension — this is just temporary. Ideally it should filter based on the file’s root scope (in addition to attr.*).
We presently have no sample commands for mouse-clicking. This is however using the scope of where the mouse-click falls (incl. the modifiers held down via the dyn.* scopes).
On Dec 27, 2011, at 6:18 AM, Allan Odgaard wrote:
On 26 Dec 2011, at 17:13, Gerd Knops wrote:
On Dec 25, 2011, at 2:40 PM, Allan Odgaard wrote:
- `callback.file-browser.action-menu`
- `callback.mouse-click`
Is there some documentation somewhere, or could you say a few words about these?
These are really just proof-of-concept.
The first makes the command show in the action menu of the file browser — if you run the command it should setup the TM variables and the command can also get the file’s content on stdin, have output set to e.g. New Window / HTML etc.
The last one is just like regular commands but activated via mouse click instead of key / tab trigger.
Interesting. How can I scope it so it only intercepts certain mouse clicks (eg with modifier combination, or double-clicks etc)?
Gerd
On 01/01/2012, at 00.11, Gerd Knops wrote:
[…] How can I scope it so it only intercepts certain mouse clicks (eg with modifier combination, or double-clicks etc)?
You can use the dyn.modifier.* constants in the scope selector mentioned in a previous post (this thread).
Presently no way to distinguish between single/double-click.
On Jan 3, 2012, at 4:20 PM, Allan Odgaard wrote:
On 01/01/2012, at 00.11, Gerd Knops wrote:
[…] How can I scope it so it only intercepts certain mouse clicks (eg with modifier combination, or double-clicks etc)?
You can use the dyn.modifier.* constants in the scope selector mentioned in a previous post (this thread).
Presently no way to distinguish between single/double-click.
Very cool! I have an experimental version of the CTags bundle that upon CMD-click jumps to wherever the term under the mouse is defined. That is an amazing time saver. I'll put it on github when I had a chance to test it a bit more.
Gerd