Writing Tool for Programmer

bp
bparanj
Posts: 1
Joined: Fri Feb 01, 2008 8:07 pm

Fri Feb 01, 2008 8:11 pm Post

Hello, I am a programmer and writing includes code snippets. I am finding it difficult to use the empty template. It lacks code formatting. Is there any template that I could use?

User avatar
AmberV
Posts: 24307
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Sat Feb 02, 2008 12:07 am Post

Do you happen to use TextMate? If you do, and are still on Tiger or a version of Leopard that still supports input managers, you could see about installing the Edit in Textmate plug-in which would let you select a document in Scrivener, choose that option from the Edit menu, and then have full access to TM's code support. Saving in TM will update Scrivener.

If you are looking for full code format export in Scrivener, though, you won't find it. The best you can do is put your code snippets in their own Scrivener documents, and make sure to check the "Preserve Formatting" option in the Inspector. Then you can apply whatever font/colour/rule attributes you wish and they will not be wiped out when compiling the draft.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
bobueland
Posts: 423
Joined: Wed Jun 06, 2007 4:13 pm
Location: Sweden

Thu Feb 07, 2008 8:45 am Post

AmberV wrote
...still on Tiger or a version of Leopard that still supports input managers


If you have Leopard then you have to use Terminal to get things to work. Check
http://blog.macromates.com/2007/inputma ... n-leopard/

Essantially you have to enter the following commands in the Terminal
# Remove old version
rm ~/Library/InputManagers/Edit\ in\ TextMate

# Create InputManagers folder
sudo mkdir /Library/InputManagers

# Copy the input manager to /Library
sudo cp -pR /Applications/TextMate.app/Contents/Resources/Edit\ in\ TextMate /Library/InputManagers

# Ensure everything is owned by root
sudo chown -R root:admin /Library/InputManagers


After you've done things described there, start Scrivener (or any other Cocoa App) and the menu item “Edit in TextMateâ€
Don't be a sissy, don't be a snob. Post a reply to Ueland Bob.

User avatar
antony
Posts: 905
Joined: Thu Mar 29, 2007 7:50 pm
Location: England
Contact:

Thu Feb 07, 2008 11:47 am Post

That is serious (and potentially system-dangerous) overkill for something than can easily be done in the Finder...!
Antony Johnston
antonyjohnston.com

User avatar
AmberV
Posts: 24307
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Thu Feb 07, 2008 10:14 pm Post

Do those instructions still work for 10.5.1, though? I had it working in 10.5, but in the last update it stopped working for me.

Antony---what part of that can be done in the Finder? I suppose if there is a safer way of adjusting these system settings it would be good to have them---but as far as I know, there are no Mac Finder ways of doing some of these things here.

The risky move is the last command, which grants root ownership to everything in that directory. Since Input Managers are kind of a security risk anyway (which is why Apple is phasing them out), it's a bit like using an easy to guess password in Windows 95. Point is, if somebody wanted to wreak havoc with InputManagers, they could do it without the root ownership.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
antony
Posts: 905
Joined: Thu Mar 29, 2007 7:50 pm
Location: England
Contact:

Fri Feb 08, 2008 12:08 am Post

AmberV wrote:Antony---what part of that can be done in the Finder?


All of it, apart from the last global root command, but that's not necessary for Input Managers anyway. Just setting them to admin ownership (if they aren't already) should be enough.

I've installed several IMs on my 10.5 systems (Inquisitor, PicLens, Plaxo) by just manually creating the folders and making sure the IMs went in the right place. Didn't have to go near the Terminal.
Antony Johnston
antonyjohnston.com

User avatar
MarcustheBlacksmith
Posts: 220
Joined: Mon Sep 10, 2007 4:48 am
Location: Brisbane, Australia
Contact:

Fri Feb 08, 2008 1:04 am Post

True, but those terminal commands are doing just that - creating the right folders and then setting the permissions correctly. I don't see the overkill :-P

But then I never use 23 clicks where 4 lines will do :) Hangover habit from being a dirty *nix user.

User avatar
AmberV
Posts: 24307
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Fri Feb 08, 2008 3:24 am Post

Yeah, I guess I'm the same way. I trust the command line tools way more than dragging files around that need specific permissions, and Apple's permission tool---especially Leopard's---which seems to have an ornery mind of its own! And yes, the whole 23 clicks thing. :)
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

da
dafu
Posts: 564
Joined: Tue Jan 30, 2007 1:33 am
Platform: Mac
Location: Chicago
Contact:

Fri Feb 08, 2008 4:33 am Post

But then I never use 23 clicks where 4 lines will do Hangover habit from being a dirty *nix user.


Ahem, versus 231 characters that have to be typed perfectly?

:)

Dave

(Former, not lamented, unix sysop who still uses the terminal when he has to.)

cy
cyberbryce
Posts: 74
Joined: Tue Jan 09, 2007 4:27 am

Fri Feb 08, 2008 5:34 am Post

antony wrote:If it, apart from the last global root command, but that's not necessary for Input Managers anyway. Just setting them to admin ownership (if they aren't already) should be enough.

I've installed several IMs on my 10.5 systems (Inquisitor, PicLens, Plaxo) by just manually creating the folders and making sure the IMs went in the right place. Didn't have to go near the Terminal.


Perhaps two separate issues are getting confused in this discussion, then -- how you make the changes, and what changes are necessary. The script sets the permissions to root:admin, but if I'm understanding you correctly, one could instead change that line to set permissions to <an_admin_user>:admin, whether in the Finder or via the commandline:

sudo chown -R <an_admin_user>:admin /Library/InputManagers

Or have I totally misunderstood? Maybe that's not truly much safer than root (or perhaps I'm suffering mental bit-rot given that the most exciting thing that happens in my system is the appearance of "Stealth Mode" in the logs?)

Bryce

User avatar
MarcustheBlacksmith
Posts: 220
Joined: Mon Sep 10, 2007 4:48 am
Location: Brisbane, Australia
Contact:

Fri Feb 08, 2008 11:35 am Post

AmberV wrote:Yeah, I guess I'm the same way. I trust the command line tools way more than dragging files around that need specific permissions, and Apple's permission tool---especially Leopard's---which seems to have an ornery mind of its own! And yes, the whole 23 clicks thing. :)


Ugh, tell me about it - just did a migrate after upgrading my HDD in my MBP (300GB usable...woo!), and my Library and Application folders are all referring to '_unknown user' for read and write permissions rather than System like they should.

I *could* go through and set them using Leopard's permissions manager, one by one, and *maybe* they'll take and maybe they won't. Or, I could use chown and do it in one foul swoop :)

Yah, Mac OSX's window manager is a beautiful thing, but that doesn't make it perfect for everything (and I hear we're due a good number of fixes for Leopard's borked permissions system in 10.5.2).

User avatar
antony
Posts: 905
Joined: Thu Mar 29, 2007 7:50 pm
Location: England
Contact:

Fri Feb 08, 2008 11:43 am Post

Yeah, as Dave says, my problem with this sort of method - especially when you're giving the advice to users who aren't familiar with Unix* - is the potential for disaster if you type something wrong, or inadvertently enter a command without fully understanding what it does. Particularly when sudo is invoked...

For something system-wide, of course you'd use the Terminal, but I would also always stress the importance of accurate typing. For something that's essentially just creating a couple of folders, I'd always rather stick with the Finder - at least that way I can move stuff out of the Trash if I mess it up ;)

*Not necessarily the OP in this case, but there are plenty out there who might have the same problem and decide to try it out...
Antony Johnston
antonyjohnston.com