On Dec 31, 2007, at 1:04 AM, Hans-Jörg Bibiko wrote:
On 30.12.2007, at 20:13, Sergei Yakovlev wrote:
It would certainly be easier for the average user (and somewhat
more flexible) if TextMate had something like
$TM_SELECTED_TEXT_START_LINE_NUMBER and
$TM_SELECTED_TEXT_START_COLUMN_NUMBER
variables, or, alternatively, slightly changed semantics of
$TM_LINE_NUMBER and $TM_COLUMN_NUMBER variables
so that they always return the starting position of selection
(no matter how the selection was made).
Do you know these variables?
$TM_INPUT_START_LINE
$TM_INPUT_START_LINE_INDEX
Oh, I did not know these existed. Thank you, Hans! These variables
are missing from the official Manual. I decided to check for other
variables, and found that TM_COLUMNS and TM_COLUMN_NUMBER
are missing as well. Should I submit a documentation patch?
Ho-ho-ho,
Sergei Yakovlev
I've created a rather nasty hack to allow one to paste to any online
contact ASWELL as any open chat in adiumx. (current version is only
any open chat). The full source of get_destinations.scpt (found in
TextMate.tmbundle/Support/) is attached along with a screen shot.
Compile it with Script Editor.
On Dec 26, 2007, at 10:28 PM, Allan Odgaard wrote:
On 26 Dec 2007, at 14:28, Сергей Яковлев wrote:
[...]
Suggestion 1. It would be useful if TextMate had
variables like $TM_SELECTION_START and
$TM_SELECTION_END which would return the
corresponding offsets in the file (or the cursor
offset, if nothing is selected).
It does in the form of a line/column position of the start position.
Maybe I am simply misunderstanding you, but are you saying that
TextMate returns line and column position of the start position of
selection?
I'm asking because the $TM_LINE_NUMBER and
$TM_COLUMN_NUMBER variables don't quite work this way.
To illustrate what I mean, let's add a 'Show Position' command
that displays position as a tooltip:
echo "$TM_LINE_NUMBER:$TM_COLUMN_NUMBER"
and type 'TextMate' into an empty document. Now, if we select
'TextMate' with mouse from left to right, the command returns 1:9.
If we select 'TextMate' with mouse from right to left, the command
returns 1:1. Finally, if we select 'TextMate' by double-clicking
between 't' and 'M', the command returns 1:5.
So, these variables actually return the cursor position, not the
starting position of selection and it is impossible to calculate the
starting and ending positions of selection from
$TM_LINE_NUMBER and $TM_COLUMN_NUMBER variables
(without knowing how the selection was made).
The only way to do this (that is known to me) is to write a macro that
first calls a command that replaces selection with itself wrapped in
U+FFFC characters:
echo -n $'\357\277\274'$TM_SELECTED_TEXT$'\357\277\274'
and then calls another command that receives the whole document
as an input and can "find" the selection looking for U+FFFC
characters.
It would certainly be easier for the average user (and somewhat
more flexible) if TextMate had something like
$TM_SELECTED_TEXT_START_LINE_NUMBER and
$TM_SELECTED_TEXT_START_COLUMN_NUMBER
variables, or, alternatively, slightly changed semantics of
$TM_LINE_NUMBER and $TM_COLUMN_NUMBER variables
so that they always return the starting position of selection
(no matter how the selection was made).
The reason it does not use a byte offset is that internally TM would have to
"calculate" this (by adding the length of each line preceding the selection)
and I am generally wary of exporting shell variables that need to be
calculated and have an unknown running time (i.e. in practice the user could
have a million lines and each command execution would then always require a
million numbers to be added together).
I assumed that these calculations were already being performed,
after I had a look at:
$ class-dump -C OakTextView TextMate | grep selectedRange
- (struct _NSRange)selectedRange;
- (void)setMarkedText:(id)fp8 selectedRange:(struct _NSRange)fp12;
and saw 'selectedRange'. But, evidently, something much more
complicated is going on, and I certainly would not ask you questions
about TextMate internal workings :-)
The only remaining question is what symbol to use as a
mark. I decided to use √ (221A, SQUARE ROOT character,
which you can type with Option-V), but I'm not sure
this is the best choice. Maybe it's better to use some
character from Private Use Area (E000--F8FF)?
We generally use U+FFFC, OBJECT REPLACEMENT CHARACTER.
I've attached a new version of macros using U+FFFC to the original ticket.
Happy New Year!
-- Sergei Yakovlev
Hello list,
when running the following simple Ruby-Program:
require 'rubygems'
require 'active_support'
using Command+R, I get the following output:
/Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in
`blank_slate_method_added': stack level too deep (SystemStackError)
from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:
84:in `blank_slate_method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/
builder.rb:86:in `method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/
builder.rb:111
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
active_support/core_ext/array/conversions.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
... 8 levels...
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
active_support.rb:30
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `require'
from /Users/cypher/Projects/test.rb:2
/Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in
`blank_slate_method_added': stack level too deep (SystemStackError)
from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:
84:in `blank_slate_method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/
builder.rb:86:in `method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/
builder.rb:111
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
active_support/core_ext/array/conversions.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
... 8 levels...
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
active_support.rb:30
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `require'
from /Users/cypher/Projects/test.rb:2
(OS X.5, default Ruby 1.8.6p111, TextMate Build 1436)
The problem is that both the builder-gem and TextMate's builder.rb try
to alias method_added to blank_slate_method_added. I've patched TM's
builder.rb to alias to tm_blank_slate_method_added instead, which
works. However, this is only a hack to fix this problem, I'm sure
there is a better way to address this (e.g. builder.rb checking wether
a module 'Builder' already exists, and if not, load tm_builder.rb or
something like that).
regards, Markus
When typing the space key in my code in TextMate, how can I let
TextMate use a particular number of spaces instead of that tab character?
I would like to always use 2 spaces instead of the tab character.
Also, how can I auto-format code that already have tabs (or tabs replaced by, say, 4 spaces)
to format it the way I want it (say, tabs replaced by 2 spaces)? Microsoft Visual Studio allowed me to do that. Does TextMate provide such facilities? (Guess I could always turn to regular expressions to fix such stuff.)
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Today i get new revision of TextMate. This is good! and i saw this:
[2007-12-29: REVISION 1455]
[NEW] JavaScript bundle: Add a Javascript beautifier script, with a shortcut
of Ctrl+Q. (Michael Sheets)
Cool! But... sorry pals - I can't find it!
I didnt use svn version of Javascript bundle (but ofcourse i svn up Support
and all *.tmbundles after i receive new TM revision).
I restart TM - and still nothing.
Ctrl+Q works but it do something i would call "minify me code".
Do i miss something?
Hello,
I am new to TM, and I have a couple of questions regarding the Project
Drawer. I did search google and the mailing list archives but I
didn't see an answer to my question.
When I am launching TM I would like it to open up with the Project
Drawer already present.
Also if it could open a directory (like ~/.projects) and all the sub
directories that would be great as well.
I am guessing there is a way to do this with TM since I can issue
`mate ~/.projects`
On the command line and that works. I have Quicksilver installed, so
I bet I could create a trigger that would do what I want, but I would
prefer to just have it work this way by default.
TIA
--
nathan
nathan_at_nathanpowell_dot_org
Ambition is a poor excuse for not having sense enough to be lazy.
~ Edgar Bergen
------------------------------------
Any other GTDAlt users out there?
After doing a clean install of Leopard, I'm having trouble getting the
GTDAlt bundle working again in TextMate.
Am getting Ruby errors when I add dates to actions, and iCal syncing
is using the incorrect date in iCal (one day earlier than set in my
gdt files).
It's a wonderful bundle, and I would love to keep it running smoothly.
Any clues appreciated.
Richard
I just added three bundles to Review.
JavaScript, MooTools & Prototype
The major change is that I moved all the bracketed and whitespace
scopes out of "prototype bracketed" into "javascript base".
There are now two core Javascript languages. "Javascript" and
"Javascript Basic"
When opening a Javascript file, you'll want to use "Javascript".
When you use a language like HTML, it'll automatically include
"javascript basic" as embedded source where necessary.
"Javascript basic" is mostly just a modified version of the current
Javascript language. It should be pared down a bit more still.
The MooTools bundle contains a completely new language syntax.
It also includes the classic mootools language by Joe Maller as
"MooTools 1.1"
It's pretty basic at the moment, but I have plans for upgrading it
and adding context sensitive codecompletion.
The Review Prototype bundle is NOT upgraded for the latest version of
prototype.
All it is is a compatibility upgrade to support the new javascript
core languages.
Those few of you who care, please let me know what I need to do before
I can replace the core bundles with these guys.
—Thomas Aylott – subtleGradient—
Hi,
I saw my NetNewsWire doesn't output from bundle updates RSS feeds.
See the image.
Something needs to be escaped here. Is this a bug in a script to make
feeds?
Or something is wrong in NetNewsWire?
I don't have any plan to make _malicious_file name and commit the file
to the repo :)
Takaaki
--
Takaaki Kato
http://samuraicoder.net