* requested feature
@ 2010-10-29 23:24 Marvin Doyley
2010-11-14 19:31 ` David Maus
0 siblings, 1 reply; 7+ messages in thread
From: Marvin Doyley @ 2010-10-29 23:24 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 340 bytes --]
Does anybody have a function that turns a org header into file with a link
to the file where it originated from ?
For example, lets say I have the following heading
* Apples
* Cherry
* Tomatoes
Lets say I have a mini project on Apples, it would be nice to issue a single
command that turns Applies into Apples.org with a link
Best,
M
[-- Attachment #1.2: Type: text/html, Size: 393 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please 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] 7+ messages in thread
* Re: requested feature
2010-10-29 23:24 requested feature Marvin Doyley
@ 2010-11-14 19:31 ` David Maus
2010-11-15 14:01 ` Marvin Doyley
0 siblings, 1 reply; 7+ messages in thread
From: David Maus @ 2010-11-14 19:31 UTC (permalink / raw)
To: Marvin Doyley; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1013 bytes --]
At Fri, 29 Oct 2010 19:24:32 -0400,
Marvin Doyley wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; ISO-8859-1 (7bit)>]
> Does anybody have a function that turns a org header into file with a link
> to the file where it originated from ?
> For example, lets say I have the following heading
>
> * Apples
> * Cherry
> * Tomatoes
>
> Lets say I have a mini project on Apples, it would be nice to issue a single
> command that turns Applies into Apples.org with a link
Maybe something like this:
(defun dmj:turn-word-into-org-mode-link ()
"Replace word at point by an Org mode link."
(interactive)
(let ((word (thing-at-point 'word)))
(when word
(re-search-backward "\\W" nil t)
(replace-string
word (format "[[file:%s.org][%s]]" word word) t)
(point) (+ (point) (length word)))))
Grab word at point, go to its beginning, replace with an Org mode
link.
Best,
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please 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] 7+ messages in thread
* Re: requested feature
2010-11-14 19:31 ` David Maus
@ 2010-11-15 14:01 ` Marvin Doyley
2010-11-15 15:01 ` Paul Mead
0 siblings, 1 reply; 7+ messages in thread
From: Marvin Doyley @ 2010-11-15 14:01 UTC (permalink / raw)
To: David Maus; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1223 bytes --]
Hi David,
This is exactly what I was looking for, thank you.
cheers
M
On Sun, Nov 14, 2010 at 2:31 PM, David Maus <dmaus@ictsoc.de> wrote:
> At Fri, 29 Oct 2010 19:24:32 -0400,
> Marvin Doyley wrote:
> >
> > [1 <multipart/alternative (7bit)>]
> > [1.1 <text/plain; ISO-8859-1 (7bit)>]
> > Does anybody have a function that turns a org header into file with a
> link
> > to the file where it originated from ?
> > For example, lets say I have the following heading
> >
> > * Apples
> > * Cherry
> > * Tomatoes
> >
> > Lets say I have a mini project on Apples, it would be nice to issue a
> single
> > command that turns Applies into Apples.org with a link
>
> Maybe something like this:
>
> (defun dmj:turn-word-into-org-mode-link ()
> "Replace word at point by an Org mode link."
> (interactive)
> (let ((word (thing-at-point 'word)))
> (when word
> (re-search-backward "\\W" nil t)
> (replace-string
> word (format "[[file:%s.org][%s]]" word word) t)
> (point) (+ (point) (length word)))))
>
> Grab word at point, go to its beginning, replace with an Org mode
> link.
>
> Best,
> -- David
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de
>
[-- Attachment #1.2: Type: text/html, Size: 1888 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please 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] 7+ messages in thread
* Re: requested feature
2010-11-15 14:01 ` Marvin Doyley
@ 2010-11-15 15:01 ` Paul Mead
2010-11-15 18:02 ` David Maus
0 siblings, 1 reply; 7+ messages in thread
From: Paul Mead @ 2010-11-15 15:01 UTC (permalink / raw)
To: Marvin Doyley; +Cc: David Maus, emacs-orgmode
This looks pretty interesting to me, but how would you change this so
that it used the whole heading text, not just one word?
Paul
Marvin Doyley <marvinpas@gmail.com> writes:
> Hi David,
>
> This is exactly what I was looking for, thank you.
>
> cheers
> M
>
> On Sun, Nov 14, 2010 at 2:31 PM, David Maus <dmaus@ictsoc.de> wrote:
>
> At Fri, 29 Oct 2010 19:24:32 -0400,
> Marvin Doyley wrote:
> >
> > [1 <multipart/alternative (7bit)>]
> > [1.1 <text/plain; ISO-8859-1 (7bit)>]
> > Does anybody have a function that turns a org header into file with a link
> > to the file where it originated from ?
> > For example, lets say I have the following heading
> >
> > * Apples
> > * Cherry
> > * Tomatoes
> >
> > Lets say I have a mini project on Apples, it would be nice to issue a single
> > command that turns Applies into Apples.org with a link
>
> Maybe something like this:
>
> (defun dmj:turn-word-into-org-mode-link ()
> "Replace word at point by an Org mode link."
> (interactive)
> (let ((word (thing-at-point 'word)))
> (when word
> (re-search-backward "\\W" nil t)
> (replace-string
> word (format "[[file:%s.org][%s]]" word word) t)
> (point) (+ (point) (length word)))))
>
> Grab word at point, go to its beginning, replace with an Org mode
> link.
>
> Best,
> -- David
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] 7+ messages in thread
* Re: requested feature
2010-11-15 15:01 ` Paul Mead
@ 2010-11-15 18:02 ` David Maus
2010-11-15 18:23 ` Marvin Doyley
0 siblings, 1 reply; 7+ messages in thread
From: David Maus @ 2010-11-15 18:02 UTC (permalink / raw)
To: Paul Mead; +Cc: Marvin Doyley, emacs-orgmode, David Maus
[-- Attachment #1.1: Type: text/plain, Size: 942 bytes --]
At Mon, 15 Nov 2010 15:01:09 +0000,
Paul Mead wrote:
>
>
> This looks pretty interesting to me, but how would you change this so
> that it used the whole heading text, not just one word?
It's basically the same, only difference is finding the headline text
and making the headline text link-safe:
(defun dmj:turn-headline-into-org-mode-link ()
"Replace word at point by an Org mode link."
(interactive)
(when (org-at-heading-p)
(let ((hl-text (nth 4 (org-heading-components))))
(unless (or (null hl-text)
(org-string-match-p "^[ \t]*:[^:]+:$" hl-text))
(beginning-of-line)
(search-forward hl-text (point-at-eol))
(replace-string
hl-text
(format "[[file:%s.org][%s]]"
(org-link-escape hl-text)
(org-link-escape hl-text '((?\] . "%5D") (?\[ . "%5B"))))
nil (- (point) (length hl-text)) (point))))))
Best,
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please 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] 7+ messages in thread
* Re: requested feature
2010-11-15 18:02 ` David Maus
@ 2010-11-15 18:23 ` Marvin Doyley
2010-11-16 19:43 ` Suvayu Ali
0 siblings, 1 reply; 7+ messages in thread
From: Marvin Doyley @ 2010-11-15 18:23 UTC (permalink / raw)
To: David Maus; +Cc: emacs-orgmode, Paul Mead
[-- Attachment #1.1: Type: text/plain, Size: 1710 bytes --]
This is awesome guys, but I have one other request.
Lets say we want to export the content of the main and the linked file to
latex, how would we do this ?
Just for some more clarity
Lets say my main file contain the following headings
Apples
Cherry
Banana
Using your code I create a new file Apples.org, in which I have bunch of
info on apples. It would be nice to be able to export the content of the
main and linked files to latex. I am thinking of the equivalent of having an
\include{}
Does anybody have any thoughts on how to do this ?
cheers
M
On Mon, Nov 15, 2010 at 1:02 PM, David Maus <dmaus@ictsoc.de> wrote:
> At Mon, 15 Nov 2010 15:01:09 +0000,
> Paul Mead wrote:
> >
> >
> > This looks pretty interesting to me, but how would you change this so
> > that it used the whole heading text, not just one word?
>
> It's basically the same, only difference is finding the headline text
> and making the headline text link-safe:
>
> (defun dmj:turn-headline-into-org-mode-link ()
> "Replace word at point by an Org mode link."
> (interactive)
> (when (org-at-heading-p)
> (let ((hl-text (nth 4 (org-heading-components))))
> (unless (or (null hl-text)
> (org-string-match-p "^[ \t]*:[^:]+:$" hl-text))
> (beginning-of-line)
> (search-forward hl-text (point-at-eol))
> (replace-string
> hl-text
> (format "[[file:%s.org][%s]]"
> (org-link-escape hl-text)
> (org-link-escape hl-text '((?\] . "%5D") (?\[ . "%5B"))))
> nil (- (point) (length hl-text)) (point))))))
>
> Best,
> -- David
>
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de
>
[-- Attachment #1.2: Type: text/html, Size: 2438 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please 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] 7+ messages in thread
* Re: Re: requested feature
2010-11-15 18:23 ` Marvin Doyley
@ 2010-11-16 19:43 ` Suvayu Ali
0 siblings, 0 replies; 7+ messages in thread
From: Suvayu Ali @ 2010-11-16 19:43 UTC (permalink / raw)
To: emacs-orgmode
On Monday 15 November 2010 10:23 AM, Marvin Doyley wrote:
> Using your code I create a new file Apples.org, in which I have bunch of
> info on apples. It would be nice to be able to export the content of the
> main and linked files to latex. I am thinking of the equivalent of having an
> \include{}
>
> Does anybody have any thoughts on how to do this ?
I think there is an #+include: directive that you can use.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-11-16 19:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29 23:24 requested feature Marvin Doyley
2010-11-14 19:31 ` David Maus
2010-11-15 14:01 ` Marvin Doyley
2010-11-15 15:01 ` Paul Mead
2010-11-15 18:02 ` David Maus
2010-11-15 18:23 ` Marvin Doyley
2010-11-16 19:43 ` Suvayu Ali
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).