Browse Source

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

Dan Davison 14 years ago
parent
commit
68b810dab5
11 changed files with 65 additions and 30 deletions
  1. 14 11
      doc/org.texi
  2. 2 1
      lisp/ob-R.el
  3. 1 1
      lisp/ob-latex.el
  4. 1 1
      lisp/ob-ref.el
  5. 4 2
      lisp/ob.el
  6. 29 0
      lisp/org-compat.el
  7. 4 4
      lisp/org-inlinetask.el
  8. 6 6
      lisp/org-latex.el
  9. 1 1
      lisp/org-list.el
  10. 1 1
      lisp/org-taskjuggler.el
  11. 2 2
      lisp/org.el

+ 14 - 11
doc/org.texi

@@ -456,6 +456,7 @@ Using header arguments
 * Buffer-wide header arguments::  Set default values for a specific buffer
 * Buffer-wide header arguments::  Set default values for a specific buffer
 * Header arguments in Org-mode properties::  Set default values for a buffer or heading
 * Header arguments in Org-mode properties::  Set default values for a buffer or heading
 * Code block specific header arguments::  The most common way to set values
 * Code block specific header arguments::  The most common way to set values
+* Header arguments in function calls::  The most specific level
 
 
 Specific header arguments
 Specific header arguments
 
 
@@ -1072,18 +1073,15 @@ the content of that line is made the new heading.  If the command is
 used at the end of a folded subtree (i.e. behind the ellipses at the end
 used at the end of a folded subtree (i.e. behind the ellipses at the end
 of a headline), then a headline like the current one will be inserted
 of a headline), then a headline like the current one will be inserted
 after the end of the subtree.
 after the end of the subtree.
-@kindex C-@key{RET}
-@item C-@key{RET}
+@orgcmd{C-@key{RET},org-insert-heading-respect-content}
 Just like @kbd{M-@key{RET}}, except when adding a new heading below the
 Just like @kbd{M-@key{RET}}, except when adding a new heading below the
 current heading, the new heading is placed after the body instead of before
 current heading, the new heading is placed after the body instead of before
 it.  This command works from anywhere in the entry.
 it.  This command works from anywhere in the entry.
-@kindex M-S-@key{RET}
-@item M-S-@key{RET}
+@orgcmd{M-S-@key{RET},org-insert-todo-heading}
 @vindex org-treat-insert-todo-heading-as-state-change
 @vindex org-treat-insert-todo-heading-as-state-change
 Insert new TODO entry with same level as current heading.  See also the
 Insert new TODO entry with same level as current heading.  See also the
 variable @code{org-treat-insert-todo-heading-as-state-change}.
 variable @code{org-treat-insert-todo-heading-as-state-change}.
-@kindex C-S-@key{RET}
-@item C-S-@key{RET}
+@orgcmd{C-S-@key{RET},org-insert-todo-heading-respect-content}
 Insert new TODO entry with same level as current heading.  Like
 Insert new TODO entry with same level as current heading.  Like
 @kbd{C-@key{RET}}, the new headline will be inserted after the current
 @kbd{C-@key{RET}}, the new headline will be inserted after the current
 subtree.
 subtree.
@@ -11299,7 +11297,7 @@ Code blocks defined in the ``Library of Babel'' can be called remotely as if
 they were in the current Org-mode buffer (see @ref{Evaluating code blocks}
 they were in the current Org-mode buffer (see @ref{Evaluating code blocks}
 for information on the syntax of remote code block evaluation).
 for information on the syntax of remote code block evaluation).
 
 
-@kindex C-c C-v l
+@kindex C-c C-v i
 Code blocks located in any Org-mode file can be loaded into the ``Library of
 Code blocks located in any Org-mode file can be loaded into the ``Library of
 Babel'' with the @code{org-babel-lob-ingest} function, bound to @kbd{C-c C-v
 Babel'' with the @code{org-babel-lob-ingest} function, bound to @kbd{C-c C-v
 i}.
 i}.
@@ -11378,7 +11376,7 @@ describes each header argument in detail.
 @node Using header arguments, Specific header arguments, Header arguments, Header arguments
 @node Using header arguments, Specific header arguments, Header arguments, Header arguments
 @subsection Using header arguments
 @subsection Using header arguments
 
 
-The values of header arguments can be set in five different ways, each more
+The values of header arguments can be set in six different ways, each more
 specific (and having higher priority) than the last.
 specific (and having higher priority) than the last.
 @menu
 @menu
 * System-wide header arguments::  Set global default values
 * System-wide header arguments::  Set global default values
@@ -11386,6 +11384,7 @@ specific (and having higher priority) than the last.
 * Buffer-wide header arguments::  Set default values for a specific buffer
 * Buffer-wide header arguments::  Set default values for a specific buffer
 * Header arguments in Org-mode properties::  Set default values for a buffer or heading
 * Header arguments in Org-mode properties::  Set default values for a buffer or heading
 * Code block specific header arguments::  The most common way to set values
 * Code block specific header arguments::  The most common way to set values
+* Header arguments in function calls::  The most specific level
 @end menu
 @end menu
 
 
 
 
@@ -11480,7 +11479,7 @@ Properties defined in this way override the properties set in
 @code{org-set-property} function bound to @kbd{C-c C-x p} to set properties
 @code{org-set-property} function bound to @kbd{C-c C-x p} to set properties
 in Org-mode documents.
 in Org-mode documents.
 
 
-@node Code block specific header arguments,  , Header arguments in Org-mode properties, Using header arguments
+@node Code block specific header arguments, Header arguments in function calls, Header arguments in Org-mode properties, Using header arguments
 @subsubheading Code block specific header arguments
 @subsubheading Code block specific header arguments
 
 
 The most common way to assign values to header arguments is at the
 The most common way to assign values to header arguments is at the
@@ -11501,14 +11500,18 @@ fac 0 = 1
 fac n = n * fac (n-1)
 fac n = n * fac (n-1)
 #+end_src
 #+end_src
 @end example
 @end example
-
 Similarly, it is possible to set header arguments for inline code blocks:
 Similarly, it is possible to set header arguments for inline code blocks:
 
 
 @example
 @example
 src_haskell[:exports both]@{fac 5@}
 src_haskell[:exports both]@{fac 5@}
 @end example
 @end example
 
 
-Header arguments for ``Library of Babel'' or function call lines can be set as shown below:
+@node Header arguments in function calls,  , Code block specific header arguments, Using header arguments
+@comment  node-name,  next,  previous,  up
+@subsubheading Header arguments in function calls
+
+At the most specific level, header arguments for ``Library of Babel'' or
+function call lines can be set as shown below:
 
 
 @example
 @example
 #+call: factorial(n=5) :exports results
 #+call: factorial(n=5) :exports results

+ 2 - 1
lisp/ob-R.el

@@ -38,6 +38,7 @@
 (declare-function inferior-ess-send-input "ext:ess-inf" ())
 (declare-function inferior-ess-send-input "ext:ess-inf" ())
 (declare-function ess-make-buffer-current "ext:ess-inf" ())
 (declare-function ess-make-buffer-current "ext:ess-inf" ())
 (declare-function ess-eval-buffer "ext:ess-inf" (vis))
 (declare-function ess-eval-buffer "ext:ess-inf" (vis))
+(declare-function org-number-sequence "org-compat" (from &optional to inc))
 
 
 (defconst org-babel-header-arg-names:R
 (defconst org-babel-header-arg-names:R
   '(width height bg units pointsize antialias quality compression
   '(width height bg units pointsize antialias quality compression
@@ -61,7 +62,7 @@
 			 (cdr (nth i (nth 1 processed-params)))
 			 (cdr (nth i (nth 1 processed-params)))
 			 (cdr (nth i (nth 4 processed-params)))
 			 (cdr (nth i (nth 4 processed-params)))
 			 (cdr (nth i (nth 5 processed-params))))))
 			 (cdr (nth i (nth 5 processed-params))))))
-		(number-sequence 0 (1- (length (nth 1 processed-params))))))
+		(org-number-sequence 0 (1- (length (nth 1 processed-params))))))
          (out-file (cdr (assoc :file params))))
          (out-file (cdr (assoc :file params))))
     (mapconcat ;; define any variables
     (mapconcat ;; define any variables
      #'org-babel-trim
      #'org-babel-trim

+ 1 - 1
lisp/ob-latex.el

@@ -150,7 +150,7 @@ Extracted from `org-export-as-pdf' in org-latex.el."
 		     (save-match-data
 		     (save-match-data
 		       (shell-quote-argument output-dir))
 		       (shell-quote-argument output-dir))
 		     t t cmd)))
 		     t t cmd)))
-	(shell-command cmd outbuf outbuf)))
+	(shell-command cmd outbuf)))
     (message (concat "Processing LaTeX file " file "...done"))
     (message (concat "Processing LaTeX file " file "...done"))
     (if (not (file-exists-p pdffile))
     (if (not (file-exists-p pdffile))
 	(error (concat "PDF file " pdffile " was not produced"))
 	(error (concat "PDF file " pdffile " was not produced"))

+ 1 - 1
lisp/ob-ref.el

@@ -199,7 +199,7 @@ to \"0:-1\"."
             (if (or (= 0 (length portion)) (string-match ind-re portion))
             (if (or (= 0 (length portion)) (string-match ind-re portion))
                 (mapcar
                 (mapcar
 		 (lambda (n) (nth n lis))
 		 (lambda (n) (nth n lis))
-		 (apply 'number-sequence
+		 (apply 'org-number-sequence
 			(if (and (> (length portion) 0) (match-string 2 portion))
 			(if (and (> (length portion) 0) (match-string 2 portion))
 			    (list
 			    (list
 			     (wrap (string-to-number (match-string 2 portion)))
 			     (wrap (string-to-number (match-string 2 portion)))

+ 4 - 2
lisp/ob.el

@@ -72,6 +72,7 @@
 (declare-function org-babel-ref-resolve-reference "ob-ref"
 (declare-function org-babel-ref-resolve-reference "ob-ref"
 		  (ref &optional params))
 		  (ref &optional params))
 (declare-function org-babel-lob-execute-maybe "ob-lob" ())
 (declare-function org-babel-lob-execute-maybe "ob-lob" ())
+(declare-function org-number-sequence "org-compat" (from &optional to inc))
 
 
 (defgroup org-babel nil
 (defgroup org-babel nil
   "Code block evaluation and management in `org-mode' documents."
   "Code block evaluation and management in `org-mode' documents."
@@ -263,7 +264,8 @@ specific header arguments as well.")
   '((:session . "none") (:results . "silent") (:exports . "results"))
   '((:session . "none") (:results . "silent") (:exports . "results"))
   "Default arguments to use when evaluating an inline source block.")
   "Default arguments to use when evaluating an inline source block.")
 
 
-(defvar org-babel-current-buffer-properties)
+(defvar org-babel-current-buffer-properties nil
+  "Local cache for buffer properties.")
 (make-variable-buffer-local 'org-babel-current-buffer-properties)
 (make-variable-buffer-local 'org-babel-current-buffer-properties)
 
 
 (defvar org-babel-result-regexp
 (defvar org-babel-result-regexp
@@ -1229,7 +1231,7 @@ following the source block."
 		     (if indent
 		     (if indent
 			 (mapconcat
 			 (mapconcat
 			  (lambda (el) " ")
 			  (lambda (el) " ")
-			  (number-sequence 1 indent) "")
+			  (org-number-sequence 1 indent) "")
 		       "")
 		       "")
 		     "#+results"
 		     "#+results"
 		     (when hash (concat "["hash"]"))
 		     (when hash (concat "["hash"]"))

+ 29 - 0
lisp/org-compat.el

@@ -162,6 +162,15 @@ If DELETE is non-nil, delete all those overlays."
       (let ((x (org-get-x-clipboard-compat value)))
       (let ((x (org-get-x-clipboard-compat value)))
 	(if x (org-no-properties x)))))
 	(if x (org-no-properties x)))))
 
 
+(defsubst org-decompose-region (beg end)
+  "Decompose from BEG to END."
+  (if (featurep 'xemacs)
+      (let ((modified-p (buffer-modified-p))
+	    (buffer-read-only nil))
+	(remove-text-properties beg end '(composition nil))
+	(set-buffer-modified-p modified-p))
+    (decompose-region beg end)))
+
 ;; Miscellaneous functions
 ;; Miscellaneous functions
 
 
 (defun org-add-hook (hook function &optional append local)
 (defun org-add-hook (hook function &optional append local)
@@ -197,6 +206,26 @@ ignored in this case."
 	 (shrink-window-if-larger-than-buffer window)))
 	 (shrink-window-if-larger-than-buffer window)))
   (or window (selected-window)))
   (or window (selected-window)))
 
 
+(defun org-number-sequence (from &optional to inc)
+  "Call `number-sequence or emulate it."
+  (if (fboundp 'number-sequence)
+      (number-sequence from to inc)
+    (if (or (not to) (= from to))
+	(list from)
+      (or inc (setq inc 1))
+      (when (zerop inc) (error "The increment can not be zero"))
+      (let (seq (n 0) (next from))
+	(if (> inc 0)
+	    (while (<= next to)
+	      (setq seq (cons next seq)
+		    n (1+ n)
+		    next (+ from (* n inc))))
+	  (while (>= next to)
+	    (setq seq (cons next seq)
+		  n (1+ n)
+		  next (+ from (* n inc)))))
+	(nreverse seq)))))
+
 ;; Region compatibility
 ;; Region compatibility
 
 
 (defvar org-ignore-region nil
 (defvar org-ignore-region nil

+ 4 - 4
lisp/org-inlinetask.el

@@ -106,7 +106,7 @@ When nil, they will not be exported."
 (defvar org-complex-heading-regexp)
 (defvar org-complex-heading-regexp)
 (defvar org-property-end-re)
 (defvar org-property-end-re)
 
 
-(defcustom org-inlinetask-defaut-state nil
+(defcustom org-inlinetask-default-state nil
   "Non-nil means make inline tasks have a TODO keyword initially.
   "Non-nil means make inline tasks have a TODO keyword initially.
 This should be the state `org-inlinetask-insert-task' should use by
 This should be the state `org-inlinetask-insert-task' should use by
 default, or nil of no state should be assigned."
 default, or nil of no state should be assigned."
@@ -117,16 +117,16 @@ default, or nil of no state should be assigned."
 
 
 (defun org-inlinetask-insert-task (&optional no-state)
 (defun org-inlinetask-insert-task (&optional no-state)
   "Insert an inline task.
   "Insert an inline task.
-If prefix arg NO-STATE is set, ignore `org-inlinetask-defaut-state'."
+If prefix arg NO-STATE is set, ignore `org-inlinetask-default-state'."
   (interactive "P")
   (interactive "P")
   (or (bolp) (newline))
   (or (bolp) (newline))
   (let ((indent org-inlinetask-min-level))
   (let ((indent org-inlinetask-min-level))
     (if org-odd-levels-only
     (if org-odd-levels-only
         (setq indent (- (* 2 indent) 1)))
         (setq indent (- (* 2 indent) 1)))
     (insert (make-string indent ?*)
     (insert (make-string indent ?*)
-            (if (or no-state (not org-inlinetask-defaut-state))
+            (if (or no-state (not org-inlinetask-default-state))
 		" \n"
 		" \n"
-	      (concat " " org-inlinetask-defaut-state " \n"))
+	      (concat " " org-inlinetask-default-state " \n"))
             (make-string indent ?*) " END\n"))
             (make-string indent ?*) " END\n"))
   (end-of-line -1))
   (end-of-line -1))
 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task)
 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task)

+ 6 - 6
lisp/org-latex.el

@@ -534,21 +534,21 @@ This function should accept the file name as its single argument."
 	  (repeat :tag "Shell command sequence"
 	  (repeat :tag "Shell command sequence"
 		  (string :tag "Shell command"))
 		  (string :tag "Shell command"))
 	  (const :tag "2 runs of pdflatex"
 	  (const :tag "2 runs of pdflatex"
-		 '("pdflatex -interaction nonstopmode -output-directory %o %f"
+		 ("pdflatex -interaction nonstopmode -output-directory %o %f"
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"))
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"))
 	  (const :tag "3 runs of pdflatex"
 	  (const :tag "3 runs of pdflatex"
-		 '("pdflatex -interaction nonstopmode -output-directory %o %f"
+		 ("pdflatex -interaction nonstopmode -output-directory %o %f"
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"))
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"))
 	  (const :tag "pdflatex,bibtex,pdflatex,pdflatex"
 	  (const :tag "pdflatex,bibtex,pdflatex,pdflatex"
-		 '("pdflatex -interaction nonstopmode -output-directory %o %f"
+		 ("pdflatex -interaction nonstopmode -output-directory %o %f"
 		   "bibtex %b"
 		   "bibtex %b"
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"))
 		   "pdflatex -interaction nonstopmode -output-directory %o %f"))
 	  (const :tag "texi2dvi"
 	  (const :tag "texi2dvi"
-		 '("texi2dvi -p -b -c -V %f"))
+		 ("texi2dvi -p -b -c -V %f"))
 	  (const :tag "rubber"
 	  (const :tag "rubber"
-		 '("rubber -d --into %o %f"))
+		 ("rubber -d --into %o %f"))
 	  (function)))
 	  (function)))
 
 
 (defcustom org-export-pdf-logfiles
 (defcustom org-export-pdf-logfiles
@@ -944,7 +944,7 @@ when PUB-DIR is set, use this as the publishing directory."
 		     (save-match-data
 		     (save-match-data
 		       (shell-quote-argument output-dir))
 		       (shell-quote-argument output-dir))
 		     t t cmd)))
 		     t t cmd)))
-	(shell-command cmd outbuf outbuf)))
+	(shell-command cmd outbuf)))
     (message (concat "Processing LaTeX file " file "...done"))
     (message (concat "Processing LaTeX file " file "...done"))
     (setq errors (org-export-latex-get-error outbuf))
     (setq errors (org-export-latex-get-error outbuf))
     (if (not (file-exists-p pdffile))
     (if (not (file-exists-p pdffile))

+ 1 - 1
lisp/org-list.el

@@ -343,7 +343,7 @@ Arguments SEARCH, RE, BOUND and NOERR are similar to those in
       (while t
       (while t
 	;; 1. No match: return to origin or bound, depending on NOERR.
 	;; 1. No match: return to origin or bound, depending on NOERR.
 	(unless (funcall search re bound noerr)
 	(unless (funcall search re bound noerr)
-	  (throw 'exit (and (goto-char (if (booleanp noerr) origin bound))
+	  (throw 'exit (and (goto-char (if (memq noerr '(t nil)) origin bound))
 			    nil)))
 			    nil)))
 	;; 2. Match not in block or protected: return point. Else
 	;; 2. Match not in block or protected: return point. Else
 	;; skip the block and carry on.
 	;; skip the block and carry on.

+ 1 - 1
lisp/org-taskjuggler.el

@@ -503,7 +503,7 @@ finally add more underscore characters (\"_\")."
 	 (parts (split-string headline))
 	 (parts (split-string headline))
 	 (id (org-taskjuggler-clean-id (downcase (pop parts)))))
 	 (id (org-taskjuggler-clean-id (downcase (pop parts)))))
     ; try to add more parts of the headline to make it unique
     ; try to add more parts of the headline to make it unique
-    (while (member id unique-ids)
+    (while (and (member id unique-ids) (car parts))
       (setq id (concat id "_" (org-taskjuggler-clean-id (downcase (pop parts))))))
       (setq id (concat id "_" (org-taskjuggler-clean-id (downcase (pop parts))))))
     ; if its still not unique add "_"
     ; if its still not unique add "_"
     (while (member id unique-ids)
     (while (member id unique-ids)

+ 2 - 2
lisp/org.el

@@ -5543,7 +5543,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
       (message "Entities are displayed as UTF8 characers")
       (message "Entities are displayed as UTF8 characers")
     (save-restriction
     (save-restriction
       (widen)
       (widen)
-      (decompose-region (point-min) (point-max))
+      (org-decompose-region (point-min) (point-max))
       (message "Entities are displayed plain"))))
       (message "Entities are displayed plain"))))
 
 
 (defun org-fontify-entities (limit)
 (defun org-fontify-entities (limit)
@@ -5643,7 +5643,7 @@ If KWD is a number, get the corresponding match group."
 	 (inhibit-read-only t) (inhibit-point-motion-hooks t)
 	 (inhibit-read-only t) (inhibit-point-motion-hooks t)
 	 (inhibit-modification-hooks t)
 	 (inhibit-modification-hooks t)
 	 deactivate-mark buffer-file-name buffer-file-truename)
 	 deactivate-mark buffer-file-name buffer-file-truename)
-    (decompose-region beg end)
+    (org-decompose-region beg end)
     (remove-text-properties
     (remove-text-properties
      beg end
      beg end
      (if org-indent-mode
      (if org-indent-mode