On Tue, 8 Apr 2008, Christiaan Hofman wrote:

...

>>> To work around that, you could write your own script that makes sure
>>> Emacs runs and then calls the server (emacsclient). You could then
>>> set
>>> that as the script in the Skim preferences instead of directly
>>> calling
>>> emacsclient. I think something like the script below may work (save
>>> it
>>> to file, make it executable, and call it with arguments '%line
>>> "%file"').
>>>
>>> #\!/bin/bash
>>> line=$1
>>> file="$2"
>>> osascript -e "tell application \"Emacs\" to activate"
>>> /Applications/Emacs.app/Contents/MacOS/bin/emacsclient --no-wait +
>>> $line "$file"
...

>> I have created a file skimemacs.sh, with the above content (the last
>> three lines are perhaps just one,
...
>
> It should be one line. The script is also linked on the wiki.

>> ~/bin$ ls -l skimemacs.sh
>> -rwxr-xr--  1 rosi  rosi  165 Apr  8 15:05 skimemacs.sh
>>
>> Then, in Skim > Preferences > Sync
>> [Preset] Custom
>> [Command] skimemacs.sh
>
> You need to enter the full path to the script, or install it in a
> default location like /usr/local/bin/.

Since I wouldn't like messing up with the upper system, I added the full 
path to my local ~/bin/skimemacs.sh

> As I said above, use %line "%file", as the script will insert the --no-
> wait and +.

Done:
[Arguments] %line "%file"

I actually grabbed the script from Wiki, adjusted the path of emacsclent, 
because on my MBP, I do not have
/Applications/Emacs.app/Contents/MacOSX

======> the script:
#!/bin/sh
#
# Activates Emacs.app and loads a file at a given line
#
# Usage: openemacs %line "%file"

emacsclient_tool="/Applications/Emacs.app/Contents/MacOSX/emacsclient"

/usr/bin/osascript -e "tell application \"Emacs\" to activate" 
"${emacsclient_tool}" --no-wait +$1 "$2"
======< ignore this separation line, which is part of this email

The above two lines are actually one continuous line in the script.

Quit emacs;
start Skim and open file.pdf at some location

Shift + Cmd + Click launches Emacs with its default *GNU Emacs* 
title buffer. The file.tex can not be opened in the buffer with
Shift + Cmd + Click. If I open file.tex by C-x C-f, then the pdfsync
forward search, i.e. Emacs -> Skim works.

But Skim -> Emacs only raises Emacs without bringing the cursor to the 
corresponding tex code.

Roussanka

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users

Reply via email to