emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [rfc] org-dired
@ 2017-11-12 15:17 Marco Wahl
  2017-11-12 16:38 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Wahl @ 2017-11-12 15:17 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

org-dired (https://github.com/marcowahl/org-dired) is a experimental
little tool to ease attaching files to org subtrees via dired.

Actually I use this feature quite often.

Up to now org-dired-attach-hardlinked-to-next-best-orgee is the only
function available.

The flow goes like so

    Prepare
    - In a dired buffer mark files or have the cursor on a file.
    - Have also an org mode window open.
    - Place the cursor in an orgee. (Orgee is short for org subtree.)
    Act
    - M-x org-dired-attach-hardlinked-to-next-best-orgee
    Enjoy
    - Find the files attached to the orgee.

Feel free to play with the implementation.

WDYT?

Should something like this enter orgmode?


Thanks for your time,
                     Marco

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

* Re: [rfc] org-dired
  2017-11-12 15:17 [rfc] org-dired Marco Wahl
@ 2017-11-12 16:38 ` Nicolas Goaziou
  2017-11-12 17:53   ` Marco Wahl
  2017-11-15 11:07   ` Marco Wahl
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2017-11-12 16:38 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

Hello,

Marco Wahl <marcowahlsoft@gmail.com> writes:

> org-dired (https://github.com/marcowahl/org-dired) is a experimental
> little tool to ease attaching files to org subtrees via dired.
>
> Actually I use this feature quite often.
>
> Up to now org-dired-attach-hardlinked-to-next-best-orgee is the only
> function available.
>
> The flow goes like so
>
>     Prepare
>     - In a dired buffer mark files or have the cursor on a file.
>     - Have also an org mode window open.
>     - Place the cursor in an orgee. (Orgee is short for org subtree.)
>     Act
>     - M-x org-dired-attach-hardlinked-to-next-best-orgee
>     Enjoy

Why is hard linking mandatory? Couldn't this function obey to
`org-attach-method'?

>     - Find the files attached to the orgee.
>
> Feel free to play with the implementation.
>
> WDYT?

According to this description, I think it could be implemented as
a function within "org-attach.el" instead of a new library.

Also, in the context of Org, an "org subtree" is simply a "subtree".
I prefer "subtree" over "orgee".

> Thanks for your time,

Thank you for your work.

Regards,

-- 
Nicolas Goaziou

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

* Re: [rfc] org-dired
  2017-11-12 16:38 ` Nicolas Goaziou
@ 2017-11-12 17:53   ` Marco Wahl
  2017-11-15 11:07   ` Marco Wahl
  1 sibling, 0 replies; 7+ messages in thread
From: Marco Wahl @ 2017-11-12 17:53 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> org-dired (https://github.com/marcowahl/org-dired) is a experimental
>> little tool to ease attaching files to org subtrees via dired.
>>
>> Actually I use this feature quite often.
>>
>> Up to now org-dired-attach-hardlinked-to-next-best-orgee is the only
>> function available.
>>
>> The flow goes like so
>>
>>     Prepare
>>     - In a dired buffer mark files or have the cursor on a file.
>>     - Have also an org mode window open.
>>     - Place the cursor in an orgee. (Orgee is short for org subtree.)
>>     Act
>>     - M-x org-dired-attach-hardlinked-to-next-best-orgee
>>     Enjoy
>
> Why is hard linking mandatory? Couldn't this function obey to
> `org-attach-method'?

This was just my preference since I hardlink almost all of the time.
Further attach-methods should be included, I agree.

>>     - Find the files attached to the orgee.
>>
>> Feel free to play with the implementation.
>>
>> WDYT?
>
> According to this description, I think it could be implemented as
> a function within "org-attach.el" instead of a new library.

I chose org-dired.el because of the similar gnus-dired.el from which the
idea has emerged.  org-attach.el also looks like a good location for the
feature to me.

> Also, in the context of Org, an "org subtree" is simply a "subtree".
> I prefer "subtree" over "orgee".

Okay, I will stay with "subtree".


Thanks!
       Marco
       

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

* Re: [rfc] org-dired
  2017-11-12 16:38 ` Nicolas Goaziou
  2017-11-12 17:53   ` Marco Wahl
@ 2017-11-15 11:07   ` Marco Wahl
  2017-11-15 11:38     ` Nicolas Goaziou
  1 sibling, 1 reply; 7+ messages in thread
From: Marco Wahl @ 2017-11-15 11:07 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>>     Prepare
>>     - In a dired buffer mark files or have the cursor on a file.
>>     - Have also an org mode window open.
>>     - Place the cursor in an orgee. (Orgee is short for org subtree.)
>>     Act
>>     - M-x org-dired-attach-hardlinked-to-next-best-orgee
>>     Enjoy
>
> Why is hard linking mandatory? Couldn't this function obey to
> `org-attach-method'?
>
>>     - Find the files attached to the orgee.
>>
>> Feel free to play with the implementation.
>>
>> WDYT?
>
> According to this description, I think it could be implemented as
> a function within "org-attach.el" instead of a new library.
>
> Also, in the context of Org, an "org subtree" is simply a "subtree".
> I prefer "subtree" over "orgee".

I just pushed the functionality to master.

With the lines

    (add-hook
     'dired-mode-hook
     (lambda ()
       (define-key dired-mode-map (kbd "C-c C-x a") #'org-attach-dired-attach-to-next-best-subtree)
       (define-key dired-mode-map (kbd "C-c C-x c") #'org-attach-dired-attach-to-next-best-subtree-cp)
       (define-key dired-mode-map (kbd "C-c C-x m") #'org-attach-dired-attach-to-next-best-subtree-mv)
       (define-key dired-mode-map (kbd "C-c C-x l") #'org-attach-dired-attach-to-next-best-subtree-ln)
       (define-key dired-mode-map (kbd "C-c C-x s") #'org-attach-dired-attach-to-next-best-subtree-lns)))

in the config file dired gets the functionality on the respective keys.


Critique and improvements welcome, as always, thanks,
                                                     Marco

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

* Re: [rfc] org-dired
  2017-11-15 11:07   ` Marco Wahl
@ 2017-11-15 11:38     ` Nicolas Goaziou
  2017-11-15 13:54       ` Marco Wahl
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2017-11-15 11:38 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

Hello,

Marco Wahl <marcowahlsoft@gmail.com> writes:

> I just pushed the functionality to master.


Thank you. 

However, I didn't have time to comment the code.

There are a few stylistic issues:

  `mapc' + `lambda' -> `dolist' in `org-attach-attach-files'.  

However, I think `org-attach-attach-files' can be removed, since it is
called only once and is really two lines long. IOW, please include it in
`org-attach-dired-attach-to-next-best-subtree'.

  "no window in Org-mode" -> "No window displaying an Org buffer"

I don't think it is useful to implement
`org-attach-dired-attach-to-next-best-subtree-mv'. I assume that once
`org-attach-method' is set, a user is unlikely to change it for a single
command. IOW, let's just implement
`org-attach-dired-attach-to-next-best-subtree'.

Nitpick: an inline comment uses a single semicolon.

It would also be better to shorten function names, e.g.

  org-attach-dired-attach-to-next-best-subtree  ->  org-attach-dired-to-subtree


There are also a few issues in "test-org-attach.el".

For example `touch' uses the wrong name-space. Besides, it is not
useful. We usually do

  (org-test-with-temp-text-in-file 
    "... Org bufer..."
    (let ((filename (buffer-file-name)))
     ...))

It would be best to refactor
`test-org-attach/dired-attach-to-next-best-subtree/1' so that `should'
is the outer sexp. The cleanup part should probably be in an
`unwind-protect'. Not that it is not useful if
°org-test-with-temp-text-in-file'.

Regards,

-- 
Nicolas Goaziou

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

* Re: [rfc] org-dired
  2017-11-15 11:38     ` Nicolas Goaziou
@ 2017-11-15 13:54       ` Marco Wahl
  2017-11-21 22:48         ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Wahl @ 2017-11-15 13:54 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hi!

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Marco Wahl <marcowahlsoft@gmail.com> writes:
>
>> I just pushed the functionality to master.
>
>
> Thank you.
>
> However, I didn't have time to comment the code.
>
> There are a few stylistic issues:
>
>   `mapc' + `lambda' -> `dolist' in `org-attach-attach-files'.

Done.

> However, I think `org-attach-attach-files' can be removed, since it is
> called only once and is really two lines long. IOW, please include it in
> `org-attach-dired-attach-to-next-best-subtree'.

Done.

>   "no window in Org-mode" -> "No window displaying an Org buffer"

Done.

> I don't think it is useful to implement
> `org-attach-dired-attach-to-next-best-subtree-mv'. I assume that once
> `org-attach-method' is set, a user is unlikely to change it for a single
> command. IOW, let's just implement
> `org-attach-dired-attach-to-next-best-subtree'.

Done.

> Nitpick: an inline comment uses a single semicolon.

Okay.

> It would also be better to shorten function names, e.g.
>
>   org-attach-dired-attach-to-next-best-subtree  ->  org-attach-dired-to-subtree

Done.

> There are also a few issues in "test-org-attach.el".
>
> For example `touch' uses the wrong name-space. Besides, it is not
> useful.

Removed.

> We usually do
>
>   (org-test-with-temp-text-in-file
>     "... Org bufer..."
>     (let ((filename (buffer-file-name)))
>      ...))

Okay.

> It would be best to refactor
> `test-org-attach/dired-attach-to-next-best-subtree/1' so that `should'
> is the outer sexp. The cleanup part should probably be in an
> `unwind-protect'. Not that it is not useful if
> °org-test-with-temp-text-in-file'.

I followed you suggestions and I think the new version is cleaner.


Thank you!
          Marco

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

* Re: [rfc] org-dired
  2017-11-15 13:54       ` Marco Wahl
@ 2017-11-21 22:48         ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2017-11-21 22:48 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

Hello,

Marco Wahl <marcowahlsoft@gmail.com> writes:

> I followed you suggestions and I think the new version is cleaner.

It looks good. Thank you!

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

end of thread, other threads:[~2017-11-21 22:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-12 15:17 [rfc] org-dired Marco Wahl
2017-11-12 16:38 ` Nicolas Goaziou
2017-11-12 17:53   ` Marco Wahl
2017-11-15 11:07   ` Marco Wahl
2017-11-15 11:38     ` Nicolas Goaziou
2017-11-15 13:54       ` Marco Wahl
2017-11-21 22:48         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).