-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single file / multiple posts in single file support #14
base: master
Are you sure you want to change the base?
Conversation
Flycheck notes spaces after punctuation and missing punctuation.
Enabled by setting 'writefreely-multiple-mode' to t. If enabled: - Each first-level heading in the file can be published as its own post. - Post metadata (id, token) is maintained as Org properties on the headline instead of Emacs file-local variables.
This is really cool. Thanks for opening the PR.
What do you think of Alternatively, I think the coolest would be to have a sort of Upon publish or update we check:
Something in the lines of: (let ((multiple-posts-per-file
(cond ((boundp 'writefreely-post-id) nil)
((org-entry-get (point) "POST-ID" t) t)
((writefreely--any-other-heading-has-post-id) t)
((writefreely--query-user-multiple-posts-per-file))
nil)))) |
- Separate the code that deals with properties in to separate functions. - Write wrapper *-post-metadata functions that dispatch to the correct implementation.
That strikes me as being a bit overkill. Step 2b will also potentially cause the amount of work to be done to post each entry to grow with every post. How about either a single defcustom variable, or a property set in the file at the top level. If a variable, call it If a property, call it If the property doesn't exist then attempting to post will use the value from the variable and set the property at the top of the file to match the current value of the variable. |
I think your PROPERTY suggestion is a decent trade-off. |
I'll try and find some time to work on that this weekend. |
Change the type from a boolean to one of a set of symbols.
I'm not convinced it's possible to reliably write a If you don't have a This doesn't make sense as a per-heading property (what should the code do if one entry says So for the time being I've got a customisation variable that the use can set. If they need it set to different things on a per-file basis then they can always use file-local variables to customise it. I gave it the suffix |
Hello. Thank you both. I am going to try writefreely.el soon. I just wanted to ask if this would allow me to have several files, each one with multiple posts. If so, in which order would they appear when published? Thanks again! |
They'll appear in the order that you post them. |
Hi,
This is a work in progress, but I wanted to give you the chance to take a look before it's finished.
It enables a new way of working for writefreely, allowing the user to have multiple posts in a single Org file.
Each post should be its own first-level heading in the file, and each post can be posted, updated, or deleted individually. Per-post metadata is maintained as properties on the headings, instead of as Emacs file-local variables.
Things to probably fix before this is ready to merge:
I'm not sold on the idea of the customisation variable being called writefreely-multiple-mode (unless this actually made sense to be implemented as a derived minor mode...)
I haven't updated the docstrings or documentation.
Some of the functions should be renamed (e.g., writefreely--remove-org-buffer-locals -> writefreely--remove-post-metadata)
Thoughts?