emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Adding path and file name into file links
@ 2007-11-18  8:39 Graham Smith
  2007-11-18 10:44 ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Graham Smith @ 2007-11-18  8:39 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 354 bytes --]

When adding a file link, is there some way of searching for the file you
want to add while in the file link and then inserting the path and file name
of the found file rather than having to type the whole thing in.

Or alternatively, can you search for the file with dired and then copy and
paste the path from dired into the file link.

Thanks,

Graham

[-- Attachment #1.2: Type: text/html, Size: 379 bytes --]

[-- Attachment #2: 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] 5+ messages in thread

* Re: Adding path and file name into file links
  2007-11-18  8:39 Adding path and file name into file links Graham Smith
@ 2007-11-18 10:44 ` Bastien
  2007-11-18 11:21   ` Graham Smith
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2007-11-18 10:44 UTC (permalink / raw)
  To: emacs-orgmode

"Graham Smith" <myotisone@gmail.com> writes:

> When adding a file link, is there some way of searching for the file you
> want to add while in the file link and then inserting the path and file
> name of the found file rather than having to type the whole thing in.

C-u C-c C-l to find the file, then RET RET to insert it with its name as
the default description.

> Or alternatively, can you search for the file with dired and then copy
> and paste the path from dired into the file link.

I'm not sure of what you mean.

The usual way is to call `org-store-link' (`C-c l' here) on a file in
dired then to insert this link back with `org-insert-link' (C-c C-l).

Does that help?

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

-- 
Bastien

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

* Re: Adding path and file name into file links
  2007-11-18 10:44 ` Bastien
@ 2007-11-18 11:21   ` Graham Smith
  2007-11-19  3:04     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Graham Smith @ 2007-11-18 11:21 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2167 bytes --]

Bastien,

Thanks, the latter does exactly what I want, obviously a terminology thing
confusing my question.

With Explorer in Windows I can right click on a file and select  copy file
name to the clipboard which copies and the path and file name to the
clipboard. I can then paste the path and file name into any other program.
And  'org-store-link' seems to provide the same facility with dired and
Org-mode/

However,  I cant get  C-u C-c C-l  to work.

I still seem to need to type in the file path and file name, rather than
have the ability to search for a file. Presumably I am missing the obvious.

Thanks,

Graham

On 18/11/2007, Bastien <bzg@altern.org> wrote:
>
> "Graham Smith" <myotisone@gmail.com> writes:
>
> > When adding a file link, is there some way of searching for the file you
> > want to add while in the file link and then inserting the path and file
> > name of the found file rather than having to type the whole thing in.
>
> C-u C-c C-l to find the file, then RET RET to insert it with its name as
> the default description.
>
> > Or alternatively, can you search for the file with dired and then copy
> > and paste the path from dired into the file link.
>
> I'm not sure of what you mean.
>
> The usual way is to call `org-store-link' (`C-c l' here) on a file in
> dired then to insert this link back with `org-insert-link' (C-c C-l).
>
> Does that help?
>
> 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))))
>
> --
> Bastien
>
>
> _______________________________________________
> 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
>

[-- Attachment #1.2: Type: text/html, Size: 3098 bytes --]

[-- Attachment #2: 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] 5+ messages in thread

* Re: Adding path and file name into file links
  2007-11-18 11:21   ` Graham Smith
@ 2007-11-19  3:04     ` Bastien
  2007-11-19  7:47       ` Graham Smith
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2007-11-19  3:04 UTC (permalink / raw)
  To: emacs-orgmode

"Graham Smith" <myotisone@gmail.com> writes:

> However, I cant get C-u C-c C-l to work.
>
> I still seem to need to type in the file path and file name, rather
> than have the ability to search for a file.  

I you want to *search* for a file in dired then copy this file into the
Emacs kill-ring, then you can use the function I wrote.

I you know where is the file and want to link to it, then C-u C-c C-l
should be enough.  You will still have to do type something but it's not
a lot of work, especially because TAB will suggest possible completion.

> Presumably I am missing the obvious.

Just remember Org is an Emacs mode, not a W32 feature :)

-- 
Bastien

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

* Re: Adding path and file name into file links
  2007-11-19  3:04     ` Bastien
@ 2007-11-19  7:47       ` Graham Smith
  0 siblings, 0 replies; 5+ messages in thread
From: Graham Smith @ 2007-11-19  7:47 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1247 bytes --]

Bastien

Ah OK, so I wasn't missing anything, you can't actually search for a file
using C-u C-c C-l.

As files I want to link can be several layers deep in a directory structure
and have names I can't remember, and as a said, the dired approach works
fine.

Thanks again.

Graham

On 19/11/2007, Bastien <bzg@altern.org> wrote:
>
> "Graham Smith" <myotisone@gmail.com> writes:
>
> > However, I cant get C-u C-c C-l to work.
> >
> > I still seem to need to type in the file path and file name, rather
> > than have the ability to search for a file.
>
> I you want to *search* for a file in dired then copy this file into the
> Emacs kill-ring, then you can use the function I wrote.
>
> I you know where is the file and want to link to it, then C-u C-c C-l
> should be enough.  You will still have to do type something but it's not
> a lot of work, especially because TAB will suggest possible completion.
>
> > Presumably I am missing the obvious.
>
> Just remember Org is an Emacs mode, not a W32 feature :)
>
> --
> Bastien
>
>
> _______________________________________________
> 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
>

[-- Attachment #1.2: Type: text/html, Size: 1790 bytes --]

[-- Attachment #2: 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] 5+ messages in thread

end of thread, other threads:[~2007-11-19  7:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-18  8:39 Adding path and file name into file links Graham Smith
2007-11-18 10:44 ` Bastien
2007-11-18 11:21   ` Graham Smith
2007-11-19  3:04     ` Bastien
2007-11-19  7:47       ` Graham Smith

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