Re: Best practice for displaying results of shell commands (LaTeX)

2023-01-23 Thread Prachi Gauriar
Hey there,

It’s been 15 years since I did this, but my recollection I built a Makefile 
to do this.

BASE_NAME = MyLaTeXDoc
TEX_SOURCE = $(BASE_NAME).tex
BIBTEX_SOURCE = $(BASE_NAME).bib

RESOURCES = 

INTERMEDIATE_FILES = $(BASE_NAME).aux $(BASE_NAME).log $(BASE_NAME).log 
$(BASE_NAME).bbl $(BASE_NAME).blg
PRODUCT = $(BASE_NAME).pdf
compile: $(TEX_SOURCE) $(RESOURCES) bibtexFile 
pdflatex $(TEX_SOURCE)
pdflatex $(TEX_SOURCE)

bibtexFile: $(BIBTEX_SOURCE) auxFile
bibtex $(BASE_NAME)

auxFile: $(TEX_SOURCE)
pdflatex $(TEX_SOURCE)

preview: $(PRODUCT)
open $(PRODUCT)

.PHONY: clean
clean:
rm -f $(INTERMEDIATE_FILES) $(PRODUCT)

Then I wrote several simple scripts that would run the different Make 
targets (Compile LaTeX, Preview LaTeX, etc.), which I would launch from the 
Scripts palette.

Like I said, it’s been ages since I did this, but it worked pretty well for 
me.

-Prachi

On Sunday, January 22, 2023 at 5:51:09 PM UTC-5 Maarten Sneep wrote:

> Hi,
>
> > On 22 Jan 2023, at 23:18, Andrew J  wrote:
> > 
> > Dear all,
> > 
> > I have been using BBEdit on and off for many years, but I've never been 
> satisfied with its use with LaTeX projects. Many other editing environments 
> (emacs, TextMate, VS Code) have well-supported packages for editing tex 
> files as well as running various latex engines and dealing with the output. 
> > 
> > I understand that BBEdit does not want to be an IDE, but this use case 
> seems pretty straightforward. Indeed, there have been various attempts 
> through the years at making an environment like this through BBEdit's 
> scripting capabilities. 
> > 
> > I note that many such attempts, including this fairly recent one, use a 
> separate terminal process to actually run the latex compiler. Is this 
> considered best practice? It seems to ignore things that BBEdit can do 
> which give ideas for other options:
> > • 
> > capture stdout as the result of the do shell script AppleScript and 
> display in a new untitled window. This is actually straightforward, 
> although I wish I could figure out how to deal with naming windows and 
> possibly not requiring them to be saved.
> > • populate a shell worksheet and run it automatically. I can't quite 
> figure this out -- I've seem some pointers to actually getting the text 
> into a worksheet, but I can't work out running a shell command in a shell 
> worksheet from AppleScript.
> > So: are either of these considered the standard method for this sort of 
> thing -- and is there a standard method, or do most people just keep a 
> terminal window open and do everything by hand?
> > 
> > Any other ideas? Obviously even more advanced stuff like parsing error 
> output, etc. (which is possible in most of the aforementioned IDE-like 
> editors) would be a bonus. I'd really like to move more of my work over to 
> BBEdit
>
>
> I wrote a solution some 20 years ago in AppleScript, using the terminal to 
> do the heavy lifting. This saves you from a ton of configuration issues, as 
> most instructions to get LaTeX working focus on the terminal. In fact most 
> of the scripting is in a shell script that gets called from AppleScript (I 
> strongly dislike AppleScript, it seems that I never get it to behave 
> exactly as I’d like to have it. 
>
> I would not advise to use a worksheet. It will save the output of the 
> latex run, and that is certainly now what you want. Also the behaviour is 
> not exactly what you want when you encounter tex errors. The interaction 
> with terminal windows is in my experience less cumbersome than avoiding the 
> terminal. A variant of the title of a Stanley Kubric movie suddenly floats 
> to the top of my head: "Dr. Strangelove or: How I Learned to Stop Worrying 
> and Love the Terminal".
>
> My tooling is still available on https://msneep.home.xs4all.nl/latex/ I 
> can no longer update it as my ISP made some changes to the overall setup, 
> so if updates are required someone else will have to take over the 
> maintenance. From the title you can figure out how old it is, TextWrangler 
> is absorbed into BBEdit, so a lot of the text no longer applies. The BBEdit 
> version of all scripts still work fine though. Feel free to use this as a 
> starting point. 
>
> Kind regards,
>
> Maarten Sneep

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/5cd46d7d-3b2d-4ae4-b21e-254119075953n%40googlegroups.com.


Re: Clipping and indent

2011-08-07 Thread Prachi Gauriar
On Aug 5, 8:34 pm, Verdon Vaillancourt  wrote:
> I'm trying to make a clipping to do the following…
…
> Any thoughts how to get the subsequent lines to indent to the position of the 
> first in the selection?


(I tried to post this to the group a minute ago, but it didn’t appear
to work, so my apologies if this is double-posted.)

Hi Verdon,

I don’t think you can do this with a Clipping, as Clippings don’t
appear to have access to the individual bits of a selection. I was
able write an AppleScript Text Filter that does what you want:

-- Begin AppleScript Text Filter --

on RunFromBBEdit(text)
set INDENT_STRING to "  "
set chorus to "{c:Chorus}" & return & INDENT_STRING & "{soc}" &
return

tell application "BBEdit"
set selectionLines to every line of selection
repeat with selectionLine in selectionLines
set chorus to chorus & INDENT_STRING & selectionLine &
return
end repeat
end tell

return chorus & INDENT_STRING & "{eoc}" & return
end RunFromBBEdit

-- End AppleScript Text Filter --

Just copy/paste that into AppleScript Editor and save it into ~/
Library/Application Support/BBEdit/Text Filters with a name like
Chorus. It’ll appear in the Text Filters menu and palette. I think it
accomplishes everything your Clipping would have except for placing
the insertion between the {soc} and {eoc} if there was no selection.
Also, if you don’t want to use tabs as your indent string, you can
change the value of INDENT_STRING to whatever you want.

BTW, I’m a total novice at AppleScript, so this may not be super
efficient. I’ll leave it to more experience AppleScripters to chime in
as they see fit.

Hope that helps!

-Prachi

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: Clipping and indent

2011-08-09 Thread Prachi Gauriar
On Aug 8, 9:34 am, verdonv  wrote:
> Well, I think I'm on the right track combining applescript with a
> clipping, but I'm missing something really basic in my applescript.
>
> My clipping is
>
> {c:Chorus}
>     {soc}
> #SCRIPT indentselection.scpt#
>     {eoc}
>
> My applescript is
>
> set INDENT_STRING to "    "
> set selectionLines to every line of selection
> repeat with selectionLine in selectionLines
>         set selectionLine to INDENT_STRING & selectionLine
> end repeat
>

When using scripts with clippings, you need to return a string at the
end:

Try this script:

tell application "BBEdit"
set INDENT_STRING to "  "
set indentedLines to INDENT_STRING & return
set selectionLines to every line of selection
repeat with selectionLine in selectionLines
set indentedLines to indentedLines & INDENT_STRING & 
selectionLine &
return
end repeat
return indentedLines
end tell

with this clipping:

{c:Chorus}
{soc}#SCRIPT indentselection.scpt#{eoc}

While, John’s suggestion of using a UNIX filter is a bit cleaner than
this AppleScript + Clipping stuff, the unfortunate thing about UNIX
filters is that if you don’t have anything selected, it operates on
the entire text of the selection, which might not be what you want.

-Prachi

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


How to get an unsaved document’s selection from a UNIX script?

2011-08-09 Thread Prachi Gauriar
Hi,

I want to automatically produce Java accessor methods (getters/
setters) for the instance variables that I have selected in BBEdit. My
plan is to use a script to read the selection from BBEdit, generate
the accessors, and put the accessor methods on the clipboard. I’m not
an AppleScript fan, so I was hoping to use a UNIX script (in Ruby,
specifically). I have two questions:

1. Is this the right approach? I considered UNIX Filters, but those
replace the selection, which doesn’t work for me; Clippings don’t seem
powerful enough either, given that I might have several instance
variables selected and need to parse/manipulate text.

2. I saw in the manual that there are lots of environment variables
set by BBEdit as a convenience for UNIX scripts. Unfortunately, I
can’t figure out how to get the current selection. It’s not passed in
via STDIN or as an argument like with UNIX filters. In some cases, you
could figure it out using BB_DOC_PATH, BB_DOC_SELSTART, and
BB_DOC_SELEND, but this doesn’t work if the file has never been saved
(BB_DOC_PATH isn’t set) or has unsaved changes (you can’t use the
saved version to figure out the characters in the selection range).
Short of using AppleScript, how does one get the contents of the
current text selection from a UNIX script? Any help would be
appreciated.

-Prachi


P.S. I’ve actually gotten this working using the Scripting Bridge and
Ruby, but I’d prefer a pure Ruby solution, as AppleScript and the
Scripting Bridge never seem to work as I’d expect. Here’s a snippet to
get the lines of the selection

#!/usr/bin/env ruby

bbedit =
OSX::SBApplication.applicationWithBundleIdentifier_("com.barebones.BBEdit")

# Get the contents of the selection, convert it from an NSString into
a String and break it into several lines.
# Regular expressions don't work with NSStrings, so doing the
conversion early is A Good Idea. Also note
# that you have to split using "\r", even if your document uses UNIX
line endings.
bbedit.selection.get.contents.get.to_s.split("\r").each do |line|
  ...
end

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: How to get an unsaved document's selection from a UNIX script?

2011-08-09 Thread Prachi Gauriar

On Aug 9, 1:13 pm, John Delacour  wrote:
> This script leaves the selection as it is (overprints it), performs a
> simple transformation on lines of the selection and prints this to a
> temporary file, which is then read onto the clipboard.

Ah, good thinking! I didn’t consider simply overprinting the selection
and then doing my processing. Thanks, I’ll try this instead of using
the Scripting Bridge.

-Prachi

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: How to get an unsaved document’s selection from a UNIX script?

2011-08-09 Thread Prachi Gauriar
On Aug 9, 12:21 pm, Maarten Sneep  wrote:
> Get all info from an AppleScript, and kick off your shell script (Ruby,
> python, bash, perl, ...) from there. You'd have to pass argument and
> stdin from AppleScript ("do shell script"). My LaTeX scripts [1] do
> exactly that.

I initially attempted to do this, but "set output to do shell
script ..." only saved part of my script’s output. I always struggle
so much when writing AppleScript that I’d prefer avoiding it in the
future. It just doesn’t behave how I expect, which is especially
bothersome given how long and with how many other languages I’ve
programmed.

-Prachi

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: FTP/SFTP Browser shows two "folders" in every directory

2011-08-13 Thread Prachi Gauriar
In UNIX, the . directory is the current directory, and .. is its parent. This 
is common throughout UNIX and many FTP clients. In other words, nothing to 
worry about.

-Prachi (sent from my iPhone)

On Aug 13, 2011, at 12:23 PM, Patrick James  wrote:

> Hi
> 
> I have a strong feeling this question is more about Apache and how my server 
> works than BBEdit, however this issue only arises in the BBEdit  FTP/SFTP 
> browser window, so maybe it is a BBEdit query.
> 
> In every directory shown in there browser there are two "folders" (okay 
> "directories") one has a single full-stop only as its name, the other has two 
> full-stops as its name. (In US english "full-stop" is called a "period").
> 
> Well I know that the full-stop, or period, or dot, at the beginning of a 
> file-name makes that file invisible. When I go to my File Manager in cPanel 
> with "show dot files" enabled I do not see these two directories in every 
> directory.
> 
> I only see them in BBEdit. I had Transmit for a while on a trial basis and it 
> did not show these folders when it was set to show invisibles.
> 
> Thank you for any assistance you may have.
> 
> It is not a very big issue of course, I am just wondering why they are there 
> :)
> 
> Patrick
> 
> -- 
> You received this message because you are subscribed to the 
> "BBEdit Talk" discussion group on Google Groups.
> To post to this group, send email to bbedit@googlegroups.com
> To unsubscribe from this group, send email to
> bbedit+unsubscr...@googlegroups.com
> For more options, visit this group at
> 
> If you have a feature request or would like to report a problem, 
> please email "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: How to get Balance Tags to include the tags

2011-08-23 Thread Prachi Gauriar
On Aug 23, 7:25 pm, DaveHein  wrote:
> I have a lot of HTML files that have do-nothing  blocks in them.
> I'd like to select all the text -- including the opening and closing
> tags -- and then strip HTML. Actually I'd like to just strip the
> opening and closing span tags, and leave what's inside them alone.

Why not do a Grep search/replace?

Search: (.*?)
Replace: \1

-Prachi

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: Font Issues

2012-04-03 Thread Prachi Gauriar

On Apr 2, 5:42 pm, Peter Fleck  wrote:
> I know this has come up before but no one seems to have an answer. I cannot
> change the default editor font.

I have run into this, but the following just worked for me:

1. Launch BBEdit fresh.
2. Make sure no documents are open.
3. Open the prefs, go to Editor Defaults, and set the default font.

I’ve tried this multiple times and it works for me. There have been
other times when documents have been open and I can’t change the
default font to save my life.

Hope that helps!

-Prachi

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: Font Issues

2012-04-04 Thread Prachi Gauriar
On Apr 3, 9:25 am, Peter Fleck  wrote:
> It worked! Thanks, Prachi.
>
> I don't see any mention in the manual of this procedure. In fact, on page
> 194 of the manual describing working with Preferences, it says:
>
> BBEdit’s Preferences window is non-modal: you can leave it open and change> 
> preference settings while you work,

This is clearly not the intended behavior. I suggest you send support
an email reporting the bug and how to reproduce it.

-Prachi

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: Build Menu Option

2012-06-26 Thread Prachi Gauriar

On Monday, June 25, 2012 7:12:57 AM UTC-4, Lea Hayes wrote:
>
> Is there a way to add a menu item to BBEdit called "Build" which will 
> perform the same build action as MonoDevelop?
>

I’m not familiar with MonoDevelop, but if you can build your project from 
the command-line, it shouldn’t be too hard to write an AppleScript or a 
UNIX shell script that you can invoke from BBEdit.

Once you’ve written the script, just drop it into ~/Library/Application 
Support/BBEdit/Scripts with an appropriate name and it should show up in 
your Scripts menu. You can assign keyboard shortcuts and all that. For more 
info, check out chapter 13 of the BBEdit manual.

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: Synchronizing project collection with SFTP and AppleScript

2013-04-28 Thread Prachi Gauriar
On Saturday, April 13, 2013 4:36:58 AM UTC-4, Sandman wrote:
>
> So, what I want to do is to be able to select a collection in a 
> project window in BBEdit, and then select a folder in an Interarchy 
> window (my SFTP client of choice) and then run an AppleScript to 
> synchronize their content. 
>
> And by synchronize, I mean that the script should empty the collection 
> in the project window in BBEdit, and then ask Interarchy for the 
> content of the selected folder. For every result for that list, I 
> would want to create a SFTP linked project item if it is a file, and a 
> new empty collection if it is a folder. 
>

I’m not sure I understand this 100%, but it sounds like you have a folder 
on a remote system, and you want to update that folder via SFTP and have 
your BBEdit project reflect the changes? If that’s not correct, could you 
please explain where I’m misunderstanding?

Anyway, assuming I’m correct, why don’t you just add the (local copy) of 
the folder as a project item instead of using a collection? Then just 
download the folder using Interarchy, and BBEdit should reflect the file 
system changes correctly.

-Prachi

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Ruby Group Comments

2015-11-19 Thread Prachi Gauriar
Hi,

You can get BBEdit to recognize them by going to Preferences:Languages and 
adding Custom Language Preferences for Ruby. In the General tab, set the 
Block comment start to “=begin” and the Block comment end to “=end”.

For Ruby to recognize them, you need to make sure =begin and =end must both 
be the very first thing on their respective lines. 

Hope that helps!

-Prachi

On Wednesday, November 18, 2015 at 1:29:30 PM UTC-5, BeeRich33 wrote:
>
> Hi folks.
>
> I thought the following would group comment Ruby.  BBEdit isn't 
> registering them, nor is Ruby for that matter.  I'm obviously missing 
> something.  Also, I'm not sure how to group comment a block using this 
> technique instead of the default line commenting with #.
>
> =begin
>
> commented out
>
> =end
>
> Any insight appreciated.
>
> Cheers
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.