From mboxrd@z Thu Jan 1 00:00:00 1970 From: Omid Subject: Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) Date: Wed, 05 Feb 2014 15:40:50 -0500 Message-ID: <52F2A1D2.4030802@gmail.com> References: <525DE996.2000408@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB9HM-0007vU-HI for emacs-orgmode@gnu.org; Wed, 05 Feb 2014 15:41:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WB9HC-0006AI-5H for emacs-orgmode@gnu.org; Wed, 05 Feb 2014 15:41:04 -0500 Received: from mail-yk0-x232.google.com ([2607:f8b0:4002:c07::232]:57035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB9HC-0006AD-0m for emacs-orgmode@gnu.org; Wed, 05 Feb 2014 15:40:54 -0500 Received: by mail-yk0-f178.google.com with SMTP id 79so2435462ykr.9 for ; Wed, 05 Feb 2014 12:40:53 -0800 (PST) Received: from [192.168.1.100] (dhcpd2d254.math.fsu.edu. [128.186.2.254]) by mx.google.com with ESMTPSA id 44sm99974134yhp.17.2014.02.05.12.40.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Feb 2014 12:40:52 -0800 (PST) In-Reply-To: <525DE996.2000408@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hello, I am using Org-mode version 8.2.5g (8.2.5g-elpa) in GNU Emacs 24.3.1. I have two questions about the behavior of the fantastic Org mode+Babel with respect to code and comments: Here is a minimal example: #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very very very very very long comment line. print *, "Hello, World!" end program main #+END_SRC Below is the code snippet after M-q (fill-paragraph) on the comment line. The comment line has been refilled (intended behavior) but all lines have been indented. This may also be an intended behavior; but FIRST QUESTION: Is there a way to disable this indentation upon M-Q in Org Babel code snippets? #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very ! very very very very long comment line. print *, "Hello, World!" end program main #+END_SRC Below is the code snippet after a C-/ (undo). Note that the indentation and the refill which were done by the last command above (M-q) are not being undone. The text in the comment is being removed which I believe means that the previous (self-insert-command)'s that created the text are being undone. This is very undesirable since even a user who is aware of this behavior may by mistake issue the command M-q, have the code snippet formatted in an undesirable way (e.g., sometimes new lines are not respected and code and comments get mixed up), without any immediate way to undo this reformatting. SECOND QUESTION: How can one get the usual (undo) behavior in a Babel code snippet? #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very ! very v comment line. print *, "Hello, World!" end program main #+END_SRC Please note that these edits are done in the Org mode buffer directly. If I switch to the native language mode using C-c ' things work as expected. Thanks, Omid