How does the "live" refresh work? It doesn't with Emacs.

Carsten's Avatar

Carsten

22 Jul, 2012 02:58 PM

With Emacs, I actually have to hit refresh (⌘-R) in Marked to see the update from an edited/saved file.
Not even doing another "open -a marked" for the file does it.

  1. Support Staff 1 Posted by Brett on 22 Jul, 2012 05:04 PM

    Brett's Avatar

    The live refresh watches the open file for any filesystem changes. It has been tested with Emacs and there shouldn't be any difference from other applications as it's not reliant on any editor hooks. Does the refresh work for you with any other applications (say, TextEdit)?

  2. 2 Posted by Carsten on 23 Jul, 2012 06:48 AM

    Carsten's Avatar

    Interesting. Doesn't work with textedit either.
    (I didn't even think of testing that... Thought it might be due to Emacs' special way of saving a file by renaming the old file and creating a new one.)

    Hmm. OSX 10.7.4.
    When I save the file in textedit, the following happens in Marked (fs_usage):

    08:40:16.473792 statfs64 /private/tmp/test1.mkd.txt 0.000007 Marked.5240357
    08:40:16.477031 getattrlist //.DocumentRevisions-V100/PerUID/501/9f/com.apple.documentVersions/F71C6CC3-AB64-41E5-A0CC-E4A963D628E7.txt 0.000017 Marked.5240357

    But the change is not shown.

    When I save in Emacs, no fs_usage activity is visible at all.

    Various preferences are attached.

  3. Support Staff 3 Posted by Brett on 23 Jul, 2012 10:28 AM

    Brett's Avatar

    Is your text file in /private/tmp? Changes won't likely be tracked in system folders…

  4. 4 Posted by Carsten Bormann on 23 Jul, 2012 11:06 AM

    Carsten Bormann's Avatar

    > Is your text file in /private/tmp? Changes won't likely be tracked in system folders…

    Good point, tried it again with ~/Documents. Symptoms appear identical.

    The file is called ~/Documents/test2.mkd

    When I open it in Marked and then start editing it in Emacs, Emacs creates the #...# file. This immediately leads to:

    12:50:22.370600 getattrlist /Users/cabo/Documents 0.000010 Marked.5366352
    12:50:22.370686 getattrlist [ 2] /Users/cabo/Applications 0.000006 Marked.5366352
    12:50:22.370694 getattrlist /Users/cabo 0.000007 Marked.5366352

    Then when I save it, this immediately leads to:

    12:50:28.223815 getattrlist /Users/cabo/Documents 0.000009 Marked.5366494
    12:50:28.223900 getattrlist [ 2] /Users/cabo/Applications 0.000006 Marked.5366494
    12:50:28.223908 getattrlist /Users/cabo 0.000006 Marked.5366494
    12:50:29.478026 getattrlist /Users/cabo/Library/Preferences 0.000009 Marked.5366494

    But no update in Marked.

    And this is the sequence of fsusage events immediately after I save from Textedit.

    12:52:56.291900 PAGE_IN_FILE A=0x7fff88a6e000 <TEXT> QuickLookUI.framework 0.000335 W Marked.5367454
    12:52:56.314727 getattrlist /Users/cabo/Documents 0.000011 Marked.5367454
    12:52:56.314818 getattrlist [ 2] /Users/cabo/Applications 0.000006 Marked.5367454
    12:52:56.314826 getattrlist /Users/cabo 0.000007 Marked.5367454
    12:52:56.329374 statfs64 /Users/cabo/Documents/test2.mkd 0.000019 Marked.5367454
    12:52:56.342670 getattrlist //.DocumentRevisions-V100/PerUID/501/a0/com.apple.documentVersions/71A22E87-4C53-4F29-AE58-E07BA526A63F.mkd 0.000025 Marked.5367454
    12:52:56.490006 statfs64 /Users/cabo/Documents/test2.mkd 0.000025 Marked.5367880
    12:52:56.494623 getattrlist //.DocumentRevisions-V100/PerUID/501/a0/com.apple.documentVersions/9480963D-3081-4F8B-8E1D-402C187D7545.mkd 0.000019 Marked.5367880
    12:52:56.813296 getattrlist /Users/cabo/Documents 0.000049 Marked.5367454
    12:52:56.813398 getattrlist [ 2] /Users/cabo/Applications 0.000008 Marked.5367454
    12:52:56.813408 getattrlist /Users/cabo 0.000008 Marked.5367454
    12:53:01.905984 PAGE_IN_ANON A=0x7fdefb37e000 0.000477 W Marked.5367878

    So it did notice the change, but then did a couple of statfs64 (sic), and didn't act on the event.

    And immediately after another save from Textedit, maybe a bit cleaner:

    12:55:10.812740 statfs64 /Users/cabo/Documents/test2.mkd 0.000124 W Marked.5368851
    12:55:10.820419 getattrlist //.DocumentRevisions-V100/PerUID/501/a0/com.apple.documentVersions/8BA7AE16-7567-4CF2-A4D0-23A4E4648444.mkd 0.000024 Marked.5368851
    12:55:11.061655 getattrlist /Users/cabo/Documents 0.000033 Marked.5368932
    12:55:11.061741 getattrlist [ 2] /Users/cabo/Applications 0.000005 Marked.5368932
    12:55:11.061758 getattrlist /Users/cabo 0.000015 Marked.5368932

    Grüße, Carsten

  5. Support Staff 5 Posted by Brett on 23 Jul, 2012 01:15 PM

    Brett's Avatar

    Not that I have any reason to think it matters, but are you using emacs from a terminal or a GUI?

  6. 6 Posted by Carsten Bormann on 23 Jul, 2012 04:51 PM

    Carsten Bormann's Avatar

    I'm using Emacs 24.1.50 in the emacsforosx version (GUI).

    Below find the completely unbelievable trace from updating the file using vi (command line).
    Again, I need to ⌘-R to display the updated markdown file.

    Grüße, Carsten

  7. Support Staff 7 Posted by Brett on 23 Jul, 2012 04:54 PM

    Brett's Avatar

    I'm going to have to recommend repairing disk permissions and possibly rebuilding spotlight index. I've tested all of these circumstances and am not seeing any issues.

    I'm assuming you have Marked 1.4 running. If you're interested in trying the beta for 1.5 and seeing if it functions better in this case, start a private conversation with me.

  8. Support Staff 8 Posted by Brett on 23 Jul, 2012 04:57 PM

    Brett's Avatar

    By the way, Marked currently uses PresentedItemDidChange for notifications, not root-level fsevents or kqueue's. Those should bubble up to the notification center, though.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac