Commit Graph

15 Commits

Author SHA1 Message Date
Allan Odgaard
69c83e56df The ‘const’ keyword should be to the right of its type
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.

E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
2014-03-31 08:27:19 +07:00
Allan Odgaard
db13d4c1f9 Use std::string::back() instead of operator[] with size()-1 2014-03-31 08:27:18 +07:00
Allan Odgaard
6cbf04547e The mate command will only default to UUID when stdin is empty
This is a minor change of the behavior introduced in 18d9aa030, which made it default to the new --uuid mode when TM_DOCUMENT_UUID was set, and no files were given. This meant that commands (executed from TextMate) could not do something like:

    echo foo|"$TM_MATE"

Since there is no way to know if data is actively being sent to mate, we check if the length of data read is zero, and treat that as “no data was sent to mate”, but in theory a command could pipe potential empty user data to mate, which would lead to the wrong behavior. A command that may do this, should unset the TM_DOCUMENT_UUID environment variable.
2014-02-26 08:29:42 +07:00
Allan Odgaard
6c31a849b1 Use constants from sysexits.h for mate failure codes 2014-02-23 23:18:52 +07:00
Allan Odgaard
18d9aa030b Add -u/--uuid option to mate shell tool
If no files are specified, the -w flag is not used, and TM_DOCUMENT_UUID is set, then this argument defaults to the value of the TM_DOCUMENT_UUID environment value.
2014-02-11 16:45:39 +07:00
Shane Becker
b1fe3b7561 Added a possessive apostrophe to mate -h
TextMate's, not TextMates.
2013-10-24 16:04:35 +02:00
Grant Hollingworth
fa1f4254cb Remove obsolete help text for mate -n 2013-07-21 13:25:14 +02:00
Allan Odgaard
17ef6ef5d0 Use path::is_absolute instead of custom code 2013-03-14 10:14:45 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
216bcb61ac mate: don’t disable untitled document when called w/o files 2013-02-03 10:48:44 +01:00
Allan Odgaard
84587dccc9 mate: disable untitled document via user defaults
This is instead of setting an environment variable. Since there already is a user defaults setting for whether or not we want an untitled document created at startup, it seems nicer to have mate set that, instead of effectively introducing an alias for the setting.
2013-02-03 10:48:43 +01:00
Allan Odgaard
eb3e7dd8f2 Fix running mate via sudo
Since we now use the (numeric) user ID as part of TextMate’s named socket (to allow multiple users on the same system to each run an instance of TextMate), mate needs to know this.

Running ‘mate’ via ‘sudo’ has getuid() return zero (root), hence why we need to specifically handle this.
2012-08-31 23:16:39 +02:00
Allan Odgaard
d38308f6c8 Move ‘mate’ socket (back) to /tmp
We moved it to TMPDIR so that multiple instances of TextMate could run (for different users) but have since gotten a lot of reports about problems with this location. The short version is that ‘ls’ shows the socket exists (in TMPDIR), but stat’ing it or similar will fail.

To still allow different users to use mate side-by-side we add the user ID to the socket name.

Hopefully this closes issue #183.
2012-08-21 21:54:18 +02:00
Allan Odgaard
5d0682d317 Use user-specific temp directory for mate’s socket
We have TextMate create a named socket that ‘mate’ can use to contact the main application. Previously it was hardcoded to ‘/tmp/avian.sock’ which is bad on a multi-user system.

Placing it in the user’s temporary directory should ensure it doesn’t clash, yet still give us a predictable path (for mate to use).

Presently we maintain the old socket path as a link to the new location so that old versions of mate will still work.
2012-08-11 21:01:40 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00