Browse Source

Use C-c ' to exit source code editing.

Carsten Dominik 17 years ago
parent
commit
3b2b3556b7

+ 3 - 6
ORGWEBPAGE/Changes.org

@@ -74,12 +74,9 @@ Org mode examples.  You can now use the key "C-c '" (that is C-c
 followed by the single quote) to edit the example in its native
 mode.  This works by creating an indirect buffer, narrowing it to
 the example and setting the appropriate mode.  You need to exit
-editing by killing that indirect buffer, with =C-x k=.  This is
-important, because lines that have syntactic meaning in Org will
-be quoted when the indirect buffer is killed.
-
-I guess it would be nice to exit with =C-c C-c=, but who knows
-what this key is supposed to do in a random mode.
+editing by pressing "C-c '" again.  This is important, because
+lines that have syntactic meaning in Org will be quoted by
+calling this command.
 
 *** iCalendar now defines proper UIDs for entries
 

+ 3 - 3
ORGWEBPAGE/index.org

@@ -22,9 +22,9 @@ messages, BBDB entries, and any files related to the projects.  For
 printing and sharing of notes, an Org-mode file can be exported as a
 structured ASCII file, HTML, and LaTeX.
 
-* Current Version (6.04) and Compatibility
+* Current Version (6.04a) and Compatibility
 
-The current version is 6.04.  To see what has changed in recent
+The current version is 6.04a.  To see what has changed in recent
 releases, check this [[file:Changes.html][list of user-visible changes]].  These descriptions
 are extensive, to avoid that people will be printing the manual after
 each incremental release.  If you have an older version of the manual,
@@ -41,7 +41,7 @@ release.
 
 **** Distribution
 
-Download as [[file:org-6.04.zip][zip file]] or [[file:org-6.04.tar.gz][gzipped tar archive]].  These archives contain
+Download as [[file:org-6.04a.zip][zip file]] or [[file:org-6.04a.tar.gz][gzipped tar archive]].  These archives contain
 both the Lisp file org.el and the documentation in PDF and (TeX)Info
 formats.  A shell script to simplify upgrading to the newest release
 has been posted [[http://www.philfam.co.uk/pete/GTD/org-mode/update-org.sh][here]].

+ 1 - 1
README_DIST

@@ -1,7 +1,7 @@
 The is a distribution of Org, a plain text notes and project planning
 tool for Emacs.
 
-The version of this release is: 6.04
+The version of this release is: 6.04a
 
 The homepage of Org is at http://orgmode.org
 

+ 2 - 3
doc/org.texi

@@ -3,7 +3,7 @@
 @setfilename ../../info/org
 @settitle The Org Manual
 
-@set VERSION 6.04
+@set VERSION 6.04a
 @set DATE May 2008
 
 @dircategory Emacs
@@ -6838,8 +6838,7 @@ example:
 @item C-c '
 Edit the source code example at point in its native mode.  This works by
 switching to an indirect buffer, narrowing the buffer and switching to the
-other mode.  You need to exit by killing the indirect buffer using @kbd{C-x
-k}.
+other mode.  You need to exit by pressing @kbd{C-c '} again.
 @end table
 
 

+ 1 - 1
doc/orgcard.tex

@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{6.04}
+\def\orgversionnumber{6.04a}
 \def\versionyear{2008}          % latest update
 \def\year{2008}                 % latest copyright year
 

+ 6 - 0
lisp/ChangeLog

@@ -1,5 +1,11 @@
 2008-05-25  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org.el (org-edit-src-exit): New function.
+	(org-exit-edit-mode): New minor mode.
+
+	* org-exp.el (org-export-preprocess-string): Fix bug with removing
+	comment-like lines from protected examples.
+
 	* org.el (org-edit-src-example, org-find-src-example-start)
 	(org-protect-source-example, org-edit-special): New functions.
 

+ 1 - 1
lisp/org-agenda.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-archive.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-bbdb.el

@@ -6,7 +6,7 @@
 ;;         Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-bibtex.el

@@ -5,7 +5,7 @@
 ;; Author: Bastien Guerry <bzg at altern dot org>
 ;;         Carsten Dominik <carsten dot dominik at gmail dot com>
 ;; Keywords: org, wp, remember
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-clock.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-colview-xemacs.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-colview.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-compat.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 4 - 2
lisp/org-exp.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -1463,7 +1463,9 @@ on this string to produce the exported version."
 	    (progn (add-text-properties
 		    (match-beginning 0) (match-end 0) '(org-protected t))
 		   (replace-match (format commentsp (match-string 1)) t t))
-	  (replace-match "")))
+	  (goto-char (1+ (match-beginning 0)))
+	  (org-if-unprotected (replace-match ""))
+	  (end-of-line 1)))
 
       ;; Find matches for radio targets and turn them into internal links
       (goto-char (point-min))

+ 1 - 1
lisp/org-export-latex.el

@@ -4,7 +4,7 @@
 ;;
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-export-latex.el
-;; Version: 6.04
+;; Version: 6.04a
 ;; Author: Bastien Guerry <bzg AT altern DOT org>
 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: org, wp, tex

+ 1 - 1
lisp/org-faces.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-gnus.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-id.el

@@ -4,7 +4,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-info.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-irc.el

@@ -4,7 +4,7 @@
 ;;
 ;; Author: Philip Jackson <emacs@shellarchive.co.uk>
 ;; Keywords: erc, irc, link, org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-jsinfo.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-mac-message.el

@@ -3,7 +3,7 @@
 ;; Copyright (C) 2008 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
-;; Version: 6.04
+;; Version: 6.04a
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.

+ 1 - 1
lisp/org-macs.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-mew.el

@@ -5,7 +5,7 @@
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 
 ;; This file is part of GNU Emacs.
 

+ 1 - 1
lisp/org-mhe.el

@@ -5,7 +5,7 @@
 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-mouse.el

@@ -4,7 +4,7 @@
 ;;
 ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-publish.el

@@ -4,7 +4,7 @@
 ;; Author: David O'Toole <dto@gnu.org>
 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: hypermedia, outlines, wp
-;; Version: 6.04
+;; Version: 6.04a
 
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-remember.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-rmail.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-table.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-vm.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 1 - 1
lisp/org-wl.el

@@ -5,7 +5,7 @@
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

+ 20 - 8
lisp/org.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.04
+;; Version: 6.04a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -91,7 +91,7 @@
 
 ;;; Version
 
-(defconst org-version "6.04"
+(defconst org-version "6.04a"
   "The version number of the file org.el.")
 
 (defun org-version (&optional here)
@@ -5333,6 +5333,12 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive."
 
 ;;; Editing source examples
 
+(defvar org-exit-edit-mode-map (make-sparse-keymap))
+(define-key org-exit-edit-mode-map "\C-c'" 'org-edit-src-exit)
+
+(define-minor-mode org-exit-edit-mode
+  "Minor mode installing a single key binding, \"C-c '\" to exit special edit.")
+
 (defun org-edit-src-example ()
   "Edit the source code example at point.
 An indirect buffer is created, and that buffer is then narrowed to the
@@ -5343,7 +5349,7 @@ in this way because some Org quoting of the example will take place."
   (let ((line (org-current-line))
 	(case-fold-search t)
 	(msg (substitute-command-keys
-	      "Edit, then kill this indirect buffer with \\[kill-buffer]"))
+	      "Edit, then kill this indirect buffer with C-c ' (C-c and single quote)"))
 	beg end)
     (if (not (org-find-src-example-start))
 	;; not at an example
@@ -5367,13 +5373,14 @@ in this way because some Org quoting of the example will take place."
       (switch-to-buffer (make-indirect-buffer (current-buffer)
 					      "*Org Edit Src Example*"))
       (narrow-to-region beg end)
-      (funcall lang-f)
+      (let ((org-inhibit-startup t))
+	(funcall lang-f))
       (goto-char (point-min))
       (while (re-search-forward "^," nil t)
 	(replace-match ""))
       (goto-char (point-min))
       (goto-line line)
-      (org-add-hook 'kill-buffer-hook 'org-protect-source-example nil 'loc)
+      (org-exit-edit-mode)
       (org-set-local 'header-line-format msg)
       (message "%s" msg)
       t)))
@@ -5394,13 +5401,18 @@ If not, just return nil."
 	(goto-char pos)
 	nil))))
 
-(defun org-protect-source-example ()
-  "Protect example lines with Org syntax."
+(defun org-edit-src-exit ()
+  "Exit special edit and protect problematic lines."
+  (interactive)
   (unless (> (point-min) 1)
     (error "This buffer is not narrowed, something is wrong..."))
   (goto-char (point-min))
   (while (re-search-forward (if (org-mode-p) "^\\(.\\)" "^\\([*#]\\)") nil t)
-    (replace-match ",\\1")))
+    (replace-match ",\\1"))
+  (when font-lock-mode
+    (font-lock-unfontify-region (point-min) (point-max)))
+  (put-text-property (point-min) (point-max) 'font-lock-fontified t)
+  (kill-buffer (current-buffer)))
 
 ;;;; Plain list items, including checkboxes