For example the bundle item “Execute Line / Selection” will (without a selection) show as “Execute Line” in the menu, and now also if the command causes the error sheet to appear or the user press ⌃C / ⌘. to prematurely kill it.
This is instead of having a copy of the same code. Ideally command execution would be called after potential pre-exec stuff, but macro execution is presently handled by editor_t which doesn’t have access to the higher level stuff.
These are now all prefixed with what they are obtaining variables for (scope, document, bundle, …) which makes it easier to analyze/refactor the code.
Also change document_t’s settings function to document_settings.
Previously we would only set the variable if the command couldn’t be found via PATH. By always setting the variable, we remove redundancy from commands, as they can now rely on the variable instead of needing fallback code (to load via PATH).
The downside is that there are cases where a command may wish to know if the user explicitly set the variable, for example the Run command for Python will ignore the script’s shebang if the user explicitly set TM_PYTHON. As this command doesn’t use the requirement system, it’s not an actual problem. Should it want to specify the requirement, it can do so by using a variable like TM_PYTHON_AUTO and then in the locations array, set TM_PYTHON, this would allow the command to test if TM_PYTHON is set and if not, still have ‘python’ available via the TM_PYTHON_AUTO variable — although, should python not be found, the error dialog will tell the user to set TM_PYTHON_AUTO.
Issue #767
While I have tried to keep most of the functionality the same (to get functional changes spelled out in the commit history) there are some significant changes:
When you open a folder or document(s) a default project folder will be based on the path(s) opened. This means that as long as you always open the root of your project (via `mate`, `open -a TextMate`, dragging the folder to TextMate, using the favorites (⇧⌘O), open dialog, `txmt:` URL scheme, or what have you), your project no longer require a `.tm_properties` file setting `projectDirectory` for Find in Folder (⇧⌘T), Go to File (⌘T), and similar to work as desired. Additionally the default properties now set a window title that include the project folder’s name (and SCM branch when available), so most projects can now also drop setting `windowTitle`.
Furthermore the file browser (for when opening documents) will default to the project folder rather than the folder set in Preferences (the latter is still used if there is no document, e.g. after ⌘N or ⌃⌘N).
The default project folder, even for opening a single document, means that opening more documents from the same folder (via Finder or perhaps something that uses the same temp folder for the local versions (which `rmate` does)) means that the following documents will open as tabs in the already open window (containing the first one opened). I _think_ this takes care of the common request of having all documents opened appear in new tabs of the frontmost window.
For managing tabs the ‘Merge All Windows’ action now ignores minimized windows. This means that if you wish to only merge a few windows then you can minimize all but those you wish to merge and then perform the action.
This commit should also address issue #117 (closing window’s last document via the file browser closes the entire window). Canceling a file open also no longer causes the entire window to close, but there’s still some work to do in this department (actually backtracking to previous state, which could mean closing the window if the window was opened only to show this document).
Prior to this commit the tab bar would be automatically pruned when overflowing, this is no longer the case, though this functionality should return.
The block used the ‘uuid’ variable, this variable was however a (const) reference, so it wasn’t safe to use within the block.
While fixing the bug (by introducing a local non-reference variable for the bundle item) we have also changed the code slightly, so that “Edit Command…” only shows when a bundle item is found (this is mainly in preparation for running shell commands that doesn’t have a bundle item, e.g. from a future “Filter Through Command” dialog).
There’s a few commands which want to read settings from the current theme. So far these have been reading the theme UUID from TextMate’s settings and scanned the disk to find the corresponding property list.
This is pretty bad because theme UUID can be set in different ways, themes can be in arbitrary bundles, and the property lists can be in delta format.
The latter is not solved, though we ensure the variable point to the base theme, incase a delta exist. TextMate could simply write a non-delta version of the theme to TMPDIR and let the variable point to that, so we’re not really limiting ourself by adding this variable.