From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: function for inserting a block Date: Sat, 14 Oct 2017 12:52:27 +0200 Message-ID: <87po9q2e8k.fsf@nicolasgoaziou.fr> References: <877exghblx.fsf@ericabrahamsen.net> <87efromccg.fsf@nicolasgoaziou.fr> <87ziabepxt.fsf@ericabrahamsen.net> <87bmml2fb0.fsf@ericabrahamsen.net> <87fubuzpsa.fsf@nicolasgoaziou.fr> <874lsabdop.fsf@ericabrahamsen.net> <87vak1l11m.fsf@nicolasgoaziou.fr> <87r2uoc4q7.fsf@ericabrahamsen.net> <87bmllk5xy.fsf@nicolasgoaziou.fr> <878tgmwwsa.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3K3X-00065s-0e for emacs-orgmode@gnu.org; Sat, 14 Oct 2017 06:52:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3K3S-0002o8-19 for emacs-orgmode@gnu.org; Sat, 14 Oct 2017 06:52:35 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:39785) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e3K3R-0002nz-RC for emacs-orgmode@gnu.org; Sat, 14 Oct 2017 06:52:29 -0400 In-Reply-To: <878tgmwwsa.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 07 Oct 2017 13:03:17 -0700") 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: Eric Abrahamsen Cc: emacs-orgmode@gnu.org Hello, Eric Abrahamsen writes: > How does this look? Thank you! I have some questions and remarks. > * etc/ORG-NEWS: Mention in news. This doesn't need to be added to the commit message. > +Do not be put off by having to remember the source block syntax. Org mode > +offers two ways of speeding up the creation of @samp{src} code blocks: src code blocks is enough, IMO. There are may of them across the manual, and it just makes reading more tedious. > +@findex org-insert-structure-template I would also add @kindex C-c C-x t > + (let ((s (copy-marker (if (use-region-p) > + (region-beginning) > + (point)))) Does it really need to be a marker? AFAICT, nothing really changes this position. > + (back-to-indentation) > + (insert (format "#+BEGIN_%s\n" > + type)) > + (indent-to column) What about (beginning-of-line) (indent-to column) (insert (format "#+BEGIN_%s\n" type)) ? It avoids `back-to-indentation'. > + (if (bolp) > + (progn > + (skip-chars-backward " \n\t") > + (forward-char)) > + (end-of-line) > + (insert "\n")) I don't understand this part. In particular, the `forward-char' looks wrong. Do you mean `forward-line' ? If so, do you handle the case where buffer doesn't end with a newline character? > + (set-marker s nil) See above. Regards, -- Nicolas Goaziou