all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emulating Scrivener's binder feature
@ 2019-04-01  8:09 Paul W. Rankin
  2019-04-01 15:06 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul W. Rankin @ 2019-04-01  8:09 UTC (permalink / raw)
  To: help-gnu-emacs

Hello Emaczens,

I've started a new Emacs package to try and emulate the behaviour of Scrivener's
binder feature.

A buffer in a side window would display the current project not unlike
dired-sidebar -- each file in the project occupying a single line. The ordering
of these files should be arbitrary (i.e. the user may reorder the files) and
this project structure should be persistent across sessions. Global keybindings
should allow navigation from a file in the current project to the next/previous
file in this structure. The user should (eventually) be able to mark a selection
of files and concatenate/export these into a master output.

The idea would be to have a .binder file in the top directory of the project.
This file should be human-readable. Each line in this file should be a file path
relative to the .binder file. Metadata relating to each file is stored below the
file, terminating at the next file or EOF.

Metadata could be: Tags beginning with ":" e.g. :tag1 :tag2 :toast :piglet.
Multi-line notes prefixed with ">" like Markdown blockquotes. Comments start
with "#". Blank lines are ignored.

An example .binder file might look like this:

    # This is a comment

    The Problem of Space.txt
    :kirin
    First Attempt.txt
    :noomi
    > Intro to Noomi.
    An Angry Driver.txt
    :cameo

    > Uncle Bob could do this?

    Archive/Other Options.txt
    Working Together.txt
    :act3 :revised
    > Putting ego aside, Kirin puts all his faith in Noomi's ability to judge
    > the space from outside the truck. Little by little, they make it in.

Someone might suggest that this info all be stored as lisp objects in
.dir-locals.el but my thinking is that a .binder file could be cross-platform
(i.e. also work outside of Emacs).

Before I go to far,

Question 1: Has someone already made something like this? I don't want to
reinvent the wheel...

Question 2: Any suggestions, pitfalls or edge cases?

Regards,
Paul

p.s. please Reply-All, I'm not on the list.

--
https://www.paulwrankin.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Emulating Scrivener's binder feature
  2019-04-01  8:09 Emulating Scrivener's binder feature Paul W. Rankin
@ 2019-04-01 15:06 ` Drew Adams
  2019-04-03  9:34   ` Paul W. Rankin
  2019-04-01 15:27 ` Skip Montanaro
  2019-04-01 16:57 ` Marcin Borkowski
  2 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2019-04-01 15:06 UTC (permalink / raw)
  To: Paul W. Rankin, help-gnu-emacs

> I've started a new Emacs package to try and emulate the behaviour of
> Scrivener's
> binder feature.
> 
> A buffer in a side window would display the current project not unlike
> dired-sidebar -- each file in the project occupying a single line. The
> ordering
> of these files should be arbitrary (i.e. the user may reorder the files) and
> this project structure should be persistent across sessions. Global
> keybindings
> should allow navigation from a file in the current project to the
> next/previous
> file in this structure. The user should (eventually) be able to mark a
> selection
> of files and concatenate/export these into a master output...

> Before I go to far,

Please _do_ go far into this.  Such effort is never wasted, IMO.

> Question 1: Has someone already made something like this?
> I don't want to reinvent the wheel...

There is not only one wheel.  Wheels often need reinventing.

FYI, here is something similar, but it does not correspond
to everything you describe:

1. You can create a Dired buffer that has any combination
   of files and directories that you like.  This feature
   is not very well known, but it's always been there.

   If you use library Dired+ then it's a bit easier to
   create such buffers interactively (and you can
   interactively create Dired buffers as unions etc. of
   other Dired buffers, and add arbitrary files and dirs
   to an existing Dired buffer).

   However, it is not possible (until someone implements
   it!) to sort such a Dired buffer with ad hoc entries.

2. If you use library Bookmark+ then you can bookmark Dired
   buffers, including those just described (i.e., with ad
   hoc entries from anywhere).  Jumping to such a bookmark
   restores the Dired buffer, including all of its markings
   omitted files, `ls' switches, inserted subdirs, etc.

   This gives you a persistent way to record and restore
   the files and dirs of a project, for example.  You can
   also create different bookmark display lists or different
   bookmark files, so you can list only the bookmarks for
   a given project or have different views of a project or
   parts of a project.  You can also bookmark Emacs desktops,
   and quickly switch among them, to flip between different
   projects or different views of a project.

   You can also bookmark a Dired tree.  This gives you a
   set of Dired bookmarks that represent a hierarchy and
   are opened together.

   Bookmark+ also lets you tag bookmarks (and so bookmarked
   files and directories) with arbitrary strings or even
   Lisp key-value pairs.  This gives you another way to
   access/view/define sets of bookmarks (thus files & dirs).


https://www.emacswiki.org/emacs/DiredPlus

(search for "bookmark", for example)


https://www.emacswiki.org/emacs/BookmarkPlus

(search for "dired", for example)




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emulating Scrivener's binder feature
  2019-04-01  8:09 Emulating Scrivener's binder feature Paul W. Rankin
  2019-04-01 15:06 ` Drew Adams
@ 2019-04-01 15:27 ` Skip Montanaro
  2019-04-01 16:57 ` Marcin Borkowski
  2 siblings, 0 replies; 6+ messages in thread
From: Skip Montanaro @ 2019-04-01 15:27 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: Help GNU Emacs

> A buffer in a side window would display the current project not unlike
dired-sidebar

My first thought was that this sounded a bit like speedbar. (I've never
used dired-sidebar.) Might be worth looking around to see what, if any,
metadata files it uses.

Skip Montanaro


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emulating Scrivener's binder feature
  2019-04-01  8:09 Emulating Scrivener's binder feature Paul W. Rankin
  2019-04-01 15:06 ` Drew Adams
  2019-04-01 15:27 ` Skip Montanaro
@ 2019-04-01 16:57 ` Marcin Borkowski
  2019-04-03  9:59   ` Paul W. Rankin
  2 siblings, 1 reply; 6+ messages in thread
From: Marcin Borkowski @ 2019-04-01 16:57 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: help-gnu-emacs


On 2019-04-01, at 10:09, Paul W. Rankin <hello@paulwrankin.com> wrote:

> Hello Emaczens,
>
> I've started a new Emacs package to try and emulate the behaviour of Scrivener's
> binder feature.
>
> A buffer in a side window would display the current project not unlike
> dired-sidebar -- each file in the project occupying a single line. The ordering
> of these files should be arbitrary (i.e. the user may reorder the files) and
> this project structure should be persistent across sessions. Global keybindings
> should allow navigation from a file in the current project to the next/previous
> file in this structure. The user should (eventually) be able to mark a selection
> of files and concatenate/export these into a master output.
>
> The idea would be to have a .binder file in the top directory of the project.
> This file should be human-readable. Each line in this file should be a file path
> relative to the .binder file. Metadata relating to each file is stored below the
> file, terminating at the next file or EOF.
>
> Metadata could be: Tags beginning with ":" e.g. :tag1 :tag2 :toast :piglet.
> Multi-line notes prefixed with ">" like Markdown blockquotes. Comments start
> with "#". Blank lines are ignored.
>
> An example .binder file might look like this:
>
>     # This is a comment
>
>     The Problem of Space.txt
>     :kirin
>     First Attempt.txt
>     :noomi
>     > Intro to Noomi.
>     An Angry Driver.txt
>     :cameo
>
>     > Uncle Bob could do this?
>
>     Archive/Other Options.txt
>     Working Together.txt
>     :act3 :revised
>     > Putting ego aside, Kirin puts all his faith in Noomi's ability to judge
>     > the space from outside the truck. Little by little, they make it in.

Quick question: why not use Org-mode syntax for the binder file?  I.e.,
make each file a headline, and metadata its properties.  You'd get
reordering for free, and maybe other stuff could be useful, like column
view maybe.  Also, it would be usable outside Emacs, since there are
many Org syntax parsers out there.

Just my 2 cents,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emulating Scrivener's binder feature
  2019-04-01 15:06 ` Drew Adams
@ 2019-04-03  9:34   ` Paul W. Rankin
  0 siblings, 0 replies; 6+ messages in thread
From: Paul W. Rankin @ 2019-04-03  9:34 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs


On Tue, Apr 02 2019, Drew Adams wrote:

>> Before I go to far,
>
> Please _do_ go far into this.  Such effort is never wasted, IMO.
>
>> Question 1: Has someone already made something like this?
>> I don't want to reinvent the wheel...
>
> There is not only one wheel.  Wheels often need reinventing.

Thanks Drew, I appreciate the encouragement :)

> FYI, here is something similar, but it does not correspond
> to everything you describe:
>
> 1. You can create a Dired buffer that has any combination
>    of files and directories that you like.  This feature
>    is not very well known, but it's always been there.
>
>    If you use library Dired+ then it's a bit easier to
>    create such buffers interactively (and you can
>    interactively create Dired buffers as unions etc. of
>    other Dired buffers, and add arbitrary files and dirs
>    to an existing Dired buffer).
>
>    However, it is not possible (until someone implements
>    it!) to sort such a Dired buffer with ad hoc entries.

I am a big fan of the `i' key in Dired. I will check out Dired+.

> 2. If you use library Bookmark+ then you can bookmark Dired
>    buffers, including those just described (i.e., with ad
>    hoc entries from anywhere).  Jumping to such a bookmark
>    restores the Dired buffer, including all of its markings
>    omitted files, `ls' switches, inserted subdirs, etc.
>
>    This gives you a persistent way to record and restore
>    the files and dirs of a project, for example.  You can
>    also create different bookmark display lists or different
>    bookmark files, so you can list only the bookmarks for
>    a given project or have different views of a project or
>    parts of a project.  You can also bookmark Emacs desktops,
>    and quickly switch among them, to flip between different
>    projects or different views of a project.
>
>    You can also bookmark a Dired tree.  This gives you a
>    set of Dired bookmarks that represent a hierarchy and
>    are opened together.
>
>    Bookmark+ also lets you tag bookmarks (and so bookmarked
>    files and directories) with arbitrary strings or even
>    Lisp key-value pairs.  This gives you another way to
>    access/view/define sets of bookmarks (thus files & dirs).

Excellent! I think Bookmarks+ will offer a lot of clues on a good 
implementation, as essentially it will be a case of "bookmarking" all 
the files in the project directory in a specific order and 
tagging/annotating them. The other half of things is navigating around 
the project hierachy from the project files themselves (e.g. 
next/previous). Thanks :)

--
https://www.paulwrankin.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emulating Scrivener's binder feature
  2019-04-01 16:57 ` Marcin Borkowski
@ 2019-04-03  9:59   ` Paul W. Rankin
  0 siblings, 0 replies; 6+ messages in thread
From: Paul W. Rankin @ 2019-04-03  9:59 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: help-gnu-emacs


On Tue, Apr 02 2019, Marcin Borkowski wrote:
> Quick question: why not use Org-mode syntax for the binder file? 
> I.e.,
> make each file a headline, and metadata its properties.  You'd get
> reordering for free, and maybe other stuff could be useful, like 
> column
> view maybe.  Also, it would be usable outside Emacs, since there are
> many Org syntax parsers out there.
>
> Just my 2 cents,

That's a valuable 2 cents. Although I don't think that org-mode's 
outline structure would work well the same time as file-path structure, 
this got me really thinking about the fundamental route I'd take to make 
this...

There are two ways to go: a buffer that visits a text file on disk and 
manipulates the properties of the text (like org-mode), or a 
special-mode buffer that constructs text based on a lisp object (like 
bookmarks).

If the .binder file should be human-readable it makes sense to visit a 
file, but I'm beginning to think this is not the best way. When a user 
attempts to navigate from one binder file to another, which should be 
acheivable from any binder file, not just from the binder buffer, I'd 
need to find and parse the binder buffer each time (and make sure it's 
the correct project!). I'd rather have a lisp variable, whereby the 
binder buffer and any visited binder files rely on that variable 
instead. So now I'm thinking this variable really might be best stored 
in .dir-locals.el... hmmm.

Thanks :)


p.s. I actually find org-mode's subtree reordering code to be overly 
complicated (i.e. It kills the current subtree from the buffer, then 
when inserting it in the appropriate place, it needs a whole bunch of 
extra properties about the subtree to appropriately reconstruct it and 
place the point. When I implemented similar subtree reordering in 
fountain-mode, instead when the user moves a subtree up, I just kill the 
preceding subtree and reinsert it below the current one -- way easier!)

--
https://www.paulwrankin.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-03  9:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-01  8:09 Emulating Scrivener's binder feature Paul W. Rankin
2019-04-01 15:06 ` Drew Adams
2019-04-03  9:34   ` Paul W. Rankin
2019-04-01 15:27 ` Skip Montanaro
2019-04-01 16:57 ` Marcin Borkowski
2019-04-03  9:59   ` Paul W. Rankin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.