[Orgmode] Re: [Babel] Macro for begin_src?

2010-10-18 Thread Sébastien Vauban
Hi Eric,

Eric Schulte wrote:
 The snippets used by the starter kit are available in their own git
 repository at http://github.com/eschulte/yasnippet-org-mode

Trying to clone it, I get:

#+begin_src sh
[...@mediacenter] ~/srcgit clone http://github.com/eschulte/yasnippet-org-mode
Cloning into yasnippet-org-mode...
fatal: http://github.com/eschulte/yasnippet-org-mode/info/refs not found: did 
you run git update-server-info on the server?
#+end_src

Best regards,
  Seb

-- 
Sébastien Vauban


___
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] Re: [Babel] Macro for begin_src?

2010-10-18 Thread Greg Troxel

Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric,

 Eric Schulte wrote:
 The snippets used by the starter kit are available in their own git
 repository at http://github.com/eschulte/yasnippet-org-mode

 Trying to clone it, I get:

 #+begin_src sh
 [...@mediacenter] ~/srcgit clone 
 http://github.com/eschulte/yasnippet-org-mode
 Cloning into yasnippet-org-mode...
 fatal: http://github.com/eschulte/yasnippet-org-mode/info/refs not found: did 
 you run git update-server-info on the server?
 #+end_src

The usual github lossage :-) The http interface for people to look at
the repo is the above path.  However the git repo has a .git on the end.
Use the path you quoted with a browser and find the git URL.

gdt 22 ~/SOFTWARE/EMACS  git clone 
http://github.com/eschulte/yasnippet-org-mode.git
Initialized empty Git repository in 
/usr/home/gdt/SOFTWARE/EMACS/yasnippet-org-mode/.git/
remote: Counting objects: 42, done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 42 (delta 9), reused 0 (delta 0)
Unpacking objects: 100% (42/42), done.


pgpfLd0qnsa1J.pgp
Description: PGP signature
___
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] Re: [Babel] Macro for begin_src?

2010-10-18 Thread Dan Davison


Sébastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org
writes:

 Hi Eric,

 Eric Schulte wrote:
 The snippets used by the starter kit are available in their own git
 repository at http://github.com/eschulte/yasnippet-org-mode

 Trying to clone it, I get:

I think the above URL is for a web browser. The URLs for git are listed
on that page. I normally use the Git Read-Only URLs of the form

git://github.com/eschulte/yasnippet-org-mode.git

Dan



 #+begin_src sh
 [...@mediacenter] ~/srcgit clone 
 http://github.com/eschulte/yasnippet-org-mode
 Cloning into yasnippet-org-mode...
 fatal: http://github.com/eschulte/yasnippet-org-mode/info/refs not found: did 
 you run git update-server-info on the server?
 #+end_src

 Best regards,
   Seb


___
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] Re: [Babel] Macro for begin_src?

2010-10-18 Thread Sébastien Vauban
Hi Dan and Greg,

Dan Davison wrote:
 Sébastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org
 writes:

 Hi Eric,

 Eric Schulte wrote:
 The snippets used by the starter kit are available in their own git
 repository at http://github.com/eschulte/yasnippet-org-mode

 Trying to clone it, I get:

 I think the above URL is for a web browser. The URLs for git are listed
 on that page. I normally use the Git Read-Only URLs of the form

 git://github.com/eschulte/yasnippet-org-mode.git

Thanks.

Best regards,
  Seb

-- 
Sébastien Vauban


___
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] Re: [Babel] Macro for begin_src?

2010-10-17 Thread Eric Schulte
Yes,

The snippets used by the starter kit are available in their own git
repository at http://github.com/eschulte/yasnippet-org-mode

Best -- Eric

also, any suggestions or contributions are welcome

Rainer M Krug r.m.k...@gmail.com writes:

 On Tue, Apr 20, 2010 at 4:48 PM, Eric Schulte schulte.e...@gmail.comwrote:

 Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

  Hi Eric,
 
  Eric S Fraga wrote:
  it might be nice to have a worg page on snippets for org-mode?
 
  Sure. Or having them somewhere in the git directories...
 

 +1 for git directories.


 Is there any progress on that? I just started with yasnippet and think they
 are quite handy.




 That way users who keep their Emacs config in git repos can add the
 snippets as a submodule, and I can include the submodule in the literate
 emacs-starter-kit [1].


 I got the yasnipet expansion working through your Starter Kit (
 http://eschulte.github.com/emacs-starter-kit/starter-kit-org.html) and I
 realised that you have org-toggle-iimage-in-org in it - as far as I know,
 this does not exist any more in the newer versions of org (but it does not
 cause an error).

 Cheers,

 Rainer



 -- Eric

 
 
  I'm happy to contribute a few.
 
  figure:
  #name : figure
  # --
  #+attr_latex: width=$1\textwidth
  [[file:$2.pdf]]
  $0
 
  Better use \linewidth instead of \textwidth. You will avoid bad
 surprises.
 
  They are generally equivalent, but \linewidth is more often the real
 width to
  consider: it is correctly adapted in column environments, itemized lists
 and
  quotes, to cite a few.
 
  Seb

 Footnotes:
 [1]  http://eschulte.github.com/emacs-starter-kit/



 ___
 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


[Orgmode] Re: [Babel] Macro for begin_src?

2010-04-20 Thread Sébastien Vauban
Hi Eric,

Eric S Fraga wrote:
 it might be nice to have a worg page on snippets for org-mode?

Sure. Or having them somewhere in the git directories...


 I'm happy to contribute a few.

 figure:
 #name : figure
 # --
 #+attr_latex: width=$1\textwidth
 [[file:$2.pdf]]
 $0

Better use \linewidth instead of \textwidth. You will avoid bad surprises.

They are generally equivalent, but \linewidth is more often the real width to
consider: it is correctly adapted in column environments, itemized lists and
quotes, to cite a few.

Seb

-- 
Sébastien Vauban



___
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: [OT] [Orgmode] Re: [Babel] Macro for begin_src?

2010-04-20 Thread Eric S Fraga
On Tue, 20 Apr 2010 11:19:10 +0200, Sébastien Vauban 
wxhgmqzgw...@spammotel.com wrote:

[...]

  I'm happy to contribute a few.
 
  figure:
  #name : figure
  # --
  #+attr_latex: width=$1\textwidth
  [[file:$2.pdf]]
  $0
 
 Better use \linewidth instead of \textwidth. You will avoid bad surprises.
 
 They are generally equivalent, but \linewidth is more often the real width to
 consider: it is correctly adapted in column environments, itemized lists and
 quotes, to cite a few.
 
 Seb

Interesting.  I've always used textwidth and have never run into
problems: it does adapt to column environments and I've never really
used this within lists or quotes I guess.  Good to know and I'll try
to re-train my fingers to type linewidth instead!  (and I've already
updated my snippet...)

Thanks,
eric


___
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] Re: [Babel] Macro for begin_src?

2010-04-20 Thread Eric Schulte
Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric,

 Eric S Fraga wrote:
 it might be nice to have a worg page on snippets for org-mode?

 Sure. Or having them somewhere in the git directories...


+1 for git directories.

That way users who keep their Emacs config in git repos can add the
snippets as a submodule, and I can include the submodule in the literate
emacs-starter-kit [1].

-- Eric



 I'm happy to contribute a few.

 figure:
 #name : figure
 # --
 #+attr_latex: width=$1\textwidth
 [[file:$2.pdf]]
 $0

 Better use \linewidth instead of \textwidth. You will avoid bad surprises.

 They are generally equivalent, but \linewidth is more often the real width to
 consider: it is correctly adapted in column environments, itemized lists and
 quotes, to cite a few.

 Seb

Footnotes: 
[1]  http://eschulte.github.com/emacs-starter-kit/



___
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] Re: [Babel] Macro for begin_src?

2010-04-19 Thread Štěpán Němec
Dan Davison davi...@stats.ox.ac.uk writes:
 I guess, for Nate's original application (converting existing code to
 src blocks), what might have been most useful is something to enclose a
 given region in a source block. Can anyone show how to do that with
 yasnippet (or anything else)?

I don't have a ready-to-use snippet, but this is what you need:

http://yasnippet.googlecode.com/svn/trunk/doc/snippet-development.html#yas-wrap-around-region


HTH,

  Štěpán


___
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] Re: [Babel] Macro for begin_src?

2010-04-19 Thread Eric S Fraga
On Mon, 19 Apr 2010 00:24:46 + (UTC), Shelagh Manton 
shelagh.man...@gmail.com wrote:
 
 On Sun, 18 Apr 2010 11:44:24 +0100, Eric S Fraga wrote:
  
  artist-mode has a full set of key bindings.  I never use the mouse (for
  anything at all, if I can help it, due to RSI issues) and artist-mode is
  perfectly usable nonetheless!  Type C-h m in artist-mode to see all
  the key bindings.
 
 I am aware of the keybindings, though I tend to use the mouse myself, but 
 I have never been able to get artist-mode running properly in tty. If you 
 have, I would be interested to know if you had to tweak anything to get 
 it to work or whether it is the usual my set-up is screwy and I don't 
 know why syndrome.

I do find artist-mode to be quite finicky (maybe it is less so using
the mouse but I've not really tried it that way) so I have a feeling
that your problems are due to artist-mode itself.  I've not tweaked
anything however.  In any case, I use it less and less, doing most
drawing with either graphviz (dot et al.) and tikz (in latex).

Sorry I can't be more helpful.


___
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] Re: [Babel] Macro for begin_src?

2010-04-19 Thread Sebastian Rose

 artist-mode has a full set of key bindings.  I never use the mouse (for
 anything at all, if I can help it, due to RSI issues) and artist-mode is
 perfectly usable nonetheless!  Type C-h m in artist-mode to see all
 the key bindings.

 I am aware of the keybindings, though I tend to use the mouse myself, but
 I have never been able to get artist-mode running properly in tty.

M-x customize-variable RET org-edit-fixed-width-region-mode
and choose `picture-mode':

  `C-c '  move right after each keypress
  `C-c '  move left after each keypress
  `C-c ^'  move up after each keypress
  `C-c .'  move down after each keypress


Picture-mode is always active here if I do `M-x artist-mode'. I'm not
sure why. It even becomes the major mode. Might be how things work in
emacs24 as I couldn't find anything in my setup.


   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] Re: [Babel] Macro for begin_src?

2010-04-18 Thread Eric S Fraga
On Sat, 17 Apr 2010 15:55:51 -1000, Thomas S. Dye t...@tsdye.com wrote:
 On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:
  1. The first and simplest option is built into org-mode. Simply type:
 
  s [TAB] or [M-TAB]

Thanks Matt for this.  I'd forgotten about the built-in definitions.
These do make many of my yasnippets superfluous.

 Neat.  What would you use yasnippets for, if anything?
 
 All the best,
 Tom

Good question!  One case I would still use yasnippets for is more
complex constructions.  For instance, I use tikz a lot for creating
drawings for teaching.  For a given course, many of these drawings are
similar.  One snippet I have is:

--8---cut here---start-8---
#name : tikz
# --
#+begin_latex 
\tikzstyle{unit}=[rectangle, draw=blue!80!black, fill=black!5!white]
\tikzstyle{stream}=[rectangle, draw=white, fill=yellow!50!white]
\begin{tikzpicture}[node distance=2cm]
  \node[stream] (feed) {Feed};
  \node[unit] (reactor) [right of=feed] {Reactor} edge [-] (feed);
  \node[unit] (separator) [right of=reactor] {Separation} edge [-] (reactor);
$0
\end{tikzpicture}
#+end_latex
--8---cut here---end---8---

Before Carsten implemented the beamer option in org-mode, I also had a
snippet for setting up columns with blocks in org-mode for my custom
beamer setup I used to have.


___
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] Re: [Babel] Macro for begin_src?

2010-04-18 Thread Eric S Fraga
On Sun, 18 Apr 2010 01:01:56 + (UTC), Shelagh Manton 
shelagh.man...@gmail.com wrote:
 
 On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:
 
 You could play around with artist-mode if you use X. It uses the mouse 
 with ascii symbols to create rectangles, lines etc. Then just change the  
 text how you need. There are some helpful functions on emacswiki that 
 show you how to set up ido with artist. Don't have the url handy though.
 
 Sadly, it seems you can't get artist-mode to work in a tty, though I 
 believe you can in an xterm.

Shelagh,

artist-mode has a full set of key bindings.  I never use the mouse
(for anything at all, if I can help it, due to RSI issues) and
artist-mode is perfectly usable nonetheless!  Type C-h m in
artist-mode to see all the key bindings.

HTH,
eric


___
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] Re: [Babel] Macro for begin_src?

2010-04-18 Thread Dan Davison
Eric S Fraga ucec...@ucl.ac.uk writes:

 On Sat, 17 Apr 2010 15:55:51 -1000, Thomas S. Dye t...@tsdye.com wrote:
 On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:
  1. The first and simplest option is built into org-mode. Simply type:
 
  s [TAB] or [M-TAB]

 Thanks Matt for this.  I'd forgotten about the built-in definitions.
 These do make many of my yasnippets superfluous.

 Neat.  What would you use yasnippets for, if anything?
 
 All the best,
 Tom

 Good question!  One case I would still use yasnippets for is more
 complex constructions.

I guess, for Nate's original application (converting existing code to
src blocks), what might have been most useful is something to enclose a
given region in a source block. Can anyone show how to do that with
yasnippet (or anything else)? Or is it best to make a custom function
for a task like this, e.g.

  (defun dan/enclose-region-in-src-block ()
(interactive)
(let* ((beg (if (region-active-p) (region-beginning) (point)))
   (end (if (region-active-p) (region-end) (point
  (goto-char end)
  (unless (eq (char-before) ?\n) (insert \n))
  (insert #+end_src\n)
  (goto-char beg)
  (beginning-of-line)
  (insert #+begin_src \n)
  (backward-char)))

Dan


  For instance, I use tikz a lot for creating
 drawings for teaching.  For a given course, many of these drawings are
 similar.  One snippet I have is:

 #name : tikz
 # --
 #+begin_latex 
 \tikzstyle{unit}=[rectangle, draw=blue!80!black, fill=black!5!white]
 \tikzstyle{stream}=[rectangle, draw=white, fill=yellow!50!white]
 \begin{tikzpicture}[node distance=2cm]
   \node[stream] (feed) {Feed};
   \node[unit] (reactor) [right of=feed] {Reactor} edge [-] (feed);
   \node[unit] (separator) [right of=reactor] {Separation} edge [-] (reactor);
 $0
 \end{tikzpicture}
 #+end_latex

 Before Carsten implemented the beamer option in org-mode, I also had a
 snippet for setting up columns with blocks in org-mode for my custom
 beamer setup I used to have.


 ___
 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


[Orgmode] Re: [Babel] Macro for begin_src?

2010-04-18 Thread Eric S Fraga
On Sun, 18 Apr 2010 22:13:27 +0200, Štěpán Němec step...@gmail.com wrote:
 
 Dan Davison davi...@stats.ox.ac.uk writes:
  I guess, for Nate's original application (converting existing code to
  src blocks), what might have been most useful is something to enclose a
  given region in a source block. Can anyone show how to do that with
  yasnippet (or anything else)?
 
 I don't have a ready-to-use snippet, but this is what you need:
 
 http://yasnippet.googlecode.com/svn/trunk/doc/snippet-development.html#yas-wrap-around-region
 
 
 HTH,
 
   Štěpán

and you can also insert the value of yas/selected-text directly into
the snippet anywhere you want.  e.g.

--8---cut here---start-8---
#name : testing yasnippets for org-mode
# --
#+BEGIN_LaTeX
`yas/selected-text`
$0
#+END_LaTeX
--8---cut here---end---8---

of course, you can only do this (or the wrap around region approach)
if you invoke the snippet directly using a key binding (e.g. the
default C-c  C-s or M-x yas/insert-snippet) as opposed to tab
expansion on the snippet name (which is more convenient).

Note that you can assign key bindings directly to snippets.


___
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] Re: [Babel] Macro for begin_src?

2010-04-18 Thread Shelagh Manton
On Sun, 18 Apr 2010 11:44:24 +0100, Eric S Fraga wrote:

 On Sun, 18 Apr 2010 01:01:56 + (UTC), Shelagh Manton
 shelagh.man...@gmail.com wrote:
 
 On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:
 
 You could play around with artist-mode if you use X. It uses the mouse
 with ascii symbols to create rectangles, lines etc. Then just change
 the text how you need. There are some helpful functions on emacswiki
 that show you how to set up ido with artist. Don't have the url handy
 though.
 
 Sadly, it seems you can't get artist-mode to work in a tty, though I
 believe you can in an xterm.
 
 Shelagh,
 
 artist-mode has a full set of key bindings.  I never use the mouse (for
 anything at all, if I can help it, due to RSI issues) and artist-mode is
 perfectly usable nonetheless!  Type C-h m in artist-mode to see all
 the key bindings.

I am aware of the keybindings, though I tend to use the mouse myself, but 
I have never been able to get artist-mode running properly in tty. If you 
have, I would be interested to know if you had to tweak anything to get 
it to work or whether it is the usual my set-up is screwy and I don't 
know why syndrome.

Shelagh
 
 HTH,
 eric
 
 
 ___ 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


[Orgmode] Re: [Babel] Macro for begin_src?

2010-04-18 Thread Bernt Hansen
Shelagh Manton shelagh.man...@gmail.com writes:

 On Sun, 18 Apr 2010 11:44:24 +0100, Eric S Fraga wrote:

 On Sun, 18 Apr 2010 01:01:56 + (UTC), Shelagh Manton
 shelagh.man...@gmail.com wrote:
 
 On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:
 
 You could play around with artist-mode if you use X. It uses the mouse
 with ascii symbols to create rectangles, lines etc. Then just change
 the text how you need. There are some helpful functions on emacswiki
 that show you how to set up ido with artist. Don't have the url handy
 though.
 
 Sadly, it seems you can't get artist-mode to work in a tty, though I
 believe you can in an xterm.
 
 Shelagh,
 
 artist-mode has a full set of key bindings.  I never use the mouse (for
 anything at all, if I can help it, due to RSI issues) and artist-mode is
 perfectly usable nonetheless!  Type C-h m in artist-mode to see all
 the key bindings.

 I am aware of the keybindings, though I tend to use the mouse myself, but 
 I have never been able to get artist-mode running properly in tty. If you 
 have, I would be interested to know if you had to tweak anything to get 
 it to work or whether it is the usual my set-up is screwy and I don't 
 know why syndrome.

The key bindings don't work well for me in regular emacs in X either.

GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of 2008-11-09
on raven, modified by Debian

Marking regions seems to lose the mark when I move around trying to draw
rectangles.  Using the mouse is much easier for this.

-Bernt


___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Eric S Fraga
On Fri, 16 Apr 2010 21:23:35 -0500, Erik Iverson er...@ccbr.umn.edu wrote:
  http://doc.norang.ca/org-mode.html#Yasnippets
 
  If anyone else has a different macro set up, I'm still interested in
  hearing your solutions.
 
 
 Nope, yasnippet is the way to go I think!

+1

it might be nice to have a worg page on snippets for org-mode?  I'm
happy to contribute a few.  The ones I use the most are these two:

block:
--8---cut here---start-8---
#name : #+begin_...#+end_
# --
#+begin_$1 $2
$0
#+end_$1
--8---cut here---end---8---

and

figure:
--8---cut here---start-8---
#name : figure
# --
#+attr_latex: width=$1\textwidth
[[file:$2.pdf]]
$0
--8---cut here---end---8---



___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Štěpán Němec
Dan Davison davi...@stats.ox.ac.uk writes:
 Thanks!  I'm having trouble triggering the yasnippets using the TAB key, so
 I'm
 just using the GUI menu.

 Do you literally type src (no quotes), then press Tab?

 Yeah, but there's some magic code needed, which is also on Bernt's
 page.

   (add-hook 'org-mode-hook
 (lambda ()
   ;; yasnippet
   (make-variable-buffer-local 'yas/trigger-key)
   (setq yas/trigger-key [tab])
   (define-key yas/keymap [tab] 'yas/next-field-group)))

I'm guessing what you really want there is

(set (make-local-variable 'yas/trigger-key) [tab])

instead of

   (make-variable-buffer-local 'yas/trigger-key)
   (setq yas/trigger-key [tab])

The difference is that in the latter case you're making
`yas/trigger-key' be automatically buffer-local for *all* buffers, not
only in the buffer you're setting it (see e.g. the docstring of
`make-variable-buffer-local').


  Štěpán


___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Nathan Neff
What do you guys use for ditaa diagrams?

Just copy/paste?  Seems like it'd be a bit tedious to draw those boxes.

--Nate

On Sat, Apr 17, 2010 at 5:12 AM, Eric S Fraga ucec...@ucl.ac.uk wrote:

 On Fri, 16 Apr 2010 21:23:35 -0500, Erik Iverson er...@ccbr.umn.edu
 wrote:
   http://doc.norang.ca/org-mode.html#Yasnippets
  
   If anyone else has a different macro set up, I'm still interested in
   hearing your solutions.
  
 
  Nope, yasnippet is the way to go I think!

 +1

 it might be nice to have a worg page on snippets for org-mode?  I'm
 happy to contribute a few.  The ones I use the most are these two:

 block:
 --8---cut here---start-8---
 #name : #+begin_...#+end_
 # --
 #+begin_$1 $2
 $0
 #+end_$1
 --8---cut here---end---8---

 and

 figure:
 --8---cut here---start-8---
 #name : figure
 # --
 #+attr_latex: width=$1\textwidth
 [[file:$2.pdf]]
 $0
 --8---cut here---end---8---


___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Nathan Neff
On Sat, Apr 17, 2010 at 6:03 AM, Štěpán Němec step...@gmail.com wrote:

 Dan Davison davi...@stats.ox.ac.uk writes:
  Thanks!  I'm having trouble triggering the yasnippets using the TAB key,
 so
  I'm
  just using the GUI menu.
 
  Do you literally type src (no quotes), then press Tab?
 
  Yeah, but there's some magic code needed, which is also on Bernt's
  page.
 
(add-hook 'org-mode-hook
  (lambda ()
;; yasnippet
(make-variable-buffer-local 'yas/trigger-key)
(setq yas/trigger-key [tab])
(define-key yas/keymap [tab] 'yas/next-field-group)))

 I'm guessing what you really want there is

 (set (make-local-variable 'yas/trigger-key) [tab])

 instead of

(make-variable-buffer-local 'yas/trigger-key)
(setq yas/trigger-key [tab])


Hmmm.

Do you guys un-map your TAB key so that it doesn't run org-cycle?
My TAB key will correctly trigger yas/insert-snippet in emacs-lisp mode.
However, in org-mode my TAB key is still mapped to org-cycle, even if I add
the org-mode hook using the code above.

Thanks,
--Nate



 The difference is that in the latter case you're making
 `yas/trigger-key' be automatically buffer-local for *all* buffers, not
 only in the buffer you're setting it (see e.g. the docstring of
 `make-variable-buffer-local').


  Štěpán

___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Erik Iverson



I'm guessing what you really want there is

(set (make-local-variable 'yas/trigger-key) [tab])

instead of

(make-variable-buffer-local 'yas/trigger-key)
(setq yas/trigger-key [tab])


Hmmm.

Do you guys un-map your TAB key so that it doesn't run org-cycle?
My TAB key will correctly trigger yas/insert-snippet in emacs-lisp mode.
However, in org-mode my TAB key is still mapped to org-cycle, even if I 
add the org-mode hook using the code above.


Thanks,
--Nate



The order you do it might matter?


___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Nathan Neff
On Sat, Apr 17, 2010 at 9:06 AM, Erik Iverson er...@ccbr.umn.edu wrote:


 I'm guessing what you really want there is

(set (make-local-variable 'yas/trigger-key) [tab])

instead of

(make-variable-buffer-local 'yas/trigger-key)
(setq yas/trigger-key [tab])


 Hmmm.

 Do you guys un-map your TAB key so that it doesn't run org-cycle?
 My TAB key will correctly trigger yas/insert-snippet in emacs-lisp mode.
 However, in org-mode my TAB key is still mapped to org-cycle, even if I
 add the org-mode hook using the code above.

 Thanks,
 --Nate


 The order you do it might matter?


I found the problem -- it's detailed right here, and it's tailored to fix
compatibility with org-mode:
http://yasnippet.googlecode.com/svn/trunk/doc/faq.html

--Nate
___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Matt Lundin
Erik Iverson er...@ccbr.umn.edu writes:

 http://doc.norang.ca/org-mode.html#Yasnippets

 If anyone else has a different macro set up, I'm still interested in
 hearing your solutions.


 Nope, yasnippet is the way to go I think!

There are quite a few other options. IMO, installing yasnippet is
overkill if you are only using it for comment blocks in org-mode.

1. The first and simplest option is built into org-mode. Simply type:

s [TAB] or [M-TAB]

This will automatically expand to:

--8---cut here---start-8---
#+begin_src 

#+end_src
--8---cut here---end---8---

For a full list of completions, type C-h v
org-structure-template-alist.

2. The second option is to save the text to a register:

(set-register ?b #+begin_src\n\n#+end_src)

Then type C-x r i b to insert the source block.

(info (emacs) Registers)

3. You can use abbrev mode for dynamic expansion:

 - Activate the abbrev minor-mode in org-mode:

   + M-x abbrev-mode

   + permanently: (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))

 - In org-mode, type something like sbp for a perl source block.

 - Immediately after sbp type C-x a i l.

 - Enter the expansion: #+begin_src perl[C-q C-j][C-q C-j]#+end_src

   + Note: the C-q C-j creates a new line in the minibuffer

 - Now, whenever, you type sbp[Space, RET, TAB, etc.] in an org-mode
   buffer, the src block will magically appear.

 - If you want more complex completion (like yasnippet) you can combine
   abbrev mode with skeletons.

   See: 
- (info (emacs) Abbrevs) and
- http://www.emacswiki.org/emacs/SkeletonMode

Best,
Matt





___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Shelagh Manton
On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:

You could play around with artist-mode if you use X. It uses the mouse 
with ascii symbols to create rectangles, lines etc. Then just change the  
text how you need. There are some helpful functions on emacswiki that 
show you how to set up ido with artist. Don't have the url handy though.

Sadly, it seems you can't get artist-mode to work in a tty, though I 
believe you can in an xterm.

Shelagh



___
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] Re: [Babel] Macro for begin_src?

2010-04-17 Thread Thomas S. Dye


On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:


Erik Iverson er...@ccbr.umn.edu writes:


http://doc.norang.ca/org-mode.html#Yasnippets

If anyone else has a different macro set up, I'm still interested in
hearing your solutions.



Nope, yasnippet is the way to go I think!


There are quite a few other options. IMO, installing yasnippet is
overkill if you are only using it for comment blocks in org-mode.

1. The first and simplest option is built into org-mode. Simply type:

s [TAB] or [M-TAB]

This will automatically expand to:

--8---cut here---start-8---
#+begin_src

#+end_src
--8---cut here---end---8---

For a full list of completions, type C-h v
org-structure-template-alist.

2. The second option is to save the text to a register:

(set-register ?b #+begin_src\n\n#+end_src)

Then type C-x r i b to insert the source block.

(info (emacs) Registers)

3. You can use abbrev mode for dynamic expansion:

- Activate the abbrev minor-mode in org-mode:

  + M-x abbrev-mode

  + permanently: (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))

- In org-mode, type something like sbp for a perl source block.

- Immediately after sbp type C-x a i l.

- Enter the expansion: #+begin_src perl[C-q C-j][C-q C-j]#+end_src

  + Note: the C-q C-j creates a new line in the minibuffer

- Now, whenever, you type sbp[Space, RET, TAB, etc.] in an org-mode
  buffer, the src block will magically appear.

- If you want more complex completion (like yasnippet) you can combine
  abbrev mode with skeletons.

  See:
   - (info (emacs) Abbrevs) and
   - http://www.emacswiki.org/emacs/SkeletonMode

Best,
Matt



Neat.  What would you use yasnippets for, if anything?

All the best,
Tom


___
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] Re: [Babel] Macro for begin_src?

2010-04-16 Thread Nathan Neff
On Fri, Apr 16, 2010 at 8:18 PM, Nathan Neff nathan.n...@gmail.com wrote:

 I've been converting my init.el file to org-babel, and am getting tired of
 copying/pasting or typing the begin_src and end_src blocks.

 Example:
 #+begin_src emacs-lisp :results silent
 #+end_src


*Sigh* I Googled around for about 15 minutes, then posted the question to
the mailing list. (I swear!)

Then, I stumbled upon Brent's Yasnippets when researching something totally
different.

http://doc.norang.ca/org-mode.html#Yasnippets

If anyone else has a different macro set up, I'm still interested in hearing
your solutions.

Thanks,
--Nate
___
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] Re: [Babel] Macro for begin_src?

2010-04-16 Thread Bernt Hansen
Nathan Neff nathan.n...@gmail.com writes:

 I've been converting my init.el file to org-babel, and am getting tired of
 copying/pasting or typing the begin_src and end_src blocks.

 Example:
 #+begin_src emacs-lisp :results silent
 #+end_src

 As an Emacs n00b, I'd like to know if anyone here has defined some kind of
 macro / shortcut to define an org-babel block.

 I'd like a shortcut/macro that I could put into my config files, and put into 
 my git repo.

 Thanks for any input,

 --Nate

That sounds like a good candidate for yasnippet to me.

-Bernt


___
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] Re: [Babel] Macro for begin_src?

2010-04-16 Thread Erik Iverson




http://doc.norang.ca/org-mode.html#Yasnippets

If anyone else has a different macro set up, I'm still interested in 
hearing your solutions.




Nope, yasnippet is the way to go I think!


___
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] Re: [Babel] Macro for begin_src?

2010-04-16 Thread Nathan Neff
On Fri, Apr 16, 2010 at 9:35 PM, Dan Davison davi...@stats.ox.ac.uk wrote:

 Nathan Neff nathan.n...@gmail.com writes:

  On Fri, Apr 16, 2010 at 8:18 PM, Nathan Neff nathan.n...@gmail.com
 wrote:
 
  I've been converting my init.el file to org-babel, and am getting
 tired of
  copying/pasting or typing the begin_src and end_src blocks.
 
  Example:
  #+begin_src emacs-lisp :results silent
  #+end_src

 Hi Nate,

 By the way, if you are using :results silent for all your blocks, then
 you can just enter it once as a buffer property:

 #+property: results silent

 (and if you want it for a whole subtree but not a whole buffer, then set
 a property called :results: with value silent in the root of the
 subtree).

 I agree with the others about using yasnippets for blocks. I have src
 and elisp snippets (although to be honest I still haven't learned the
 syntax for defining them and I have trouble stopping them leaving
 annoying trailing spaces...ok thanks you made me fix that, although I
 still don't know the syntax, something like this then

 src:

 #+begin_src...#+end_src
 # --
 #+begin_src ${2:language}
 $0
 #+end_src

 elisp:

 #name : #+begin_src...#+end_src
 # --
 #+begin_src emacs-lisp
 $0
 #+end_src



Thanks!  I'm having trouble triggering the yasnippets using the TAB key, so
I'm just using the GUI menu.

Do you literally type src (no quotes), then press Tab?

--Nate
___
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