From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?S=C3=A9bastien_Vauban?= Subject: Re: Orgmode + other modes for outlining and studying. Date: Sat, 09 Jan 2010 21:38:03 +0100 Message-ID: <87vdfb10b8.fsf@mundaneum.com> References: <1e5bcefd1001071521k17705476p27809506dfb36fea@mail.gmail.com> <87r5q156de.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi Thomas and Marcelo, >>> Everytime I need to study some unknown code, I create a new org file, p= ut a >>> * Code headline, paste the code in there and start making notes below or >>> in the code (as comments). It is extremelly fast and efficient to do so= mething >>> like that, things just flow. >>> >>> What I'd like to know is if there's a way to have, for example, orgmode= + >>> javascript-mode, so that I can get syntax-highlighting/coloring on the >>> pasted javascript code. I've tried with javascript mode, but since it i= s a >>> major mode, it just kills org and all its goodies, and I don't want tha= t. >>> >>> Is there a way to have two major modes at the same time, such as org + >>> js-mode? >> >> Are you aware of Org-babel's SRC blocks? >> >> #+BEGIN_SRC java >> bla bla >> #+END_SRC >> >> And, to work on that source block, just hit C-c C-c when point is in the >> block. > > Currently, java isn't on the list of Org-babel supported languages, so I > don't know if Seb's solution will work out of the box. Did not know that. Not using it myself. > Org-babel has a facility for adding new language support. A java addition > would be great. Seb, if you have this working could you share your approa= ch? Yes, you can easily add new languages. I did that for AWK: --8<---------------cut here---------------start------------->8--- ;; Org-babel needs to be told to recognize awk source code blocks and ;; how they should be tangled, which can be accomplished with the ;; following: (org-babel-add-interpreter "awk") (add-to-list 'org-babel-tangle-langs '("awk" "awk")) --8<---------------cut here---------------end--------------->8--- I guess replacing awk by java would make it. Untested, though, as I don't u= se it. > I agree with Seb that Org-babel is useful in the situation that Marcelo > describes. I use it this way myself with python. Comments are distinguish= ed > from code very cleanly. In effect, you end up with a literate program. I guess this is the best thing to do, yes. Thanks for your comment (and support), Thomas! Best regards, Seb --=20 S=C3=A9bastien Vauban _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode