Re: org-insert-structure-template

2022-12-29 Thread Ihor Radchenko
Ihor Radchenko  writes:

> C-c C-x , is actually not available (it is bound to timer).
> I went with C-c C-x s.
>
> See the attached patch.

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5bc5add32

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: org-insert-structure-template

2022-12-13 Thread Ihor Radchenko
Anthony Carrico  writes:

>> The general pattern is C-c C-x . Maybe we can add "C-c C-x ,"?
>
> Thanks, that is probably a good pattern to use. I'll look into 
> org-use-extra-keys. This is the only keybinding that regularly bites me 
> on the TTY.

C-c C-x , is actually not available (it is bound to timer).
I went with C-c C-x s.

See the attached patch.

>From 2646a3279689cd9afdf4b5b0e44d29c1fca38d84 Mon Sep 17 00:00:00 2001
Message-Id: <2646a3279689cd9afdf4b5b0e44d29c1fca38d84.1670924473.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Tue, 13 Dec 2022 12:30:36 +0300
Subject: [PATCH] lisp/org-keys.el: Provide terminal binding for
 `org-insert-structure-template'

* lisp/org-keys.el (or): Add alternative terminal binding for
`org-insert-structure-template'.  The default binding may not be
available in some terminals.

* doc/org-manual.org (Using Org on a TTY): List the new binding in the
manual.

Reported-by: Anthony Carrico 
Link: https://orgmode.org/list/d9222967-5747-bf54-8041-4a8453fe8...@memebeam.org
---
 doc/org-manual.org | 1 +
 lisp/org-keys.el   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 0680fb593..1431f8546 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -20481,6 +20481,7 @@ ** Using Org on a TTY
 | {{{kbd(S-DOWN)}}}| {{{kbd(C-c DOWN)}}}  |  |  |
 | {{{kbd(C-S-LEFT)}}}  | {{{kbd(C-c C-x LEFT)}}}  |  |  |
 | {{{kbd(C-S-RIGHT)}}} | {{{kbd(C-c C-x RIGHT)}}} |  |  |
+| {{{kbd(C-c C-\,)}}}  | {{{kbd(C-c C-x s)}}} |  |  |
 
 ** Protocols for External Access
 :PROPERTIES:
diff --git a/lisp/org-keys.el b/lisp/org-keys.el
index 95f64a3f9..7c6e38e64 100644
--- a/lisp/org-keys.el
+++ b/lisp/org-keys.el
@@ -503,6 +503,7 @@ (when (or org-use-extra-keys (not (display-graphic-p)))
   (org-defkey org-mode-map (kbd "C-c C-x c") #'org-table-copy-down)
   (org-defkey org-mode-map (kbd "C-c C-x m") #'org-meta-return)
   (org-defkey org-mode-map (kbd "C-c C-x M") #'org-insert-todo-heading)
+  (org-defkey org-mode-map (kbd "C-c C-x s") #'org-insert-structure-template)
   (org-defkey org-mode-map (kbd "C-c C-x RET") #'org-meta-return)
   (org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
   (org-defkey org-mode-map (kbd "ESC ") #'org-metaleft)
-- 
2.38.1



-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


Re: org-insert-structure-template

2022-12-12 Thread Tim Cross


Anthony Carrico  writes:

> I'm trying to remember what the old keybinding was before it got switched to 
> 'C-c C-,'...

IIRC there wasn't one.


Previously, a completely different system was used for adding these
templates and it was bound to  <  (or was it >, I cannot remember).

The problem was that the old 'template' system was not terribly
flexible/powerful. For example, you could not mark a region, call tte
template function and have it wrap the template around the marked
region. 



Re: org-insert-structure-template

2022-12-12 Thread Alain . Cochard
Anthony Carrico writes on Mon 12 Dec 2022 09:41:
 > On 12/12/22 09:20, alain.coch...@unistra.fr wrote:
 > > Perhaps you have in min >
 > >'<', followed by a template selector and '
 > 
 > Yes!
 
 > Was this deprecated because it isn't a regular emacs keybinding?

I don't remember.  It was debated in the past.  Hopefully someone else
can summarize it.  Otherwise, perhaps start with:

https://list.orgmode.org/87lgd671k7@bzg.fr/


-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France | [ slot available for rent ]




Re: org-insert-structure-template

2022-12-12 Thread Anthony Carrico

On 12/12/22 09:20, alain.coch...@unistra.fr wrote:

Perhaps you have in min >
   '<', followed by a template selector and '


Yes! I didn't realize that could be enabled. I trained myself not to 
rely on this when the new keybinding came. Only recently did I realize 
the reason the new keybinding is sometimes unreliable is the limited 
ASCII control keys on the TTY.


Thanks!

Was this deprecated because it isn't a regular emacs keybinding?

--
Anthony Carrico



Re: org-insert-structure-template

2022-12-12 Thread Anthony Carrico

On 12/12/22 09:04, Ihor Radchenko wrote:

Note that we have alternative key bindings for TTY. See
`org-use-extra-keys'.

The general pattern is C-c C-x . Maybe we can add "C-c C-x ,"?


Thanks, that is probably a good pattern to use. I'll look into 
org-use-extra-keys. This is the only keybinding that regularly bites me 
on the TTY.


--
Anthony Carrico



Re: org-insert-structure-template

2022-12-12 Thread Alain . Cochard
Anthony Carrico writes on Mon 12 Dec 2022 08:50:

 > I'm trying to remember what the old keybinding was before it got
 > switched to 'C-c C-,'...

Perhaps you have in mind

  '<', followed by a template selector and '

?

See 17.2 Structure Templates:

   For example, ‘< s ’ creates a code block.  Enable it by
   customizing ‘org-modules’ or add ‘(require 'org-tempo)’ to your
   Emacs init file

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France | [ slot available for rent ]




Re: org-insert-structure-template

2022-12-12 Thread Ihor Radchenko
Anthony Carrico  writes:

> I use this command all the time because the literal syntax is so heavy. 
> The problem is that the current keybinding is not available on the TTY, 
> and every time I use it there I get org-priority which is bound to 'C-c 
> ,'. Does anyone else find this frustrating? Which keybinding do you use 
> for org-insert-structure-template? I don't think I've ever used 
> org-priority, so I'll probably just rebind 'C-c ,' to fix the problem.

Note that we have alternative key bindings for TTY. See
`org-use-extra-keys'.

The general pattern is C-c C-x . Maybe we can add "C-c C-x ,"?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



Re: org-insert-structure-template

2022-12-12 Thread Anthony Carrico
I'm trying to remember what the old keybinding was before it got 
switched to 'C-c C-,'...


--
Anthony Carrico



org-insert-structure-template

2022-12-12 Thread Anthony Carrico
I use this command all the time because the literal syntax is so heavy. 
The problem is that the current keybinding is not available on the TTY, 
and every time I use it there I get org-priority which is bound to 'C-c 
,'. Does anyone else find this frustrating? Which keybinding do you use 
for org-insert-structure-template? I don't think I've ever used 
org-priority, so I'll probably just rebind 'C-c ,' to fix the problem.


‘C-c C-,’ (‘org-insert-structure-template’)
 Prompt for a type of block structure, and insert the block at
 point.  If the region is active, it is wrapped in the block.  First
 prompts the user for keys, which are used to look up a structure
 type from the variable below.  If the key is ‘’, ‘’, or
 ‘’, the user is prompted to enter a block type.

--
Anthony Carrico



Re: [PATCH] Re: [BUG] Hard-coded begin/end in org-insert-structure-template [9.5.2 (release_9.5.2-24-g668205 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]

2022-06-17 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
> I patched a local checkout of the main branch, and I can confirm that
> your works well here.  I also added [1] to my configuration file to
> upcase all the structure templates automatically.  I hope we will have
> this bundled with Org proper.  Fantastic work!

Applied onto main via 9632401dc also adding NEWS entry.

Best,
Ihor



Re: [PATCH] Re: [BUG] Hard-coded begin/end in org-insert-structure-template [9.5.2 (release_9.5.2-24-g668205 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]

2022-03-24 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

I patched a local checkout of the main branch, and I can confirm that
your works well here.  I also added [1] to my configuration file to
upcase all the structure templates automatically.  I hope we will have
this bundled with Org proper.  Fantastic work!

[1] Code that upcases the structure templates:

(setq org-structure-template-alist
  (mapcar
   (lambda (pair)
 (cons (car pair)
   (upcase (cdr pair
   org-structure-template-alist))

Rudy
-- 
"Strange as it may sound, the power of mathematics rests on its evasion
of all unnecessary thought and on its wonderful saving of mental
operations."
-- Ernst Mach, 1838-1916

Rudolf Adamkovic  [he/him]
Studenohorska 25
84103 Bratislava
Slovakia



Re: [PATCH] Re: [BUG] Hard-coded begin/end in org-insert-structure-template [9.5.2 (release_9.5.2-24-g668205 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]

2022-03-23 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

>> +with \"#+begin_\" and \"#+end_\" added automatically.  If the block
>> +type is written using upper case letter, \"#+BEGIN_\" and \"#+END_\"
>> +are added instead.
>
> FYI: A typo in "letter" (expected "letters")
>
> (We could also simplify to: "if the block type consists of just
> uppercase letter".)
>
>> +  (let* ((case-fold-search t) ; Make sure that matches are case-insnsitive.
>> + (region? (use-region-p))
>
> FYI: A typo in "case-insnsitive" (expected "case-insensitive")

Thanks for proofreading! Attaching the fixed version of the patch.

Best,
Ihor

>From b39925decd0e5ee5a0ce88b3fcea3a9647d35001 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Sun, 20 Mar 2022 20:15:21 +0800
Subject: [PATCH] Auto-Upcase/downcase #+begin/#+end in structure templates

* lisp/org-tempo.el (org-tempo-add-block):
* lisp/org.el (org-insert-structure-template): When inserting
 #+begin_type/#+end_type, follow type's case.  TYPE will become
 #+BEGIN_TYPE and type will become #+bein_type.

(org-insert-structure-template): Make sure that we use
case-insensitive match even when user changes case-fold-search value.

(org-structure-template-alist): Clarify selection of #+BEGIN/END
vs. #+begin/end in the docstring.
---
 lisp/org-tempo.el | 13 ++---
 lisp/org.el   | 23 +++
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/lisp/org-tempo.el b/lisp/org-tempo.el
index b34007bf7..cd5ef9e8e 100644
--- a/lisp/org-tempo.el
+++ b/lisp/org-tempo.el
@@ -119,11 +119,18 @@ (defun org-tempo-add-block (entry)
   "Add block entry from `org-structure-template-alist'."
   (let* ((key (format "<%s" (car entry)))
 	 (name (cdr entry))
-	 (special (member name '("src" "export"
+	 (special (member name '("src" "export")))
+ (upcase? (string= (car (split-string name))
+   (upcase (car (split-string name))
 (tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" name))
-			   `(,(format "#+begin_%s%s" name (if special " " ""))
+			   `(,(format "#+%s_%s%s"
+  (if upcase? "BEGIN" "begin")
+  name
+  (if special " " ""))
 			 ,(when special 'p) '> n ,(unless special 'p) n
-			 ,(format "#+end_%s" (car (split-string name " ")))
+			 ,(format "#+%s_%s"
+  (if upcase? "END" "end")
+      (car (split-string name " ")))
 			 >)
 			   key
 			   (format "Insert a %s block" name)
diff --git a/lisp/org.el b/lisp/org.el
index 9455c15c8..529146097 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9490,9 +9490,11 @@ (defcustom org-structure-template-alist
 ("s" . "src")
 ("v" . "verse"))
   "An alist of keys and block types.
-`org-insert-structure-template' will display a menu with this
-list of templates to choose from.  The block type is inserted,
-with \"#+BEGIN_\" and \"#+END_\" added automatically.
+`org-insert-structure-template' will display a menu with this list of
+templates to choose from.  The block type is inserted, with
+\"#+begin_\" and \"#+end_\" added automatically.  If the block type
+consists of just uppercase letters, \"#+BEGIN_\" and \"#+END_\" are
+added instead.
 
 The menu keys are defined by the car of each entry in this alist.
 If two entries have the keys \"a\" and \"aa\" respectively, the
@@ -9624,18 +9626,23 @@ (defun org-insert-structure-template (type)
 Select a block from `org-structure-template-alist' then type
 either RET, TAB or SPC to write the block type.  With an active
 region, wrap the region in the block.  Otherwise, insert an empty
-block."
+block.
+
+When foo is written as FOO, upcase the #+BEGIN/END as well."
   (interactive
(list (pcase (org--insert-structure-template-mks)
 	   (`("\t" . ,_) (read-string "Structure type: "))
 	   (`(,_ ,choice . ,_) choice
-  (let* ((region? (use-region-p))
+  (let* ((case-fold-search t) ; Make sure that matches are case-insensitive.
+ (region? (use-region-p))
 	 (region-start (and region? (region-beginning)))
 	 (region-end (and region? (copy-marker (region-end
 	 (extended? (string-match-p "\\`\\(src\\|export\\)\\'" type))
 	 (verbatim? (string-match-p
 		 (concat "\\`" (regexp-opt &

Re: [PATCH] Re: [BUG] Hard-coded begin/end in org-insert-structure-template [9.5.2 (release_9.5.2-24-g668205 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]

2022-03-22 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> We can auto-magically determine whether to use BEGIN_ or begin_
> depending on the case in template type. Tentative patch attached.

Interesting!

> +with \"#+begin_\" and \"#+end_\" added automatically.  If the block
> +type is written using upper case letter, \"#+BEGIN_\" and \"#+END_\"
> +are added instead.

FYI: A typo in "letter" (expected "letters")

(We could also simplify to: "if the block type consists of just
uppercase letter".)

> +  (let* ((case-fold-search t) ; Make sure that matches are case-insnsitive.
> + (region? (use-region-p))

FYI: A typo in "case-insnsitive" (expected "case-insensitive")

Looking forward to seeing this merged!

Rudy
-- 
"I love deadlines.  I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt, 2002

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



[PATCH] Re: [BUG] Hard-coded begin/end in org-insert-structure-template [9.5.2 (release_9.5.2-24-g668205 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]

2022-03-20 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Inspired by Protesilaos Stavrou, I started using uppercase Org keywords.
> I like the results so far, but I also noticed some inflexibility in the
> Org mode.  Specifically, the `org-insert-structure-template' procedure
> hard-codes lowercase "begin_" and "end_".  Thus, even if one customizes
> the `org-structure-template-alist' with uppercase keywords, Org still
> inserts them as "begin_SRC".  Given that Org lets the user pick their
> preferred style, I consider this a bug.

I would not call it a bug, but the situation can certainly be improved.

We can auto-magically determine whether to use BEGIN_ or begin_
depending on the case in template type. Tentative patch attached.

Best,
Ihor

>From bdf8340ab8b41f0c9f26f5b0bdadbf079b8f6d66 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Sun, 20 Mar 2022 20:15:21 +0800
Subject: [PATCH] Auto-Upcase/downcase #+begin/#+end in structure templates

* lisp/org-tempo.el (org-tempo-add-block):
* lisp/org.el (org-insert-structure-template): When inserting
 #+begin_type/#+end_type, follow type's case.  TYPE will become
 #+BEGIN_TYPE and type will become #+bein_type.

(org-insert-structure-template): Make sure that we use
case-insensitive match even when user changes case-fold-search value.

(org-structure-template-alist): Clarify selection of #+BEGIN/END
vs. #+begin/end in the docstring.
---
 lisp/org-tempo.el | 13 ++---
 lisp/org.el   | 19 +--
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/lisp/org-tempo.el b/lisp/org-tempo.el
index b34007bf7..cd5ef9e8e 100644
--- a/lisp/org-tempo.el
+++ b/lisp/org-tempo.el
@@ -119,11 +119,18 @@ (defun org-tempo-add-block (entry)
   "Add block entry from `org-structure-template-alist'."
   (let* ((key (format "<%s" (car entry)))
 	 (name (cdr entry))
-	 (special (member name '("src" "export"
+	 (special (member name '("src" "export")))
+ (upcase? (string= (car (split-string name))
+   (upcase (car (split-string name))
 (tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" name))
-			   `(,(format "#+begin_%s%s" name (if special " " ""))
+			   `(,(format "#+%s_%s%s"
+  (if upcase? "BEGIN" "begin")
+  name
+  (if special " " ""))
 			 ,(when special 'p) '> n ,(unless special 'p) n
-			 ,(format "#+end_%s" (car (split-string name " ")))
+			 ,(format "#+%s_%s"
+  (if upcase? "END" "end")
+          (car (split-string name " ")))
 			 >)
 			   key
 			   (format "Insert a %s block" name)
diff --git a/lisp/org.el b/lisp/org.el
index 9455c15c8..26617d7c8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9492,7 +9492,9 @@ (defcustom org-structure-template-alist
   "An alist of keys and block types.
 `org-insert-structure-template' will display a menu with this
 list of templates to choose from.  The block type is inserted,
-with \"#+BEGIN_\" and \"#+END_\" added automatically.
+with \"#+begin_\" and \"#+end_\" added automatically.  If the block
+type is written using upper case letter, \"#+BEGIN_\" and \"#+END_\"
+are added instead.
 
 The menu keys are defined by the car of each entry in this alist.
 If two entries have the keys \"a\" and \"aa\" respectively, the
@@ -9624,18 +9626,23 @@ (defun org-insert-structure-template (type)
 Select a block from `org-structure-template-alist' then type
 either RET, TAB or SPC to write the block type.  With an active
 region, wrap the region in the block.  Otherwise, insert an empty
-block."
+block.
+
+When foo is written as FOO, upcase the #+BEGIN/END as well."
   (interactive
(list (pcase (org--insert-structure-template-mks)
 	   (`("\t" . ,_) (read-string "Structure type: "))
 	   (`(,_ ,choice . ,_) choice
-  (let* ((region? (use-region-p))
+  (let* ((case-fold-search t) ; Make sure that matches are case-insnsitive.
+ (region? (use-region-p))
 	 (region-start (and region? (region-beginning)))
 	 (region-end (and region? (copy-marker (region-end
 	 (extended? (string-match-p "\\`\\(src\\|export\\)\\'" type))
 	 (verbatim? (string-match-p
 		 (concat "\\`" (regexp-opt '("example" "export" "src")))
-		 type)))
+		 type))
+ (upcase? (string= (car (split-string type))
+   (upcas

[BUG] Hard-coded begin/end in org-insert-structure-template [9.5.2 (release_9.5.2-24-g668205 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]

2022-03-20 Thread Rudolf Adamkovič



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.

Hello smart people!

Inspired by Protesilaos Stavrou, I started using uppercase Org keywords.
I like the results so far, but I also noticed some inflexibility in the
Org mode.  Specifically, the `org-insert-structure-template' procedure
hard-codes lowercase "begin_" and "end_".  Thus, even if one customizes
the `org-structure-template-alist' with uppercase keywords, Org still
inserts them as "begin_SRC".  Given that Org lets the user pick their
preferred style, I consider this a bug.

Rudy

Emacs  : GNU Emacs 29.0.50 (build 14, x86_64-apple-darwin21.2.0, NS 
appkit-2113.20 Version 12.1 (Build 21C52))
 of 2022-03-15
Package: Org mode version 9.5.2 (release_9.5.2-24-g668205 @ 
/Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)
-- 
"Thinking is a momentary dismissal of irrelevancies."
-- Richard Buckminster Fuller, 1969

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: what happened to org-insert-structure-template

2021-01-27 Thread Diego Zamboni
Also works for me, Org version 9.5.

Could it be that just the keybinding got un/redefined somehow? Have you
tried running M-x org-insert-structure-template?

--Diego

On Wed, Jan 27, 2021 at 10:45 PM  wrote:

> On Wed, Jan 27, 2021 at 09:29:14PM +, JRSS wrote:
> > Hi,
> >
> > This has been missing for a while for me and I recently checked the
> manual. It seems like org-insert-structure-template doesn't exist. I tried
> Emacs -q, same thing. I also loaded org-tempo, thought it has something to
> do with it, but nothing.
>
> Hm. Works for me (Org 9.4.4).
>
> > How do I activate is so that C-c C-, works?
>
> Strange. C-h f org-insert-structure-template turns up empty?
>
> Cheers
>  - t
>


Re: what happened to org-insert-structure-template

2021-01-27 Thread tomas
On Wed, Jan 27, 2021 at 09:29:14PM +, JRSS wrote:
> Hi,
> 
> This has been missing for a while for me and I recently checked the manual. 
> It seems like org-insert-structure-template doesn't exist. I tried Emacs -q, 
> same thing. I also loaded org-tempo, thought it has something to do with it, 
> but nothing.

Hm. Works for me (Org 9.4.4).

> How do I activate is so that C-c C-, works?

Strange. C-h f org-insert-structure-template turns up empty?

Cheers
 - t


signature.asc
Description: Digital signature


what happened to org-insert-structure-template

2021-01-27 Thread JRSS
Hi,

This has been missing for a while for me and I recently checked the manual. It 
seems like org-insert-structure-template doesn't exist. I tried Emacs -q, same 
thing. I also loaded org-tempo, thought it has something to do with it, but 
nothing.

How do I activate is so that C-c C-, works?

Re: Wring case when using org-insert-structure-template

2020-07-10 Thread Nick Dokos
Nicolas Goaziou  writes:

>> Second question: I couldn't find any configuration variable or
>> function to change the default behaviour. Is there a way to do so?
>
> You can customize `org-structure-template-alist'. I don't remember if
> that's possible in Org 9.1.9, tho.
>
But you cannot change the case of the begin/end that way, so it would be entered
in mixed case:

#+begin_SRC ...
..
#+end_SRC

(I think - but I have not tested.)
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Wring case when using org-insert-structure-template

2020-07-09 Thread tomas
On Wed, Jul 08, 2020 at 03:04:38PM +0200, Guillaume MULLER wrote:
> Hi,
> 
> Thanks for Org-mode. This is really THE software I needed! I LOVE everything 
> about it! This is the only piece of software I know of that really designed 
> by users for users, with users & efficiency in mind!
> 
> I'm using GNU Emacs 26.3, with built-in org 9.1.9.
> 
> When I try to automatically insert Structure Templates (e.g. by typing C-c 
> C-, s), I get everything inserted in lowercase (e.g. #+begin_src).
> 
> In ALL the documentation pages I read, the snippets are written in uppercase 
> (i.e. #+BEGIN_SRC, like in the main documentation for this feature: 
> https://orgmode.org/org.html#Structure-Templates). I would myself prefer to 
> have the templates inserted in uppercase, as it allows to clearly & visually 
> differentiate between my main document text and the specific instructions for 
> Org.
> 
> First question: why isn't the default as in the docs?

I think the default moved slowly to lower case. The docs
have stayed as-is. Guessing by the mailing lists, this does
confuse people from time to time.

> Second question: I couldn't find any configuration variable or function to 
> change the default behaviour. Is there a way to do so?

See the (customizable) variable `org-structure-template-alist'.

Cheers
-- t


signature.asc
Description: Digital signature


Re: Wring case when using org-insert-structure-template

2020-07-09 Thread Nicolas Goaziou
Hello,

Guillaume MULLER  writes:

> In ALL the documentation pages I read, the snippets are written in
> uppercase (i.e. #+BEGIN_SRC, like in the main documentation for this
> feature: https://orgmode.org/org.html#Structure-Templates). I would
> myself prefer to have the templates inserted in uppercase, as it
> allows to clearly & visually differentiate between my main document
> text and the specific instructions for Org.
>
> First question: why isn't the default as in the docs?

Because it is ugly for the majority of expressed opinion, and
fontification is a more appropriate way to distinguish between contents
and syntax.

The reason why the manual still uses uppercase is explained at (info
"(org) Conventions").

> Second question: I couldn't find any configuration variable or
> function to change the default behaviour. Is there a way to do so?

You can customize `org-structure-template-alist'. I don't remember if
that's possible in Org 9.1.9, tho.

Regards,
-- 
Nicolas Goaziou



Wring case when using org-insert-structure-template

2020-07-08 Thread Guillaume MULLER
Hi,

Thanks for Org-mode. This is really THE software I needed! I LOVE everything 
about it! This is the only piece of software I know of that really designed by 
users for users, with users & efficiency in mind!

I'm using GNU Emacs 26.3, with built-in org 9.1.9.

When I try to automatically insert Structure Templates (e.g. by typing C-c C-, 
s), I get everything inserted in lowercase (e.g. #+begin_src).

In ALL the documentation pages I read, the snippets are written in uppercase 
(i.e. #+BEGIN_SRC, like in the main documentation for this feature: 
https://orgmode.org/org.html#Structure-Templates). I would myself prefer to 
have the templates inserted in uppercase, as it allows to clearly & visually 
differentiate between my main document text and the specific instructions for 
Org.

First question: why isn't the default as in the docs?

Second question: I couldn't find any configuration variable or function to 
change the default behaviour. Is there a way to do so?

Thanks!

-- 
Guillaume MULLER
Data Scientist, PhD
Télécom Saint-Étienne (office i119)
25 rue du Dr Remy Annino
-
Laboratoire Hubert Curien (office e002)
18 rue du Pr Benoît Lauras
-
42000 Saint-Étienne
FRANCE
Mobile : +33 (0)6 51 22 33 49



signature.asc
Description: OpenPGP digital signature


Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Nicolas Goaziou
Hello,

Allen Li  writes:

> That's very interesting.  Perhaps this is too invasive, but maybe C-c
> C-, should do C-c ' automatically?

No, it shouldn't. You can also create non-verbatim blocks, e.g. "center"
with C-c C-,. There C-c ' doesn't do anything useful.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Allen Li
On Tue, Oct 2, 2018 at 2:14 PM Bernt Hansen  wrote:
>
> Nicolas Goaziou  writes:
>
> > Hello,
> >
> > Allen Li  writes:
> >
> >> org-insert-structure-template (C-c C-,) leaves point at an inconvenient
> >> place (X marks the spot):
> >>
> >> #+begin_example
> >> X#+end_example
> >>
> >> My expectation is that right after inserting the template, I can start
> >> typing or yank right into it:
> >>
> >> #+begin_example
> >> X
> >> #+end_example
> >
> > Use `C-o'.
> >
> > I think the current behaviour is better because you can yank text within
> > the newly created block without dealing with a blank line later on.
>
> I also prefer the current behaviour.
>
> I regularly use C-c C-, e C-c ' C-y C-c '
>
> to create and populate my example blocks.  This handles the newline
> correctly and does not break the syntax.  This also has the benefit of
> properly escaping text that interferes with org's syntax.

That's very interesting.  Perhaps this is too invasive, but maybe C-c
C-, should do C-c ' automatically?

Since the user almost certainly wants to populate the block
immediately, this saves the user a step,
and also handles characters to escape and a missing final newline correctly.

>
> When you have text in the kill buffer that looks like org headlines it
> pastes outside the example block -- which is proper behaviour when
> moving headlines around.
>
> try this:
>
> C-c C-, e C-y
> with the following your yank buffer
>
> 
> *** one
> some text
> *** two
> more text
> 
>
> You can't paste that inside
>
> #begin_example
> #end_example
>
> or
>
> #begin_example
>
> #end_example
>
> Regards,
> Bernt



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Bernt Hansen
Nicolas Goaziou  writes:

> Hello,
>
> Allen Li  writes:
>
>> org-insert-structure-template (C-c C-,) leaves point at an inconvenient
>> place (X marks the spot):
>>
>> #+begin_example
>> X#+end_example
>>
>> My expectation is that right after inserting the template, I can start
>> typing or yank right into it:
>>
>> #+begin_example
>> X
>> #+end_example
>
> Use `C-o'.
>
> I think the current behaviour is better because you can yank text within
> the newly created block without dealing with a blank line later on.

I also prefer the current behaviour.

I regularly use C-c C-, e C-c ' C-y C-c '

to create and populate my example blocks.  This handles the newline
correctly and does not break the syntax.  This also has the benefit of
properly escaping text that interferes with org's syntax.

When you have text in the kill buffer that looks like org headlines it
pastes outside the example block -- which is proper behaviour when
moving headlines around.

try this:

C-c C-, e C-y
with the following your yank buffer


*** one
some text
*** two
more text


You can't paste that inside

#begin_example
#end_example

or

#begin_example

#end_example

Regards,
Bernt



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Allen Li
On Tue, Oct 2, 2018 at 8:06 AM Nicolas Goaziou  wrote:
>
> Hello,
>
> Allen Li  writes:
>
> > org-insert-structure-template (C-c C-,) leaves point at an inconvenient
> > place (X marks the spot):
> >
> > #+begin_example
> > X#+end_example
> >
> > My expectation is that right after inserting the template, I can start
> > typing or yank right into it:
> >
> > #+begin_example
> > X
> > #+end_example
>
> Use `C-o'.
>
> I think the current behaviour is better because you can yank text within
> the newly created block without dealing with a blank line later on.

But it works less well when you yank text that doesn't have a trailing newline.

Either you need to press C-o in one case, or DEL/backspace in the
other (to get rid of the extra blank line).

I guess I don't have a huge preference, but the current behavior is
annoying because it's the opposite of the old template behavior (e.g.
< s TAB).

One advantage that I can think of is that an extra newline is an
annoyance but otherwise harmless, whereas missing a newline messes up
the syntax.

#+begin_example
yanked text

#+end_example

#+begin_example
yanked text#+end_example

>
> Regards,
>
> --
> Nicolas Goaziou



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Nicolas Goaziou
Hello,

Allen Li  writes:

> org-insert-structure-template (C-c C-,) leaves point at an inconvenient
> place (X marks the spot):
>
> #+begin_example
> X#+end_example
>
> My expectation is that right after inserting the template, I can start
> typing or yank right into it:
>
> #+begin_example
> X
> #+end_example

Use `C-o'.

I think the current behaviour is better because you can yank text within
the newly created block without dealing with a blank line later on.

Regards,

-- 
Nicolas Goaziou



[O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-01 Thread Allen Li
org-insert-structure-template (C-c C-,) leaves point at an inconvenient
place (X marks the spot):

#+begin_example
X#+end_example

My expectation is that right after inserting the template, I can start
typing or yank right into it:

#+begin_example
X
#+end_example

Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.22.24), modified by Debian
Package: Org mode version 9.1.14 (9.1.14-932-gf82a30-elpaplus @
/usr/local/google/home/ayatane/.emacs.d/elpa/org-plus-contrib-20180923/)



Re: [O] [BUG] there are weird offset when org-insert-structure-template

2018-06-12 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> The original text:
>
> ,
> | We define refs the same way we define atoms, but the two are used rather 
> differently.
> | Let's take a quick look at how they work below.
> | 
> | (def names (ref []))
> | 
> | (dosync
> |   (ref-set names ["John"])
> |   (alter names #(if (not-empty %)
> |   (conj % "Jane") %)))
> | 
> | In this code, we define a ref called names, then open a transaction using 
> the dosync statement. Inside the transaction we set names to a vector with 
> the value "John". Next, we call alter to check if names is not empty and add 
> "Jane" to the vector of the names if that's the case.
> | 
> | Note that since this is happening inside a transaction, the check for 
> emptiness depends on the existing state along with any state built up within 
> the same transaction. If we tried to add or remove a name in a different 
> transaction, it would have no visible effect on ours. In case of a collision, 
> one of the transactions would end up being retried.
> `
>
> Then I use region select code from (def to ))), then press [C-c C-, s].
>
> It has weird offset like this:
>
> ,
> |   #+begin_src 
> | (def names (ref []))
> | 
> | (dosync
> |   (ref-set names ["John"])
> |   (alter names #(if (not-empty %)
> |   (conj % "Jane") %)))
> |   #+end_src
> `
>
> But when I region select by backward from ))) to (def, it works fine.
> no offset.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] [BUG] there are weird offset when org-insert-structure-template

2018-06-11 Thread stardiviner
The original text:

,
| We define refs the same way we define atoms, but the two are used rather 
differently.
| Let's take a quick look at how they work below.
| 
| (def names (ref []))
| 
| (dosync
|   (ref-set names ["John"])
|   (alter names #(if (not-empty %)
|   (conj % "Jane") %)))
| 
| In this code, we define a ref called names, then open a transaction using the 
dosync statement. Inside the transaction we set names to a vector with the 
value "John". Next, we call alter to check if names is not empty and add "Jane" 
to the vector of the names if that's the case.
| 
| Note that since this is happening inside a transaction, the check for 
emptiness depends on the existing state along with any state built up within 
the same transaction. If we tried to add or remove a name in a different 
transaction, it would have no visible effect on ours. In case of a collision, 
one of the transactions would end up being retried.
`

Then I use region select code from (def to ))), then press [C-c C-, s].

It has weird offset like this:

,
|   #+begin_src 
| (def names (ref []))
| 
| (dosync
|   (ref-set names ["John"])
|   (alter names #(if (not-empty %)
|   (conj % "Jane") %)))
|   #+end_src
`

But when I region select by backward from ))) to (def, it works fine. no offset.

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] [BUG] org-insert-structure-template on region selected text will delete some characters

2018-06-02 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> For example:
>
> Region select on:
>
> ENTRYPOINT ["/usr/sbin/nginx"]
>
> When I press =[C-c C-,]= on this region, the region content will be wrapped 
> with src block,
> but it deleted the last "]".
>
> This is a bug I think.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] [BUG] org-insert-structure-template on region selected text will delete some characters

2018-05-30 Thread stardiviner
For example:

Region select on:

ENTRYPOINT ["/usr/sbin/nginx"]

When I press =[C-c C-,]= on this region, the region content will be wrapped 
with src block,
but it deleted the last "]".

This is a bug I think.

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] stuck: templates don't work anymore: org-complete-expand-structure-template vs org-insert-structure-template

2018-02-21 Thread Uwe Brauer


Hi

As I learned, unfortunately for me, 
org-complete-expand-structure-template is gone and has been 
replaced by


org-insert-structure-template 


Now I have, for example,  the following template via customize

("s" "#+begin_src matlab :results output latex :exports results 
:eval never-export   #+end_src")


However, it is not clear to me how to use the new function.

I simply executed it.
org-insert-structure-template

Then it 
asks me for a key, I press s, but org tells me no such template 
does exist.


I am stuck. Please don't tell me I have to rewrite all my 
templates.


Uwe Brauer 





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 ">>> 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
>>   )
>
> 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 ">>>
 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...




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 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.




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




[O] Key binding popup interface (Was: Re: Poll: new keybinding for org-insert-structure-template on org mode list)

2017-12-12 Thread Kaushal Modi
Copying this on both Emacs devel and Org mode list. Hopefully this
discussion is eligible for that.

Problem statement: Need to have a pretty interface that shows the available
valid key bindings.

We have something custom developed for Org export interface. Magit has its
own popup interface. I know verilog-mode.el has something in-house for
picking the skeleton for insertion, but the interface is not as good as
hydra's.  Projectile.el (not on GNU Elpa) has its projectile commander,
another in-house attempt to get a similar pop-up interface.

Of all those options and more that I've seen out there, hydra.el looks like
the most elegant and *configurable* option.

Can hydra.el be merged into Emacs core, so that all the packages can start
taking advantage of that? We need to stop having each package develop their
own way to do this same thing.

It's already on GNU Elpa[1] , so there won't be any legal concerns.

[1]: https://elpa.gnu.org/packages/hydra.html

On Tue, Dec 12, 2017, 8:50 AM Rasmus  wrote:

> 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.
>
-- 

Kaushal Modi


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




Re: [O] The new function org-insert-structure-template is not following option org-babel-capitalize-example-region-markers

2017-11-10 Thread stardiviner
Yes, sure, currently the Git master branch last commit does not support
this new option yet. Hope be added in next patch. Thanks really.


On 11/11/2017 01:34 AM, Eric Abrahamsen wrote:
> "numbch...@gmail.com"  writes:
>
>> RT.
>> Hope Org-mode can fix this issue.
> It looks like that option has been obsoleted by
> `org-babel-uppercase-example-markers'. I added that in and it compiled
> and tested fine, so I guess it's available. I can make that part of the
> next patch.
>
>




Re: [O] The new function org-insert-structure-template is not following option org-babel-capitalize-example-region-markers

2017-11-10 Thread Eric Abrahamsen
"numbch...@gmail.com"  writes:

> RT.
> Hope Org-mode can fix this issue.

It looks like that option has been obsoleted by
`org-babel-uppercase-example-markers'. I added that in and it compiled
and tested fine, so I guess it's available. I can make that part of the
next patch.




[O] The new function org-insert-structure-template is not following option org-babel-capitalize-example-region-markers

2017-11-09 Thread numbch...@gmail.com
RT.
Hope Org-mode can fix this issue.

[stardiviner] 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/