From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] there are weird offset when org-insert-structure-template Date: Tue, 12 Jun 2018 09:05:10 +0200 Message-ID: <87in6oxz6h.fsf@nicolasgoaziou.fr> References: <87vaaooc9p.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSdMm-0002pi-3m for emacs-orgmode@gnu.org; Tue, 12 Jun 2018 03:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSdMg-0005s9-F9 for emacs-orgmode@gnu.org; Tue, 12 Jun 2018 03:05:20 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:35557) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSdMg-0005q4-98 for emacs-orgmode@gnu.org; Tue, 12 Jun 2018 03:05:14 -0400 In-Reply-To: <87vaaooc9p.fsf@gmail.com> (stardiviner's message of "Tue, 12 Jun 2018 12:32:34 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: stardiviner Cc: org-mode 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