emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: C-c ' eats last newline of a figure [6.35trans (release_6.35g.72.g2e12)]
@ 2010-04-19  2:01 Bernt Hansen
  2010-04-19  6:34 ` Dan Davison
  0 siblings, 1 reply; 3+ messages in thread
From: Bernt Hansen @ 2010-04-19  2:01 UTC (permalink / raw)
  To: emacs-orgmode


With the following file if you use C-c ' to edit the ditta graphic in
artist mode and then just exit artist mode with another C-c '
the #+end_src line moves up one line which breaks the block.

--8<---------------cut here---------------start------------->8---
* Ditta Test
#+begin_src ditaa :file x.png :cmdline 
  +--------------+                                                  +-----------------------------+
  |              |                                                  |                             |
  |              +<------------------------------------------------>+                             |
  |    cBLU      |                                                  |      cF00                   |
  |              +<--------+      +-----------------+               |                             |
  |              |         |      |                 |               |                             |
  +--------------+         |      |                 |               +--------------+--------------+
                           |      |                 |                              |
                           +------+    cRED         |                              |
                                  |                 |                              |
                                  |                 |                              |
                                  |                 |                +-------------+
                                  +-----+----+------+                |
   +--------------------+               |    |                       v
   |                    |               |    |          +------------+-----------+
   |                    |               |    |          |                        |
   |    cGRE            +<-----=--------+    |          |                        |
   |                    |                    |          |                        |
   |                    |                    +--------->+                        |
   +--------------------+                               |      cYEL              |
                                                        |                        |
                                                        +------------------------+
#+end_src

#+results:
[[file:x.png]]
--8<---------------cut here---------------end--------------->8---

After the key sequence C-c ' C-c ' in the block the end of the block now
looks like this:

--8<---------------cut here---------------start------------->8---
                                                        |                        |
                                                        +------------------------+#+end_src
--8<---------------cut here---------------end--------------->8---

This occurs in both the master and compatibility branches.

Emacs  : GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2008-11-09 on raven, modified by Debian
Package: Org-mode version 6.35trans (release_6.35g.72.g2e12)

-Bernt

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

* Re: Bug: C-c ' eats last newline of a figure [6.35trans (release_6.35g.72.g2e12)]
  2010-04-19  2:01 Bug: C-c ' eats last newline of a figure [6.35trans (release_6.35g.72.g2e12)] Bernt Hansen
@ 2010-04-19  6:34 ` Dan Davison
  2010-04-21  7:49   ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Davison @ 2010-04-19  6:34 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

I've had a quick look at this. A minimal example is

#+begin_src ditaa
  +--
#+end_src

The problem seems to be that C-c ' concludes that we're in a table.el
table. One solution that came to mind is to move the test for table.el
context until after all the other block regexps have been tried. Patch
below.

Dan

commit 1dd6dd3bd79f06dfe2f27958b457c5b4766b3368
Author: Dan Davison <davison@stats.ox.ac.uk>
Date:   Mon Apr 19 02:29:33 2010 -0400

    Don't jump to conclusion that we are at table.el table
    
    Test various block regexps before testing for table.el context

	Modified lisp/org-src.el
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 54ec4af..3319a9e 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -459,15 +459,6 @@ the language, a switch telling if the content should be in a single line."
 	(pos (point))
 	re1 re2 single beg end lang lfmt match-re1 ind entry)
     (catch 'exit
-      (when (org-at-table.el-p)
-	(re-search-backward "^[\t]*[^ \t|\\+]" nil t)
-	(setq beg (1+ (point-at-eol)))
-	(goto-char beg)
-	(or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
-	    (progn (goto-char (point-max)) (newline)))
-	(setq end (point-at-bol))
-	(setq ind (org-edit-src-get-indentation beg))
-	(throw 'exit (list beg end 'table.el nil nil ind)))
       (while (setq entry (pop re-list))
 	(setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
 	      single (nth 3 entry))
@@ -498,7 +489,16 @@ the language, a switch telling if the content should be in a single line."
 			(throw 'exit
 			       (list (match-end 0) end
 				     (org-edit-src-get-lang lang)
-				     single lfmt ind))))))))))))
+				     single lfmt ind)))))))))
+      (when (org-at-table.el-p)
+	(re-search-backward "^[\t]*[^ \t|\\+]" nil t)
+	(setq beg (1+ (point-at-eol)))
+	(goto-char beg)
+	(or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
+	    (progn (goto-char (point-max)) (newline)))
+	(setq end (point-at-bol))
+	(setq ind (org-edit-src-get-indentation beg))
+	(throw 'exit (list beg end 'table.el nil nil ind))))))
 
 (defun org-edit-src-get-lang (lang)
   "Extract the src language."



Bernt Hansen <bernt@norang.ca> writes:

> With the following file if you use C-c ' to edit the ditta graphic in
> artist mode and then just exit artist mode with another C-c '
> the #+end_src line moves up one line which breaks the block.
>
> * Ditta Test
> #+begin_src ditaa :file x.png :cmdline 
>   +--------------+                                                  +-----------------------------+
>   |              |                                                  |                             |
>   |              +<------------------------------------------------>+                             |
>   |    cBLU      |                                                  |      cF00                   |
>   |              +<--------+      +-----------------+               |                             |
>   |              |         |      |                 |               |                             |
>   +--------------+         |      |                 |               +--------------+--------------+
>                            |      |                 |                              |
>                            +------+    cRED         |                              |
>                                   |                 |                              |
>                                   |                 |                              |
>                                   |                 |                +-------------+
>                                   +-----+----+------+                |
>    +--------------------+               |    |                       v
>    |                    |               |    |          +------------+-----------+
>    |                    |               |    |          |                        |
>    |    cGRE            +<-----=--------+    |          |                        |
>    |                    |                    |          |                        |
>    |                    |                    +--------->+                        |
>    +--------------------+                               |      cYEL              |
>                                                         |                        |
>                                                         +------------------------+
> #+end_src
>
> #+results:
> [[file:x.png]]
>
> After the key sequence C-c ' C-c ' in the block the end of the block now
> looks like this:
>
>                                                         |                        |
>                                                         +------------------------+#+end_src
>
> This occurs in both the master and compatibility branches.
>
> Emacs  : GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11)
>  of 2008-11-09 on raven, modified by Debian
> Package: Org-mode version 6.35trans (release_6.35g.72.g2e12)
>
> -Bernt
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Bug: C-c ' eats last newline of a figure [6.35trans (release_6.35g.72.g2e12)]
  2010-04-19  6:34 ` Dan Davison
@ 2010-04-21  7:49   ` Carsten Dominik
  0 siblings, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-04-21  7:49 UTC (permalink / raw)
  To: Dan Davison; +Cc: Bernt Hansen, emacs-orgmode

Applied, thank.

- Carsten

On Apr 19, 2010, at 8:34 AM, Dan Davison wrote:

> diff --git a/lisp/org-src.el b/lisp/org-src.el
> index 54ec4af..3319a9e 100644
> --- a/lisp/org-src.el
> +++ b/lisp/org-src.el
> @@ -459,15 +459,6 @@ the language, a switch telling if the content  
> should be in a single line."
>  	(pos (point))
>  	re1 re2 single beg end lang lfmt match-re1 ind entry)
>      (catch 'exit
> -      (when (org-at-table.el-p)
> -	(re-search-backward "^[\t]*[^ \t|\\+]" nil t)
> -	(setq beg (1+ (point-at-eol)))
> -	(goto-char beg)
> -	(or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
> -	    (progn (goto-char (point-max)) (newline)))
> -	(setq end (point-at-bol))
> -	(setq ind (org-edit-src-get-indentation beg))
> -	(throw 'exit (list beg end 'table.el nil nil ind)))
>        (while (setq entry (pop re-list))
>  	(setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
>  	      single (nth 3 entry))
> @@ -498,7 +489,16 @@ the language, a switch telling if the content  
> should be in a single line."
>  			(throw 'exit
>  			       (list (match-end 0) end
>  				     (org-edit-src-get-lang lang)
> -				     single lfmt ind))))))))))))
> +				     single lfmt ind)))))))))
> +      (when (org-at-table.el-p)
> +	(re-search-backward "^[\t]*[^ \t|\\+]" nil t)
> +	(setq beg (1+ (point-at-eol)))
> +	(goto-char beg)
> +	(or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
> +	    (progn (goto-char (point-max)) (newline)))
> +	(setq end (point-at-bol))
> +	(setq ind (org-edit-src-get-indentation beg))
> +	(throw 'exit (list beg end 'table.el nil nil ind))))))
>
>  (defun org-edit-src-get-lang (lang)
>    "Extract the src language."
>

- Carsten

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

end of thread, other threads:[~2010-04-21  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19  2:01 Bug: C-c ' eats last newline of a figure [6.35trans (release_6.35g.72.g2e12)] Bernt Hansen
2010-04-19  6:34 ` Dan Davison
2010-04-21  7:49   ` Carsten Dominik

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