On 29 Sep 2014, at 18:07, Hans-Jörg Bibiko wrote:
[…] In order to use TextMate::Executor one should execute "TextMate.save_if_untitled('foo')" in beforehand. But I'd like to allow to the user that s/he runs either the entire document or only a selection […]
I don’t understand your proposed semantics as we go from two to four cases:
1. Document is untitled, we have a selection 2. Document is untitled, no selection 3. Document has filename, we have a selection 4. Document has filename, no selection
For example for #3, would you change TM_FILENAME to a temporary file and then save selection to this temporary file? If so, I think this is better handled by your command, e.g.:
if ENV.has_key?('TM_SELECTION') # setup temporary TM_FILENAME and save selection else TextMate.save_if_untitled end
- TextMate::Executor.run -> version
[…] I believe one could solve this kind of problem quite easily, namely if the developer sets explicitly ":version_args => nil" the version querying won't be executed. To achieve that one has to change one single line:
executor.rb line: 99
version = (not options[:version_args].nil?) ?
parse_version(args[0], options) : ''
This makes sense, and I’ve run into this myself (inability to disable the version check for “interpreters” where it didn’t really make sense).
Will you submit a PR for this? If so, I’d suggest avoiding the “not” operator.