emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-edit-file ?
@ 2011-07-20 14:26 Dov Grobgeld
  2011-07-20 17:15 ` Jambunathan K
  0 siblings, 1 reply; 7+ messages in thread
From: Dov Grobgeld @ 2011-07-20 14:26 UTC (permalink / raw)
  To: emacs-orgmode

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

I just thought of an idea that I wonder if someone has implemented.

While writing my journal I find myself wanting to insert a graphics file,
e.g. a svg file and I write *file:foo.svg* . After having written the name
I  enter inkscape to create the contents of the file. To do that I have to
run inkscape manually and eventually doing saveas and navigate to the
correct directory to save the file. So my idea is to have a a new command
org-edit-file that would:

   - If the file does not exist, copy a skeleton file to the filename or
   generate the skeleton file by an emacs-function or by calling an external
   application.
   - Call the configured editor application on the new file.
   - If invoked with Ctrl-u , allow the user to specify what editor to run
   on the file, e.g. inkscape, or killustrator on svg files.

Does something like this already exists?

Regards,
Dov

[-- Attachment #2: Type: text/html, Size: 1093 bytes --]

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

* Re: org-edit-file ?
  2011-07-20 14:26 org-edit-file ? Dov Grobgeld
@ 2011-07-20 17:15 ` Jambunathan K
  2011-07-21  9:32   ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2011-07-20 17:15 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: emacs-orgmode

Dov Grobgeld <dov.grobgeld@gmail.com> writes:

> I just thought of an idea that I wonder if someone has implemented.
>
> While writing my journal I find myself wanting to insert a graphics
> file, e.g. a svg file and I write file:foo.svg . After having written
> the name I  enter inkscape to create the contents of the file. To do
> that I have to run inkscape manually and eventually doing saveas and
> navigate to the correct directory to save the file. So my idea is to
> have a a new command org-edit-file that would:
>
>     If the file does not exist, copy a skeleton file to the filename
>     or generate the skeleton file by an emacs-function or by calling
>     an external application.
>     Call the configured editor application on the new file.
>     If invoked with Ctrl-u , allow the user to specify what editor to
>     run on the file, e.g. inkscape, or killustrator on svg files.
>
> Does something like this already exists?

Start from C-h f org-open-file.

>
> Regards,
> Dov
>
>
>

-- 

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

* Re: org-edit-file ?
  2011-07-20 17:15 ` Jambunathan K
@ 2011-07-21  9:32   ` Bastien
  2011-07-21  9:42     ` Dov Grobgeld
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2011-07-21  9:32 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Dov Grobgeld, emacs-orgmode

Hi Dov,

Jambunathan K <kjambunathan@gmail.com> writes:

>> have a a new command org-edit-file that would:
>>
>>     If the file does not exist, copy a skeleton file to the filename
>>     or generate the skeleton file by an emacs-function or by calling
>>     an external application.

Such a functionality belongs to Emacs itself rather than Org-mode. 
Are you aware of existing templating facilities?

  http://emacs-template.sourceforge.net/

>>     Call the configured editor application on the new file.
>>     If invoked with Ctrl-u , allow the user to specify what editor to
>>     run on the file, e.g. inkscape, or killustrator on svg files.
>>
>> Does something like this already exists?
>
> Start from C-h f org-open-file.

Indeed!

Best,

-- 
 Bastien

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

* Re: org-edit-file ?
  2011-07-21  9:32   ` Bastien
@ 2011-07-21  9:42     ` Dov Grobgeld
  2011-07-21 10:54       ` Jambunathan K
  2011-07-21 22:11       ` Sebastian Rose
  0 siblings, 2 replies; 7+ messages in thread
From: Dov Grobgeld @ 2011-07-21  9:42 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Jambunathan K

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

I'm not sure that emacs is the best tool to e.g. generate a template png
file of a given size and given background, or a svg file. I still don't feel
that any of the proposed solutions solves the file:foo.svg edit scenario,
where foo.svg does not exist yet. Also I would rather differentiate between
opening a few for viewing and opening a file for editing, as e.g. eog and
inkview are good for viewing, whereas gimp and inkscape are better for
editing.

Regards,
Dov

On Thu, Jul 21, 2011 at 12:32, Bastien <bzg@altern.org> wrote:

> Hi Dov,
>
> Jambunathan K <kjambunathan@gmail.com> writes:
>
> >> have a a new command org-edit-file that would:
> >>
> >>     If the file does not exist, copy a skeleton file to the filename
> >>     or generate the skeleton file by an emacs-function or by calling
> >>     an external application.
>
> Such a functionality belongs to Emacs itself rather than Org-mode.
> Are you aware of existing templating facilities?
>
>  http://emacs-template.sourceforge.net/
>
> >>     Call the configured editor application on the new file.
> >>     If invoked with Ctrl-u , allow the user to specify what editor to
> >>     run on the file, e.g. inkscape, or killustrator on svg files.
> >>
> >> Does something like this already exists?
> >
> > Start from C-h f org-open-file.
>
> Indeed!
>
> Best,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1981 bytes --]

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

* Re: org-edit-file ?
  2011-07-21  9:42     ` Dov Grobgeld
@ 2011-07-21 10:54       ` Jambunathan K
  2011-07-21 22:11       ` Sebastian Rose
  1 sibling, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2011-07-21 10:54 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: emacs-orgmode


Dov

I believe you would like to follow a link to svg file and have it open
in one of the many external editors depending on whether the link is
"visited" (read-only) or "opened" (edit). May be others could help you
here. 

What you need to begin with is a home-brewed elisp command to "view" or
"edit" a file based on (say a prefix modifier). 

Read on. Hints below.

> I'm not sure that emacs is the best tool to e.g. generate a template
> png file of a given size and given background, or a svg file. 

I don't think there are any svg or png experts here in this list and I
don't think any of us understand what you mean by template. Please
provide an example.

> I still don't feel that any of the proposed solutions solves the
> file:foo.svg edit scenario, where foo.svg does not exist yet. 

We never proposed solutions. We only gave you hints. Your questions are
better suited to help-gnu-emacs list. See URL:

https://lists.gnu.org/archive/html/help-gnu-emacs/

> Also I would rather differentiate between opening a few for viewing
> and opening a file for editing, as e.g. eog and inkview are good for
> viewing, whereas gimp and inkscape are better for editing.

You are the expert here and you have right to feel the way you feel -
"unsatisifed" and "disappointed". Not many of us use eog, inkview, gimp
or inkscape. At the minimum you should list how these apps open a given
file - ie, the exact command line string to open a given file and then
you can use `call-process' to launch the app.

Jambunathan K.

>
> Regards,
> Dov
>
> On Thu, Jul 21, 2011 at 12:32, Bastien <bzg@altern.org> wrote:
>
>     Hi Dov,
>    
>     Jambunathan K <kjambunathan@gmail.com> writes:
>    
>     >> have a a new command org-edit-file that would:
>     >>
>     >>     If the file does not exist, copy a skeleton file to the
>     filename
>     >>     or generate the skeleton file by an emacs-function or by
>     calling
>     >>     an external application.
>    
>     Such a functionality belongs to Emacs itself rather than
>     Org-mode.
>     Are you aware of existing templating facilities?
>    
>      http://emacs-template.sourceforge.net/
>    
>     >>     Call the configured editor application on the new file.
>     >>     If invoked with Ctrl-u , allow the user to specify what
>     editor to
>     >>     run on the file, e.g. inkscape, or killustrator on svg
>     files.
>     >>
>     >> Does something like this already exists?
>     >
>     > Start from C-h f org-open-file.
>    
>     Indeed!
>    
>     Best,
>    
>     --
>      Bastien

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

* Re: org-edit-file ?
  2011-07-21  9:42     ` Dov Grobgeld
  2011-07-21 10:54       ` Jambunathan K
@ 2011-07-21 22:11       ` Sebastian Rose
  2011-07-21 23:50         ` Jambunathan K
  1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Rose @ 2011-07-21 22:11 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: Bastien, emacs-orgmode, Jambunathan K

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

Dov Grobgeld <dov.grobgeld@gmail.com> writes:
> I'm not sure that emacs is the best tool to e.g. generate a template png
> file of a given size and given background, or a svg file. I still don't feel
> that any of the proposed solutions solves the file:foo.svg edit scenario,
> where foo.svg does not exist yet. Also I would rather differentiate between
> opening a few for viewing and opening a file for editing, as e.g. eog and
> inkview are good for viewing, whereas gimp and inkscape are better for
> editing.



I used to do what you request on a dayly base creating SVGs from
GPX-Data.  I Use a special link type:

[[track:((12.0399212 14.919293)(32.12394 15.342345))FILE.svg][Name of track]]


See
https://github.com/SebastianRose/org-osm/blob/de4634518c8dd7713ff702412cfc7ae89852a074/org-osm-link.el

and follow the function `osm-org-link-follow'.

If the SVG-Map for the track does not exist, it calls code from
https://github.com/SebastianRose/org-osm/blob/de4634518c8dd7713ff702412cfc7ae89852a074/osm-maps.el
to create it.

It's seems a bit complicated in that example, as the name and size of
the resulting SVG image depends on the area, customized zoom factor
a.s.o.  but this second file boils down to approx. 50 lines for your use
case.

Either a PNG (not tested for a long time - I don't think it works....)
or an SVG (I use this on a dayly basis) is created, depending on your
choice.  You'll need image-magick to create PNGs while SVG is a simple
text (XML) format, so emacs should be as good as any tool to create it.

The track is drawn on top of background-images I download from
Openstreetmap.org (customize google-maps if you like those better) in
the function `osm-draw-track'.  That's where your SVG-template would
come to life.

Once that file exists, it's easy to open it an editor.  The function
mentioned first calls `osm-org-image-viewer-function' which in turn
opens the prepared image:


In your case (provided inkscape is in your path):



[-- Attachment #2: Type: application/emacs-lisp, Size: 122 bytes --]

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



....and don't forget to share the results :)


Best wishes

   Sebastian

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

* Re: org-edit-file ?
  2011-07-21 22:11       ` Sebastian Rose
@ 2011-07-21 23:50         ` Jambunathan K
  0 siblings, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2011-07-21 23:50 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Dov Grobgeld, emacs-orgmode

Sebastian Rose <sebastian_rose@gmx.de> writes:

> Dov Grobgeld <dov.grobgeld@gmail.com> writes:
>> I'm not sure that emacs is the best tool to e.g. generate a template png
>> file of a given size and given background, or a svg file. I still don't feel
>> that any of the proposed solutions solves the file:foo.svg edit scenario,
>> where foo.svg does not exist yet. Also I would rather differentiate between
>> opening a few for viewing and opening a file for editing, as e.g. eog and
>> inkview are good for viewing, whereas gimp and inkscape are better for
>> editing.

> I used to do what you request on a dayly base creating SVGs from
> GPX-Data.  I Use a special link type:

I think you nailed the entire story. Will you teach me how to read
people's mind over internet?

I think OP should have just explained what he is trying to achieve in
simple English instead of starting with what the solution would look
like (as indicated by the subject chosen by him). My guess is that the
OP is new to elisp.

Anyways, I hope OP is happy now or has something concrete to work with.

Jambunathan K.

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

end of thread, other threads:[~2011-07-21 23:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-20 14:26 org-edit-file ? Dov Grobgeld
2011-07-20 17:15 ` Jambunathan K
2011-07-21  9:32   ` Bastien
2011-07-21  9:42     ` Dov Grobgeld
2011-07-21 10:54       ` Jambunathan K
2011-07-21 22:11       ` Sebastian Rose
2011-07-21 23:50         ` Jambunathan K

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