Comment 2 for bug 1834336

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote : Re: [Bug 1834336] Re: Reload if content file changed on disk (feature request)

Nice!

I probably will have a look at it next week.
I might use your code as a starting point, keeping in mind a possible
future auto-refresh (on disk update) functionality.

No worries, about the crappy code.
I am a decent Java developer, but a horrible C coder myself too. :)

On Thu, 27 Jun 2019 at 10:30, metastork <email address hidden> wrote:

> Hi, in case you want to consider merging this, I've made a pull request
> for my local install adding a --refresh command line argument
> functionality, which seems to work fine (but please note I have never
> coded in C properly, so please check that it looks fine if considering
> it):
>
> https://code.launchpad.net/~metastork/xpad/xpad
>
> (sorry about the errant white-space diffs in the branch - I'm new to bzr
> and wasn't able to get it to ignore white spaces that sublime text seems
> to have inserted for no obvious reason)
>
> --
> You received this bug notification because you are subscribed to Xpad.
> Matching subscriptions: Arthur Borsboom
> https://bugs.launchpad.net/bugs/1834336
>
> Title:
> Reload if content file changed on disk (feature request)
>
> Status in Xpad:
> New
>
> Bug description:
> Hi all, wonderful work on xpad, and the scrollbars fix in version 5.4
> is working very well! I thought I'd float a small request for a
> feature, which others might perhaps find useful if using xpad as a
> todolist.
>
> Currently, I think, if directly modifying a ~/.config/xpad/content-
> ABCDEF file in a text editor, an existing xpad instance that is open
> does not reflect those changes (which is expected behaviour).
>
> But it may be useful if xpad periodically checks when it's running
> whether a content-ABCDEF file has been modified more recently than the
> last time xpad has written the file and, if it has been, to reload the
> file from disk.
>
> ==Why?==
>
> This would allow using command line tools (like TODO.txt, awk, etc) or
> text editors to do more advanced searches and manipulation of the
> content file (i.e., to have a script automatically and periodically
> delete any items that have been marked DONE or formatted with
> 'strikethrough' (or even archive those into another xpad note), or to
> sort the file by priority of tasks, etc).
>
> It is possible to currently emulate this behaviour by using "xpad
> --quit" and restarting xpad but that's perhaps less elegant for those
> who keep it running in the background, and it could be nice if it was
> native functionality.
>
> Edit: Another temporary but much easier solution to implement, could
> be a command line option like --refresh. This could manually reload
> all open files from disk and could be triggered by users' scripts
> manipulating the content files.
>
> ==Potential risks==
>
> While a fairly simple operation, this could negatively impact
> performance a little (potentially the check could be limited to only
> run if an xpad window is currently in focus / active?).
>
> It could also lead to issues in xpad remembering the previous cursor
> position within a note, if complex manipulations have been made, which
> may be more tricky to solve (but it could perhaps be behaviour that a
> user would accept if they intentionally manually modify the file...)
>
> Finally, I'm not sure how robust the content- file format is and if it
> would be possible for users to corrupt the file if they accidentally
> break some formatting codes or insert strange characters into the
> file.
>
> Would be happy to hear the community's thoughts on if this would be a
> useful feature.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/xpad/+bug/1834336/+subscriptions
>

--
Arthur Borsboom
Mob: +31629089953
Email: <email address hidden>
[image: View Arthur's LinkedIn profile]
<http://uk.linkedin.com/in/arthurborsboom>