Re: [O] function for inserting a block

2017-12-10 Thread Thorsten Jolitz
Hello, this is a long thread so I did not read everything, just want to mention that in org-dp.el I did something similar using - tempo templates (for a programmer who wants to insert an org-dp-create call in his emacs-lisp program) and - a universal (org) prompt function for a user who wants t

Re: [O] function for inserting a block

2017-11-20 Thread Eric Abrahamsen
Rasmus writes: > Hi Eric, > > >> It incorporates Rasmus' org-tempo.el file, with modifications, and >> Thomas' suggestion to re-instate `org-try-structure-completion', and, >> erm, stardiviner's request to honor >> `org-babel-uppercase-example-markers'. >> >> Remaining issues: >> >> 1. The "org-i

Re: [O] function for inserting a block

2017-11-20 Thread Rasmus
Hi Eric, > It incorporates Rasmus' org-tempo.el file, with modifications, and > Thomas' suggestion to re-instate `org-try-structure-completion', and, > erm, stardiviner's request to honor > `org-babel-uppercase-example-markers'. > > Remaining issues: > > 1. The "org-include" tempo template doesn'

Re: [O] function for inserting a block

2017-11-17 Thread numbch...@gmail.com
Ok, I see, Just I have to replace all uppercased babels and example blocks to lowercase to keep same. I have a lot of org files. Huge for me. I can take with the lower-case tag. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild

Re: [O] function for inserting a block

2017-11-17 Thread Eric Abrahamsen
"numbch...@gmail.com" writes: > Yeah, I misunderstand your code. Anyway, It should be like this: > > #+BEGIN_SRC python > ... > #+END_SRC > > #+BEGIN_EXAMPLE > ... > #+END_EXAMPLE > > etc If you look back up this (admittedly very long) thread, you'll see the general consensus is to move to lower

Re: [O] function for inserting a block

2017-11-17 Thread numbch...@gmail.com
Yeah, I misunderstand your code. Anyway, It should be like this: #+BEGIN_SRC python ... #+END_SRC #+BEGIN_EXAMPLE ... #+END_EXAMPLE etc [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3

Re: [O] function for inserting a block

2017-11-15 Thread Eric Abrahamsen
"numbch...@gmail.com" writes: > I think the function `org-insert-structure-template' also should respect the > `org-babel-uppercase-example-markers'. > Besides, your new diff does not have a condition on > `org-babel-uppercase-example-markers', you just use `upcase-initials` by > default. Then

Re: [O] function for inserting a block

2017-11-15 Thread numbch...@gmail.com
I think the function `org-insert-structure-template' also should respect the `org-babel-uppercase-example-markers'. Besides, your new diff does not have a condition on `org-babel-uppercase-example-markers', you just use `upcase-initials` by default. Then the new `tempo` snippets will be uppercase,

Re: [O] function for inserting a block

2017-11-14 Thread Eric Abrahamsen
"Thomas S. Dye" writes: > Eric Abrahamsen writes: > >> Rasmus writes: >> >>> Hi Eric, >>> >>> Eric Abrahamsen writes: >>> > Also, Eric, it seems that org-structure-template-alist only supports a > single letter for short-hands (the car of an entry in > org-structure-template-alist i

Re: [O] function for inserting a block

2017-11-11 Thread numbch...@gmail.com
+1 I added a snippet for ` GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Sun, Nov 12, 2017 at 12:35 PM, Matt Lundin wrote: > Carsten Domini

Re: [O] function for inserting a block

2017-11-11 Thread Matt Lundin
Carsten Dominik writes: > I have always come down on the side of NOT breaking backward > compatibility unless we really HAVE TO in order to make progress. The > reason for this bias is because most Org users are not reading this > maling list and just want the system to function and to continue t

Re: [O] function for inserting a block

2017-11-11 Thread Thomas S. Dye
Eric Abrahamsen writes: > Rasmus writes: > >> Hi Eric, >> >> Eric Abrahamsen writes: >> Also, Eric, it seems that org-structure-template-alist only supports a single letter for short-hands (the car of an entry in org-structure-template-alist is a char). I used to have blocks lik

Re: [O] function for inserting a block

2017-11-10 Thread stardiviner
I agree. I hope this feature too. +1 On 11/10/2017 05:31 PM, Rasmus wrote: > Hi Eric, > > Eric Abrahamsen writes: > >>> Also, Eric, it seems that org-structure-template-alist only supports a >>> single letter for short-hands (the car of an entry in >>> org-structure-template-alist is a char).

Re: [O] function for inserting a block

2017-11-10 Thread Eric Abrahamsen
Rasmus writes: > Hi Eric, > > Eric Abrahamsen writes: > >>> Also, Eric, it seems that org-structure-template-alist only supports a >>> single letter for short-hands (the car of an entry in >>> org-structure-template-alist is a char). I used to have blocks like ">> expanding to an "abstract" spe

Re: [O] function for inserting a block

2017-11-10 Thread Rasmus
Hi Eric, Eric Abrahamsen writes: >> Also, Eric, it seems that org-structure-template-alist only supports a >> single letter for short-hands (the car of an entry in >> org-structure-template-alist is a char). I used to have blocks like "> expanding to an "abstract" special-block, which I guess i

Re: [O] function for inserting a block

2017-11-09 Thread James Harkins
One more vote in favor of not removing my own use, I added Anyway, just an opinion. "<" macros save me tons of time with ox-latex markup. I like them. hjh Sent with AquaMail for Android http://www.aqua-mail.com

Re: [O] function for inserting a block

2017-11-09 Thread Eric Abrahamsen
Rasmus writes: > Rasmus writes: > >> Nicolas Goaziou writes: >> >>> Takaaki Ishikawa writes: >>> I also support the idea of keeping ">>> Please give importance to the backward compatibility in this case. >>> >>> I explained why I thought it could be removed. I also suggested >>> solutions

Re: [O] function for inserting a block

2017-11-09 Thread Rasmus
Rasmus writes: > Nicolas Goaziou writes: > >> Takaaki Ishikawa writes: >> >>> I also support the idea of keeping ">> Please give importance to the backward compatibility in this case. >> >> I explained why I thought it could be removed. I also suggested >> solutions to get an equivalent feature

Re: [O] function for inserting a block

2017-11-09 Thread Rasmus
Nicolas Goaziou writes: > Takaaki Ishikawa writes: > >> I also support the idea of keeping "> Please give importance to the backward compatibility in this case. > > I explained why I thought it could be removed. I also suggested > solutions to get an equivalent feature without implementing it in

Re: [O] function for inserting a block

2017-11-08 Thread Carsten Dominik
On Thu, Nov 9, 2017 at 5:31 AM, Thomas S. Dye wrote: > Aloha Nicolas, > > Nicolas Goaziou writes: > > > Hello, > > > > Takaaki Ishikawa writes: > > > >> I also support the idea of keeping " >> Please give importance to the backward compatibility in this case. > > > > I explained why I thought it

Re: [O] function for inserting a block

2017-11-08 Thread Thomas S. Dye
Aloha Nicolas, Nicolas Goaziou writes: > Hello, > > Takaaki Ishikawa writes: > >> I also support the idea of keeping "> Please give importance to the backward compatibility in this case. > > I explained why I thought it could be removed. I also suggested > solutions to get an equivalent feature

Re: [O] function for inserting a block

2017-11-08 Thread Nicolas Goaziou
Hello, Takaaki Ishikawa writes: > I also support the idea of keeping " Please give importance to the backward compatibility in this case. I explained why I thought it could be removed. I also suggested solutions to get an equivalent feature without implementing it in Org. What is wrong with Ab

Re: [O] function for inserting a block

2017-11-08 Thread Eric Abrahamsen
Perhaps what we can do is re-instate this functionality using the built-in Emacs mechanisms?

Re: [O] function for inserting a block

2017-11-08 Thread Takaaki Ishikawa
I also support the idea of keeping ": > > Berry, Charles writes: > >>> On Nov 8, 2017, at 6:07 AM, Rasmus wrote: >>> >>> I think the template expansion a la ">> YASnippet installed for many years, and I never figured out how to use it >>> properly. To me, it is a bit too complex a replacement. >>

Re: [O] function for inserting a block

2017-11-08 Thread Thomas S. Dye
Berry, Charles writes: >> On Nov 8, 2017, at 6:07 AM, Rasmus wrote: >> >> I think the template expansion a la "> YASnippet installed for many years, and I never figured out how to use it >> properly. To me, it is a bit too complex a replacement. > > > Me too. " > I suspect that there will be c

Re: [O] function for inserting a block

2017-11-08 Thread Nicolas Goaziou
Hello, "Berry, Charles" writes: >> On Nov 8, 2017, at 6:07 AM, Rasmus wrote: >> >> I think the template expansion a la "> YASnippet installed for many years, and I never figured out how to use it >> properly. To me, it is a bit too complex a replacement. > > > Me too. " > I suspect that ther

Re: [O] function for inserting a block

2017-11-08 Thread Berry, Charles
> On Nov 8, 2017, at 6:07 AM, Rasmus wrote: > > I think the template expansion a la " YASnippet installed for many years, and I never figured out how to use it > properly. To me, it is a bit too complex a replacement. Me too. "

Re: [O] function for inserting a block

2017-11-08 Thread William Denton
On 8 November 2017, Bastien wrote: I'm aware of Yasnippet, but it is not in Emacs core and it can be daunting for newcomers to install, customize and use. The previous function was very straightforward and simple, the cost for losing it seems to high to me. I'd rather have 10 lines in Org (and

Re: [O] function for inserting a block

2017-11-08 Thread Eric Abrahamsen
Bastien Guerry writes: > Hi Nicolas, > > Nicolas Goaziou writes: > >> Bastien writes: >> >>> is there a simple mechanism in Emacs core to restore the same >>> functionnality? >> >> Of course, it is called Abbrev mode: (info "(emacs)Abbrev >> Concepts"). > > Abbrev only expands on words constitu

Re: [O] function for inserting a block

2017-11-08 Thread Bastien Guerry
Hi Nicolas, Nicolas Goaziou writes: > Bastien writes: > >> is there a simple mechanism in Emacs core to restore the same >> functionnality? > > Of course, it is called Abbrev mode: (info "(emacs)Abbrev > Concepts"). Abbrev only expands on words constituents, so " You may also use (info "(autot

Re: [O] function for inserting a block

2017-11-08 Thread Rasmus
Hi, Thanks you, Eric, for providing this new functionality. Nicolas Goaziou writes: > Bastien writes: > >> Maybe I missed something in this thread, but what about making >> the change backward-compatible by allowing "> be expanded? For me, I'd rather type > I suggested the idea to remove " m

Re: [O] function for inserting a block

2017-11-08 Thread Nicolas Goaziou
Bastien writes: > is there a simple mechanism in Emacs core to restore the same > functionnality? Of course, it is called Abbrev mode: (info "(emacs)Abbrev Concepts"). You may also use (info "(autotype)Using Skeletons") for more advanced uses. Regards,

Re: [O] function for inserting a block

2017-11-08 Thread Bastien
Hi Nicolas, > I suggested the idea to remove " many other template systems, e.g., YASnippet, already provides this. > I didn't want to re-implement the wheel and let, instead, various parts > of Emacs cooperate. is there a simple mechanism in Emacs core to restore the same functionnality? I'm aw

Re: [O] function for inserting a block

2017-11-08 Thread Nicolas Goaziou
Hello, Bastien writes: > Maybe I missed something in this thread, but what about making > the change backward-compatible by allowing " be expanded? For me, I'd rather type

Re: [O] function for inserting a block

2017-11-08 Thread Bastien
Hi Eric, thanks *a lot* for implementing this change! Maybe I missed something in this thread, but what about making the change backward-compatible by allowing "

Re: [O] function for inserting a block

2017-11-06 Thread Kaushal Modi
On Mon, Nov 6, 2017 at 8:48 AM Nicolas Goaziou wrote: > I documented the two changes above in ORG-NEWS. > Thanks! -- Kaushal Modi

Re: [O] function for inserting a block

2017-11-06 Thread Nicolas Goaziou
Hello, Kaushal Modi writes: > On Sun, Nov 5, 2017 at 9:24 AM Kaushal Modi wrote: > >> This is a breaking change though (org-try-structure-completion doesn't >> exist any more.. it breaks at least my config.. could be breaking more). >> > > It could actually be a wider breakage as it changes th

Re: [O] function for inserting a block

2017-11-05 Thread Eric Abrahamsen
On 11/05/17 10:06 AM, Nicolas Goaziou wrote: > Hello, > > Eric Abrahamsen writes: > >> From 055af9e9545947b9aeccc3370c8b67a237eea5d8 Mon Sep 17 00:00:00 2001 >> From: Eric Abrahamsen >> Date: Mon, 30 Oct 2017 10:55:29 -0700 >> Subject: [PATCH] Replace easy templates with org-insert-structure-tem

Re: [O] function for inserting a block

2017-11-05 Thread Kaushal Modi
On Sun, Nov 5, 2017 at 9:24 AM Kaushal Modi wrote: > This is a breaking change though (org-try-structure-completion doesn't > exist any more.. it breaks at least my config.. could be breaking more). > It could actually be a wider breakage as it changes the structure of org-structure-template-al

Re: [O] function for inserting a block

2017-11-05 Thread Kaushal Modi
On Sun, Nov 5, 2017 at 4:07 AM Nicolas Goaziou wrote: > Hello, > > Eric Abrahamsen writes: > > > From 055af9e9545947b9aeccc3370c8b67a237eea5d8 Mon Sep 17 00:00:00 2001 > > From: Eric Abrahamsen > > Date: Mon, 30 Oct 2017 10:55:29 -0700 > > Subject: [PATCH] Replace easy templates with > org-inse

Re: [O] function for inserting a block

2017-11-05 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > From 055af9e9545947b9aeccc3370c8b67a237eea5d8 Mon Sep 17 00:00:00 2001 > From: Eric Abrahamsen > Date: Mon, 30 Oct 2017 10:55:29 -0700 > Subject: [PATCH] Replace easy templates with org-insert-structure-template > > * lisp/org.el (org-insert-structure-template):

Re: [O] function for inserting a block

2017-10-30 Thread Eric Abrahamsen
Sorry, last patch had some documentation errors. >From 055af9e9545947b9aeccc3370c8b67a237eea5d8 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Mon, 30 Oct 2017 10:55:29 -0700 Subject: [PATCH] Replace easy templates with org-insert-structure-template * lisp/org.el (org-insert-structure-temp

Re: [O] function for inserting a block

2017-10-30 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Hello, > > Eric Abrahamsen writes: > >> This will get there eventually! Because there's likely to be more >> tweaking, I haven't touched the manual or the tests yet, just reworked >> the option and function: > > Thank you. Some comments follow. > >> #+BEGIN_SRC elisp >>

Re: [O] function for inserting a block

2017-10-30 Thread Eric S Fraga
On Monday, 30 Oct 2017 at 12:05, Nicolas Goaziou wrote: [...] > As suggested by Rasmus once, maybe we could get away from FORTRAN touch > and insert everything lowercase. +1 (repeat many times) -- : Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-155-gf474c7 signature.asc Description: PGP

Re: [O] function for inserting a block

2017-10-30 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > This will get there eventually! Because there's likely to be more > tweaking, I haven't touched the manual or the tests yet, just reworked > the option and function: Thank you. Some comments follow. > #+BEGIN_SRC elisp > (defcustom org-structure-template-alist

Re: [O] function for inserting a block

2017-10-28 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Hello, > > Eric Abrahamsen writes: > >> In that case, would you be more in favor of a keymap-plus-subkey system, >> or a keymap-plus-prompt system? > > I have no strong opinion, but a keymap-plus-subkey system (subkeys > matching current keys in `org-structure-template-

Re: [O] function for inserting a block

2017-10-24 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > In that case, would you be more in favor of a keymap-plus-subkey system, > or a keymap-plus-prompt system? I have no strong opinion, but a keymap-plus-subkey system (subkeys matching current keys in `org-structure-template-alist') with an additional key (e.g. )

Re: [O] function for inserting a block

2017-10-23 Thread Eric Abrahamsen
Eric Abrahamsen writes: > Nicolas Goaziou writes: > >> Hello, >> >> Eric Abrahamsen writes: >> >>> Kaushal Modi writes: >>> On Fri, Oct 20, 2017, 5:43 PM Kaushal Modi wrote: >>> >>> [...] >>> @Eric: I believe you were sort of onboard with this suggestion, just gated by a doubt

Re: [O] function for inserting a block

2017-10-23 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Hello, > > Eric Abrahamsen writes: > >> Kaushal Modi writes: >> >>> On Fri, Oct 20, 2017, 5:43 PM Kaushal Modi wrote: >> >> [...] >> >>> @Eric: I believe you were sort of onboard with this suggestion, just gated >>> by a doubt if this actually can make into master.

Re: [O] function for inserting a block

2017-10-23 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > Kaushal Modi writes: > >> On Fri, Oct 20, 2017, 5:43 PM Kaushal Modi wrote: > > [...] > >> @Eric: I believe you were sort of onboard with this suggestion, just gated >> by a doubt if this actually can make into master. > > In principle yes, I agree it's odd t

Re: [O] function for inserting a block

2017-10-23 Thread Eric Abrahamsen
Kaushal Modi writes: > On Fri, Oct 20, 2017, 5:43 PM Kaushal Modi wrote: [...] > @Eric: I believe you were sort of onboard with this suggestion, just gated by > a doubt if this actually can make into master. In principle yes, I agree it's odd to have two completely different systems for ess

Re: [O] function for inserting a block

2017-10-23 Thread Kaushal Modi
On Mon, Oct 23, 2017 at 10:00 AM Carsten Dominik wrote: > I am not sure I understand, at least with transient-region turned on. > Typing You're correct. > Or do you mean to actually put "<" into a keymap? > I actually do that in my personal config .. Maybe binding "<" in org keymap is the si

Re: [O] function for inserting a block

2017-10-23 Thread Carsten Dominik
On Mon, Oct 23, 2017 at 12:52 PM, Kaushal Modi wrote: > On Fri, Oct 20, 2017, 5:43 PM Kaushal Modi wrote: > >> On Fri, Oct 20, 2017 at 5:15 PM Eric Abrahamsen >> wrote: >> >>> The template really only inserts the block type, not anything specific >>> like the source language or export backend.

Re: [O] function for inserting a block

2017-10-23 Thread Kaushal Modi
On Fri, Oct 20, 2017, 5:43 PM Kaushal Modi wrote: > On Fri, Oct 20, 2017 at 5:15 PM Eric Abrahamsen > wrote: > >> The template really only inserts the block type, not anything specific >> like the source language or export backend. > > > Right, but based on the code you have, you can easily add

Re: [O] function for inserting a block

2017-10-22 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Hello, > > Eric Abrahamsen writes: > >> Kaushal Modi writes: > >>> I just tried it out, and it works great! >>> >>> I have a comment about >>> >>> (when (string-equal (downcase type) "example") >>> (org-escape-code-in-region s e)) >>> >>> I have never needed to

Re: [O] function for inserting a block

2017-10-22 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > Kaushal Modi writes: >> I just tried it out, and it works great! >> >> I have a comment about >> >> (when (string-equal (downcase type) "example") >> (org-escape-code-in-region s e)) >> >> I have never needed to escape org in example, blocks, but I *have

Re: [O] function for inserting a block

2017-10-21 Thread Eric Abrahamsen
Kaushal Modi writes: > On Fri, Oct 20, 2017 at 5:15 PM Eric Abrahamsen > wrote: > > The template really only inserts the block type, not anything specific > like the source language or export backend. > > Right, but based on the code you have, you can easily add "SRC org", "SRC > emacs-lisp"

Re: [O] function for inserting a block

2017-10-21 Thread Xebar Saram
thx thats perfect Z On Sat, Oct 21, 2017 at 2:59 PM, Marco Wahl wrote: > The following message is a courtesy copy of an article > that has been posted to gmane.emacs.orgmode as well. > > Hi! > > Xebar Saram writes: > > > this looks really cool and would love to try. as a non technical user, >

Re: [O] function for inserting a block

2017-10-21 Thread Marco Wahl
Hi! Xebar Saram writes: > this looks really cool and would love to try. as a non technical user, how > does one use the patch to get the functionality? is there a way to create a > clean function only version from the patch i can try? You could simply pick the relevant parts from the patch and

Re: [O] function for inserting a block

2017-10-21 Thread Xebar Saram
Hi all this looks really cool and would love to try. as a non technical user, how does one use the patch to get the functionality? is there a way to create a clean function only version from the patch i can try? thx! Z On Sat, Oct 21, 2017 at 12:43 AM, Kaushal Modi wrote: > On Fri, Oct 20, 20

Re: [O] function for inserting a block

2017-10-20 Thread Kaushal Modi
On Fri, Oct 20, 2017 at 5:15 PM Eric Abrahamsen wrote: > The template really only inserts the block type, not anything specific > like the source language or export backend. Right, but based on the code you have, you can easily add "SRC org", "SRC emacs-lisp" to the default value of that list.

Re: [O] function for inserting a block

2017-10-20 Thread Eric Abrahamsen
Kaushal Modi writes: > Also, if the type is "src", shouldn't the point end up after "#+BEGIN_SRC"? > Because the user will anyways need to type something there. My original version did that. It might be nice to still do that selectively if the user adds a SRC or EXPORT block. > Finally, I am t

Re: [O] function for inserting a block

2017-10-20 Thread Eric Abrahamsen
Kaushal Modi writes: > On Fri, Oct 20, 2017 at 2:07 PM Eric Abrahamsen > wrote: > > Okay, here's another version, with a new keybinding and completion. The > completion strings are uppercase, which might not always be the right > thing, but probably more often than not. > > Hi Eric, > > I ju

Re: [O] function for inserting a block

2017-10-20 Thread Kaushal Modi
Also, if the type is "src", shouldn't the point end up after "#+BEGIN_SRC"? Because the user will anyways need to type something there. Finally, I am trying to understand what this does: (if (bolp) (progn (skip-chars-backward " \n\t") (forward-line)) ;; snip ) If the point is

Re: [O] function for inserting a block

2017-10-20 Thread Kaushal Modi
On Fri, Oct 20, 2017 at 2:07 PM Eric Abrahamsen wrote: > Okay, here's another version, with a new keybinding and completion. The > completion strings are uppercase, which might not always be the right > thing, but probably more often than not. > Hi Eric, I just tried it out, and it works great!

Re: [O] function for inserting a block

2017-10-20 Thread Eric Abrahamsen
Carsten Dominik writes: > Hi Eric, > > On Wed, Oct 18, 2017 at 4:58 PM, Eric Abrahamsen > wrote: > > Carsten Dominik writes: > > > Dear all, > > > > this is great added functionality that I have missed a lot myself. Thanks > for this! Also, I like the key binding. > > I do too, though

Re: [O] function for inserting a block

2017-10-19 Thread Carsten Dominik
Hi Eric, On Wed, Oct 18, 2017 at 4:58 PM, Eric Abrahamsen wrote: > Carsten Dominik writes: > > > Dear all, > > > > this is great added functionality that I have missed a lot myself. > Thanks for this! Also, I like the key binding. > > I do too, though I also notice it conflicts with inlineta

Re: [O] function for inserting a block

2017-10-18 Thread Eric Abrahamsen
Carsten Dominik writes: > Dear all, > > this is great added functionality that I have missed a lot myself. Thanks > for this! Also, I like the key binding. I do too, though I also notice it conflicts with inlinetask insertion. > One improvement I can think of it to read the block type with c

Re: [O] function for inserting a block

2017-10-17 Thread Carsten Dominik
Dear all, this is great added functionality that I have missed a lot myself. Thanks for this! Also, I like the key binding. One improvement I can think of it to read the block type with completion (but still allow any word to be used). Carsten On Wed, Oct 18, 2017 at 12:03 AM, Eric Abrahamsen

Re: [O] function for inserting a block

2017-10-17 Thread Eric Abrahamsen
Eric Abrahamsen writes: > Nicolas Goaziou writes: > >> Eric Abrahamsen writes: >> >>> I'm still not quite seeing this. This chunk should take care of it: >>> >>> (goto-char e) >>> (if (bolp) >>> (progn >>> (skip-chars-backward " \n\t") >>> (forward-line)) >>> (end-

Re: [O] function for inserting a block

2017-10-17 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Eric Abrahamsen writes: > >> I'm still not quite seeing this. This chunk should take care of it: >> >> (goto-char e) >> (if (bolp) >> (progn >>(skip-chars-backward " \n\t") >>(forward-line)) >> (end-of-line) >> (insert "\n")) >>

Re: [O] function for inserting a block

2017-10-17 Thread Nicolas Goaziou
Eric Abrahamsen writes: > I'm still not quite seeing this. This chunk should take care of it: > > (goto-char e) > (if (bolp) > (progn > (skip-chars-backward " \n\t") > (forward-line)) > (end-of-line) > (insert "\n")) > > If "e" is EOB, we do `end-of-line'

Re: [O] function for inserting a block

2017-10-17 Thread Eric Abrahamsen
Nicolas Goaziou writes: [...] > Then it's `forward-line', not `forward-char', because there could be > trailing spaces at the end of the paragraph, e.g. > >This is a paragraph. Okay, changed to `forward-line'. > Also, my question still holds, what about the last paragraph in a buffer > no

Re: [O] function for inserting a block

2017-10-17 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > Nicolas Goaziou writes: >>> +(if (bolp) >>> + (progn >>> + (skip-chars-backward " \n\t") >>> + (forward-char)) >>> + (end-of-line) >>> + (insert "\n")) >> >> I don't understand this part. In particular, the `forward-char' looks >> wrong.

Re: [O] function for inserting a block

2017-10-16 Thread Eric Abrahamsen
Eric Abrahamsen writes: [...] > #+BEGIN_SRC org > #+BEGIN_FOO > This is a paragraph. > > #+END_FOO > > This is another paragraph. > #+END_SRC Make that: #+BEGIN_FOO This is a paragraph #+END_FOO This is another paragraph

Re: [O] function for inserting a block

2017-10-16 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Hello, > > Eric Abrahamsen writes: > >> How does this look? > > Thank you! I have some questions and remarks. > >> * etc/ORG-NEWS: Mention in news. > > This doesn't need to be added to the commit message. > >> +Do not be put off by having to remember the source block sy

Re: [O] function for inserting a block

2017-10-14 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > How does this look? Thank you! I have some questions and remarks. > * etc/ORG-NEWS: Mention in news. This doesn't need to be added to the commit message. > +Do not be put off by having to remember the source block syntax. Org mode > +offers two ways of speed

Re: [O] function for inserting a block

2017-10-07 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Hello, > > Eric Abrahamsen writes: > >> Nicolas Goaziou writes: >> >> >> [...] >> >>> C-c C-x t is free, tho. >> >> Oops, I think that's what I meant to type. Here's the latest version of >> the patch -- I removed the bit fooling with the location of point at the >> en

Re: [O] function for inserting a block

2017-10-05 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > Nicolas Goaziou writes: > > > [...] > >> C-c C-x t is free, tho. > > Oops, I think that's what I meant to type. Here's the latest version of > the patch -- I removed the bit fooling with the location of point at the > end, as it seemed simpler was better. How's

Re: [O] function for inserting a block

2017-09-30 Thread Eric Abrahamsen
Nicolas Goaziou writes: [...] > C-c C-x t is free, tho. Oops, I think that's what I meant to type. Here's the latest version of the patch -- I removed the bit fooling with the location of point at the end, as it seemed simpler was better. How's this look? Eric >From b8636d918e9ff79cac3200033

Re: [O] function for inserting a block

2017-09-29 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > On 09/10/17 14:44 PM, Nicolas Goaziou wrote: > > [...] > >> Some free key bindings: >> - C-c C-x C-e >> - C-c C-x C-g >> - C-c C-x C-h >> - C-c C-x C-k >> - C-c C-x h >> - C-c C-x j >> - C-c C-x k >> - C-c C-x l >> - C-c C-x m >> - C-c C-x n >> - C-c C-x r >> - C

Re: [O] function for inserting a block

2017-09-10 Thread Eric Abrahamsen
On 09/10/17 14:44 PM, Nicolas Goaziou wrote: [...] > Some free key bindings: > - C-c C-x C-e > - C-c C-x C-g > - C-c C-x C-h > - C-c C-x C-k > - C-c C-x h > - C-c C-x j > - C-c C-x k > - C-c C-x l > - C-c C-x m > - C-c C-x n > - C-c C-x r > - C-c C-x s > - C-c C-x t > - C-c C-x u > - C-c C-x w >

Re: [O] function for inserting a block

2017-09-10 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > And here's an actual patch, with docs. Thank you! Some comments follow. > +This function can be used to wrap existing text or Org elements in > +a #+BEGIN_FOO/#+END_FOO block. Not bound to a key by default. Some free key bindings: - C-c C-x C-e - C-c C-x C-g

Re: [O] function for inserting a block

2017-09-08 Thread Eric Abrahamsen
Eric Abrahamsen writes: [...] > Here's another stab at it. Is "example" the only block that should be > verbatim? Will using `newline-and-indent' instead of inserting literal > newlines solve the indentation problem? > > > (defun org-insert-structure-template (type) > "Insert a block structure

Re: [O] function for inserting a block

2017-09-03 Thread Eric Abrahamsen
Josiah Schwab writes: > Hi Eric, > >> Erm, I'd be surprised if there's a single Org mode binding that >> *doesn't* start with C-c. That convention is right out the window with >> Org... > > To be clear, this is referring to C-c and then a single ASCII letter, > not just any binding that starts wi

Re: [O] function for inserting a block

2017-09-03 Thread Josiah Schwab
Hi Eric, > Erm, I'd be surprised if there's a single Org mode binding that > *doesn't* start with C-c. That convention is right out the window with > Org... To be clear, this is referring to C-c and then a single ASCII letter, not just any binding that starts with C-c. The manual /suggests/ glob

Re: [O] function for inserting a block

2017-09-03 Thread Eric Abrahamsen
Josiah Schwab writes: > Hi Eric, > >>> We cannot bind it to "C-c i", this is a reserved key-binding. But we can >>> suggest users to do so in the manual. Or find another binding. >> >> That's fine. Incidentally, why is "C-c i" reserved? It's not bound to >> anything here. Does it look like in te

Re: [O] function for inserting a block

2017-09-03 Thread Josiah Schwab
Hi Eric, >> We cannot bind it to "C-c i", this is a reserved key-binding. But we can >> suggest users to do so in the manual. Or find another binding. > > That's fine. Incidentally, why is "C-c i" reserved? It's not bound to > anything here. Does it look like in terminal Emacs? The keybinding co

Re: [O] function for inserting a block

2017-09-03 Thread Eric Abrahamsen
Nicolas Goaziou writes: > Hello, > > Eric Abrahamsen writes: > >> The easy template entry thing is useful as far as it goes, but for some >> reason I find myself "marking up" existing text in Org as least as often >> as I'm writing new text from scratch. I've always wanted a "wrap region >> in b

Re: [O] function for inserting a block

2017-09-03 Thread Nicolas Goaziou
Adam Porter writes: > "...it is a good idea to make a marker point nowhere if you are sure you > don’t need it any more. Markers that can no longer be accessed are > eventually removed (*note Garbage Collection::)." > > I asked on /r/emacs about this but never got a firm answer; some thought > t

Re: [O] function for inserting a block

2017-09-03 Thread Adam Porter
Nicolas Goaziou writes: > You need to clean these markers at the end of the function. Markers set > to a position are never garbage-collected. Usually, it happens at the > end of an `unwind-protect'. Not that I oppose cleaning up markers after you're done with them, but are they actually never c

Re: [O] function for inserting a block

2017-09-03 Thread Nicolas Goaziou
Hello, Eric Abrahamsen writes: > The easy template entry thing is useful as far as it goes, but for some > reason I find myself "marking up" existing text in Org as least as often > as I'm writing new text from scratch. I've always wanted a "wrap region > in block" command, and finally wrote one

Re: [O] function for inserting a block

2017-09-02 Thread Eric Abrahamsen
Kaushal Modi writes: > On Sat, Sep 2, 2017, 10:23 PM Adam Porter wrote: > > Hi Eric, > > Thanks for doing this. I've had some similar code in my config for a > while. I'll share some of it here in case you find it useful in doing > this. You especially might find the org-read-structure-te

Re: [O] function for inserting a block

2017-09-02 Thread Kaushal Modi
On Sat, Sep 2, 2017, 10:23 PM Adam Porter wrote: > Hi Eric, > > Thanks for doing this. I've had some similar code in my config for a > while. I'll share some of it here in case you find it useful in doing > this. You especially might find the org-read-structure-template > function useful. > A

Re: [O] function for inserting a block

2017-09-02 Thread Adam Porter
Hi Eric, Thanks for doing this. I've had some similar code in my config for a while. I'll share some of it here in case you find it useful in doing this. You especially might find the org-read-structure-template function useful. Note that some of this uses s and hydra, which obviously isn't su

[O] function for inserting a block

2017-09-02 Thread Eric Abrahamsen
The easy template entry thing is useful as far as it goes, but for some reason I find myself "marking up" existing text in Org as least as often as I'm writing new text from scratch. I've always wanted a "wrap region in block" command, and finally wrote one. Don't know why it took me so long. Would