From cd16b872165b41b0ec45361c65f51e61643c3d76 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 27 May 2008 08:08:28 +0200 Subject: [PATCH] Make C-c ' edit even more things around point. --- ORGWEBPAGE/Changes.org | 54 ++++++++++++++++------------------------ contrib/lisp/org-eval.el | 2 ++ doc/org.texi | 9 ++++++- doc/orgcard.tex | 2 +- lisp/ChangeLog | 5 ++++ lisp/org-exp.el | 6 ++++- lisp/org.el | 19 ++++++++------ 7 files changed, 54 insertions(+), 43 deletions(-) diff --git a/ORGWEBPAGE/Changes.org b/ORGWEBPAGE/Changes.org index 49cf8523b..b9761b748 100644 --- a/ORGWEBPAGE/Changes.org +++ b/ORGWEBPAGE/Changes.org @@ -10,39 +10,6 @@ #+LINK_UP: index.html #+LINK_HOME: http://orgmode.org -* Version 6.05 - -** Details -*** Source code example editing expanded. - -The editing of source code in the proper major mode has been -expanded. It works now inside all kinds of constructs, for -example - -#+begin_src org -,#+HTML: this code can be edited in html-mode - -,#+BEGIN_HTML -,Same here -,#+BEGIN_HTML - -,#+LaTeX: this code can be edited in latex-mode - -,#+BEGIN_LaTeX -,Same here -,#+BEGIN_LaTeX - -,#+BEGIN_SRC fortran -,Here we can edit in fortran-mode -,#+END_SRC -#+end_src - -In addition to that, the syntax that is used by Emacs Muse ( -or tags, even and ) works as well - in -fact, I think you can call `org-edit-src-code' directly from -Muse. Hey, if you guys bind it to "C-c '" in Muse mode as well, -this could be a nice convergence. - * Version 6.04 :PROPERTIES: :VISIBILITY: content @@ -111,6 +78,27 @@ editing by pressing "C-c '" again. This is important, because lines that have syntactic meaning in Org will be quoted by calling this command. +"C-c '" also edits include files, the setupfile in a =#+setufile= +line, and all those little foreign snippets like: + +#+begin_src org +,#+HTML: this code can be edited in html-mode + +,#+BEGIN_HTML +,Same here +,#+BEGIN_HTML + +,#+LaTeX: this code can be edited in latex-mode + +,#+BEGIN_LaTeX +,Same here +,#+BEGIN_LaTeX + +,#+BEGIN_SRC fortran +,Here we can edit in fortran-mode +,#+END_SRC +#+end_src + *** iCalendar now defines proper UIDs for entries This is necessary for synchronization services. The UIDs are diff --git a/contrib/lisp/org-eval.el b/contrib/lisp/org-eval.el index 146d2cc58..0dd3adeed 100644 --- a/contrib/lisp/org-eval.el +++ b/contrib/lisp/org-eval.el @@ -56,6 +56,8 @@ ;; the variable `org-eval-interpreters' to add more interpreters like ;; `perl', `python', or the `shell'. ;; +;; You can edit the code snippets with "C-c '" (org-edit-src-code). +;; ;; Please note that this mechanism is potentially dangerous, because it ;; executes code that you don't even see. This gives you great power, ;; but also enough rope to hang yourself. And, it gives your friends diff --git a/doc/org.texi b/doc/org.texi index d87d7bf80..431159281 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -6860,6 +6860,12 @@ language for formatting the contents. The markup is optional, if it is not given, the text will be assumed to be in Org mode format and will be processed normally. +@table @kbd +@kindex C-c ' +@item C-c ' +Visit the include file at point. +@end table + @node Tables exported, Footnotes, Include files, Markup rules @subheading Tables @cindex tables, markup rules @@ -8014,7 +8020,8 @@ entirely ignored. Only when the buffer is parsed for option-setting lines (i.e. when starting Org mode for a file, when pressing @kbd{C-c C-c} in a settings line, or when exporting), then the contents of this file are parsed as if they had been included in the buffer. In particlar, the file can be -any other Org mode file with internal setup. +any other Org mode file with internal setup. You can visit the file the +cursor is in the line with @kbd{C-c '}. @item #+STARTUP: This line sets options to be used at startup of Org mode, when an Org file is being visited. The first set of options deals with the diff --git a/doc/orgcard.tex b/doc/orgcard.tex index 8cc67eb6d..71b87993c 100644 --- a/doc/orgcard.tex +++ b/doc/orgcard.tex @@ -454,7 +454,7 @@ formula, \kbd{:=} a field formula. \key{jump back to last followed link(s)}{C-c \&} \key{Find next link}{C-c C-x C-n} \key{Find previous link}{C-c C-x C-p} - +\key{Edit code snippet of file at point}{C-c '} {\bf Internal Links} \key{\kbd{<>}}{\rm target} diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5b409b6be..78f78c91e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-05-27 Carsten Dominik + + * org-exp.el (org-export-html-style): Changed the size of in the +
 element to 90%.
+
 2008-05-26  Carsten Dominik  
 
 	* org.el (org-find-src-example-start): Function removed.
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index dd9495ca4..3d038e0ec 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -464,6 +464,7 @@ Org-mode file."
 	background-color: #F3F5F7;
 	padding: 5pt;
 	font-family: courier, monospace;
+        font-size: 90%;
   }
   table { border-collapse: collapse; }
   td, th {
@@ -1359,7 +1360,7 @@ on this string to produce the exported version."
 	(while (re-search-forward "^#\\+BEGIN_EXAMPLE[ \t]*\n" nil t)
 	  (goto-char (match-end 0))
 	  (while (not (looking-at "#\\+END_EXAMPLE"))
-	    (insert ": ")
+	    (insert ":  ")
 	    (beginning-of-line 2)))
 	(goto-char (point-min))
 	(while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t)
@@ -1755,6 +1756,9 @@ backends, it converts the segment into an EXAMPLE segment."
 	  (concat "#+BEGIN_HTML\n" htmltext "\n#+END_HTML\n"))))
      (t
       ;; This is not HTML, so just make it an example.
+      (when (equal lang "org")
+	(while (string-match "^," code)
+	  (setq code (replace-match "" t t code))))
       (concat "#+BEGIN_EXAMPLE\n" code
 	      (if (string-match "\n\\'" code) "" "\n")
 	      "#+END_EXAMPLE\n")))))
diff --git a/lisp/org.el b/lisp/org.el
index 0edfebe84..ca6e13a11 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12710,14 +12710,19 @@ See the individual commands for more information."
 (defun org-edit-special ()
   "Call a special editor for the stuff at point.
 When at a table, call the formula editor with `org-table-edit-formulas'.
-When at the first line of an src example, call `org-edit-src-code'."
+When at the first line of an src example, call `org-edit-src-code'.
+When in an #+include line, visit the include file.  Otherwise call
+`ffap' to visit the file at point."
   (interactive)
-  (if (org-at-table-p)
-      (call-interactively 'org-table-edit-formulas)
-    (or (org-edit-src-code)
-	(error "%s"
-	       (substitute-command-keys
-		"\\[org-edit-special] can do nothing useful here.")))))
+  (cond
+   ((org-at-table-p)
+    (call-interactively 'org-table-edit-formulas))
+   ((save-excursion
+      (beginning-of-line 1)
+      (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*.*?file=\"\\)\\([^\"\n>]+\\)"))
+    (find-file (org-trim (match-string 1))))
+   ((org-edit-src-code))
+   (t (call-interactively 'ffap))))
 
 (defun org-ctrl-c-ctrl-c (&optional arg)
   "Set tags in headline, or update according to changed information at point.