Commit Graph

30 Commits

Author SHA1 Message Date
Allan Odgaard
c7ef9d2d78 Fix typo 2014-09-02 21:16:43 +02:00
Allan Odgaard
2aae17aeb3 fixup! Add items to recent menu when ‘mate’ is called without -w option 2014-09-01 17:36:57 +02:00
Allan Odgaard
7d448c993f Remove --change-dir from mate’s usage information
I don’t think anyone uses it, so consider it deprecated and subject for removal.

Also update the short options list to the currently valid options.
2014-08-30 16:19:23 +02:00
Allan Odgaard
db1fa96114 Add items to recent menu when ‘mate’ is called without -w option
One can force adding to the recent menu by using --recent or disable it (for files we do not wait on) using --no-recent.
2014-08-30 08:51:33 +02:00
Allan Odgaard
4afbf0c0e3 Remove incorrect text about -w being ignored for multiple files
Also update it in an attempt of improving it.
2014-08-28 22:02:49 +02:00
Allan Odgaard
9c5557b442 Boolean mate options are now --[no-]option to force on/off 2014-08-28 22:02:49 +02:00
Allan Odgaard
b624726f9f Remove unused option 2014-08-28 22:02:49 +02:00
Allan Odgaard
14211e5f29 Change all local variables to use camelCase 2014-08-28 22:02:49 +02:00
Allan Odgaard
ecc2f3ad90 Strip ANSI escapes when mate reads from stdin
A warning will be written to stderr when this happens. The user can provide -e/--preserve-escapes to disable the behavior.

Use -e0/--preserve-escapes=0 to suppress the warning.
2014-08-17 22:24:23 +02:00
Allan Odgaard
2e4603bc8c Alphabetize getopt_long() options
This makes it easier to see what letters are still available.
2014-08-17 22:24:23 +02:00
Allan Odgaard
4669dbaa28 Remove commented fprintf statements 2014-08-17 22:24:23 +02:00
Allan Odgaard
8d9a2f5426 Improve lifetime of the authorization wrapper used by mate
While the memory was released during exit, we didn’t free the authorization right, which is shared between multiple processes, unsure if that would actually leak any resources.
2014-07-30 17:40:23 +02:00
Allan Odgaard
c272afaff2 Cleanup/harmonize whitespace
Leading indent should consist only of tabs, beyond that, only spaces should be used.
2014-04-25 16:55:31 +07:00
Allan Odgaard
6359a2ef7c Use symbolic exit success/failure constants 2014-04-21 17:05:35 +07:00
Allan Odgaard
5b47dca1e6 Add ‘sysexits.h’ as a precompiled header 2014-04-14 08:55:06 +07:00
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