diff --git a/doc/org.texi b/doc/org.texi index bd22ce9cb..637eee9f7 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -456,6 +456,7 @@ Using header arguments * 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 * Code block specific header arguments:: The most common way to set values +* Header arguments in function calls:: The most specific level 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 of a headline), then a headline like the current one will be inserted 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 current heading, the new heading is placed after the body instead of before 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 Insert new TODO entry with same level as current heading. See also the 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 @kbd{C-@key{RET}}, the new headline will be inserted after the current 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} 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 Babel'' with the @code{org-babel-lob-ingest} function, bound to @kbd{C-c C-v i}. @@ -11378,7 +11376,7 @@ describes each header argument in detail. @node Using header arguments, Specific header arguments, Header arguments, 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. @menu * 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 * 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 +* Header arguments in function calls:: The most specific level @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 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 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) #+end_src @end example - Similarly, it is possible to set header arguments for inline code blocks: @example src_haskell[:exports both]@{fac 5@} @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 #+call: factorial(n=5) :exports results diff --git a/lisp/ob-R.el b/lisp/ob-R.el index c709064c3..ea4df18fd 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -38,6 +38,7 @@ (declare-function inferior-ess-send-input "ext:ess-inf" ()) (declare-function ess-make-buffer-current "ext:ess-inf" ()) (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 '(width height bg units pointsize antialias quality compression @@ -61,7 +62,7 @@ (cdr (nth i (nth 1 processed-params))) (cdr (nth i (nth 4 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)))) (mapconcat ;; define any variables #'org-babel-trim diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index dde3eae20..f9960495e 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -150,7 +150,7 @@ Extracted from `org-export-as-pdf' in org-latex.el." (save-match-data (shell-quote-argument output-dir)) t t cmd))) - (shell-command cmd outbuf outbuf))) + (shell-command cmd outbuf))) (message (concat "Processing LaTeX file " file "...done")) (if (not (file-exists-p pdffile)) (error (concat "PDF file " pdffile " was not produced")) diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el index 99960c869..e96bf3b2e 100644 --- a/lisp/ob-ref.el +++ b/lisp/ob-ref.el @@ -199,7 +199,7 @@ to \"0:-1\"." (if (or (= 0 (length portion)) (string-match ind-re portion)) (mapcar (lambda (n) (nth n lis)) - (apply 'number-sequence + (apply 'org-number-sequence (if (and (> (length portion) 0) (match-string 2 portion)) (list (wrap (string-to-number (match-string 2 portion))) diff --git a/lisp/ob.el b/lisp/ob.el index d3bd76628..ff3f920c6 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -72,6 +72,7 @@ (declare-function org-babel-ref-resolve-reference "ob-ref" (ref &optional params)) (declare-function org-babel-lob-execute-maybe "ob-lob" ()) +(declare-function org-number-sequence "org-compat" (from &optional to inc)) (defgroup org-babel nil "Code block evaluation and management in `org-mode' documents." @@ -263,7 +264,8 @@ specific header arguments as well.") '((:session . "none") (:results . "silent") (:exports . "results")) "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) (defvar org-babel-result-regexp @@ -1229,7 +1231,7 @@ following the source block." (if indent (mapconcat (lambda (el) " ") - (number-sequence 1 indent) "") + (org-number-sequence 1 indent) "") "") "#+results" (when hash (concat "["hash"]")) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 4383bec67..e7e4fa3d1 100644 --- a/lisp/org-compat.el +++ b/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))) (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 (defun org-add-hook (hook function &optional append local) @@ -197,6 +206,26 @@ ignored in this case." (shrink-window-if-larger-than-buffer 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 (defvar org-ignore-region nil diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index 29b154431..041ee2914 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -106,7 +106,7 @@ When nil, they will not be exported." (defvar org-complex-heading-regexp) (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. This should be the state `org-inlinetask-insert-task' should use by 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) "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") (or (bolp) (newline)) (let ((indent org-inlinetask-min-level)) (if org-odd-levels-only (setq indent (- (* 2 indent) 1))) (insert (make-string indent ?*) - (if (or no-state (not org-inlinetask-defaut-state)) + (if (or no-state (not org-inlinetask-default-state)) " \n" - (concat " " org-inlinetask-defaut-state " \n")) + (concat " " org-inlinetask-default-state " \n")) (make-string indent ?*) " END\n")) (end-of-line -1)) (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 4cbc031ff..4fcbbb7d6 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -534,21 +534,21 @@ This function should accept the file name as its single argument." (repeat :tag "Shell command sequence" (string :tag "Shell command")) (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")) (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")) (const :tag "pdflatex,bibtex,pdflatex,pdflatex" - '("pdflatex -interaction nonstopmode -output-directory %o %f" + ("pdflatex -interaction nonstopmode -output-directory %o %f" "bibtex %b" "pdflatex -interaction nonstopmode -output-directory %o %f" "pdflatex -interaction nonstopmode -output-directory %o %f")) (const :tag "texi2dvi" - '("texi2dvi -p -b -c -V %f")) + ("texi2dvi -p -b -c -V %f")) (const :tag "rubber" - '("rubber -d --into %o %f")) + ("rubber -d --into %o %f")) (function))) (defcustom org-export-pdf-logfiles @@ -944,7 +944,7 @@ when PUB-DIR is set, use this as the publishing directory." (save-match-data (shell-quote-argument output-dir)) t t cmd))) - (shell-command cmd outbuf outbuf))) + (shell-command cmd outbuf))) (message (concat "Processing LaTeX file " file "...done")) (setq errors (org-export-latex-get-error outbuf)) (if (not (file-exists-p pdffile)) diff --git a/lisp/org-list.el b/lisp/org-list.el index baa89af42..737cfb128 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -343,7 +343,7 @@ Arguments SEARCH, RE, BOUND and NOERR are similar to those in (while t ;; 1. No match: return to origin or bound, depending on 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))) ;; 2. Match not in block or protected: return point. Else ;; skip the block and carry on. diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el index 23f4b6261..6367b7a39 100644 --- a/lisp/org-taskjuggler.el +++ b/lisp/org-taskjuggler.el @@ -503,7 +503,7 @@ finally add more underscore characters (\"_\")." (parts (split-string headline)) (id (org-taskjuggler-clean-id (downcase (pop parts))))) ; 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)))))) ; if its still not unique add "_" (while (member id unique-ids) diff --git a/lisp/org.el b/lisp/org.el index 17bce2532..6ea9d259f 100644 --- a/lisp/org.el +++ b/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") (save-restriction (widen) - (decompose-region (point-min) (point-max)) + (org-decompose-region (point-min) (point-max)) (message "Entities are displayed plain")))) (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-modification-hooks t) deactivate-mark buffer-file-name buffer-file-truename) - (decompose-region beg end) + (org-decompose-region beg end) (remove-text-properties beg end (if org-indent-mode