emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: TRS-80 <lists.trs-80@isnotmyreal.name>
To: emacs-orgmode@gnu.org
Subject: Re: from dired to an org file with list of files with links
Date: Fri, 11 Dec 2020 11:14:44 -0500	[thread overview]
Message-ID: <187b91011b02ac8bf039accd9905423b@isnotmyreal.name> (raw)
In-Reply-To: <87o8j069wx.fsf@mat.ucm.es>

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... ;)

Cheers,
TRS-80


  reply	other threads:[~2020-12-11 16:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 19:44 from dired to an org file with list of files with links Uwe Brauer
2020-12-10 20:36 ` [one pkf found] (was: from dired to an org file with list of files with links) Uwe Brauer
2020-12-10 21:04 ` from dired to an org file with list of files with links Jean Louis
2020-12-11  8:09   ` Uwe Brauer
2020-12-11 16:14     ` TRS-80 [this message]
2020-12-13 15:46       ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=187b91011b02ac8bf039accd9905423b@isnotmyreal.name \
    --to=lists.trs-80@isnotmyreal.name \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).