all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: create links for all marked files in dired
  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-27 14:47 ` Bastien
  1 sibling, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2007-11-25 14:22 UTC (permalink / raw)
  To: Fabian Braennstroem; +Cc: emacs-orgmode

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?

- Carsten

>
> Greetings!
> Fabian
>
>
>
> _______________________________________________
> 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
>

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

* create links for all marked files in dired
@ 2007-11-25 14:51 Fabian Braennstroem
  2007-11-25 14:22 ` Carsten Dominik
  2007-11-27 14:47 ` Bastien
  0 siblings, 2 replies; 6+ messages in thread
From: Fabian Braennstroem @ 2007-11-25 14:51 UTC (permalink / raw)
  To: emacs-orgmode

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

Greetings!
Fabian

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

* Re: create links for all marked files in dired
  2007-11-25 14:22 ` Carsten Dominik
@ 2007-11-25 17:17   ` Fabian Braennstroem
  2007-11-26 12:29     ` Phil Jackson
  0 siblings, 1 reply; 6+ messages in thread
From: Fabian Braennstroem @ 2007-11-25 17:17 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: Re: create links for all marked files in dired
  2007-11-25 17:17   ` Fabian Braennstroem
@ 2007-11-26 12:29     ` Phil Jackson
  0 siblings, 0 replies; 6+ messages in thread
From: Phil Jackson @ 2007-11-26 12:29 UTC (permalink / raw)
  To: Fabian Braennstroem; +Cc: emacs-orgmode

[-- 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

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

* Re: create links for all marked files in dired
  2007-11-25 14:51 create links for all marked files in dired Fabian Braennstroem
  2007-11-25 14:22 ` Carsten Dominik
@ 2007-11-27 14:47 ` Bastien
  2007-11-28 21:39   ` Fabian Braennstroem
  1 sibling, 1 reply; 6+ messages in thread
From: Bastien @ 2007-11-27 14:47 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Fabian Braennstroem

Hi Fabian,

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

> is there a chance to create links from the marked files in a
> dired buffer using org-mode internal functions?

I already suggested something for this here:

  http://article.gmane.org/gmane.emacs.orgmode/4440

If you want to create a list of links from dired and copy this list to
the kill-ring, maybe you can use something like this as well:

(defun my-copy-dired-files-in-kill-ring ()
  "Copy files names in the kill ring."
  (interactive)
  (let ((files (dired-map-over-marks (dired-get-filename) nil)))
    (kill-new
     (mapconcat 
      (lambda (f) 
	(concat "[[file:" f "][" 
		(file-name-nondirectory f) "]]"))
      files "\n"))
    (message "%d Org links copied to the kill-ring" (length files))))

Does that help?

-- 
Bastien

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

* Re: create links for all marked files in dired
  2007-11-27 14:47 ` Bastien
@ 2007-11-28 21:39   ` Fabian Braennstroem
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Braennstroem @ 2007-11-28 21:39 UTC (permalink / raw)
  To: emacs-orgmode

Hi to both,

thanks for your help ...

Bastien schrieb am 11/27/2007 02:47 PM:
> Hi Fabian,
> 
> Fabian Braennstroem <f.braennstroem@gmx.de> writes:
> 
>> is there a chance to create links from the marked files in a
>> dired buffer using org-mode internal functions?
> 
> I already suggested something for this here:
> 
>   http://article.gmane.org/gmane.emacs.orgmode/4440
> 
> If you want to create a list of links from dired and copy this list to
> the kill-ring, maybe you can use something like this as well:
> 
> (defun my-copy-dired-files-in-kill-ring ()
>   "Copy files names in the kill ring."
>   (interactive)
>   (let ((files (dired-map-over-marks (dired-get-filename) nil)))
>     (kill-new
>      (mapconcat 
>       (lambda (f) 
> 	(concat "[[file:" f "][" 
> 		(file-name-nondirectory f) "]]"))
>       files "\n"))
>     (message "%d Org links copied to the kill-ring" (length files))))
> 
> Does that help?

Works great! I was thinking about it , but just in python ;-)
Greetings!

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

end of thread, other threads:[~2007-11-28 20:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-11-27 14:47 ` Bastien
2007-11-28 21:39   ` Fabian Braennstroem

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.