Re: [Orgmode] Embedding org-syntax in program source

2010-04-14 Thread LanX
Hi Dan



 Right. Given the present forum I presume you are using emacs, so that
 shouldn't be a problem per se?


Well, don't you think that telling other people that changing the
_source_-code requires emacs might be a problem?



 I think you may have formed an inaccurate idea of how people are working
 with source code in org-mode.

 maybe... and I have to admit my knowledge of LP is theoretical (but at
least I investigated  the sources of TeX long ago! :)

my idea for the beginning was to extend my codes with org-modes folding,
linking and some TODO features in perl comments. Maybe automatically
switching the mode when the cursor is entering/leaving comments.

Multiline wouldn't be a problem since I can include them in POD (perl's
simplified approach to LP)

or I could embrace them in heredocs, for instance the following is legal
perlcode as long as the last line is empty (no whitespaces allowed).

;
* block1
** [test] bla


 And relying on an extra step for code generation is dangerous...

 You would have to explain that assertion.


Sorry, no offence intended, this is the common sense of perlmonks when
talking about run time code generation and adding extra dependencies. (Maybe
not the appropriate slang here...)

I wouldn't find many to join my projects when relying on extra make files
and I suppose running emacs in batch mode to tangle the code is not that
stable.

 This is for sure acceptable with elisp or multilanguage projects.

I didn't understand this.


emacs is a natural habitat of elisp , like unix is one for C.

And multilanguage projects would naturally rely on some make mechanisms.




  PS: I forgot to mention that when switching to other modes the
 highlighting
  will also get confused and fly-make will report plenty of syntax
 problems.

 I'm not sure what you mean here. When working with code in org-mode, one
 uses C-c ' to switch to a language major-mode buffer containing the body
 of the source code block. Is that working OK for you?


hm, yes ...but if I do this I could equally embrace all org-mode-stuff in
between =pod-lines or prepend a # to each line when switching to
cperl-mode.

Hooking this to save would guaranty to always have legal perlcode...

bye
  Rolf
___
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


Re: [Orgmode] Embedding org-syntax in program source

2010-04-14 Thread Sebastian Rose
Hi,


I think there's no need for Org-mode in programming modes. I see
Org-mode as emacs' programming mode for plain text.


LanX lanx.p...@googlemail.com writes:
 my idea for the beginning was to extend my codes with org-modes folding,
 linking and some TODO features in perl comments. Maybe automatically
 switching the mode when the cursor is entering/leaving comments.

It's all there! For folding I use hs-minor-mode, for linking I still
stick with some old keyboard shortcuts here:

* `H-o o'  = 'org-open-at-point-global
* `H-o l'  = 'org-insert-link-global
* `C-c l'  = 'org-store-link

* `F3' = 'find-file-at-point

  When in emacs-lisp mode, it will open the appropriate *.el file when
  on the symbol, no matter where I store htmlize.el on my system:

 (require 'htmlize)

  In c-mode, place point on unistd.h and press F3 to open
  /usr/include/unistd.h:

 #include unistd.h

  But it will find relative paths, too.


* `M-up'   = 'backward-page
* `M-down' = 'forward-page

   `C-q C-l' inserts the formfeed. I tend to divide source files into
   pages and group functions, classes, methods that way. Does not work
   in PHP, :-/ PHP does not consider ^L a whitespace character...but
   those guys don't even consider it a bug :-D


* `M-+' = 'hs-toggle-hiding

   Finally, here's your fast and simple folding.


All these shortcuts work in comments, too.




 And relying on an extra step for code generation is dangerous...

I'm a control freak myself - that's why I use emacs in the end :-)




Best wishes

   Sebastian


___
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


Re: [Orgmode] Embedding org-syntax in program source

2010-04-14 Thread Dan Davison
LanX lanx.p...@googlemail.com writes:

 Hi Dan
  


 Right. Given the present forum I presume you are using emacs, so that
 shouldn't be a problem per se?


 Well, don't you think that telling other people that changing the 
 _source_-code
 requires emacs might be a problem?

Hi Rolf,

Yes I agree that this is something to think about. I mean, obviously
*they* can change it easily, but incorporating their edits to tangled
output back into your (version-controlled) source org file isn't so
easy.

Best wishes,

Dan

  



 I think you may have formed an inaccurate idea of how people are working
 with source code in org-mode.


 maybe... and I have to admit my knowledge of LP is theoretical (but at least I
 investigated  the sources of TeX long ago! :)

 my idea for the beginning was to extend my codes with org-modes folding,
 linking and some TODO features in perl comments. Maybe automatically switching
 the mode when the cursor is entering/leaving comments.

 Multiline wouldn't be a problem since I can include them in POD (perl's
 simplified approach to LP)

 or I could embrace them in heredocs, for instance the following is legal
 perlcode as long as the last line is empty (no whitespaces allowed).

 ;
 * block1
 ** [test] bla



  And relying on an extra step for code generation is dangerous...

 You would have to explain that assertion. 

  
 Sorry, no offence intended, this is the common sense of perlmonks when talking
 about run time code generation and adding extra dependencies. (Maybe not the
 appropriate slang here...)

 I wouldn't find many to join my projects when relying on extra make files and 
 I
 suppose running emacs in batch mode to tangle the code is not that stable.
  
 This is for sure acceptable with elisp or multilanguage projects.


 I didn't understand this.


 emacs is a natural habitat of elisp , like unix is one for C.

 And multilanguage projects would naturally rely on some make mechanisms.


  

  PS: I forgot to mention that when switching to other modes the
 highlighting
  will also get confused and fly-make will report plenty of syntax
 problems.

 I'm not sure what you mean here. When working with code in org-mode, one
 uses C-c ' to switch to a language major-mode buffer containing the body
 of the source code block. Is that working OK for you?


 hm, yes ...but if I do this I could equally embrace all org-mode-stuff in
 between =pod-lines or prepend a # to each line when switching to cperl-mode.

 Hooking this to save would guaranty to always have legal perlcode...

 bye
   Rolf


___
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


[Orgmode] Embedding org-syntax in program source

2010-04-13 Thread LanX
Hi

is there a way to make org-mode ignore comment characters at the beginning
of a line?

Such that
;* Head

or
#** Subhead

work in elisp or perl?

I know of org-babel, but the code produced is no legal Lisp/Perl code
anymore...

Thanks
  Rolf
___
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


[Orgmode] Embedding org-syntax in program source

2010-04-13 Thread LanX
Oops, forgot to reply to the list... 8-| ..

-- Forwarded message --

Thanks Eric,


see this thread http://thread.gmane.org/gmane.emacs.orgmode/7957, as I
 recall basically it's possible to get most org-like behavior using
 orgstruct-mode, but many are continually frustrated by the remaining
 missing 20% of behavior.


Hmm, for what I read it's NOT easily possible, Tassilo switched back to
outline-minor-mode.




  I know of org-babel, but the code produced is no legal Lisp/Perl code
  anymore...

 could you please elaborate,
 ...

 I'm currently using Org-babel to write code in a variety of programming
 languages, and I've had no problems running the tangled code.


Thats the point you have to tangle the code and furthermore you have to run
emacs to tangle it.

The file as such is not a legal Perl code anymore because of lines starting
with a *.
(never actually worked with babel, but thats what I read from the docs)

And relying on an extra step for code generation is dangerous...

This is for sure acceptable with elisp or multilanguage projects.

Anyway I think, I will do some experiments with using a Code Filter in Perl
which eliminates the org-code. (thats a filter run at execution-time
changing the source before it's fed into the compiler)

Cheers
  Rolf

PS: I forgot to mention that when switching to other modes the highlighting
will also get confused and fly-make will report plenty of syntax problems.
___
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


Re: [Orgmode] Embedding org-syntax in program source

2010-04-13 Thread Eric Schulte
LanX lanx.p...@googlemail.com writes:

 Oops, forgot to reply to the list... 8-| ..

 -- Forwarded message --

 Thanks Eric,


 see this thread http://thread.gmane.org/gmane.emacs.orgmode/7957, as I
 recall basically it's possible to get most org-like behavior using
 orgstruct-mode, but many are continually frustrated by the remaining
 missing 20% of behavior.


 Hmm, for what I read it's NOT easily possible, Tassilo switched back to
 outline-minor-mode.




  I know of org-babel, but the code produced is no legal Lisp/Perl code
  anymore...

 could you please elaborate,
 ...

 I'm currently using Org-babel to write code in a variety of programming
 languages, and I've had no problems running the tangled code.


 Thats the point you have to tangle the code and furthermore you have to run
 emacs to tangle it.

 The file as such is not a legal Perl code anymore because of lines starting
 with a *.
 (never actually worked with babel, but thats what I read from the docs)


Ah, I see, I was worried that you were having a problem with tangling.
Maybe there is some way to hide the org-mode wrappings with heredoc
style lines (I'm not very familiar with perl, but I hear it is very
flexible about the syntax in source-code files).  Maybe something like

  =for comment

  org-mode text

  * headlines

  etc...

  #+begin_src perl
  =cut

  =for comment
  #+end_src

  more org-mode...


 And relying on an extra step for code generation is dangerous...

 This is for sure acceptable with elisp or multilanguage projects.


Certainly tangling is an extra step, and as a matter of taste not
something many people will want to use, but I wouldn't say it's
dangerous.  I tangle in a couple of very real very large single-language
projects (sometimes with the same code tangling to run on different
platforms) and find it reliable.


 Anyway I think, I will do some experiments with using a Code Filter in
Perl
 which eliminates the org-code. (thats a filter run at execution-time
 changing the source before it's fed into the compiler)


Good luck, if you find a workable solution, I'm sure there'd be interest
to hear about it here.

Best -- Eric


 Cheers
   Rolf

 PS: I forgot to mention that when switching to other modes the highlighting
 will also get confused and fly-make will report plenty of syntax problems.
 ___
 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


___
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


Re: [Orgmode] Embedding org-syntax in program source

2010-04-13 Thread Dan Davison
LanX lanx.p...@googlemail.com writes:
[...]
  I know of org-babel, but the code produced is no legal Lisp/Perl code
  anymore...

 could you please elaborate,
 ...

 I'm currently using Org-babel to write code in a variety of programming
 languages, and I've had no problems running the tangled code.



Hi Rolf,

 Thats the point you have to tangle the code and furthermore you have to run
 emacs to tangle it.

Right. Given the present forum I presume you are using emacs, so that
shouldn't be a problem per se?

 The file as such is not a legal Perl code anymore because of lines starting
 with a *.
 (never actually worked with babel, but thats what I read from the docs)

I think you may have formed an inaccurate idea of how people are working
with source code in org-mode. It's not just about creating code files
with a bunch of stars in them; it involves embedding source code in
fully-functioning org-mode files (i.e. with headings, tags, properties,
TODO items, tables, links, timestamps etc). So of course these files do
not contain legal Perl code.


 And relying on an extra step for code generation is dangerous...

You would have to explain that assertion. I work on a number of projects
where the code files are generated by tangling, and I'm still here. Also
still here are people whose finished products require the extra step of
running make, latex, gcc compilation etc.


 This is for sure acceptable with elisp or multilanguage projects.

I didn't understand this.

[...]
 PS: I forgot to mention that when switching to other modes the highlighting
 will also get confused and fly-make will report plenty of syntax problems.

I'm not sure what you mean here. When working with code in org-mode, one
uses C-c ' to switch to a language major-mode buffer containing the body
of the source code block. Is that working OK for you?

Dan


 ___
 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


___
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