Sublime Forum

Unofficial LaTeXTools port to ST3

#21

Hi,

No it didn’t. I actually debugged it a bit, and the problem seems to be on the DDE connection to Sumatra’s service… I “fixed” it by simply using the command line rather than DDE to forward search. I changed the code in jumptoPDF.py as follow, from line 84 :

		elif plat == 'win32':
			# determine if Sumatra is running, launch it if not
			print("Windows, Calling Sumatra")
			# hide console
			startupinfo = subprocess.STARTUPINFO()
			startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
			tasks = subprocess.Popen("tasklist"], stdout=subprocess.PIPE,
					startupinfo=startupinfo).communicate()[0]
			# Popen returns a byte stream, i.e. a single line. So test simply:
			if "SumatraPDF.exe" not in str(tasks):
				print("Sumatra not running, launch it")
				self.view.window().run_command("view_pdf")
				time.sleep(0.5) # wait 1/2 seconds so Sumatra comes up
			setfocus = 0 if keep_focus else 1
			if forward_sync:
                                # Use the command line facility rather than DDE to forward search
				subprocess.Popen("SumatraPDF.exe -reuse-instance -forward-search %s %d %s" % (srcfile,line,pdffile))

This is probably not ideal, that being said DDE is an old facility. It is also probably related to Python 3 rather than Sublime… I’ll use this method for now and I’ll go back to more tests later if I have more time :wink:

0 Likes

#22

[quote=“Talaf”]Hi,

No it didn’t. I actually debugged it a bit, and the problem seems to be on the DDE connection to Sumatra’s service… I “fixed” it by simply using the command line rather than DDE to forward search. I changed the code in jumptoPDF.py as follow, from line 84 :

		elif plat == 'win32':
			# determine if Sumatra is running, launch it if not
			print("Windows, Calling Sumatra")
			# hide console
			startupinfo = subprocess.STARTUPINFO()
			startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
			tasks = subprocess.Popen("tasklist"], stdout=subprocess.PIPE,
					startupinfo=startupinfo).communicate()[0]
			# Popen returns a byte stream, i.e. a single line. So test simply:
			if "SumatraPDF.exe" not in str(tasks):
				print("Sumatra not running, launch it")
				self.view.window().run_command("view_pdf")
				time.sleep(0.5) # wait 1/2 seconds so Sumatra comes up
			setfocus = 0 if keep_focus else 1
			if forward_sync:
                                # Use the command line facility rather than DDE to forward search
				subprocess.Popen("SumatraPDF.exe -reuse-instance -forward-search %s %d %s" % (srcfile,line,pdffile))

This is probably not ideal, that being said DDE is an old facility. It is also probably related to Python 3 rather than Sublime… I’ll use this method for now and I’ll go back to more tests later if I have more time :wink:[/quote]

Nice solution.
By the way, your solution doesn’t work for filenames with spaces.
It may be better.

subprocess.Popen("SumatraPDF.exe","-reuse-instance","-forward-search", srcfile, str(line), pdffile])
0 Likes

#23

[quote=“Desilusionado”]Thanks for the quick response! I got rid of the error above, but got a new one.

After the build command it said on the console, that a .log file could not be found so I just created the file it was looking for. After that I see no errors, evince starts but is unable to open the document (Error opening file: No such file or directory).

What the hell am I doing wrong? :smiley:[/quote]

Don’t have a linux box… so not sure…

0 Likes

#24

Hi all,
Apologies for missing some of the activity on this forum. I get so used to attending mostly to the Github “Issues” interface that I sometimes forget it’s here! But my grateful thanks to @bianjiang for pointing out the self.envi issue. @Desilusionado, could you confirm that you’re still experiencing your problem with the latest Github commits? I found that some code I pulled in to help the plugin work with the temporary directory was causing silent, low-level issues with LaTeX, and though I think I have it fixed under OS X/Linux I’m still not sure about Windows. If you’d like to help debug it, please get in touch via e-mail; my address is d-at-daniel-dot-sh.

And finally, thanks for the new jumpToPDF code, @randy3k. I’m always hesitant to make sweeping changes to the original author’s work, but I’ll definitely consider pulling that or something similar in if DDE is causing serious problems.

0 Likes

#25

Hi all,

I’m the original LaTeXTools author. Good news: I’m in the process of producing an “official” port of LaTeXTools to ST3, which no includes westacular’s super-good ref/cite completion code. Bad news: I’ve only just started :smile: Of course, I’m drawing freely from phyllisstein’s EXCELLENT work, so things will move on quickly, I hope.

I didn’t pull in phyllisstein’s code directly because (1) he added a few things (e.g. different directory for aux files, other previewers) that I’d like to do differently and in any case later, and (2) some of the recent fixes/additions would have required further work merging. In any case, I’m consulting (make that cut-and-pasting) phyllisstein’s code extensively!

You can follow what I"m doing in the ‘st3’ branch. WARNING: right now things are basically still broken, so keep using phyllisstein’s port for now. I’ll let you know when you can start pulling my branch.

phyllisstein, I’ve already thanked you in private, but I’ll do so publicly now: THANKS!!! I’ll have several questions and requests for you soon :smile:

Thanks for your patience! M

0 Likes

#26

Ends up I was too pessimistic. Official announcement:

viewtopic.php?f=5&t=12940&start=0

Cheers,
Marciano.

0 Likes