[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: from dired to an org file with list of files with links
From: |
Jean Louis |
Subject: |
Re: from dired to an org file with list of files with links |
Date: |
Sun, 13 Dec 2020 18:46:40 +0300 |
User-agent: |
Mutt/2.0 (3d08634) (2020-11-07) |
* TRS-80 <lists.trs-80@isnotmyreal.name> [2020-12-11 19:21]:
> On 2020-12-11 03:09, Uwe Brauer wrote:
> > > Dear Uwe,
> > > * Uwe Brauer <oub@mat.ucm.es> [2020-12-10 22:45]:
> >
> > > (require 'dired-x)
> >
> > > (defun dired-to-org-links ()
> > > "Generates Org links for Dired files and stores in memory. Yank
> > > it in other buffer"
> > > (interactive)
> > > (let* ((files (dired-get-marked-files)))
> > > (when files
> > > (kill-new
> > > (with-temp-buffer
> > > (dolist (file files)
> > > (let* ((base (file-name-nondirectory file))
> > > (link (format "[[file:%s][%s]]\n" file base)))
> > > (insert link)))
> > > (buffer-string))))))
> >
> > Thanks, that is very nice.
> > I played a bit around with org-fstree, that is also useful.
>
> Indeed, nice function!
>
> And what great and fast service! :)
>
> If I may be permitted to pick a nit; Uwe, you may want to prefix the
> function with `my-` or `uwe-` or your initials, etc. for namespace
> reasons. Unless of course this is something Jean Louis is planning on
> submitting as a patch to dired itself... ;)
It is more Org related. In my opinion all built-in Org hyperlink types
should be already integrated in Org, probably also this is integrated.
The org-store-link actually works in Dired.
The org-insert-last-link works to put link into buffer
So it is just iteration missing.