[OS X Emacs] Emacs -> Skim sync not workin' [SOLVED]
David Reitter
david.reitter at gmail.com
Sat Sep 20 22:03:57 EDT 2008
On 20 Sep 2008, at 21:26, Christopher Menzel wrote:
>
> Tom's problem had to do with loading a file into Aquamacs whose
> full pathname included the string "TeX". Tom typed "tex" and
> Aquamacs was smart enough to do the conversion to upper case and
> load the file, but apparently the incorrectly typed name was stored
> for use in forward/inverse searching.
Ah, sounds familiar. Thanks for jogging my mind.
>
> However, I like having the folders containing all of my research
> papers in a single directory (~/Research/papers) beneath my Home
> directory, so I had created *symlinks* to the research folders on my
> (local) iDisk. The problem with Aquamacs -> Skim syncing only
> arises if I use the symlink to load a paper into Aquamacs; if I call
> it instead via its actual path on the iDisk (e.g., /Volumes/c.menzel/
> Research/papers/foo/foo.tex) I get Aquamacs -> Skim syncing back.
Excellent analysis.
> So the bottom line here is that something in the syncing process
> doesn't like symlinks. (I'm guessing Applescript.)
Applescript should just pass on the POSIX style paths.
I suspect that Skim compares the files, and it uses the canonical file
name rather than what it was started with.
I just wrote the code below that addresses this issue - I do think
that a fix should go into Skim rather than Aquamacs.
- D
--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and
support the Aquamacs Project!
(defun canonicalize-file-name (file)
"Expand symlinks in file name.
Otherwise, like `expand-file-name'."
(let ((f ""))
(mapcar
(lambda (x)
(setq f
(let* ((f2 (concat f "/" x))
(exp (file-symlink-p f2)))
(if exp (concat f "/" exp) f2))))
(cdr (split-string (expand-file-name file) "/")))
f))
(defun aquamacs-call-viewer (the-file line source)
"Display THE-FILE as PDF at LINE (as in file SOURCE).
Calls `aquamacs-tex-pdf-viewer' to display the PDF file THE-FILE."
(let ((full-file-name
(expand-file-name
the-file
(and buffer-file-name (file-name-directory buffer-file-name))))
(full-source-name
(expand-file-name
source
(and buffer-file-name (file-name-directory buffer-file-name)))))
(do-applescript
(format
"
set theSink to POSIX file \"%s\"
set theSource to POSIX file \"%s\"
tell application \"%s\"
activate
open theSink
tell front document to go to TeX line %d from theSource
end tell
" full-file-name (canonicalize-file-name full-source-name)
aquamacs-tex-pdf-viewer line))))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2193 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20080920/77f22277/attachment.p7s>
More information about the MacOSX-Emacs
mailing list