emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Rasmus
Subject: Re: [O] Poll: new keybinding for org-insert-structure-template?
Date: Thu, 21 Dec 2017 10:16:48 +0100
User-agent: Emacs Gnus

Eric Abrahamsen <address@hidden> writes:

> Eric Abrahamsen <address@hidden> writes:
>
>> Rasmus <address@hidden> writes:
>>
>>> Eric Abrahamsen <address@hidden> writes:
>>>
>>>> Eric Abrahamsen <address@hidden> writes:
>>>>
>>>>> Rasmus <address@hidden> writes:
>>>>>
>>>>>> Kaushal Modi <address@hidden> writes:
>>>>>>
>>>>>>> On Fri, Dec 15, 2017 at 6:23 AM Rasmus <address@hidden> wrote:
>>>>>>>
>>>>>>>> The only way it’s "bad" is in the sense it limits the flexibility of
>>>>>>>> snippets, like "<s".  As you point out, if I add "<sr" as an "src R" 
>>>>>>>> block
>>>>>>>> I can no longer have "<s" as plain "src" block.
>>>>>
>>>>> 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 <TAB>
>>>> as an artificial "stop key" in the sub-menus. So "s" starts the "source
>>>> code" sub-menu, and a <TAB> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]