Giter VIP home page Giter VIP logo

Comments (8)

karlicoss avatar karlicoss commented on May 26, 2024

Hi there!

One of main motivations was not relying on always running Emacs and treating org file as a plain text file (agree there is chance of edit conflict though).

You suggestion does sound interesting, but I'm not sure I get it completely -- do you find org-protocol isn't enough for you? E.g. you want to actually invoke Emacs window on capture from browser to choose file/heading to capture? How are you planning to use org-id-find?

from grasp.

alphapapa avatar alphapapa commented on May 26, 2024

The main point of doing it from within Emacs would be to avoid editing conflicts, i.e. a modified, unsaved Org buffer having its file modified from outside Emacs.

org-id-find could be used to capture entries to subtrees rather than as top-level headings.

from grasp.

karlicoss avatar karlicoss commented on May 26, 2024

Personally I just capture from grasp in a separate file and refile now and then, that way I never have conflicts. But, actually I do have bit of code that checks for emacs lockfiles in other tool that worked relibably so far, so perhaps I could use it here as well? It kind of relies on default lock file naming convention, not sure if people change it!

As for capturing into subtree: you know of org-protocol right? You can use any capture template, in particular file+headline. Feels like you'll be fine with using org-capture-extension considering you've always got Emacs running? Although, not sure how it behaves with respect to editing conflicts -- you might wanna check (bet it just silently fails).

from grasp.

alphapapa avatar alphapapa commented on May 26, 2024

Personally I just capture from grasp in a separate file and refile now and then, that way I never have conflicts.

If that separate file is already open in Emacs...

As for capturing into subtree: you know of org-protocol right?

Well, yes: https://github.com/alphapapa/org-protocol-capture-html

Feels like you'll be fine with using org-capture-extension considering you've always got Emacs running?

I thought Grasp was intended as an alternative to that extension and to org-protocol.

from grasp.

karlicoss avatar karlicoss commented on May 26, 2024

If that separate file is already open in Emacs...

I've got autoreload, so unless it was open and in the process of editing, it'll be okay.
I guess I don't understand which behaviour you're expecting when you're trying to capture into a file that's being edited :)

  • option 1: don't do anything and display error notification in browser. It's not how it works at the moment, but fairly easy to implement with lock file checking (still is tiny probability of conflict, but I'd say negligible)
  • option 2: actually talk to Emacs (and instead of treating file as plaintext file, append stuff in the buffer if it's being edited. That way capture succeeds. Also negligible probability of conflict.

Is it the latter option why you were suggesting with running the server within Emacs?

I thought Grasp was intended as an alternative to that extension and to org-protocol

I really wish I didn't have to reinvent alternatives! Grasp mainly works around two (kind of fundamental) limitations of org-protocol + mime handler:

  1. Sometimes you don't have Emacs always running
    That doesn't seem to be an issue for you?

  2. You don't know whether capture succeeded or not
    Is that why you are looking for org-protocol alternative?

from grasp.

alphapapa avatar alphapapa commented on May 26, 2024

If that separate file is already open in Emacs...

I've got autoreload, so unless it was open and in the process of editing, it'll be okay.

I also use auto-revert-mode for some of my Org files. But AFAIK most users don't.

I guess I don't understand which behaviour you're expecting when you're trying to capture into a file that's being edited :)

I'm not expecting anything. I'm just saying that, ideally, such conflicts would be handled. And the most "correct" way would probably be to pass the capture to Emacs so the file can be edited by Emacs, which avoids any out-of-process editing conflicts.

Is it the latter option why you were suggesting with running the server within Emacs?

IIUC the extension works by contacting a server over HTTP with the capture data, and it's the server's job to capture the data to the Org file. So running the HTTP server in Emacs would cut out the middleman.

I thought Grasp was intended as an alternative to that extension and to org-protocol

I really wish I didn't have to reinvent alternatives! Grasp mainly works around two (kind of fundamental) limitations of org-protocol + mime handler:

  1. Sometimes you don't have Emacs always running
    That doesn't seem to be an issue for you?

If I'm at my desktop using a browser, I have Emacs running.

  1. You don't know whether capture succeeded or not
    Is that why you are looking for org-protocol alternative?

I'm not necessarily looking for alternatives, I just stumbled upon this and am trying to understand how it works and why, and offer ideas that might improve it. I hardly use org-protocol anymore because I do most capturing with org-web-tools. (Mainly because org-protocol stopped working for me sometime in the past due to browser churn, and though it may be fixable, I lost interest in trying to fix it.)

from grasp.

karlicoss avatar karlicoss commented on May 26, 2024

I'm not necessarily looking for alternatives, I just stumbled upon this and am trying to understand how it works and why, and offer ideas that might improve it.

Ah, gotcha. Sorry for misunderstanding! Appreciate the ideas, I just interpreted it as if you were trying to use this and were asking for features :)
Thanks for the questions, they'll help me to update readme to make the aim and scope clearer.

IIUC the extension works by contacting a server over HTTP with the capture data, and it's the server's job to capture the data to the Org file

Yep, you understood right, that's all grasp does.

So running the HTTP server in Emacs would cut out the middleman.

Yes!

But one of the reasons I developed it in the first place is that I have some computers without Emacs installed where I want to use something simular to org-capture. Grasp backend script doesn't use anything apart from Python's standard library, so more portable in the sense that you can run it on most compurets without having to install anything.
In addition not relying on Emacs makes it format-agnostic, e.g. you can use it with any other syntax and outliner whether you're doing it in sublime, vim or anything else. I think capture is a very powerful concept and should be spread outside community of people using Emacs.

ideally, such conflicts would be handled
the most "correct" way would probably be to pass the capture to Emacs

Yep, agree!
I guess this is the basic tradeoff of this tool -- not relying on Emacs is better when you don't have Emacs around and worse when you do have Emacs around.

But otherwise, in theory nothing prevents one to develop backend in Emacs -- it's basically a matter of parsing bit of JSON.

from grasp.

alphapapa avatar alphapapa commented on May 26, 2024

Cool, thanks for the explanations!

from grasp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.