emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Phil Jackson <phil@shellarchive.co.uk>
To: Fabian Braennstroem <f.braennstroem@gmx.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: create links for all marked files in dired
Date: Mon, 26 Nov 2007 12:29:01 +0000	[thread overview]
Message-ID: <87y7cli41e.fsf@shellarchive.co.uk> (raw)
In-Reply-To: <fic6vf$bm5$1@ger.gmane.org> (Fabian Braennstroem's message of "Sun\, 25 Nov 2007 17\:17\:17 +0000")

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]

Fabian Braennstroem <f.braennstroem@gmx.de> writes:

> Hi Carsten,
>
> Carsten Dominik schrieb am 11/25/2007 02:22 PM:
>> On 11/25/07, Fabian Braennstroem <f.braennstroem@gmx.de> wrote:
>>> Hi,
>>> me again :-)
>>>
>>> is there a chance to create links from the marked files in a
>>> dired buffer using org-mode internal functions?
>>> It would help, when you have a bunch of e.g. images in one
>>> directory...
>> 
>> Can you be more specific?  How you like the output in Org-mode to
>> work?  A link back to dired visiting this directory, or many links to
>> each individual file?
>
> Many links to each individual file would be great.
> Fabian

Off topic, I know, but you could use this as a temporary measure. I've
only just knocked it up and not really tested it so I'm sure there is
bugs. I might re-factor it soon and give it some options/features.


[-- Attachment #2: Zsh shell script --]
[-- Type: text/plain, Size: 629 bytes --]

#!/usr/bin/env zsh

set -e

function headline {
    depth="${1}"
    text="${2}"

    printf "%${depth}s %s" "" | tr ' ' '*'
    echo " ${text}"
}

function scan_and_populate {
    depth="${1}"
    dir="${2}"

    headline ${depth} "${dir}"

    let "depth += 1"

    for f in $(ls -d "${dir}"/* 2>/dev/null); do
        if [ -d "${f}" ]; then
            scan_and_populate ${depth} "${f}"
        else
            headline ${depth} "[[file://${f}][${${f##*/}%.*}]]"
        fi
    done

    let "depth -= 1"
}

function main {
    scan_dir="${1:-$(pwd)}"
    depth=0

    scan_and_populate ${depth} "${scan_dir}"
}

main "${@}"

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


Cheers,
Phil

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2007-11-26 12:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-25 14:51 create links for all marked files in dired Fabian Braennstroem
2007-11-25 14:22 ` Carsten Dominik
2007-11-25 17:17   ` Fabian Braennstroem
2007-11-26 12:29     ` Phil Jackson [this message]
2007-11-27 14:47 ` Bastien
2007-11-28 21:39   ` Fabian Braennstroem

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=87y7cli41e.fsf@shellarchive.co.uk \
    --to=phil@shellarchive.co.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=f.braennstroem@gmx.de \
    /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).