Comments (8)
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.
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.
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.
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.
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:
-
Sometimes you don't have Emacs always running
That doesn't seem to be an issue for you? -
You don't know whether capture succeeded or not
Is that why you are looking for org-protocol alternative?
from grasp.
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:
- 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.
- 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.
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.
Cool, thanks for the explanations!
from grasp.
Related Issues (20)
- open in sidebar HOT 2
- Feature idea: quote highlighted text HOT 2
- Add the ability to create a new file for each note HOT 2
- setup fails when systemd user directory does not exist HOT 2
- Support selecting multiple ranges HOT 9
- Add Markdown support HOT 4
- Running server/setup fails on macOS HOT 6
- How to capture the website with my own comments? HOT 2
- How to install grasp? HOT 1
- Allow escaping of '%' in templates HOT 3
- Use xdummy for tests skipped on CI?
- Only capture selection and comments if present HOT 1
- Merge captures for the same webpage ? HOT 1
- Newlines being written as '\n' HOT 3
- Feature: Scroll to ID HOT 2
- Document API for grasp/server HOT 2
- Adding support for multiple org files and multiple templates.
- Suggestion – unicorn colourful icon options HOT 4
- Capture multiple selected tabs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grasp.