Bladeren bron

Make C-c ' edit even more things around point.

Carsten Dominik 17 jaren geleden
bovenliggende
commit
cd16b87216
7 gewijzigde bestanden met toevoegingen van 54 en 43 verwijderingen
  1. 21 33
      ORGWEBPAGE/Changes.org
  2. 2 0
      contrib/lisp/org-eval.el
  3. 8 1
      doc/org.texi
  4. 1 1
      doc/orgcard.tex
  5. 5 0
      lisp/ChangeLog
  6. 5 1
      lisp/org-exp.el
  7. 12 7
      lisp/org.el

+ 21 - 33
ORGWEBPAGE/Changes.org

@@ -10,39 +10,6 @@
 #+LINK_UP: index.html
 #+LINK_UP: index.html
 #+LINK_HOME: http://orgmode.org
 #+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 (<src>
-or <example> tags, even <literal> and <lisp>) 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
 * Version 6.04
 :PROPERTIES:
 :PROPERTIES:
 :VISIBILITY: content
 :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
 lines that have syntactic meaning in Org will be quoted by
 calling this command.
 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
 *** iCalendar now defines proper UIDs for entries
 
 
 This is necessary for synchronization services.  The UIDs are
 This is necessary for synchronization services.  The UIDs are

+ 2 - 0
contrib/lisp/org-eval.el

@@ -56,6 +56,8 @@
 ;; the variable `org-eval-interpreters' to add more interpreters like
 ;; the variable `org-eval-interpreters' to add more interpreters like
 ;; `perl', `python', or the `shell'.
 ;; `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
 ;; Please note that this mechanism is potentially dangerous, because it
 ;; executes code that you don't even see.  This gives you great power,
 ;; 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
 ;; but also enough rope to hang yourself.  And, it gives your friends

+ 8 - 1
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
 given, the text will be assumed to be in Org mode format and will be
 processed normally.
 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
 @node Tables exported, Footnotes, Include files, Markup rules
 @subheading Tables
 @subheading Tables
 @cindex tables, markup rules
 @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
 (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
 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
 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:
 @item #+STARTUP:
 This line sets options to be used at startup of Org mode, when an
 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
 Org file is being visited.  The first set of options deals with the

+ 1 - 1
doc/orgcard.tex

@@ -454,7 +454,7 @@ formula, \kbd{:=} a field formula.
 \key{jump back to last followed link(s)}{C-c \&}
 \key{jump back to last followed link(s)}{C-c \&}
 \key{Find next link}{C-c C-x C-n}
 \key{Find next link}{C-c C-x C-n}
 \key{Find previous link}{C-c C-x C-p}
 \key{Find previous link}{C-c C-x C-p}
-
+\key{Edit code snippet of file at point}{C-c '}
 {\bf Internal Links}
 {\bf Internal Links}
 
 
 \key{\kbd{<<My Target>>}}{\rm target}
 \key{\kbd{<<My Target>>}}{\rm target}

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2008-05-27  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org-exp.el (org-export-html-style): Changed the size of in the
+	<pre> element to 90%.
+
 2008-05-26  Carsten Dominik  <dominik@science.uva.nl>
 2008-05-26  Carsten Dominik  <dominik@science.uva.nl>
 
 
 	* org.el (org-find-src-example-start): Function removed.
 	* org.el (org-find-src-example-start): Function removed.

+ 5 - 1
lisp/org-exp.el

@@ -464,6 +464,7 @@ Org-mode file."
 	background-color: #F3F5F7;
 	background-color: #F3F5F7;
 	padding: 5pt;
 	padding: 5pt;
 	font-family: courier, monospace;
 	font-family: courier, monospace;
+        font-size: 90%;
   }
   }
   table { border-collapse: collapse; }
   table { border-collapse: collapse; }
   td, th {
   td, th {
@@ -1359,7 +1360,7 @@ on this string to produce the exported version."
 	(while (re-search-forward "^#\\+BEGIN_EXAMPLE[ \t]*\n" nil t)
 	(while (re-search-forward "^#\\+BEGIN_EXAMPLE[ \t]*\n" nil t)
 	  (goto-char (match-end 0))
 	  (goto-char (match-end 0))
 	  (while (not (looking-at "#\\+END_EXAMPLE"))
 	  (while (not (looking-at "#\\+END_EXAMPLE"))
-	    (insert ": ")
+	    (insert ":  ")
 	    (beginning-of-line 2)))
 	    (beginning-of-line 2)))
 	(goto-char (point-min))
 	(goto-char (point-min))
 	(while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t)
 	(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"))))
 	  (concat "#+BEGIN_HTML\n" htmltext "\n#+END_HTML\n"))))
      (t
      (t
       ;; This is not HTML, so just make it an example.
       ;; 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
       (concat "#+BEGIN_EXAMPLE\n" code
 	      (if (string-match "\n\\'" code) "" "\n")
 	      (if (string-match "\n\\'" code) "" "\n")
 	      "#+END_EXAMPLE\n")))))
 	      "#+END_EXAMPLE\n")))))

+ 12 - 7
lisp/org.el

@@ -12710,14 +12710,19 @@ See the individual commands for more information."
 (defun org-edit-special ()
 (defun org-edit-special ()
   "Call a special editor for the stuff at point.
   "Call a special editor for the stuff at point.
 When at a table, call the formula editor with `org-table-edit-formulas'.
 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)
   (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]*<include\\>.*?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)
 (defun org-ctrl-c-ctrl-c (&optional arg)
   "Set tags in headline, or update according to changed information at point.
   "Set tags in headline, or update according to changed information at point.