emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]
@ 2019-12-18 13:07 Ihor Radchenko
  2019-12-19  1:15 ` Berry, Charles
  2022-10-15  4:46 ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Ihor Radchenko @ 2019-12-18 13:07 UTC (permalink / raw)
  To: emacs-orgmode

Recipe:

1. emacs -Q
2. Execute the following lisp code:

(setq org-src-tab-acts-natively t)
(require 'org-tempo)
(push (cons "el" "src emacs-lisp") org-structure-template-alist)

3. Create the following org file:

<point>

#+begin_src emacs-lisp
#+end_src

4. Put the point before the code block

5.1. Type <s TAB

Observed behaviour:

#+begin_src 


#+begin_src emacs-lisp
#+end_src

Expected behaviour:

#+begin_src 

#+end_src

#+begin_src emacs-lisp
#+end_src


5.2. Type <el TAB

Observed behaviour:

#+begin_src emacs-lisp

#+end_src

  ,#+begin_src emacs-lisp
#+end_src


Expected behaviour:

#+begin_src emacs-lisp

#+end_src

#+begin_src emacs-lisp
#+end_src

Setting org-src-tab-acts-natively to nil makes org-mode behave normally.



Emacs  : GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0)
 of 2019-12-17
Package: Org mode version 9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2019-12-18 13:07 Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
@ 2019-12-19  1:15 ` Berry, Charles
  2019-12-19 14:16   ` Ihor Radchenko
  2022-10-15  4:46 ` Ihor Radchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Berry, Charles @ 2019-12-19  1:15 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org



> On Dec 18, 2019, at 5:07 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
> 
> Recipe:
> 
> 1. emacs -Q
> 2. Execute the following lisp code:
> 
> (setq org-src-tab-acts-natively t)
> (require 'org-tempo)

I did not need to add this line to confirm the behavior:

> (push (cons "el" "src emacs-lisp") org-structure-template-alist)
> 
> 3. Create the following org file:
> 
> <point>
> 
> #+begin_src emacs-lisp
> #+end_src
> 
> 4. Put the point before the code block
> 
> 5.1. Type <s TAB
> 
> Observed behaviour:
> 
> #+begin_src 
> 
> 
> #+begin_src emacs-lisp
> #+end_src
> 


Right. The issue seems to be that `org-tempo-add-block' puts  `>' elements in its recipe for converting  `org-structure-template-alist' to `tempo-org-template-*' values.

Those are innocuous when `org-src-tab-acts-natively' is nil.

But when `org-src-tab-acts-natively' is `t', an attempt is made to indent within the src block, which I guess is where the trouble lies as an error occurs which prevents the remainder of the template from being inserted.

If you really need `<s', then this is a problem (and a bug).

You might use `C-c C-,' as long as you have no other templates defined.

HTH,

Chuck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2019-12-19  1:15 ` Berry, Charles
@ 2019-12-19 14:16   ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2019-12-19 14:16 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-orgmode@gnu.org

> I did not need to add this line to confirm the behavior:
>
>> (push (cons "el" "src emacs-lisp") org-structure-template-alist)

Note the 5.2 part of the recipe.
It is probably caused by the same reason, but the consequence is that
the following code block is being commented, sometimes out of the screen.
I accidentally commented several parts of my emacs configuration because
of this.

> If you really need `<s', then this is a problem (and a bug). 
>
> You might use `C-c C-,' as long as you have no other templates
> defined. 

I prefer to use `<el<TAB>' instead of `C-c C-, e l C-o' simply because
it takes one less key press and less modifier keys. And I do have other
templates.

> Right. The issue seems to be that `org-tempo-add-block' puts  `>'
> elements in its recipe for converting  `org-structure-template-alist'
> to `tempo-org-template-*' values. 
>
> Those are innocuous when `org-src-tab-acts-natively' is nil.

The most straightforward solutions are deleting the `'>' elements from
the template or temporary setting the `org-src-tabs-acts-natively' to
nil. 

Best,
Ihor


"Berry, Charles" <ccberry@health.ucsd.edu> writes:

>> On Dec 18, 2019, at 5:07 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
>> 
>> Recipe:
>> 
>> 1. emacs -Q
>> 2. Execute the following lisp code:
>> 
>> (setq org-src-tab-acts-natively t)
>> (require 'org-tempo)
>
> I did not need to add this line to confirm the behavior:
>
>> (push (cons "el" "src emacs-lisp") org-structure-template-alist)
>> 
>> 3. Create the following org file:
>> 
>> <point>
>> 
>> #+begin_src emacs-lisp
>> #+end_src
>> 
>> 4. Put the point before the code block
>> 
>> 5.1. Type <s TAB
>> 
>> Observed behaviour:
>> 
>> #+begin_src 
>> 
>> 
>> #+begin_src emacs-lisp
>> #+end_src
>> 
>
>
> Right. The issue seems to be that `org-tempo-add-block' puts  `>' elements in its recipe for converting  `org-structure-template-alist' to `tempo-org-template-*' values.
>
> Those are innocuous when `org-src-tab-acts-natively' is nil.
>
> But when `org-src-tab-acts-natively' is `t', an attempt is made to indent within the src block, which I guess is where the trouble lies as an error occurs which prevents the remainder of the template from being inserted.
>
> If you really need `<s', then this is a problem (and a bug).
>
> You might use `C-c C-,' as long as you have no other templates defined.
>
> HTH,
>
> Chuck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2019-12-18 13:07 Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
  2019-12-19  1:15 ` Berry, Charles
@ 2022-10-15  4:46 ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-10-15  4:46 UTC (permalink / raw)
  To: emacs-orgmode

Ihor Radchenko <yantar92@gmail.com> writes:

> Recipe:

For record, I can no longer reproduce the bug on the latest main.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-15  4:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-18 13:07 Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
2019-12-19  1:15 ` Berry, Charles
2019-12-19 14:16   ` Ihor Radchenko
2022-10-15  4:46 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).