* [BUG] there are weird offset when org-insert-structure-template
@ 2018-06-12 4:32 stardiviner
2018-06-12 7:05 ` Nicolas Goaziou
0 siblings, 1 reply; 2+ messages in thread
From: stardiviner @ 2018-06-12 4:32 UTC (permalink / raw)
To: org-mode
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] there are weird offset when org-insert-structure-template
2018-06-12 4:32 [BUG] there are weird offset when org-insert-structure-template stardiviner
@ 2018-06-12 7:05 ` Nicolas Goaziou
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2018-06-12 7:05 UTC (permalink / raw)
To: stardiviner; +Cc: org-mode
Hello,
stardiviner <numbchild@gmail.com> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-12 7:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-12 4:32 [BUG] there are weird offset when org-insert-structure-template stardiviner
2018-06-12 7:05 ` Nicolas Goaziou
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).