Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-21 Thread Rasmus
Eric Abrahamsen  writes:

> Eric Abrahamsen  writes:
>
>> Rasmus  writes:
>>
>>> Eric Abrahamsen  writes:
>>>
 Eric Abrahamsen  writes:

> Rasmus  writes:
>
>> Kaushal Modi  writes:
>>
>>> On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:
>>>
 The only way it’s "bad" is in the sense it limits the flexibility of
 snippets, like "
> I don't see any way around that. Any system that allows string keys of
> arbitrary length is going to run into that problem.

 One possible fix, a bit arbitrary: in the default value, provide 
 as an artificial "stop key" in the sub-menus. So "s" starts the "source
 code" sub-menu, and a  after that simply inserts "#+begin_src", and
 leaves point after that.
>>>
>>> Yeah, I tried to suggest that earlier (unless I didn’t say it), but I
>>> might not have expressed the idea in an understandable manner :)
>>
>> Maybe I missed it!
>>
>>> I think that would be the best approach, but there’s no infrastructure
>>> that I know of that does this ATM (but I haven’t had a lot of time lately,
>>> so my knowledge on this issue is limited!).
>>
>> Can't we do this with tempo? It will have to be "handmade", not
>> automatic, but:
>>
>> '(("s" "Source Code")
>>   ("se" "Elisp" "src elisp")
>>   ("sp" "Python" "src python")
>>   ("TAB" "Empty" "src ")
>>   ...etc
>>   ("e" "Export Block")
>>   ("eh" "HTML" "export html")
>>   ("el" "LaTeX" "export latex")
>>   ("TAB" "Empty" "export ")
>>   ...etc
>>   ("v" "Verbatim" "verbatim")
>>   ("q" "Quote" "quote")
>>   ("E" "Example" "example")
>>   ...etc
>>   )
>
> Ahem, should have actually tried that first:
>
> (org-mks
>  '(("s" "Source Code")
>("se" "Elisp" "src elisp")
>("sp" "Python" "src python")
>("s\t" "Empty" "src ")
>("e" "Export Block")
>("eh" "HTML" "export html")
>("el" "LaTeX" "export latex")
>("s\t" "Empty" "export ")
>("v" "Verbatim" "verbatim")
>("q" "Quote" "quote")
>("E" "Example" "example"))
>  "Insert Block" "Block: ")
>
> It's a bit ugly, but it works...

Great find; I didn’t realize we can use tab here!

I’ll try to build the mks list automatically.  It will be a bit annoying,
as we’ll have to figure out valid keys for things like "prop". 

Rasmus

-- 
Lasciate ogni speranza o voi che entrate: siete nella mani di'machellaio




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-20 Thread Eric Abrahamsen
Eric Abrahamsen  writes:

> Rasmus  writes:
>
>> Eric Abrahamsen  writes:
>>
>>> Eric Abrahamsen  writes:
>>>
 Rasmus  writes:

> Kaushal Modi  writes:
>
>> On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:
>>
>>> The only way it’s "bad" is in the sense it limits the flexibility of
>>> snippets, like ">> block
>>> I can no longer have ">>
>>> One possible fix, a bit arbitrary: in the default value, provide 
>>> as an artificial "stop key" in the sub-menus. So "s" starts the "source
>>> code" sub-menu, and a  after that simply inserts "#+begin_src", and
>>> leaves point after that.
>>
>> Yeah, I tried to suggest that earlier (unless I didn’t say it), but I
>> might not have expressed the idea in an understandable manner :)
>
> Maybe I missed it!
>
>> I think that would be the best approach, but there’s no infrastructure
>> that I know of that does this ATM (but I haven’t had a lot of time lately,
>> so my knowledge on this issue is limited!).
>
> Can't we do this with tempo? It will have to be "handmade", not
> automatic, but:
>
> '(("s" "Source Code")
>   ("se" "Elisp" "src elisp")
>   ("sp" "Python" "src python")
>   ("TAB" "Empty" "src ")
>   ...etc
>   ("e" "Export Block")
>   ("eh" "HTML" "export html")
>   ("el" "LaTeX" "export latex")
>   ("TAB" "Empty" "export ")
>   ...etc
>   ("v" "Verbatim" "verbatim")
>   ("q" "Quote" "quote")
>   ("E" "Example" "example")
>   ...etc
>   )

Ahem, should have actually tried that first:

(org-mks
 '(("s" "Source Code")
   ("se" "Elisp" "src elisp")
   ("sp" "Python" "src python")
   ("s\t" "Empty" "src ")
   ("e" "Export Block")
   ("eh" "HTML" "export html")
   ("el" "LaTeX" "export latex")
   ("s\t" "Empty" "export ")
   ("v" "Verbatim" "verbatim")
   ("q" "Quote" "quote")
   ("E" "Example" "example"))
 "Insert Block" "Block: ")

It's a bit ugly, but it works...




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-20 Thread Eric Abrahamsen
Rasmus  writes:

> Eric Abrahamsen  writes:
>
>> Eric Abrahamsen  writes:
>>
>>> Rasmus  writes:
>>>
 Kaushal Modi  writes:

> On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:
>
>> The only way it’s "bad" is in the sense it limits the flexibility of
>> snippets, like "> block
>> I can no longer have ">>
>>> I don't see any way around that. Any system that allows string keys of
>>> arbitrary length is going to run into that problem.
>>
>> One possible fix, a bit arbitrary: in the default value, provide 
>> as an artificial "stop key" in the sub-menus. So "s" starts the "source
>> code" sub-menu, and a  after that simply inserts "#+begin_src", and
>> leaves point after that.
>
> Yeah, I tried to suggest that earlier (unless I didn’t say it), but I
> might not have expressed the idea in an understandable manner :)

Maybe I missed it!

> I think that would be the best approach, but there’s no infrastructure
> that I know of that does this ATM (but I haven’t had a lot of time lately,
> so my knowledge on this issue is limited!).

Can't we do this with tempo? It will have to be "handmade", not
automatic, but:

'(("s" "Source Code")
  ("se" "Elisp" "src elisp")
  ("sp" "Python" "src python")
  ("TAB" "Empty" "src ")
  ...etc
  ("e" "Export Block")
  ("eh" "HTML" "export html")
  ("el" "LaTeX" "export latex")
  ("TAB" "Empty" "export ")
  ...etc
  ("v" "Verbatim" "verbatim")
  ("q" "Quote" "quote")
  ("E" "Example" "example")
  ...etc
  )




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-19 Thread Rasmus
Eric Abrahamsen  writes:

> Eric Abrahamsen  writes:
>
>> Rasmus  writes:
>>
>>> Kaushal Modi  writes:
>>>
 On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:

> The only way it’s "bad" is in the sense it limits the flexibility of
> snippets, like " I can no longer have ">
>> I don't see any way around that. Any system that allows string keys of
>> arbitrary length is going to run into that problem.
>
> One possible fix, a bit arbitrary: in the default value, provide 
> as an artificial "stop key" in the sub-menus. So "s" starts the "source
> code" sub-menu, and a  after that simply inserts "#+begin_src", and
> leaves point after that.

Yeah, I tried to suggest that earlier (unless I didn’t say it), but I
might not have expressed the idea in an understandable manner :)

I think that would be the best approach, but there’s no infrastructure
that I know of that does this ATM (but I haven’t had a lot of time lately,
so my knowledge on this issue is limited!).

Rasmus

-- 
9000!




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-18 Thread Eric Abrahamsen
Eric Abrahamsen  writes:

> Rasmus  writes:
>
>> Kaushal Modi  writes:
>>
>>> On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:
>>>
 The only way it’s "bad" is in the sense it limits the flexibility of
 snippets, like "
> I don't see any way around that. Any system that allows string keys of
> arbitrary length is going to run into that problem.

One possible fix, a bit arbitrary: in the default value, provide 
as an artificial "stop key" in the sub-menus. So "s" starts the "source
code" sub-menu, and a  after that simply inserts "#+begin_src", and
leaves point after that.




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-15 Thread Eric Abrahamsen
Rasmus  writes:

> Kaushal Modi  writes:
>
>> On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:
>>
>>> The only way it’s "bad" is in the sense it limits the flexibility of
>>> snippets, like ">> I can no longer have "> May be have "
> I wouldn’t really like that.
>
>> I missed this in the original conversation, but in the cases where plain
>> source/export blocks are inserted, does the point move to where the
>> language/backend needs to be typed?
>
> When using Org Tempo an extra space is always inserted.  It probably
> should only do it with blocks that support arguments, actually.  ATM I
> don’t think spaces are inserted when using
> ‘org-insert-structure-template’, but I they’ll probably be consistent
> eventually.

I think the idea was that for src and export blocks, where you're likely
to be adding additional parameters, point is moved to the end of the
#+begin line. Actually I think that's what happens now.




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-15 Thread Kaushal Modi
On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:

> The only way it’s "bad" is in the sense it limits the flexibility of
> snippets, like " I can no longer have "

Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-15 Thread Rasmus
Kaushal Modi  writes:

> On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:
>
>> The only way it’s "bad" is in the sense it limits the flexibility of
>> snippets, like "> I can no longer have "
>
> May be have " I missed this in the original conversation, but in the cases where plain
> source/export blocks are inserted, does the point move to where the
> language/backend needs to be typed?

When using Org Tempo an extra space is always inserted.  It probably
should only do it with blocks that support arguments, actually.  ATM I
don’t think spaces are inserted when using
‘org-insert-structure-template’, but I they’ll probably be consistent
eventually.

Rasmus

-- 
To err is human. To screw up 10⁶ times per second, you need a computer



Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-15 Thread Rasmus
Eric Abrahamsen  writes:

> That's not so bad, is it?

The only way it’s "bad" is in the sense it limits the flexibility of
snippets, like "

Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-14 Thread Eric Abrahamsen
Rasmus  writes:

> Eric Abrahamsen  writes:
>
>> Rasmus  writes:
>>
>>> Nicolas Goaziou  writes:
>>>
 Hello,

 Rasmus  writes:

> Nicolas, are there any public interfaces to make ox export like
> interfaces?

 No, there isn't. However, Org provides `org-mks'.
>>>
>>> Good point.  It isn’t quite as nice as the export dispatcher.  Let’s wait
>>> and see what Eric prefers.
>>
>> I don't have to own this! I don't have a strong feeling about it, and
>> left to my own devices would just keep the single-character keys.
>
> It’s pretty nice and quick with only one character.
>
>> But I see why people would want more/longer keys, and better
>> discoverability.
>
> Discoverability is nice to have, but it’s a secondary issue.
>
>
>> The main desires are:
>>
>> 1. String keys of arbitrary length.
>> 2. Discoverability: either a window of choices pops up automatically, or
>>you can do it with TAB, etc.
>> 3. Ideally, you don't have to hit an extra key to finish.
>>
>> Given that, it seems to me that `org-mks' is just fine. It doesn't do as
>> much as the export dispatcher, but I don't see that it needs to.
>
> It doesn’t seem to offer a way to distinguish between a single "a" and
> "ab".
>
> (org-mks '(("a" "a.. templates")
>("a" "export ascii" "")
>("ab" "abstract" "")
>("l" "latex" ""))
>  "Select a template"
>  "Template key: "
>  '(("q" "Abort")))
>
> Perhaps the best way would be to automatically reserve upper case letters
> for blocks with keys longer than one character, although that seems a bit
> arbitrary.
>
> (org-mks '(("A" "a.. templates")
>("a" "export ascii" "")
>("Ab" "abstract" "")
>("l" "latex" ""))
>  "Select a template"
>  "Template key: "
>  '(("q" "Abort")))

Right, you can't have a string act as both a "sub-menu dispatcher" and a
menu item at the same time.

I don't see that it's a big deal, though. For the default value, at
least, it's pretty clear how we would arrange the values: SRC and EXPORT
need sub-menus, and everything else doesn't. Ie:

'(("s" "Source Code")
  ("se" "Elisp" "src elisp")
  ("sp" "Python" "src python")
  ...etc
  ("e" "Export Block")
  ("eh" "HTML" "export html")
  ("el" "LaTeX" "export latex")
  ...etc
  ("v" "Verbatim" "verbatim")
  ("q" "Quote" "quote")
  ("E" "Example" "example")
  ...etc
  )

That's not so bad, is it?

Eric




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-14 Thread Rasmus
Eric Abrahamsen  writes:

> Rasmus  writes:
>
>> Nicolas Goaziou  writes:
>>
>>> Hello,
>>>
>>> Rasmus  writes:
>>>
 Nicolas, are there any public interfaces to make ox export like
 interfaces?
>>>
>>> No, there isn't. However, Org provides `org-mks'.
>>
>> Good point.  It isn’t quite as nice as the export dispatcher.  Let’s wait
>> and see what Eric prefers.
>
> I don't have to own this! I don't have a strong feeling about it, and
> left to my own devices would just keep the single-character keys.

It’s pretty nice and quick with only one character.

> But I see why people would want more/longer keys, and better
> discoverability.

Discoverability is nice to have, but it’s a secondary issue.


> The main desires are:
>
> 1. String keys of arbitrary length.
> 2. Discoverability: either a window of choices pops up automatically, or
>you can do it with TAB, etc.
> 3. Ideally, you don't have to hit an extra key to finish.
>
> Given that, it seems to me that `org-mks' is just fine. It doesn't do as
> much as the export dispatcher, but I don't see that it needs to.

It doesn’t seem to offer a way to distinguish between a single "a" and
"ab".

(org-mks '(("a" "a.. templates")
   ("a" "export ascii" "")
   ("ab" "abstract" "")
   ("l" "latex" ""))
 "Select a template"
 "Template key: "
 '(("q" "Abort")))

Perhaps the best way would be to automatically reserve upper case letters
for blocks with keys longer than one character, although that seems a bit
arbitrary.

(org-mks '(("A" "a.. templates")
   ("a" "export ascii" "")
   ("Ab" "abstract" "")
   ("l" "latex" ""))
 "Select a template"
 "Template key: "
 '(("q" "Abort")))

Rasmus

-- 
And I faced endless streams of vendor-approved Ikea furniture. . .




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-12 Thread Eric Abrahamsen
Rasmus  writes:

> Nicolas Goaziou  writes:
>
>> Hello,
>>
>> Rasmus  writes:
>>
>>> Nicolas, are there any public interfaces to make ox export like
>>> interfaces?
>>
>> No, there isn't. However, Org provides `org-mks'.
>
> Good point.  It isn’t quite as nice as the export dispatcher.  Let’s wait
> and see what Eric prefers.

I don't have to own this! I don't have a strong feeling about it, and
left to my own devices would just keep the single-character keys. But I
see why people would want more/longer keys, and better discoverability.

The main desires are:

1. String keys of arbitrary length.
2. Discoverability: either a window of choices pops up automatically, or
   you can do it with TAB, etc.
3. Ideally, you don't have to hit an extra key to finish.

Given that, it seems to me that `org-mks' is just fine. It doesn't do as
much as the export dispatcher, but I don't see that it needs to.

The only downside is that it might make the choices a bit harder to
customize, as the table argument is more fiddly. But maybe not a big
deal.

Eric




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-12 Thread Rasmus
Nicolas Goaziou  writes:

> Hello,
>
> Rasmus  writes:
>
>> Nicolas, are there any public interfaces to make ox export like
>> interfaces?
>
> No, there isn't. However, Org provides `org-mks'.

Good point.  It isn’t quite as nice as the export dispatcher.  Let’s wait
and see what Eric prefers.

Rasmus

-- 
Send from my Emacs



Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-11 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> Nicolas, are there any public interfaces to make ox export like
> interfaces?

No, there isn't. However, Org provides `org-mks'.

Regards,

-- 
Nicolas Goaziou



Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-11 Thread Rasmus
Hi,

>> Let me know when you want me to do the change to strings.
>
> No time like the present! I don't think there's anything else remaining
> to be done.

One stumbling block is how to input key strings to
org-insert-structure-template.  Currently, it employs read-key which is
really fast.  The other easy alternative is completing-read with the keys.
However, there you’d have to click RET at the end.  The ideal interface
for inputting the keys is something like the ox expert export UI.  I
looked at the code and it seems a bit complex.

Nicolas, are there any public interfaces to make ox export like
interfaces?

Rasmus

-- 
m-mm-mmm- bacon!




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-10 Thread Eric Abrahamsen
Rasmus  writes:

> Eric Abrahamsen  writes:
>
>> Hello all,
>>
>> Rasmus' org-tempo patch has landed, and it's time to make a few
>> adjustments to org-insert-structure-template: I think we're moving to
>> string keys in the template alist, rather than character keys,
>
> Let me know when you want me to do the change to strings.

No time like the present! I don't think there's anything else remaining
to be done.

>> and also
>> some people noted that the keybinding "C-c C-x w" is too close to "C-c
>> C-x C-w", which kills a whole subtree. Not a good command to run
>> accidentally!
>
> Two other things that might be nice to changer are
>
> - Perhaps there could be a space after at least "#+begin_src" so that
>   it’s ready to insert :keys.
> - Perhaps there could be a newline between "#+begin_x" and "#+end_x".
>
> These things might already have been discussed in which case I missed
> them.

The first was mentioned, not the second; I think they're both good
ideas. There's a clause in o-i-s-t that puts point at the begin line for
certain structure types, that would be a fine spot to insert a space.

>> Given that the template system has been re-instated, are there any good
>> suggestions out there for a new keybinding for
>> `org-insert-structure-template'? This is the command that wraps existing
>> text in blocks.
>
> These aren’t too bad to typo on my keyboard: C-c C-. or C-c C-,

I like either of these...




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-10 Thread Rasmus
Eric Abrahamsen  writes:

> Hello all,
>
> Rasmus' org-tempo patch has landed, and it's time to make a few
> adjustments to org-insert-structure-template: I think we're moving to
> string keys in the template alist, rather than character keys,

Let me know when you want me to do the change to strings.

> and also
> some people noted that the keybinding "C-c C-x w" is too close to "C-c
> C-x C-w", which kills a whole subtree. Not a good command to run
> accidentally!

Two other things that might be nice to changer are

- Perhaps there could be a space after at least "#+begin_src" so that
  it’s ready to insert :keys.
- Perhaps there could be a newline between "#+begin_x" and "#+end_x".

These things might already have been discussed in which case I missed
them.

> Given that the template system has been re-instated, are there any good
> suggestions out there for a new keybinding for
> `org-insert-structure-template'? This is the command that wraps existing
> text in blocks.

These aren’t too bad to typo on my keyboard: C-c C-. or C-c C-,

C-c C-x s might make sense.  It’s OKish to type on my keyboard layout, but
no harder than C-c C-x C-w.

free-keys.el can be used to identify combinations, although it isn’t
bullet-proof.

Rasmus

-- 
However beautiful the theory, one should occasionally look at the evidence




[O] Poll: new keybinding for org-insert-structure-template?

2017-12-09 Thread Eric Abrahamsen
Hello all,

Rasmus' org-tempo patch has landed, and it's time to make a few
adjustments to org-insert-structure-template: I think we're moving to
string keys in the template alist, rather than character keys, and also
some people noted that the keybinding "C-c C-x w" is too close to "C-c
C-x C-w", which kills a whole subtree. Not a good command to run
accidentally!

Given that the template system has been re-instated, are there any good
suggestions out there for a new keybinding for
`org-insert-structure-template'? This is the command that wraps existing
text in blocks.

Thanks,
Eric