Browse Source

Massive code clean-up.

Delete trailing whitespaces.
Indent all sexps correctly.
Sentences end with double spaces.
Bastien Guerry 7 years ago
parent
commit
70dd1196d2
85 changed files with 3408 additions and 3409 deletions
  1. 19 19
      lisp/ob-C.el
  2. 2 2
      lisp/ob-R.el
  3. 1 1
      lisp/ob-asymptote.el
  4. 2 2
      lisp/ob-comint.el
  5. 1 1
      lisp/ob-css.el
  6. 6 6
      lisp/ob-emacs-lisp.el
  7. 2 2
      lisp/ob-eval.el
  8. 23 23
      lisp/ob-fortran.el
  9. 1 1
      lisp/ob-haskell.el
  10. 7 7
      lisp/ob-io.el
  11. 2 2
      lisp/ob-ledger.el
  12. 13 13
      lisp/ob-lilypond.el
  13. 2 2
      lisp/ob-lisp.el
  14. 17 17
      lisp/ob-maxima.el
  15. 3 3
      lisp/ob-mscgen.el
  16. 6 6
      lisp/ob-ocaml.el
  17. 6 6
      lisp/ob-octave.el
  18. 2 2
      lisp/ob-perl.el
  19. 3 3
      lisp/ob-picolisp.el
  20. 2 2
      lisp/ob-python.el
  21. 83 83
      lisp/ob-ref.el
  22. 5 5
      lisp/ob-ruby.el
  23. 6 6
      lisp/ob-scala.el
  24. 6 6
      lisp/ob-screen.el
  25. 1 1
      lisp/ob-sh.el
  26. 5 5
      lisp/ob-sql.el
  27. 2 2
      lisp/ob-sqlite.el
  28. 172 173
      lisp/ob.el
  29. 282 282
      lisp/org-agenda.el
  30. 8 8
      lisp/org-archive.el
  31. 50 50
      lisp/org-ascii.el
  32. 5 5
      lisp/org-attach.el
  33. 1 1
      lisp/org-bbdb.el
  34. 11 11
      lisp/org-beamer.el
  35. 15 15
      lisp/org-bibtex.el
  36. 69 69
      lisp/org-capture.el
  37. 295 295
      lisp/org-clock.el
  38. 23 23
      lisp/org-colview-xemacs.el
  39. 29 29
      lisp/org-colview.el
  40. 1 1
      lisp/org-compat.el
  41. 5 5
      lisp/org-crypt.el
  42. 23 23
      lisp/org-ctags.el
  43. 34 34
      lisp/org-datetree.el
  44. 8 8
      lisp/org-docbook.el
  45. 6 6
      lisp/org-element.el
  46. 19 19
      lisp/org-entities.el
  47. 9 9
      lisp/org-eshell.el
  48. 54 54
      lisp/org-exp-blocks.el
  49. 73 73
      lisp/org-exp.el
  50. 18 18
      lisp/org-faces.el
  51. 31 31
      lisp/org-feed.el
  52. 1 1
      lisp/org-footnote.el
  53. 45 45
      lisp/org-freemind.el
  54. 3 3
      lisp/org-gnus.el
  55. 1 1
      lisp/org-habit.el
  56. 173 173
      lisp/org-html.el
  57. 6 6
      lisp/org-icalendar.el
  58. 2 2
      lisp/org-id.el
  59. 68 68
      lisp/org-indent.el
  60. 2 2
      lisp/org-info.el
  61. 73 73
      lisp/org-inlinetask.el
  62. 39 39
      lisp/org-irc.el
  63. 63 63
      lisp/org-jsinfo.el
  64. 223 223
      lisp/org-latex.el
  65. 58 58
      lisp/org-list.el
  66. 29 29
      lisp/org-lparse.el
  67. 46 46
      lisp/org-mac-message.el
  68. 24 24
      lisp/org-macs.el
  69. 12 12
      lisp/org-mhe.el
  70. 89 89
      lisp/org-mobile.el
  71. 133 133
      lisp/org-mouse.el
  72. 15 15
      lisp/org-odt.el
  73. 22 22
      lisp/org-pcomplete.el
  74. 1 1
      lisp/org-plot.el
  75. 47 47
      lisp/org-protocol.el
  76. 40 40
      lisp/org-publish.el
  77. 16 16
      lisp/org-remember.el
  78. 5 5
      lisp/org-src.el
  79. 83 83
      lisp/org-table.el
  80. 41 41
      lisp/org-taskjuggler.el
  81. 56 56
      lisp/org-timer.el
  82. 2 2
      lisp/org-vm.el
  83. 4 4
      lisp/org-wl.el
  84. 1 1
      lisp/org-xoxo.el
  85. 516 516
      lisp/org.el

+ 19 - 19
lisp/ob-C.el

@@ -61,7 +61,7 @@ is currently being evaluated.")
   (org-babel-execute:C++ body params))
 
 (defun org-babel-execute:C++ (body params)
-    "Execute a block of C++ code with org-babel.  This function is
+  "Execute a block of C++ code with org-babel.  This function is
 called by `org-babel-execute-src-block'."
   (let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
 
@@ -116,8 +116,8 @@ or `org-babel-execute:C++'."
 	(org-babel-pick-name
 	 (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))
      (org-babel-trim
-       (org-babel-eval
-	(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
+      (org-babel-eval
+       (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
 
 (defun org-babel-C-expand (body params)
   "Expand a block of C or C++ code with org-babel according to
@@ -129,22 +129,22 @@ it's header arguments."
         (defines (org-babel-read
                   (or (cdr (assoc :defines params))
                       (org-babel-read (org-entry-get nil "defines" t))))))
-     (mapconcat 'identity
-		(list
-		 ;; includes
-		 (mapconcat
-		  (lambda (inc) (format "#include %s" inc))
-		  (if (listp includes) includes (list includes)) "\n")
-		 ;; defines
-		 (mapconcat
-		  (lambda (inc) (format "#define %s" inc))
-		  (if (listp defines) defines (list defines)) "\n")
-		 ;; variables
-		 (mapconcat 'org-babel-C-var-to-C vars "\n")
-		 ;; body
-		 (if main-p
-		     (org-babel-C-ensure-main-wrap body)
-		   body) "\n") "\n")))
+    (mapconcat 'identity
+	       (list
+		;; includes
+		(mapconcat
+		 (lambda (inc) (format "#include %s" inc))
+		 (if (listp includes) includes (list includes)) "\n")
+		;; defines
+		(mapconcat
+		 (lambda (inc) (format "#define %s" inc))
+		 (if (listp defines) defines (list defines)) "\n")
+		;; variables
+		(mapconcat 'org-babel-C-var-to-C vars "\n")
+		;; body
+		(if main-p
+		    (org-babel-C-ensure-main-wrap body)
+		  body) "\n") "\n")))
 
 (defun org-babel-C-ensure-main-wrap (body)
   "Wrap body in a \"main\" function call if none exists."

+ 2 - 2
lisp/ob-R.el

@@ -289,7 +289,7 @@ current code buffer."
   (body result-type result-params column-names-p row-names-p)
   "Evaluate BODY in external R process.
 If RESULT-TYPE equals 'output then return standard output as a
-string. If RESULT-TYPE equals 'value then return the value of the
+string.  If RESULT-TYPE equals 'value then return the value of the
 last statement in BODY, as elisp."
   (case result-type
     (value
@@ -316,7 +316,7 @@ last statement in BODY, as elisp."
   (session body result-type result-params column-names-p row-names-p)
   "Evaluate BODY in SESSION.
 If RESULT-TYPE equals 'output then return standard output as a
-string. If RESULT-TYPE equals 'value then return the value of the
+string.  If RESULT-TYPE equals 'value then return the value of the
 last statement in BODY, as elisp."
   (case result-type
     (value

+ 1 - 1
lisp/ob-asymptote.el

@@ -128,7 +128,7 @@ a variable of the same value."
 DATA is a list.  Return type as a symbol.
 
 The type is `string' if any element in DATA is
-a string. Otherwise, it is either `real', if some elements are
+a string.  Otherwise, it is either `real', if some elements are
 floats, or `int'."
   (let* ((type 'int)
 	 find-type			; for byte-compiler

+ 2 - 2
lisp/ob-comint.el

@@ -144,7 +144,7 @@ statement (not large blocks of code)."
 (defun org-babel-comint-eval-invisibly-and-wait-for-file
   (buffer file string &optional period)
   "Evaluate STRING in BUFFER invisibly.
-Don't return until FILE exists. Code in STRING must ensure that
+Don't return until FILE exists.  Code in STRING must ensure that
 FILE exists at end of evaluation."
   (unless (org-babel-comint-buffer-livep buffer)
     (error "buffer %s doesn't exist or has no process" buffer))
@@ -156,7 +156,7 @@ FILE exists at end of evaluation."
   (if (file-remote-p default-directory)
       (let (v)
 	(with-parsed-tramp-file-name default-directory nil
-	  (tramp-flush-directory-property v ""))))
+				     (tramp-flush-directory-property v ""))))
   (while (not (file-exists-p file)) (sit-for (or period 0.25))))
 
 (provide 'ob-comint)

+ 1 - 1
lisp/ob-css.el

@@ -34,7 +34,7 @@
 (defun org-babel-execute:css (body params)
   "Execute a block of CSS code.
 This function is called by `org-babel-execute-src-block'."
- body)
+  body)
 
 (defun org-babel-prep-session:css (session params)
   "Return an error if the :session header argument is set.

+ 6 - 6
lisp/ob-emacs-lisp.el

@@ -41,12 +41,12 @@
          (result-params (cdr (assoc :result-params params)))
          (print-level nil) (print-length nil)
          (body (if (> (length vars) 0)
-		    (concat "(let ("
-			    (mapconcat
-			     (lambda (var)
-			       (format "%S" (print `(,(car var) ',(cdr var)))))
-			     vars "\n      ")
-			    ")\n" body "\n)")
+		   (concat "(let ("
+			   (mapconcat
+			    (lambda (var)
+			      (format "%S" (print `(,(car var) ',(cdr var)))))
+			    vars "\n      ")
+			   ")\n" body "\n)")
 		 (concat body "\n"))))
     (if (or (member "code" result-params)
 	    (member "pp" result-params))

+ 2 - 2
lisp/ob-eval.el

@@ -64,8 +64,8 @@ STDERR with `org-babel-eval-error-notify'."
 		    (buffer-string)))
 
 (defun org-babel-shell-command-on-region (start end command
-				      &optional output-buffer replace
-				      error-buffer display-error-buffer)
+						&optional output-buffer replace
+						error-buffer display-error-buffer)
   "Execute COMMAND in an inferior shell with region as input.
 
 Fixes bugs in the emacs 23.1.1 version of `shell-command-on-region'

+ 23 - 23
lisp/ob-fortran.el

@@ -72,8 +72,8 @@
 	(org-babel-pick-name
 	 (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))
      (org-babel-trim
-       (org-babel-eval
-	(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
+      (org-babel-eval
+       (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
 
 (defun org-babel-expand-body:fortran (body params)
   "Expand a block of fortran or fortran code with org-babel according to
@@ -85,31 +85,31 @@ it's header arguments."
         (defines (org-babel-read
                   (or (cdr (assoc :defines params))
                       (org-babel-read (org-entry-get nil "defines" t))))))
-     (mapconcat 'identity
-		(list
-		 ;; includes
-		 (mapconcat
-		  (lambda (inc) (format "#include %s" inc))
-		  (if (listp includes) includes (list includes)) "\n")
-		 ;; defines
-		 (mapconcat
-		  (lambda (inc) (format "#define %s" inc))
-		  (if (listp defines) defines (list defines)) "\n")
-		 ;; body
-		 (if main-p
-		     (org-babel-fortran-ensure-main-wrap
-		      (concat
-		       ;; variables
-		       (mapconcat 'org-babel-fortran-var-to-fortran vars "\n")
-		       body) params)
-		   body) "\n") "\n")))
+    (mapconcat 'identity
+	       (list
+		;; includes
+		(mapconcat
+		 (lambda (inc) (format "#include %s" inc))
+		 (if (listp includes) includes (list includes)) "\n")
+		;; defines
+		(mapconcat
+		 (lambda (inc) (format "#define %s" inc))
+		 (if (listp defines) defines (list defines)) "\n")
+		;; body
+		(if main-p
+		    (org-babel-fortran-ensure-main-wrap
+		     (concat
+		      ;; variables
+		      (mapconcat 'org-babel-fortran-var-to-fortran vars "\n")
+		      body) params)
+		  body) "\n") "\n")))
 
 (defun org-babel-fortran-ensure-main-wrap (body params)
   "Wrap body in a \"program ... end program\" block if none exists."
   (if (string-match "^[ \t]*program[ \t]*.*" (capitalize body))
-       (let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
-	 (if vars (error "cannot use :vars if 'program' statement is present"))
-	 body)
+      (let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
+	(if vars (error "cannot use :vars if 'program' statement is present"))
+	body)
     (format "program main\n%s\nend program main\n" body)))
 
 (defun org-babel-prep-session:fortran (session params)

+ 1 - 1
lisp/ob-haskell.el

@@ -130,7 +130,7 @@ then create one.  Return the initialized session."
 	    (format "let %s = %s"
 		    (car pair)
 		    (org-babel-haskell-var-to-haskell (cdr pair))))
-   (mapcar #'cdr (org-babel-get-header params :var))))
+	  (mapcar #'cdr (org-babel-get-header params :var))))
 
 (defun org-babel-haskell-table-or-string (results)
   "Convert RESULTS to an Emacs-lisp table or string.

+ 7 - 7
lisp/ob-io.el

@@ -22,7 +22,7 @@
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
-;; Currently only supports the external execution. No session support yet.
+;; Currently only supports the external execution.  No session support yet.
 ;; :results output -- runs in scripting mode
 ;; :results output repl -- runs in repl mode
 
@@ -85,11 +85,11 @@ Emacs-lisp table, otherwise return the results as a string."
 If RESULT-TYPE equals 'output then return standard output as a string.
 If RESULT-TYPE equals 'value then return the value of the last statement
 in BODY as elisp."
-  (when session (error "Sessions are not supported for Io. Yet."))
+  (when session (error "Sessions are not supported for Io.  Yet."))
   (case result-type
-    (output 
+    (output
      (if (member "repl" result-params)
-         (org-babel-eval org-babel-io-command body) 
+         (org-babel-eval org-babel-io-command body)
        (let ((src-file (org-babel-temp-file "io-")))
          (progn (with-temp-file src-file (insert body))
                 (org-babel-eval
@@ -104,14 +104,14 @@ in BODY as elisp."
               (org-babel-eval
                (concat org-babel-io-command " " src-file) ""))))))
 
-                    
+
 (defun org-babel-prep-session:io (session params)
   "Prepare SESSION according to the header arguments specified in PARAMS."
-  (error "Sessions are not supported for Io. Yet."))
+  (error "Sessions are not supported for Io.  Yet."))
 
 (defun org-babel-io-initiate-session (&optional session)
   "If there is not a current inferior-process-buffer in SESSION
-then create.  Return the initialized session. Sessions are not 
+then create.  Return the initialized session.  Sessions are not
 supported in Io."
   nil)
 

+ 2 - 2
lisp/ob-ledger.el

@@ -52,8 +52,8 @@ called by `org-babel-execute-src-block'."
 	(out-file (org-babel-temp-file "ledger-output-")))
     (with-temp-file in-file (insert body))
     (message "%s" (concat "ledger"
-		     " -f " (org-babel-process-file-name in-file)
-		     " " cmdline))
+			  " -f " (org-babel-process-file-name in-file)
+			  " " cmdline))
     (with-output-to-string
       (shell-command (concat "ledger"
 			     " -f " (org-babel-process-file-name in-file)

+ 13 - 13
lisp/ob-lilypond.el

@@ -54,14 +54,14 @@ Default value is t")
 (defvar ly-display-pdf-post-tangle t
   "Following a successful LilyPond compilation
 ly-display-pdf-post-tangle determines whether to automate the
-drawing / redrawing of the resultant pdf. If the value is nil,
-the pdf is not automatically redrawn. Default value is t")
+drawing / redrawing of the resultant pdf.  If the value is nil,
+the pdf is not automatically redrawn.  Default value is t")
 
 (defvar ly-play-midi-post-tangle t
   "Following a successful LilyPond compilation
 ly-play-midi-post-tangle determines whether to automate the
-playing of the resultant midi file. If the value is nil,
-the midi file is not automatically played. Default value is t")
+playing of the resultant midi file.  If the value is nil,
+the midi file is not automatically played.  Default value is t")
 
 (defvar ly-OSX-ly-path
   "/Applications/lilypond.app/Contents/Resources/bin/lilypond")
@@ -77,28 +77,28 @@ the midi file is not automatically played. Default value is t")
 (defvar ly-win32-midi-path "")
 
 (defvar ly-gen-png nil
-"Image generation (png) can be turned on by default by setting
+  "Image generation (png) can be turned on by default by setting
 LY-GEN-PNG to t")
 
 (defvar ly-gen-svg nil
-"Image generation (SVG) can be turned on by default by setting
+  "Image generation (SVG) can be turned on by default by setting
 LY-GEN-SVG to t")
 
 (defvar ly-gen-html nil
-"HTML generation can be turned on by default by setting
+  "HTML generation can be turned on by default by setting
 LY-GEN-HTML to t")
 
 (defvar ly-gen-pdf nil
-"PDF generation can be turned on by default by setting
+  "PDF generation can be turned on by default by setting
 LY-GEN-PDF to t")
 
 (defvar ly-use-eps nil
-"You can force the compiler to use the EPS backend by setting
+  "You can force the compiler to use the EPS backend by setting
 LY-USE-EPS to t")
 
 (defvar ly-arrange-mode nil
   "Arrange mode is turned on by setting LY-ARRANGE-MODE
-to t. In Arrange mode the following settings are altered
+to t.  In Arrange mode the following settings are altered
 from default...
 :tangle yes,    :noweb yes
 :results silent :comments yes.
@@ -133,7 +133,7 @@ Depending on whether we are in arrange mode either:
 
 (defun ly-tangle ()
   "ob-lilypond specific tangle, attempts to invoke
-=ly-execute-tangled-ly= if tangle is successful. Also passes
+=ly-execute-tangled-ly= if tangle is successful.  Also passes
 specific arguments to =org-babel-tangle="
   (interactive)
   (if (org-babel-tangle nil "yes" "lilypond")
@@ -413,8 +413,8 @@ If TEST is non-nil, it contains a simulation of the OS for test purposes"
 
 (defun ly-get-header-args (mode)
   "Default arguments to use when evaluating a lilypond
-source block. These depend upon whether we are in arrange
-mode i.e. ARRANGE-MODE is t"
+source block.  These depend upon whether we are in arrange
+mode i.e.  ARRANGE-MODE is t"
   (cond (mode
          '((:tangle . "yes")
            (:noweb . "yes")

+ 2 - 2
lisp/ob-lisp.el

@@ -85,8 +85,8 @@ current directory string."
       (insert (org-babel-expand-body:lisp body params))
       (slime-eval `(swank:eval-and-grab-output
 		    ,(let ((dir (if (assoc :dir params)
-					    (cdr (assoc :dir params))
-					  default-directory)))
+				    (cdr (assoc :dir params))
+				  default-directory)))
 		       (format
 			(if dir (format org-babel-lisp-dir-fmt dir) "(progn %s)")
 			(buffer-substring-no-properties

+ 17 - 17
lisp/ob-maxima.el

@@ -48,21 +48,21 @@
 (defun org-babel-maxima-expand (body params)
   "Expand a block of Maxima code according to its header arguments."
   (let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
-     (mapconcat 'identity
-		(list
-		 ;; graphic output
-		 (let ((graphic-file (org-babel-maxima-graphical-output-file params)))
-		   (if graphic-file
-		       (format
-			"set_plot_option ([gnuplot_term, png]); set_plot_option ([gnuplot_out_file, %S]);"
-			graphic-file)
-		     ""))
-		 ;; variables
-		 (mapconcat 'org-babel-maxima-var-to-maxima vars "\n")
-		 ;; body
-		 body
-		 "gnuplot_close ()$")
-		"\n")))
+    (mapconcat 'identity
+	       (list
+		;; graphic output
+		(let ((graphic-file (org-babel-maxima-graphical-output-file params)))
+		  (if graphic-file
+		      (format
+		       "set_plot_option ([gnuplot_term, png]); set_plot_option ([gnuplot_out_file, %S]);"
+		       graphic-file)
+		    ""))
+		;; variables
+		(mapconcat 'org-babel-maxima-var-to-maxima vars "\n")
+		;; body
+		body
+		"gnuplot_close ()$")
+	       "\n")))
 
 (defun org-babel-execute:maxima (body params)
   "Execute a block of Maxima entries with org-babel.  This function is
@@ -110,8 +110,8 @@ of the same value."
       (setq val (symbol-name val))
       (when (= (length val) 1)
         (setq val (string-to-char val))))
-      (format "%S: %s$" var
-	      (org-babel-maxima-elisp-to-maxima val))))
+    (format "%S: %s$" var
+	    (org-babel-maxima-elisp-to-maxima val))))
 
 (defun org-babel-maxima-graphical-output-file (params)
   "Name of file to which maxima should send graphical output."

+ 3 - 3
lisp/ob-mscgen.el

@@ -24,7 +24,7 @@
 ;;; Commentary:
 ;;
 ;; This software provides EMACS org-babel export support for message
-;; sequence charts. The mscgen utility is used for processing the
+;; sequence charts.  The mscgen utility is used for processing the
 ;; sequence definition, and must therefore be installed in the system.
 ;;
 ;; Mscgen is available and documented at
@@ -64,13 +64,13 @@
 (defun org-babel-execute:mscgen (body params)
   "Execute a block of Mscgen code with Babel.
 This function is called by `org-babel-execute-src-block'.
-Default filetype is png. Modify by setting :filetype parameter to
+Default filetype is png.  Modify by setting :filetype parameter to
 mscgen supported formats."
   (let* ((out-file (or (cdr (assoc :file params)) "output.png" ))
          (filetype (or (cdr (assoc :filetype params)) "png" )))
     (unless (cdr (assoc :file params))
       (error "
-ERROR: no output file specified. Add \":file name.png\" to the src header"))
+ERROR: no output file specified.  Add \":file name.png\" to the src header"))
     (org-babel-eval (concat "mscgen -T " filetype " -o " out-file) body)
     nil)) ;; signal that output has already been written to file
 

+ 6 - 6
lisp/ob-ocaml.el

@@ -72,7 +72,7 @@
 					 (progn (setq out nil) line)
 				       (when (string-match re line)
 					 (progn (setq out t) nil))))
-				 (mapcar #'org-babel-trim (reverse raw))))))))
+				   (mapcar #'org-babel-trim (reverse raw))))))))
     (org-babel-reassemble-table
      (org-babel-ocaml-parse-output (org-babel-trim clean))
      (org-babel-pick-name
@@ -131,11 +131,11 @@ Emacs-lisp table, otherwise return the results as a string."
   "Convert RESULTS into an elisp table or string.
 If the results look like a table, then convert them into an
 Emacs-lisp table, otherwise return the results as a string."
-    (org-babel-script-escape
-     (replace-regexp-in-string
-      "\\[|" "[" (replace-regexp-in-string
-		  "|\\]" "]" (replace-regexp-in-string
-			      "; " "," results)))))
+  (org-babel-script-escape
+   (replace-regexp-in-string
+    "\\[|" "[" (replace-regexp-in-string
+		"|\\]" "]" (replace-regexp-in-string
+			    "; " "," results)))))
 
 (provide 'ob-ocaml)
 

+ 6 - 6
lisp/ob-octave.el

@@ -52,7 +52,7 @@
   to a non-nil value.")
 
 (defvar org-babel-matlab-emacs-link-wrapper-method
-   "%s
+  "%s
 if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid);
 else, save -ascii %s ans
 end
@@ -147,13 +147,13 @@ specifying a variable of the same value."
 (defun org-babel-matlab-initiate-session (&optional session params)
   "Create a matlab inferior process buffer.
 If there is not a current inferior-process-buffer in SESSION then
-create. Return the initialized session."
+create.  Return the initialized session."
   (org-babel-octave-initiate-session session params 'matlab))
 
 (defun org-babel-octave-initiate-session (&optional session params matlabp)
   "Create an octave inferior process buffer.
 If there is not a current inferior-process-buffer in SESSION then
-create. Return the initialized session."
+create.  Return the initialized session."
   (if matlabp (require 'matlab) (require 'octave-inf))
   (unless (string= session "none")
     (let ((session (or session
@@ -225,9 +225,9 @@ value of the last statement in BODY, as elisp."
 		      (message "Waiting for Matlab Emacs Link")
 		      (while (file-exists-p wait-file) (sit-for 0.01))
 		      "")) ;; matlab-shell-run-region doesn't seem to
-			   ;; make *matlab* buffer contents easily
-			   ;; available, so :results output currently
-			   ;; won't work
+		;; make *matlab* buffer contents easily
+		;; available, so :results output currently
+		;; won't work
 		(org-babel-comint-with-output
 		    (session
 		     (if matlabp

+ 2 - 2
lisp/ob-perl.el

@@ -47,7 +47,7 @@ This function is called by `org-babel-execute-src-block'."
          (result-type (cdr (assoc :result-type params)))
          (full-body (org-babel-expand-body:generic
 		     body params (org-babel-variable-assignments:perl params)))
-	(session (org-babel-perl-initiate-session session)))
+	 (session (org-babel-perl-initiate-session session)))
     (org-babel-reassemble-table
      (org-babel-perl-evaluate session full-body result-type)
      (org-babel-pick-name
@@ -82,7 +82,7 @@ specifying a var of the same value."
 
 (defun org-babel-perl-initiate-session (&optional session params)
   "Return nil because sessions are not supported by perl."
-nil)
+  nil)
 
 (defvar org-babel-perl-wrapper-method
   "

+ 3 - 3
lisp/ob-picolisp.el

@@ -25,16 +25,16 @@
 ;;; Commentary:
 
 ;; This library enables the use of PicoLisp in the multi-language
-;; programming framework Org-Babel. PicoLisp is a minimal yet
+;; programming framework Org-Babel.  PicoLisp is a minimal yet
 ;; fascinating lisp dialect and a highly productive application
 ;; framework for web-based client-server applications on top of
-;; object-oriented databases. A good way to learn PicoLisp is to first
+;; object-oriented databases.  A good way to learn PicoLisp is to first
 ;; read Paul Grahams essay "The hundred year language"
 ;; (http://www.paulgraham.com/hundred.html) and then study the various
 ;; documents and essays published in the PicoLisp wiki
 ;; (http://picolisp.com/5000/-2.html). PicoLisp is included in some
 ;; GNU/Linux Distributions, and can be downloaded here:
-;; http://software-lab.de/down.html. It ships with a picolisp-mode and
+;; http://software-lab.de/down.html.  It ships with a picolisp-mode and
 ;; a inferior-picolisp-mode for Emacs (to be found in the /lib/el/
 ;; directory).
 

+ 2 - 2
lisp/ob-python.el

@@ -201,7 +201,7 @@ open('%s', 'w').write( pprint.pformat(main()) )")
   (body &optional result-type result-params preamble)
   "Evaluate BODY in external python process.
 If RESULT-TYPE equals 'output then return standard output as a
-string. If RESULT-TYPE equals 'value then return the value of the
+string.  If RESULT-TYPE equals 'value then return the value of the
 last statement in BODY, as elisp."
   ((lambda (raw)
      (if (or (member "code" result-params)
@@ -236,7 +236,7 @@ last statement in BODY, as elisp."
   (session body &optional result-type result-params)
   "Pass BODY to the Python process in SESSION.
 If RESULT-TYPE equals 'output then return standard output as a
-string. If RESULT-TYPE equals 'value then return the value of the
+string.  If RESULT-TYPE equals 'value then return the value of the
 last statement in BODY, as elisp."
   (let* ((send-wait (lambda () (comint-send-input nil t) (sleep-for 0 5)))
 	 (dump-last-value

+ 83 - 83
lisp/ob-ref.el

@@ -120,89 +120,89 @@ the variable."
 (defun org-babel-ref-resolve (ref)
   "Resolve the reference REF and return its value."
   (save-window-excursion
-  (save-excursion
-    (let ((case-fold-search t)
-          type args new-refere new-header-args new-referent result
-	  lob-info split-file split-ref index index-row index-col id)
-      ;; if ref is indexed grab the indices -- beware nested indices
-      (when (and (string-match "\\[\\([^\\[]+\\)\\]$" ref)
-		 (let ((str (substring ref 0 (match-beginning 0))))
-		   (= (org-count ?( str) (org-count ?) str))))
-        (setq index (match-string 1 ref))
-        (setq ref (substring ref 0 (match-beginning 0))))
-      ;; assign any arguments to pass to source block
-      (when (string-match
-	     "^\\(.+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)\(\\(.*\\)\)$" ref)
-        (setq new-refere      (match-string 1 ref))
-	(setq new-header-args (match-string 3 ref))
-        (setq new-referent    (match-string 5 ref))
-        (when (> (length new-refere) 0)
-          (when (> (length new-referent) 0)
-	    (setq args (mapcar (lambda (ref) (cons :var ref))
-			       (org-babel-ref-split-args new-referent))))
-	  (when (> (length new-header-args) 0)
-	    (setq args (append (org-babel-parse-header-arguments
-				new-header-args) args)))
-          (setq ref new-refere)))
-      (when (string-match "^\\(.+\\):\\(.+\\)$" ref)
-        (setq split-file (match-string 1 ref))
-        (setq split-ref (match-string 2 ref))
-        (find-file split-file) (setq ref split-ref))
-      (save-restriction
-	(widen)
-	(goto-char (point-min))
-	(if (let ((src-rx (org-babel-named-src-block-regexp-for-name ref))
-		  (res-rx (org-babel-named-data-regexp-for-name ref)))
-	      ;; goto ref in the current buffer
-	      (or
-	       ;; check for code blocks
-	       (re-search-forward src-rx nil t)
-	       ;; check for named data
-	       (re-search-forward res-rx nil t)
-	       ;; check for local or global headlines by id
-	       (setq id (org-babel-ref-goto-headline-id ref))
-	       ;; check the Library of Babel
-	       (setq lob-info (cdr (assoc (intern ref)
-					  org-babel-library-of-babel)))))
-	    (unless (or lob-info id) (goto-char (match-beginning 0)))
-	  ;; ;; TODO: allow searching for names in other buffers
-	  ;; (setq id-loc (org-id-find ref 'marker)
-	  ;;       buffer (marker-buffer id-loc)
-	  ;;       loc (marker-position id-loc))
-	  ;; (move-marker id-loc nil)
-	  (error "reference '%s' not found in this buffer" ref))
-	(cond
-	 (lob-info (setq type 'lob))
-	 (id (setq type 'id))
-	 ((and (looking-at org-babel-src-name-regexp)
-	       (save-excursion
-		 (forward-line 1)
-		 (or (looking-at org-babel-src-block-regexp)
-		     (looking-at org-babel-multi-line-header-regexp))))
-	  (setq type 'source-block))
-	 (t (while (not (setq type (org-babel-ref-at-ref-p)))
-	      (forward-line 1)
-	      (beginning-of-line)
-	      (if (or (= (point) (point-min)) (= (point) (point-max)))
-		  (error "reference not found")))))
-	(let ((params (append args '((:results . "silent")))))
-	  (setq result
-		(case type
-		  (results-line (org-babel-read-result))
-		  (table        (org-babel-read-table))
-		  (list         (org-babel-read-list))
-		  (file         (org-babel-read-link))
-		  (source-block (org-babel-execute-src-block
-				 nil nil (if org-babel-update-intermediate
-					     nil params)))
-		  (lob          (org-babel-execute-src-block
-				 nil lob-info params))
-		  (id           (org-babel-ref-headline-body)))))
-	(if (symbolp result)
-	    (format "%S" result)
-	  (if (and index (listp result))
-	      (org-babel-ref-index-list index result)
-	    result)))))))
+    (save-excursion
+      (let ((case-fold-search t)
+	    type args new-refere new-header-args new-referent result
+	    lob-info split-file split-ref index index-row index-col id)
+	;; if ref is indexed grab the indices -- beware nested indices
+	(when (and (string-match "\\[\\([^\\[]+\\)\\]$" ref)
+		   (let ((str (substring ref 0 (match-beginning 0))))
+		     (= (org-count ?( str) (org-count ?) str))))
+	  (setq index (match-string 1 ref))
+	  (setq ref (substring ref 0 (match-beginning 0))))
+	;; assign any arguments to pass to source block
+	(when (string-match
+	       "^\\(.+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)\(\\(.*\\)\)$" ref)
+	  (setq new-refere      (match-string 1 ref))
+	  (setq new-header-args (match-string 3 ref))
+	  (setq new-referent    (match-string 5 ref))
+	  (when (> (length new-refere) 0)
+	    (when (> (length new-referent) 0)
+	      (setq args (mapcar (lambda (ref) (cons :var ref))
+				 (org-babel-ref-split-args new-referent))))
+	    (when (> (length new-header-args) 0)
+	      (setq args (append (org-babel-parse-header-arguments
+				  new-header-args) args)))
+	    (setq ref new-refere)))
+	(when (string-match "^\\(.+\\):\\(.+\\)$" ref)
+	  (setq split-file (match-string 1 ref))
+	  (setq split-ref (match-string 2 ref))
+	  (find-file split-file) (setq ref split-ref))
+	(save-restriction
+	  (widen)
+	  (goto-char (point-min))
+	  (if (let ((src-rx (org-babel-named-src-block-regexp-for-name ref))
+		    (res-rx (org-babel-named-data-regexp-for-name ref)))
+		;; goto ref in the current buffer
+		(or
+		 ;; check for code blocks
+		 (re-search-forward src-rx nil t)
+		 ;; check for named data
+		 (re-search-forward res-rx nil t)
+		 ;; check for local or global headlines by id
+		 (setq id (org-babel-ref-goto-headline-id ref))
+		 ;; check the Library of Babel
+		 (setq lob-info (cdr (assoc (intern ref)
+					    org-babel-library-of-babel)))))
+	      (unless (or lob-info id) (goto-char (match-beginning 0)))
+	    ;; ;; TODO: allow searching for names in other buffers
+	    ;; (setq id-loc (org-id-find ref 'marker)
+	    ;;       buffer (marker-buffer id-loc)
+	    ;;       loc (marker-position id-loc))
+	    ;; (move-marker id-loc nil)
+	    (error "reference '%s' not found in this buffer" ref))
+	  (cond
+	   (lob-info (setq type 'lob))
+	   (id (setq type 'id))
+	   ((and (looking-at org-babel-src-name-regexp)
+		 (save-excursion
+		   (forward-line 1)
+		   (or (looking-at org-babel-src-block-regexp)
+		       (looking-at org-babel-multi-line-header-regexp))))
+	    (setq type 'source-block))
+	   (t (while (not (setq type (org-babel-ref-at-ref-p)))
+		(forward-line 1)
+		(beginning-of-line)
+		(if (or (= (point) (point-min)) (= (point) (point-max)))
+		    (error "reference not found")))))
+	  (let ((params (append args '((:results . "silent")))))
+	    (setq result
+		  (case type
+		    (results-line (org-babel-read-result))
+		    (table        (org-babel-read-table))
+		    (list         (org-babel-read-list))
+		    (file         (org-babel-read-link))
+		    (source-block (org-babel-execute-src-block
+				   nil nil (if org-babel-update-intermediate
+					       nil params)))
+		    (lob          (org-babel-execute-src-block
+				   nil lob-info params))
+		    (id           (org-babel-ref-headline-body)))))
+	  (if (symbolp result)
+	      (format "%S" result)
+	    (if (and index (listp result))
+		(org-babel-ref-index-list index result)
+	      result)))))))
 
 (defun org-babel-ref-index-list (index lis)
   "Return the subset of LIS indexed by INDEX.

+ 5 - 5
lisp/ob-ruby.el

@@ -64,12 +64,12 @@ This function is called by `org-babel-execute-src-block'."
 		     body params (org-babel-variable-assignments:ruby params)))
          (result (if (member "xmp" result-params)
 		     (with-temp-buffer
-		     (require 'rcodetools)
-		     (insert full-body)
-		     (xmp (cdr (assoc :xmp-option params)))
-		     (buffer-string))
+		       (require 'rcodetools)
+		       (insert full-body)
+		       (xmp (cdr (assoc :xmp-option params)))
+		       (buffer-string))
 		   (org-babel-ruby-evaluate
-		      session full-body result-type result-params))))
+		    session full-body result-type result-params))))
     (org-babel-reassemble-table
      result
      (org-babel-pick-name (cdr (assoc :colname-names params))

+ 6 - 6
lisp/ob-scala.el

@@ -22,7 +22,7 @@
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
-;; Currently only supports the external execution. No session support yet.
+;; Currently only supports the external execution.  No session support yet.
 
 ;;; Requirements:
 ;; - Scala language :: http://www.scala-lang.org/
@@ -84,14 +84,14 @@ Emacs-lisp table, otherwise return the results as a string."
 If RESULT-TYPE equals 'output then return standard output as a string.
 If RESULT-TYPE equals 'value then return the value of the last statement
 in BODY as elisp."
-  (when session (error "Sessions are not supported for Scala. Yet."))
+  (when session (error "Sessions are not supported for Scala.  Yet."))
   (case result-type
     (output
      (let ((src-file (org-babel-temp-file "scala-")))
        (progn (with-temp-file src-file (insert body))
               (org-babel-eval
                (concat org-babel-scala-command " " src-file) ""))))
-    (value 
+    (value
      (let* ((src-file (org-babel-temp-file "scala-"))
             (wrapper (format org-babel-scala-wrapper-method body)))
        (with-temp-file src-file (insert wrapper))
@@ -102,14 +102,14 @@ in BODY as elisp."
         (org-babel-eval
          (concat org-babel-scala-command " " src-file) ""))))))
 
-                    
+
 (defun org-babel-prep-session:scala (session params)
   "Prepare SESSION according to the header arguments specified in PARAMS."
-  (error "Sessions are not supported for Scala. Yet."))
+  (error "Sessions are not supported for Scala.  Yet."))
 
 (defun org-babel-scala-initiate-session (&optional session)
   "If there is not a current inferior-process-buffer in SESSION
-then create.  Return the initialized session. Sessions are not 
+then create.  Return the initialized session.  Sessions are not
 supported in Scala."
   nil)
 

+ 6 - 6
lisp/ob-screen.el

@@ -23,7 +23,7 @@
 
 ;;; Commentary:
 
-;; Org-Babel support for interactive terminals. Mostly shell scripts.
+;; Org-Babel support for interactive terminals.  Mostly shell scripts.
 ;; Heavily inspired by 'eev' from Eduardo Ochs
 ;;
 ;; Adding :cmd and :terminal as header arguments
@@ -64,8 +64,8 @@ In case you want to use a different screen than one selected by your $PATH")
          (process-name (concat "org-babel: terminal (" session ")")))
     (apply 'start-process process-name "*Messages*"
            terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location
-                           "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session)
-                           ,cmd))
+		      "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session)
+		      ,cmd))
     ;; XXX: Is there a better way than the following?
     (while (not (org-babel-screen-session-socketname session))
       ;; wait until screen session is available before returning
@@ -81,8 +81,8 @@ In case you want to use a different screen than one selected by your $PATH")
         (apply 'start-process (concat "org-babel: screen (" session ")") "*Messages*"
                org-babel-screen-location
                `("-S" ,socket "-X" "eval" "msgwait 0"
-                      ,(concat "readreg z " tmpfile)
-                      "paste z"))))))
+		 ,(concat "readreg z " tmpfile)
+		 "paste z"))))))
 
 (defun org-babel-screen-session-socketname (session)
   "Check if SESSION exists by parsing output of \"screen -ls\"."
@@ -137,7 +137,7 @@ The terminal should shortly flicker."
     (message (concat "org-babel-screen: Setup "
                      (if (string-match random-string tmp-string)
                          "WORKS."
-                         "DOESN'T work.")))))
+		       "DOESN'T work.")))))
 
 (provide 'ob-screen)
 

+ 1 - 1
lisp/ob-sh.el

@@ -57,7 +57,7 @@ This function is called by `org-babel-execute-src-block'."
   (let* ((session (org-babel-sh-initiate-session
 		   (cdr (assoc :session params))))
 	 (stdin ((lambda (stdin) (when stdin (org-babel-sh-var-to-string
-					 (org-babel-ref-resolve stdin))))
+					      (org-babel-ref-resolve stdin))))
 		 (cdr (assoc :stdin params))))
          (full-body (org-babel-expand-body:generic
 		     body params (org-babel-variable-assignments:sh params))))

+ 5 - 5
lisp/ob-sql.el

@@ -90,9 +90,9 @@ This function is called by `org-babel-execute-src-block'."
 				    (org-babel-process-file-name out-file)))
 		    ('postgresql (format
 				  "psql -A -P footer=off -F \"\t\"  -f %s -o %s %s"
-				    (org-babel-process-file-name in-file)
-				    (org-babel-process-file-name out-file)
-				    (or cmdline "")))
+				  (org-babel-process-file-name in-file)
+				  (org-babel-process-file-name out-file)
+				  (or cmdline "")))
                     (t (error "no support for the %s sql engine" engine)))))
     (with-temp-file in-file
       (insert
@@ -148,8 +148,8 @@ This function is called by `org-babel-execute-src-block'."
 		      (with-temp-file data-file
 			(insert (orgtbl-to-csv
 				 val '(:fmt (lambda (el) (if (stringp el)
-							el
-						      (format "%S" el)))))))
+							     el
+							   (format "%S" el)))))))
 		      data-file)
 		    (org-babel-temp-file "sql-data-"))
 		 (if (stringp val) val (format "%S" val))))

+ 2 - 2
lisp/ob-sqlite.el

@@ -128,8 +128,8 @@ This function is called by `org-babel-execute-src-block'."
 		      (with-temp-file data-file
 			(insert (orgtbl-to-csv
 				 val '(:fmt (lambda (el) (if (stringp el)
-							el
-						      (format "%S" el)))))))
+							     el
+							   (format "%S" el)))))))
 		      data-file)
 		    (org-babel-temp-file "sqlite-data-"))
 		 (if (stringp val) val (format "%S" val))))

+ 172 - 173
lisp/ob.el

@@ -464,8 +464,8 @@ be saved in the second match data.")
   "The minimum number of lines for block output.
 If number of lines of output is equal to or exceeds this
 value, the output is placed in a #+begin_example...#+end_example
-block. Otherwise the output is marked as literal by inserting
-colons at the starts of the lines. This variable only takes
+block.  Otherwise the output is marked as literal by inserting
+colons at the starts of the lines.  This variable only takes
 effect if the :results output option is in effect.")
 
 (defvar org-babel-noweb-error-langs nil
@@ -756,7 +756,7 @@ session."
   "Initiate session for current code block.
 If called with a prefix argument then resolve any variable
 references in the header arguments and assign these variables in
-the session. Copy the body of the code block to the kill ring."
+the session.  Copy the body of the code block to the kill ring."
   (interactive "P")
   (let* ((info (or info (org-babel-get-src-block-info (not arg))))
          (lang (nth 0 info))
@@ -783,7 +783,7 @@ the session. Copy the body of the code block to the kill ring."
 ;;;###autoload
 (defun org-babel-switch-to-session (&optional arg info)
   "Switch to the session of the current code block.
-Uses `org-babel-initiate-session' to start the session. If called
+Uses `org-babel-initiate-session' to start the session.  If called
 with a prefix argument then this is passed on to
 `org-babel-initiate-session'."
   (interactive "P")
@@ -1556,7 +1556,7 @@ If the point is not on a source block then return nil."
 (defun org-babel-find-named-block (name)
   "Find a named source-code block.
 Return the location of the source block identified by source
-NAME, or nil if no such block exists. Set match data according to
+NAME, or nil if no such block exists.  Set match data according to
 org-babel-named-src-block-regexp."
   (save-excursion
     (let ((case-fold-search t)
@@ -2130,89 +2130,89 @@ parameters when merging lists."
 		      output)))
 	 params results exports tangle noweb cache vars shebang comments padline)
 
-      (mapc
-       (lambda (plist)
-	 (mapc
-	  (lambda (pair)
-	    (case (car pair)
-	      (:var
-	       (let ((name (if (listp (cdr pair))
-			       (cadr pair)
-			     (and (string-match "^\\([^= \f\t\n\r\v]+\\)[ \t]*="
-						(cdr pair))
-				  (intern (match-string 1 (cdr pair)))))))
-		 (if name
-		     (setq vars
-			   (append
-			    (if (member name (mapcar #'car vars))
-				(delq nil
-				      (mapcar
-				       (lambda (p)
-					 (unless (equal (car p) name) p))
-				       vars))
-			      vars)
-			    (list (cons name pair))))
-		   ;; if no name is given and we already have named variables
-		   ;; then assign to named variables in order
-		   (if (and vars (nth variable-index vars))
-		       (prog1 (setf (cddr (nth variable-index vars))
-				    (concat (symbol-name
-					     (car (nth variable-index vars)))
-					    "=" (cdr pair)))
-			 (incf variable-index))
-		     (error "variable \"%s\" must be assigned a default value"
-			    (cdr pair))))))
-	      (:results
+    (mapc
+     (lambda (plist)
+       (mapc
+	(lambda (pair)
+	  (case (car pair)
+	    (:var
+	     (let ((name (if (listp (cdr pair))
+			     (cadr pair)
+			   (and (string-match "^\\([^= \f\t\n\r\v]+\\)[ \t]*="
+					      (cdr pair))
+				(intern (match-string 1 (cdr pair)))))))
+	       (if name
+		   (setq vars
+			 (append
+			  (if (member name (mapcar #'car vars))
+			      (delq nil
+				    (mapcar
+				     (lambda (p)
+				       (unless (equal (car p) name) p))
+				     vars))
+			    vars)
+			  (list (cons name pair))))
+		 ;; if no name is given and we already have named variables
+		 ;; then assign to named variables in order
+		 (if (and vars (nth variable-index vars))
+		     (prog1 (setf (cddr (nth variable-index vars))
+				  (concat (symbol-name
+					   (car (nth variable-index vars)))
+					  "=" (cdr pair)))
+		       (incf variable-index))
+		   (error "variable \"%s\" must be assigned a default value"
+			  (cdr pair))))))
+	    (:results
+	     (setq results (funcall e-merge results-exclusive-groups
+				    results
+				    (split-string
+				     (let ((r (cdr pair)))
+				       (if (stringp r) r (eval r)))))))
+	    (:file
+	     (when (cdr pair)
 	       (setq results (funcall e-merge results-exclusive-groups
-				      results
-				      (split-string
-				       (let ((r (cdr pair)))
-					 (if (stringp r) r (eval r)))))))
-	      (:file
-	       (when (cdr pair)
-		 (setq results (funcall e-merge results-exclusive-groups
-					results '("file")))
-		 (unless (or (member "both" exports)
-			     (member "none" exports)
-			     (member "code" exports))
-		   (setq exports (funcall e-merge exports-exclusive-groups
-					  exports '("results"))))
-		 (setq params (cons pair (assq-delete-all (car pair) params)))))
-	      (:exports
-	       (setq exports (funcall e-merge exports-exclusive-groups
-				      exports (split-string (cdr pair)))))
-	      (:tangle ;; take the latest -- always overwrite
-	       (setq tangle (or (list (cdr pair)) tangle)))
-	      (:noweb
-	       (setq noweb (funcall e-merge
-			    '(("yes" "no" "tangle" "no-export"
-			       "strip-export" "eval"))
-			    noweb
-			    (split-string (or (cdr pair) "")))))
-	      (:cache
-	       (setq cache (funcall e-merge '(("yes" "no")) cache
+				      results '("file")))
+	       (unless (or (member "both" exports)
+			   (member "none" exports)
+			   (member "code" exports))
+		 (setq exports (funcall e-merge exports-exclusive-groups
+					exports '("results"))))
+	       (setq params (cons pair (assq-delete-all (car pair) params)))))
+	    (:exports
+	     (setq exports (funcall e-merge exports-exclusive-groups
+				    exports (split-string (cdr pair)))))
+	    (:tangle ;; take the latest -- always overwrite
+	     (setq tangle (or (list (cdr pair)) tangle)))
+	    (:noweb
+	     (setq noweb (funcall e-merge
+				  '(("yes" "no" "tangle" "no-export"
+				     "strip-export" "eval"))
+				  noweb
+				  (split-string (or (cdr pair) "")))))
+	    (:cache
+	     (setq cache (funcall e-merge '(("yes" "no")) cache
+				  (split-string (or (cdr pair) "")))))
+	    (:padline
+	     (setq padline (funcall e-merge '(("yes" "no")) padline
 				    (split-string (or (cdr pair) "")))))
-	      (:padline
-	       (setq padline (funcall e-merge '(("yes" "no")) padline
-				      (split-string (or (cdr pair) "")))))
-	      (:shebang ;; take the latest -- always overwrite
-	       (setq shebang (or (list (cdr pair)) shebang)))
-	      (:comments
-	       (setq comments (funcall e-merge '(("yes" "no")) comments
-				       (split-string (or (cdr pair) "")))))
-	      (t ;; replace: this covers e.g. :session
-	       (setq params (cons pair (assq-delete-all (car pair) params))))))
-	  plist))
-       plists)
-      (setq vars (reverse vars))
-      (while vars (setq params (cons (cons :var (cddr (pop vars))) params)))
-      (mapc
-       (lambda (hd)
-	 (let ((key (intern (concat ":" (symbol-name hd))))
-	       (val (eval hd)))
-	   (setf params (cons (cons key (mapconcat 'identity val " ")) params))))
-       '(results exports tangle noweb padline cache shebang comments))
-      params))
+	    (:shebang ;; take the latest -- always overwrite
+	     (setq shebang (or (list (cdr pair)) shebang)))
+	    (:comments
+	     (setq comments (funcall e-merge '(("yes" "no")) comments
+				     (split-string (or (cdr pair) "")))))
+	    (t ;; replace: this covers e.g. :session
+	     (setq params (cons pair (assq-delete-all (car pair) params))))))
+	plist))
+     plists)
+    (setq vars (reverse vars))
+    (while vars (setq params (cons (cons :var (cddr (pop vars))) params)))
+    (mapc
+     (lambda (hd)
+       (let ((key (intern (concat ":" (symbol-name hd))))
+	     (val (eval hd)))
+	 (setf params (cons (cons key (mapconcat 'identity val " ")) params))))
+     '(results exports tangle noweb padline cache shebang comments))
+    params))
 
 (defvar *org-babel-use-quick-and-dirty-noweb-expansion* nil
   "Set to true to use regular expressions to expand noweb references.
@@ -2279,88 +2279,88 @@ block but are passed literally to the \"example-block\"."
 		     (comment-region (point) (progn (insert text) (point)))
 		     (org-babel-trim (buffer-string)))))
 	 index source-name evaluate prefix blocks-in-buffer)
-      (with-temp-buffer
-        (insert body) (goto-char (point-min))
-        (setq index (point))
-        (while (and (re-search-forward (org-babel-noweb-wrap) nil t))
-          (save-match-data (setf source-name (match-string 1)))
-          (save-match-data (setq evaluate (string-match "\(.*\)" source-name)))
-          (save-match-data
-            (setq prefix
-                  (buffer-substring (match-beginning 0)
-                                    (save-excursion
-                                      (beginning-of-line 1) (point)))))
-          ;; add interval to new-body (removing noweb reference)
-          (goto-char (match-beginning 0))
-          (funcall nb-add (buffer-substring index (point)))
-          (goto-char (match-end 0))
-          (setq index (point))
-          (funcall nb-add
-	   (with-current-buffer parent-buffer
-	     (save-restriction
-	       (widen)
-	       (mapconcat ;; interpose PREFIX between every line
-		#'identity
-		(split-string
-		 (if evaluate
-		     (let ((raw (org-babel-ref-resolve source-name)))
-		       (if (stringp raw) raw (format "%S" raw)))
-		   (or
-		    ;; retrieve from the library of babel
-		    (nth 2 (assoc (intern source-name)
-				  org-babel-library-of-babel))
-		    ;; return the contents of headlines literally
-		    (save-excursion
-		      (when (org-babel-ref-goto-headline-id source-name)
-			(org-babel-ref-headline-body)))
-		    ;; find the expansion of reference in this buffer
-		    (let ((rx (concat rx-prefix source-name "[ \t\n]"))
-			  expansion)
-		      (save-excursion
-			(goto-char (point-min))
-			(if *org-babel-use-quick-and-dirty-noweb-expansion*
-			    (while (re-search-forward rx nil t)
-			      (let* ((i (org-babel-get-src-block-info 'light))
-				     (body (org-babel-expand-noweb-references i))
-				     (sep (or (cdr (assoc :noweb-sep (nth 2 i)))
-					      "\n"))
-				     (full (if comment
-					       ((lambda (cs)
-						  (concat (funcall c-wrap (car cs)) "\n"
-							  body "\n"
-							  (funcall c-wrap (cadr cs))))
-						(org-babel-tangle-comment-links i))
-					     body)))
-				(setq expansion (cons sep (cons full expansion)))))
-			  (org-babel-map-src-blocks nil
-			    (let ((i (org-babel-get-src-block-info 'light)))
-			      (when (equal (or (cdr (assoc :noweb-ref (nth 2 i)))
-					       (nth 4 i))
-					   source-name)
-				(let* ((body (org-babel-expand-noweb-references i))
-				       (sep (or (cdr (assoc :noweb-sep (nth 2 i)))
-						"\n"))
-				       (full (if comment
-						 ((lambda (cs)
-						    (concat (funcall c-wrap (car cs)) "\n"
-							    body "\n"
-							    (funcall c-wrap (cadr cs))))
-						  (org-babel-tangle-comment-links i))
-					       body)))
-				  (setq expansion
-					(cons sep (cons full expansion)))))))))
-		      (and expansion
-			   (mapconcat #'identity (nreverse (cdr expansion)) "")))
-		    ;; possibly raise an error if named block doesn't exist
-		    (if (member lang org-babel-noweb-error-langs)
-			(error "%s" (concat
-				     (org-babel-noweb-wrap source-name)
-				     "could not be resolved (see "
-				     "`org-babel-noweb-error-langs')"))
-		      "")))
-		 "[\n\r]") (concat "\n" prefix))))))
-        (funcall nb-add (buffer-substring index (point-max))))
-      new-body))
+    (with-temp-buffer
+      (insert body) (goto-char (point-min))
+      (setq index (point))
+      (while (and (re-search-forward (org-babel-noweb-wrap) nil t))
+	(save-match-data (setf source-name (match-string 1)))
+	(save-match-data (setq evaluate (string-match "\(.*\)" source-name)))
+	(save-match-data
+	  (setq prefix
+		(buffer-substring (match-beginning 0)
+				  (save-excursion
+				    (beginning-of-line 1) (point)))))
+	;; add interval to new-body (removing noweb reference)
+	(goto-char (match-beginning 0))
+	(funcall nb-add (buffer-substring index (point)))
+	(goto-char (match-end 0))
+	(setq index (point))
+	(funcall nb-add
+		 (with-current-buffer parent-buffer
+		   (save-restriction
+		     (widen)
+		     (mapconcat ;; interpose PREFIX between every line
+		      #'identity
+		      (split-string
+		       (if evaluate
+			   (let ((raw (org-babel-ref-resolve source-name)))
+			     (if (stringp raw) raw (format "%S" raw)))
+			 (or
+			  ;; retrieve from the library of babel
+			  (nth 2 (assoc (intern source-name)
+					org-babel-library-of-babel))
+			  ;; return the contents of headlines literally
+			  (save-excursion
+			    (when (org-babel-ref-goto-headline-id source-name)
+			      (org-babel-ref-headline-body)))
+			  ;; find the expansion of reference in this buffer
+			  (let ((rx (concat rx-prefix source-name "[ \t\n]"))
+				expansion)
+			    (save-excursion
+			      (goto-char (point-min))
+			      (if *org-babel-use-quick-and-dirty-noweb-expansion*
+				  (while (re-search-forward rx nil t)
+				    (let* ((i (org-babel-get-src-block-info 'light))
+					   (body (org-babel-expand-noweb-references i))
+					   (sep (or (cdr (assoc :noweb-sep (nth 2 i)))
+						    "\n"))
+					   (full (if comment
+						     ((lambda (cs)
+							(concat (funcall c-wrap (car cs)) "\n"
+								body "\n"
+								(funcall c-wrap (cadr cs))))
+						      (org-babel-tangle-comment-links i))
+						   body)))
+				      (setq expansion (cons sep (cons full expansion)))))
+				(org-babel-map-src-blocks nil
+				  (let ((i (org-babel-get-src-block-info 'light)))
+				    (when (equal (or (cdr (assoc :noweb-ref (nth 2 i)))
+						     (nth 4 i))
+						 source-name)
+				      (let* ((body (org-babel-expand-noweb-references i))
+					     (sep (or (cdr (assoc :noweb-sep (nth 2 i)))
+						      "\n"))
+					     (full (if comment
+						       ((lambda (cs)
+							  (concat (funcall c-wrap (car cs)) "\n"
+								  body "\n"
+								  (funcall c-wrap (cadr cs))))
+							(org-babel-tangle-comment-links i))
+						     body)))
+					(setq expansion
+					      (cons sep (cons full expansion)))))))))
+			    (and expansion
+				 (mapconcat #'identity (nreverse (cdr expansion)) "")))
+			  ;; possibly raise an error if named block doesn't exist
+			  (if (member lang org-babel-noweb-error-langs)
+			      (error "%s" (concat
+					   (org-babel-noweb-wrap source-name)
+					   "could not be resolved (see "
+					   "`org-babel-noweb-error-langs')"))
+			    "")))
+		       "[\n\r]") (concat "\n" prefix))))))
+      (funcall nb-add (buffer-substring index (point-max))))
+    new-body))
 
 (defun org-babel-clean-text-properties (text)
   "Strip all properties from text return."
@@ -2516,7 +2516,7 @@ Fixes a bug in `tramp-handle-call-process-region'."
 	    (apply 'process-file program tmpfile buffer display args)
 	  (delete-file tmpfile)))
     ;; org-babel-call-process-region-original is the original emacs
-    ;; definition. It is in scope from the let binding in
+    ;; definition.  It is in scope from the let binding in
     ;; org-babel-execute-src-block
     (apply org-babel-call-process-region-original
            start end program delete buffer display args)))
@@ -2533,10 +2533,9 @@ Fixes a bug in `tramp-handle-call-process-region'."
   "Prepare NAME to be used in an external process.
 If NAME specifies a remote location, the remote portion of the
 name is removed, since in that case the process will be executing
-remotely. The file name is then processed by
-`expand-file-name'. Unless second argument NO-QUOTE-P is non-nil,
-the file name is additionally processed by
-`shell-quote-argument'"
+remotely.  The file name is then processed by `expand-file-name'.
+Unless second argument NO-QUOTE-P is non-nil, the file name is
+additionally processed by `shell-quote-argument'"
   ((lambda (f) (if no-quote-p f (shell-quote-argument f)))
    (expand-file-name (org-babel-local-file-name name))))
 

+ 282 - 282
lisp/org-agenda.el

@@ -29,15 +29,15 @@
 ;; The functions `org-batch-agenda', `org-batch-agenda-csv', and
 ;; `org-batch-store-agenda-views' are implemented as macros to provide
 ;; a convenient way for extracting agenda information from the command
-;; line. The Lisp does not evaluate parameters of a macro call; thus
+;; line.  The Lisp does not evaluate parameters of a macro call; thus
 ;; it is not necessary to quote the parameters passed to one of those
-;; functions. E.g. you can write:
+;; functions.  E.g. you can write:
 ;;
 ;;   emacs -batch -l ~/.emacs -eval '(org-batch-agenda "a" org-agenda-span 7)'
 ;;
-;; To export an agenda spanning 7 days. If `org-batch-agenda' would
+;; To export an agenda spanning 7 days.  If `org-batch-agenda' would
 ;; have been implemented as a regular function you'd have to quote the
-;; symbol org-agenda-span. Moreover: To use a symbol as parameter
+;; symbol org-agenda-span.  Moreover: To use a symbol as parameter
 ;; value you would have to double quote the symbol.
 ;;
 ;; This is a hack, but it works even when running Org byte-compiled.
@@ -128,9 +128,9 @@ addresses the separator between the current and the previous block."
 	  (string)))
 
 (defgroup org-agenda-export nil
- "Options concerning exporting agenda views in Org-mode."
- :tag "Org Agenda Export"
- :group 'org-agenda)
+  "Options concerning exporting agenda views in Org-mode."
+  :tag "Org Agenda Export"
+  :group 'org-agenda)
 
 (defcustom org-agenda-with-colors t
   "Non-nil means use colors in agenda views."
@@ -229,9 +229,9 @@ you can \"misuse\" it to also add other text to the header.  However,
   :type 'boolean)
 
 (defgroup org-agenda-custom-commands nil
- "Options concerning agenda views in Org-mode."
- :tag "Org Agenda Custom Commands"
- :group 'org-agenda)
+  "Options concerning agenda views in Org-mode."
+  :tag "Org Agenda Custom Commands"
+  :group 'org-agenda)
 
 (defconst org-sorting-choice
   '(choice
@@ -250,116 +250,116 @@ you can \"misuse\" it to also add other text to the header.  However,
 ;; the new variable `org-agenda-tag-filter-preset'.
 (if (fboundp 'defvaralias)
     (defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset)
-    (defvaralias 'org-agenda-filter 'org-agenda-tag-filter))
+  (defvaralias 'org-agenda-filter 'org-agenda-tag-filter))
 
 (defconst org-agenda-custom-commands-local-options
-  `(repeat :tag "Local settings for this command. Remember to quote values"
+  `(repeat :tag "Local settings for this command.  Remember to quote values"
 	   (choice :tag "Setting"
-	    (list :tag "Heading for this block"
-		  (const org-agenda-overriding-header)
-		  (string :tag "Headline"))
-	    (list :tag "Files to be searched"
-		  (const org-agenda-files)
-		  (list
-		   (const :format "" quote)
-		   (repeat (file))))
-	    (list :tag "Sorting strategy"
-		  (const org-agenda-sorting-strategy)
-		  (list
-		   (const :format "" quote)
-		   (repeat
-		    ,org-sorting-choice)))
-	    (list :tag "Prefix format"
-		  (const org-agenda-prefix-format :value "  %-12:c%?-12t% s")
-		  (string))
-	    (list :tag "Number of days in agenda"
-		  (const org-agenda-span)
-		  (choice (const :tag "Day" 'day)
-			  (const :tag "Week" 'week)
-			  (const :tag "Month" 'month)
-			  (const :tag "Year" 'year)
-			  (integer :tag "Custom")))
-	    (list :tag "Fixed starting date"
-		  (const org-agenda-start-day)
-		  (string :value "2007-11-01"))
-	    (list :tag "Start on day of week"
-		  (const org-agenda-start-on-weekday)
-		  (choice :value 1
-			  (const :tag "Today" nil)
-			  (integer :tag "Weekday No.")))
-	    (list :tag "Include data from diary"
-		  (const org-agenda-include-diary)
-		  (boolean))
-	    (list :tag "Deadline Warning days"
-		  (const org-deadline-warning-days)
-		  (integer :value 1))
-	    (list :tag "Category filter preset"
-		  (const org-agenda-category-filter-preset)
-		  (list
-		   (const :format "" quote)
-		   (repeat
-		    (string :tag "+category or -category"))))
-	    (list :tag "Tags filter preset"
-		  (const org-agenda-tag-filter-preset)
-		  (list
-		   (const :format "" quote)
-		   (repeat
-		    (string :tag "+tag or -tag"))))
-	    (list :tag "Set daily/weekly entry types"
-		  (const org-agenda-entry-types)
-		  (list
-		   (const :format "" quote)
-		   (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
-			(const :deadline)
-			(const :scheduled)
-			(const :timestamp)
-			(const :sexp))))
-	    (list :tag "Standard skipping condition"
-		  :value (org-agenda-skip-function '(org-agenda-skip-entry-if))
-		  (const org-agenda-skip-function)
-		  (list
-		   (const :format "" quote)
-		   (list
-		    (choice
-		     :tag "Skipping range"
-		     (const :tag "Skip entry" org-agenda-skip-entry-if)
-		     (const :tag "Skip subtree" org-agenda-skip-subtree-if))
-		    (repeat :inline t :tag "Conditions for skipping"
-			    (choice
-			     :tag "Condition type"
-			     (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp))
-			     (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp))
-			     (list :tag "TODO state is" :inline t
-				   (const 'todo)
-				   (choice
-				    (const :tag "any not-done state" 'todo)
-				    (const :tag "any done state" 'done)
-				    (const :tag "any state" 'any)
-				    (list :tag "Keyword list"
-					  (const :format "" quote)
-					  (repeat (string :tag "Keyword")))))
-			     (list :tag "TODO state is not" :inline t
-				   (const 'nottodo)
+		   (list :tag "Heading for this block"
+			 (const org-agenda-overriding-header)
+			 (string :tag "Headline"))
+		   (list :tag "Files to be searched"
+			 (const org-agenda-files)
+			 (list
+			  (const :format "" quote)
+			  (repeat (file))))
+		   (list :tag "Sorting strategy"
+			 (const org-agenda-sorting-strategy)
+			 (list
+			  (const :format "" quote)
+			  (repeat
+			   ,org-sorting-choice)))
+		   (list :tag "Prefix format"
+			 (const org-agenda-prefix-format :value "  %-12:c%?-12t% s")
+			 (string))
+		   (list :tag "Number of days in agenda"
+			 (const org-agenda-span)
+			 (choice (const :tag "Day" 'day)
+				 (const :tag "Week" 'week)
+				 (const :tag "Month" 'month)
+				 (const :tag "Year" 'year)
+				 (integer :tag "Custom")))
+		   (list :tag "Fixed starting date"
+			 (const org-agenda-start-day)
+			 (string :value "2007-11-01"))
+		   (list :tag "Start on day of week"
+			 (const org-agenda-start-on-weekday)
+			 (choice :value 1
+				 (const :tag "Today" nil)
+				 (integer :tag "Weekday No.")))
+		   (list :tag "Include data from diary"
+			 (const org-agenda-include-diary)
+			 (boolean))
+		   (list :tag "Deadline Warning days"
+			 (const org-deadline-warning-days)
+			 (integer :value 1))
+		   (list :tag "Category filter preset"
+			 (const org-agenda-category-filter-preset)
+			 (list
+			  (const :format "" quote)
+			  (repeat
+			   (string :tag "+category or -category"))))
+		   (list :tag "Tags filter preset"
+			 (const org-agenda-tag-filter-preset)
+			 (list
+			  (const :format "" quote)
+			  (repeat
+			   (string :tag "+tag or -tag"))))
+		   (list :tag "Set daily/weekly entry types"
+			 (const org-agenda-entry-types)
+			 (list
+			  (const :format "" quote)
+			  (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
+			       (const :deadline)
+			       (const :scheduled)
+			       (const :timestamp)
+			       (const :sexp))))
+		   (list :tag "Standard skipping condition"
+			 :value (org-agenda-skip-function '(org-agenda-skip-entry-if))
+			 (const org-agenda-skip-function)
+			 (list
+			  (const :format "" quote)
+			  (list
+			   (choice
+			    :tag "Skipping range"
+			    (const :tag "Skip entry" org-agenda-skip-entry-if)
+			    (const :tag "Skip subtree" org-agenda-skip-subtree-if))
+			   (repeat :inline t :tag "Conditions for skipping"
 				   (choice
-				    (const :tag "any not-done state" 'todo)
-				    (const :tag "any done state" 'done)
-				    (const :tag "any state" 'any)
-				    (list :tag "Keyword list"
-					  (const :format "" quote)
-					  (repeat (string :tag "Keyword")))))
-			     (const :tag "scheduled" 'scheduled)
-			     (const :tag "not scheduled" 'notscheduled)
-			     (const :tag "deadline" 'deadline)
-			     (const :tag "no deadline" 'notdeadline)
-			     (const :tag "timestamp" 'timestamp)
-			     (const :tag "no timestamp" 'nottimestamp))))))
-	    (list :tag "Non-standard skipping condition"
-		  :value (org-agenda-skip-function)
-		  (const org-agenda-skip-function)
-		  (sexp :tag "Function or form (quoted!)"))
-	    (list :tag "Any variable"
-		  (variable :tag "Variable")
-		  (sexp :tag "Value (sexp)"))))
+				    :tag "Condition type"
+				    (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp))
+				    (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp))
+				    (list :tag "TODO state is" :inline t
+					  (const 'todo)
+					  (choice
+					   (const :tag "any not-done state" 'todo)
+					   (const :tag "any done state" 'done)
+					   (const :tag "any state" 'any)
+					   (list :tag "Keyword list"
+						 (const :format "" quote)
+						 (repeat (string :tag "Keyword")))))
+				    (list :tag "TODO state is not" :inline t
+					  (const 'nottodo)
+					  (choice
+					   (const :tag "any not-done state" 'todo)
+					   (const :tag "any done state" 'done)
+					   (const :tag "any state" 'any)
+					   (list :tag "Keyword list"
+						 (const :format "" quote)
+						 (repeat (string :tag "Keyword")))))
+				    (const :tag "scheduled" 'scheduled)
+				    (const :tag "not scheduled" 'notscheduled)
+				    (const :tag "deadline" 'deadline)
+				    (const :tag "no deadline" 'notdeadline)
+				    (const :tag "timestamp" 'timestamp)
+				    (const :tag "no timestamp" 'nottimestamp))))))
+		   (list :tag "Non-standard skipping condition"
+			 :value (org-agenda-skip-function)
+			 (const org-agenda-skip-function)
+			 (sexp :tag "Function or form (quoted!)"))
+		   (list :tag "Any variable"
+			 (variable :tag "Variable")
+			 (sexp :tag "Value (sexp)"))))
   "Selection of examples for agenda command settings.
 This will be spliced into the custom type of
 `org-agenda-custom-commands'.")
@@ -437,69 +437,69 @@ should provide a description for the prefix, like
   :group 'org-agenda-custom-commands
   :type `(repeat
 	  (choice :value ("x" "Describe command here" tags "" nil)
-	   (list :tag "Single command"
-		 (string :tag "Access Key(s) ")
-		 (option (string :tag "Description"))
-		 (choice
-		  (const :tag "Agenda" agenda)
-		  (const :tag "TODO list" alltodo)
-		  (const :tag "Search words" search)
-		  (const :tag "Stuck projects" stuck)
-		  (const :tag "Tags/Property match (all agenda files)" tags)
-		  (const :tag "Tags/Property match of TODO entries (all agenda files)" tags-todo)
-		  (const :tag "TODO keyword search (all agenda files)" todo)
-		  (const :tag "Tags sparse tree (current buffer)" tags-tree)
-		  (const :tag "TODO keyword tree (current buffer)" todo-tree)
-		  (const :tag "Occur tree (current buffer)" occur-tree)
-		  (sexp :tag "Other, user-defined function"))
-		 (string :tag "Match (only for some commands)")
-		 ,org-agenda-custom-commands-local-options
-		 (option (repeat :tag "Export" (file :tag "Export to"))))
-	   (list :tag "Command series, all agenda files"
-		 (string :tag "Access Key(s)")
-		 (string :tag "Description  ")
-		 (repeat :tag "Component"
-		  (choice
-		   (list :tag "Agenda"
-			 (const :format "" agenda)
-			 (const :tag "" :format "" "")
-			 ,org-agenda-custom-commands-local-options)
-		   (list :tag "TODO list (all keywords)"
-			 (const :format "" alltodo)
-			 (const :tag "" :format "" "")
-			 ,org-agenda-custom-commands-local-options)
-		   (list :tag "Search words"
-			 (const :format "" search)
-			 (string :tag "Match")
-			 ,org-agenda-custom-commands-local-options)
-		   (list :tag "Stuck projects"
-			 (const :format "" stuck)
-			 (const :tag "" :format "" "")
-			 ,org-agenda-custom-commands-local-options)
-		   (list :tag "Tags search"
-			 (const :format "" tags)
-			 (string :tag "Match")
-			 ,org-agenda-custom-commands-local-options)
-		   (list :tag "Tags search, TODO entries only"
-			 (const :format "" tags-todo)
-			 (string :tag "Match")
-			 ,org-agenda-custom-commands-local-options)
-		   (list :tag "TODO keyword search"
-			 (const :format "" todo)
-			 (string :tag "Match")
-			 ,org-agenda-custom-commands-local-options)
-		   (list :tag "Other, user-defined function"
-			 (symbol :tag "function")
-			 (string :tag "Match")
-			 ,org-agenda-custom-commands-local-options)))
-
-		 (repeat :tag "Settings for entire command set"
-			 (list (variable :tag "Any variable")
-			       (sexp :tag "Value")))
-		 (option (repeat :tag "Export" (file :tag "Export to"))))
-	   (cons :tag "Prefix key documentation"
-		 (string :tag "Access Key(s)")
-		 (string :tag "Description  ")))))
+		  (list :tag "Single command"
+			(string :tag "Access Key(s) ")
+			(option (string :tag "Description"))
+			(choice
+			 (const :tag "Agenda" agenda)
+			 (const :tag "TODO list" alltodo)
+			 (const :tag "Search words" search)
+			 (const :tag "Stuck projects" stuck)
+			 (const :tag "Tags/Property match (all agenda files)" tags)
+			 (const :tag "Tags/Property match of TODO entries (all agenda files)" tags-todo)
+			 (const :tag "TODO keyword search (all agenda files)" todo)
+			 (const :tag "Tags sparse tree (current buffer)" tags-tree)
+			 (const :tag "TODO keyword tree (current buffer)" todo-tree)
+			 (const :tag "Occur tree (current buffer)" occur-tree)
+			 (sexp :tag "Other, user-defined function"))
+			(string :tag "Match (only for some commands)")
+			,org-agenda-custom-commands-local-options
+			(option (repeat :tag "Export" (file :tag "Export to"))))
+		  (list :tag "Command series, all agenda files"
+			(string :tag "Access Key(s)")
+			(string :tag "Description  ")
+			(repeat :tag "Component"
+				(choice
+				 (list :tag "Agenda"
+				       (const :format "" agenda)
+				       (const :tag "" :format "" "")
+				       ,org-agenda-custom-commands-local-options)
+				 (list :tag "TODO list (all keywords)"
+				       (const :format "" alltodo)
+				       (const :tag "" :format "" "")
+				       ,org-agenda-custom-commands-local-options)
+				 (list :tag "Search words"
+				       (const :format "" search)
+				       (string :tag "Match")
+				       ,org-agenda-custom-commands-local-options)
+				 (list :tag "Stuck projects"
+				       (const :format "" stuck)
+				       (const :tag "" :format "" "")
+				       ,org-agenda-custom-commands-local-options)
+				 (list :tag "Tags search"
+				       (const :format "" tags)
+				       (string :tag "Match")
+				       ,org-agenda-custom-commands-local-options)
+				 (list :tag "Tags search, TODO entries only"
+				       (const :format "" tags-todo)
+				       (string :tag "Match")
+				       ,org-agenda-custom-commands-local-options)
+				 (list :tag "TODO keyword search"
+				       (const :format "" todo)
+				       (string :tag "Match")
+				       ,org-agenda-custom-commands-local-options)
+				 (list :tag "Other, user-defined function"
+				       (symbol :tag "function")
+				       (string :tag "Match")
+				       ,org-agenda-custom-commands-local-options)))
+
+			(repeat :tag "Settings for entire command set"
+				(list (variable :tag "Any variable")
+				      (sexp :tag "Value")))
+			(option (repeat :tag "Export" (file :tag "Export to"))))
+		  (cons :tag "Prefix key documentation"
+			(string :tag "Access Key(s)")
+			(string :tag "Description  ")))))
 
 (defcustom org-agenda-query-register ?o
   "The register holding the current query string.
@@ -553,9 +553,9 @@ this one will be used."
 		 (const :tag "equal" "=")))
 
 (defgroup org-agenda-skip nil
- "Options concerning skipping parts of agenda files."
- :tag "Org Agenda Skip"
- :group 'org-agenda)
+  "Options concerning skipping parts of agenda files."
+  :tag "Org Agenda Skip"
+  :group 'org-agenda)
 
 (defcustom org-agenda-skip-function-global nil
   "Function to be called at each match during agenda construction.
@@ -639,11 +639,11 @@ all      Don't show any entries with a timestamp in the global todo list.
          The idea behind this is that by setting a timestamp, you
          have already \"taken care\" of this item.
 
-This variable can also have an integer as a value. If positive (N),
-todos with a timestamp N or more days in the future will be ignored. If
+This variable can also have an integer as a value.  If positive (N),
+todos with a timestamp N or more days in the future will be ignored.  If
 negative (-N), todos with a timestamp N or more days in the past will be
-ignored. If 0, todos with a timestamp either today or in the future will
-be ignored. For example, a value of -1 will exclude todos with a
+ignored.  If 0, todos with a timestamp either today or in the future will
+be ignored.  For example, a value of -1 will exclude todos with a
 timestamp in the past (yesterday or earlier), while a value of 7 will
 exclude todos with a timestamp a week or more in the future.
 
@@ -677,7 +677,7 @@ all      Don't show any scheduled entries in the global todo list.
 
 t        Same as `all', for backward compatibility.
 
-This variable can also have an integer as a value. See
+This variable can also have an integer as a value.  See
 `org-agenda-todo-ignore-timestamp' for more details.
 
 See also `org-agenda-todo-ignore-with-date'.
@@ -718,7 +718,7 @@ all     Ignore all TODO entries that do have a deadline.
 
 t       Same as `near', for backward compatibility.
 
-This variable can also have an integer as a value. See
+This variable can also have an integer as a value.  See
 `org-agenda-todo-ignore-timestamp' for more details.
 
 See also `org-agenda-todo-ignore-with-date'.
@@ -994,11 +994,11 @@ option will be ignored."
   :type 'boolean)
 
 (defcustom org-agenda-ndays nil
-   "Number of days to include in overview display.
+  "Number of days to include in overview display.
 Should be 1 or 7.
 Obsolete, see `org-agenda-span'."
-   :group 'org-agenda-daily/weekly
-   :type 'integer)
+  :group 'org-agenda-daily/weekly
+  :type 'integer)
 
 (make-obsolete-variable 'org-agenda-ndays 'org-agenda-span "24.1")
 
@@ -1698,7 +1698,7 @@ determines if it is a foreground or a background color."
 
 (defcustom org-agenda-day-face-function nil
   "Function called to determine what face should be used to display a day.
-The only argument passed to that function is the day. It should
+The only argument passed to that function is the day.  It should
 returns a face, or nil if does not want to specify a face and let
 the normal rules apply."
   :group 'org-agenda-line-format
@@ -2039,7 +2039,7 @@ The following commands are available:
 (org-defkey org-agenda-mode-map "\C-c\C-d" 'org-agenda-deadline)
 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
   (while l (org-defkey org-agenda-mode-map
-	     (int-to-string (pop l)) 'digit-argument)))
+		       (int-to-string (pop l)) 'digit-argument)))
 
 (org-defkey org-agenda-mode-map "F" 'org-agenda-follow-mode)
 (org-defkey org-agenda-mode-map "R" 'org-agenda-clockreport-mode)
@@ -2163,7 +2163,7 @@ The following commands are available:
      ["Show some entry text" org-agenda-entry-text-mode
       :style toggle :selected org-agenda-entry-text-mode
       :active t]
-    "--"
+     "--"
      ["Show Logbook entries" org-agenda-log-mode
       :style toggle :selected org-agenda-show-log
       :active (org-agenda-check-type nil 'agenda 'timeline)
@@ -2185,7 +2185,7 @@ The following commands are available:
     ["Go To (this window)" org-agenda-switch-to t]
     ["Follow Mode" org-agenda-follow-mode
      :style toggle :selected org-agenda-follow-mode :active t]
-;    ["Tree to indirect frame" org-agenda-tree-to-indirect-buffer t]
+					;    ["Tree to indirect frame" org-agenda-tree-to-indirect-buffer t]
     "--"
     ("TODO"
      ["Cycle TODO" org-agenda-todo t]
@@ -2208,7 +2208,7 @@ The following commands are available:
      ["Mark matching regexp" org-agenda-bulk-mark-regexp t]
      ["Unmark entry" org-agenda-bulk-unmark t]
      ["Unmark all entries" org-agenda-bulk-unmark-all :active t :keys "C-u s"])
-     ["Act on all marked" org-agenda-bulk-action t]
+    ["Act on all marked" org-agenda-bulk-action t]
     "--"
     ("Tags and Properties"
      ["Show all Tags" org-agenda-show-tags t]
@@ -2542,7 +2542,7 @@ Agenda views are separated by `org-agenda-block-separator'."
 	(erase-buffer)
 	(insert (eval-when-compile
 		  (let ((header
-"Press key for an agenda command:        <   Buffer, subtree/region restriction
+			 "Press key for an agenda command:        <   Buffer, subtree/region restriction
 --------------------------------        >   Remove restriction
 a   Agenda for current week or day      e   Export agenda views
 t   List of all TODO entries            T   Entries with special TODO kwd
@@ -2745,19 +2745,19 @@ s   Search for keywords                 *   Toggle sticky agenda views
 	  '(call-interactively 'org-todo-list)))
        ((eq type 'search)
 	(org-let2 gprops lprops
-		  '(org-search-view current-prefix-arg match nil)))
+	  '(org-search-view current-prefix-arg match nil)))
        ((eq type 'stuck)
 	(org-let2 gprops lprops
 	  '(call-interactively 'org-agenda-list-stuck-projects)))
        ((eq type 'tags)
 	(org-let2 gprops lprops
-		  '(org-tags-view current-prefix-arg match)))
+	  '(org-tags-view current-prefix-arg match)))
        ((eq type 'tags-todo)
 	(org-let2 gprops lprops
-		  '(org-tags-view '(4) match)))
+	  '(org-tags-view '(4) match)))
        ((eq type 'todo)
 	(org-let2 gprops lprops
-		  '(org-todo-list match)))
+	  '(org-todo-list match)))
        ((fboundp type)
 	(org-let2 gprops lprops
 	  '(funcall type match)))
@@ -3390,7 +3390,7 @@ generating a new one."
 	    (overlay-put ov 'type 'org-agenda-clocking)
 	    (overlay-put ov 'face 'org-agenda-clocking)
 	    (overlay-put ov 'help-echo
-			     "The clock is running in this item")))))))
+			 "The clock is running in this item")))))))
 
 (defun org-agenda-fontify-priorities ()
   "Make highest priority lines bold, and lowest italic."
@@ -3684,7 +3684,7 @@ When EMPTY is non-nil, also include days without any entries."
   (let ((re (concat
 	     (if pre-re pre-re "")
 	     (if inactive org-ts-regexp-both org-ts-regexp)))
-	 dates dates1 date day day1 day2 ts1 ts2 pos)
+	dates dates1 date day day1 day2 ts1 ts2 pos)
     (if force-today
 	(setq dates (list (org-today))))
     (save-excursion
@@ -3723,7 +3723,7 @@ When EMPTY is non-nil, also include days without any entries."
 ;;; Agenda Daily/Weekly
 
 (defvar org-agenda-start-day nil  ; dynamically scoped parameter
-"Start day for the agenda view.
+  "Start day for the agenda view.
 Custom commands can set this variable in the options section.")
 (defvar org-starting-day nil) ; local variable in the agenda buffer
 (defvar org-agenda-current-span nil
@@ -4510,7 +4510,7 @@ that can be put into `org-agenda-skip-function' for the duration of a command."
 (defun org-agenda-skip-if-todo (args end)
   "Helper function for `org-agenda-skip-if', do not use it directly.
 ARGS is a list with first element either `todo', `nottodo',
-`todo-unblocked' or `nottodo-unblocked'. The remainder is either
+`todo-unblocked' or `nottodo-unblocked'.  The remainder is either
 a list of TODO keywords, or a state symbol `todo' or `done' or
 `any'."
   (let ((kw (car args))
@@ -5284,8 +5284,8 @@ please use `org-class' instead."
 	    (setq txt (org-agenda-format-item
 		       (cond
 			(closedp "Closed:    ")
-			    (statep (concat "State:     (" state ")"))
-			    (t (concat "Clocked:   (" clocked  ")")))
+			(statep (concat "State:     (" state ")"))
+			(t (concat "Clocked:   (" clocked  ")")))
 		       txt category tags timestr)))
 	  (setq priority 100000)
 	  (org-add-props txt props
@@ -5369,7 +5369,7 @@ See also the user option `org-agenda-clock-consistency-checks'."
 	  ;; There is a gap, lets see if we need to report it
 	  (unless (org-agenda-check-clock-gap tlend ts gapok)
 	    (setq issue (format "Clocking gap: %d minutes"
-				  (/ (- ts tlend) 60))
+				(/ (- ts tlend) 60))
 		  face (or (plist-get pl :gap-face) face))))
 	 (t nil)))
       (setq tlend (or te tlend) tlstart (or ts tlstart))
@@ -5452,7 +5452,7 @@ See also the user option `org-agenda-clock-consistency-checks'."
 	      todo-state (save-match-data (org-get-todo-state))
 	      show-all (or (eq org-agenda-repeating-timestamp-show-all t)
 			   (member todo-state
-				    org-agenda-repeating-timestamp-show-all))
+				   org-agenda-repeating-timestamp-show-all))
 	      d2 (org-time-string-to-absolute
 		  (match-string 1) d1 'past show-all
 		  (current-buffer) pos)
@@ -5544,8 +5544,8 @@ FRACTION is what fraction of the head-warning time has passed."
 	 mm
 	 (deadline-position-alist
 	  (mapcar (lambda (a) (and (setq mm (get-text-property
-					0 'org-hd-marker a))
-			      (cons (marker-position mm) a)))
+					     0 'org-hd-marker a))
+				   (cons (marker-position mm) a)))
 		  deadline-results))
 	 d2 diff pos pos1 category org-category-pos tags donep
 	 ee txt head pastschedp todo-state face timestr s habitp show-all
@@ -5746,7 +5746,7 @@ The flag is set if the currently compiled format contains a `%e'.")
     (when (org-string-match-p (car entry) category)
       (if (listp (cadr entry))
 	  (return (cadr entry))
-      (return (apply 'create-image (cdr entry)))))))
+	(return (apply 'create-image (cdr entry)))))))
 
 (defun org-agenda-format-item (extra txt &optional category tags dotime
 				     remove-re habitp)
@@ -5948,7 +5948,7 @@ The modified list may contain inherited tags, and tags matched by
 			       x))
 			   tags ":")
 			  (if have-i "::" ":"))))))
-    txt)
+  txt)
 
 (defun org-downcase-keep-props (s)
   (let ((props (text-properties-at 0 s)))
@@ -6075,23 +6075,23 @@ HH:MM."
     (when
 	(or (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s)
 	    (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s))
-     (let* ((h (string-to-number (match-string 1 s)))
-	    (m (if (match-end 3) (string-to-number (match-string 3 s)) 0))
-	    (ampm (if (match-end 4) (downcase (match-string 4 s))))
-	    (am-p (equal ampm "am"))
-	    (h1   (cond ((not ampm) h)
-			((= h 12) (if am-p 0 12))
-			(t (+ h (if am-p 0 12)))))
-	    (h2 (if (and string mod24 (not (and (= m 0) (= h1 24))))
-		    (mod h1 24) h1))
-	    (t0 (+ (* 100 h2) m))
-	    (t1 (concat (if (>= h1 24) "+" " ")
- 			(if (and org-agenda-time-leading-zero
- 				 (< t0 1000)) "0" "")
-			(if (< t0 100) "0" "")
-			(if (< t0 10)  "0" "")
-			(int-to-string t0))))
-       (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
+      (let* ((h (string-to-number (match-string 1 s)))
+	     (m (if (match-end 3) (string-to-number (match-string 3 s)) 0))
+	     (ampm (if (match-end 4) (downcase (match-string 4 s))))
+	     (am-p (equal ampm "am"))
+	     (h1   (cond ((not ampm) h)
+			 ((= h 12) (if am-p 0 12))
+			 (t (+ h (if am-p 0 12)))))
+	     (h2 (if (and string mod24 (not (and (= m 0) (= h1 24))))
+		     (mod h1 24) h1))
+	     (t0 (+ (* 100 h2) m))
+	     (t1 (concat (if (>= h1 24) "+" " ")
+			 (if (and org-agenda-time-leading-zero
+				  (< t0 1000)) "0" "")
+			 (if (< t0 100) "0" "")
+			 (if (< t0 10)  "0" "")
+			 (int-to-string t0))))
+	(if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
 
 (defvar org-agenda-before-sorting-filter-function nil
   "Function to be applied to agenda items prior to sorting.
@@ -6432,12 +6432,12 @@ If ERROR is non-nil, throw an error, otherwise just return nil."
 		 (not (one-window-p))
 		 (delete-window)))
 	  (with-current-buffer buf
-	    (bury-buffer) 
+	    (bury-buffer)
 	    ;; Maybe restore the pre-agenda window configuration.
 	    (and org-agenda-restore-windows-after-quit
 		 (not (eq org-agenda-window-setup 'other-frame))
 		 org-pre-agenda-window-conf
-		 (set-window-configuration org-pre-agenda-window-conf)))) 
+		 (set-window-configuration org-pre-agenda-window-conf))))
       (org-agenda-Quit))))
 
 (defun org-agenda-exit ()
@@ -6522,11 +6522,11 @@ The category is that of the current line."
 (defun org-find-top-category (&optional pos)
   (save-excursion
     (with-current-buffer (if pos (marker-buffer pos) (current-buffer))
-     (if pos (goto-char pos))
-     ;; Skip up to the topmost parent
-     (while (ignore-errors (outline-up-heading 1) t))
-     (ignore-errors
-       (nth 4 (org-heading-components))))))
+      (if pos (goto-char pos))
+      ;; Skip up to the topmost parent
+      (while (ignore-errors (outline-up-heading 1) t))
+      (ignore-errors
+	(nth 4 (org-heading-components))))))
 
 (defvar org-agenda-filtered-by-top-category nil)
 
@@ -6758,7 +6758,7 @@ If the line does not have an effort defined, return nil."
 (defun org-agenda-filter-hide-line (type)
   (let (ov)
     (setq ov (make-overlay (max (point-min) (1- (point-at-bol)))
-			       (point-at-eol)))
+			   (point-at-eol)))
     (overlay-put ov 'invisible t)
     (overlay-put ov 'type type)
     (if (eq type 'tag)
@@ -6774,7 +6774,7 @@ If the line does not have an effort defined, return nil."
 	(goto-char pos)
 	(if (< (overlay-start ov) (point-at-eol))
 	    (move-overlay ov (point-at-eol)
-			      (overlay-end ov)))))))
+			  (overlay-end ov)))))))
 
 (defun org-agenda-filter-show-all-tag nil
   (mapc 'delete-overlay org-agenda-tag-filter-overlays)
@@ -6979,7 +6979,7 @@ SPAN may be `day', `week', `month', `year'."
   (if (and (not n) (equal org-agenda-current-span span))
       (error "Viewing span is already \"%s\"" span))
   (let* ((sd (or (org-get-at-bol 'day)
-		org-starting-day))
+		 org-starting-day))
 	 (sd (org-agenda-compute-starting-span sd span n))
 	 (org-agenda-overriding-arguments
 	  (or org-agenda-overriding-arguments
@@ -7217,7 +7217,7 @@ When called with a prefix argument, include all archive files as well."
 	      		   'help-echo "Category used in filtering"))
 	      	"")
 	      (if (or org-agenda-tag-filter (get 'org-agenda-tag-filter
-					     :preset-filter))
+						 :preset-filter))
 		  '(:eval (org-propertize
 			   (concat " {"
 				   (mapconcat
@@ -7347,27 +7347,27 @@ Point is in the buffer where the item originated.")
 	 (type (org-get-at-bol 'type))
 	 dbeg dend (n 0) conf)
     (org-with-remote-undo buffer
-     (with-current-buffer buffer
-       (save-excursion
-	 (goto-char pos)
-	 (if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
-	     (setq dbeg (progn (org-back-to-heading t) (point))
-		   dend (org-end-of-subtree t t))
-	   (setq dbeg (point-at-bol)
-		 dend (min (point-max) (1+ (point-at-eol)))))
-	 (goto-char dbeg)
-	 (while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
-     (setq conf (or (eq t org-agenda-confirm-kill)
-		    (and (numberp org-agenda-confirm-kill)
-			 (> n org-agenda-confirm-kill))))
-     (and conf
-	  (not (y-or-n-p
-		(format "Delete entry with %d lines in buffer \"%s\"? "
-			n (buffer-name buffer))))
-	  (error "Abort"))
-     (org-remove-subtree-entries-from-agenda buffer dbeg dend)
-     (with-current-buffer buffer (delete-region dbeg dend))
-     (message "Agenda item and source killed"))))
+      (with-current-buffer buffer
+	(save-excursion
+	  (goto-char pos)
+	  (if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
+	      (setq dbeg (progn (org-back-to-heading t) (point))
+		    dend (org-end-of-subtree t t))
+	    (setq dbeg (point-at-bol)
+		  dend (min (point-max) (1+ (point-at-eol)))))
+	  (goto-char dbeg)
+	  (while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
+      (setq conf (or (eq t org-agenda-confirm-kill)
+		     (and (numberp org-agenda-confirm-kill)
+			  (> n org-agenda-confirm-kill))))
+      (and conf
+	   (not (y-or-n-p
+		 (format "Delete entry with %d lines in buffer \"%s\"? "
+			 n (buffer-name buffer))))
+	   (error "Abort"))
+      (org-remove-subtree-entries-from-agenda buffer dbeg dend)
+      (with-current-buffer buffer (delete-region dbeg dend))
+      (message "Agenda item and source killed"))))
 
 (defvar org-archive-default-command)
 (defun org-agenda-archive-default ()
@@ -8194,7 +8194,7 @@ ARG is passed through to `org-deadline'."
 	(goto-char pos)
 	(setq ts (org-deadline arg time)))
       (org-agenda-show-new-time marker ts "D"))
-	(message "Deadline for this item set to %s" ts)))
+    (message "Deadline for this item set to %s" ts)))
 
 (defun org-agenda-action ()
   "Select entry for agenda action, or execute an agenda action.
@@ -8407,12 +8407,12 @@ the resulting entry will not be shown.  When TEXT is empty, switch to
     (cond
      ((eq type 'anniversary)
       (or (re-search-forward "^*[ \t]+Anniversaries" nil t)
-	(progn
-	  (or (org-at-heading-p t)
-	      (progn
-		(outline-next-heading)
-		(insert "* Anniversaries\n\n")
-		(beginning-of-line -1)))))
+	  (progn
+	    (or (org-at-heading-p t)
+		(progn
+		  (outline-next-heading)
+		  (insert "* Anniversaries\n\n")
+		  (beginning-of-line -1)))))
       (outline-next-heading)
       (org-back-over-empty-lines)
       (backward-char 1)
@@ -8564,14 +8564,14 @@ the cursor position."
          ;; the following 2 vars are needed in the calendar
 	 (displayed-month (car date))
 	 (displayed-year (nth 2 date)))
-      (unwind-protect
-	  (progn
-	    (fset 'calendar-cursor-to-date
-		  (lambda (&optional error dummy)
-		    (calendar-gregorian-from-absolute
-		     (get-text-property point 'day))))
-	    (call-interactively cmd))
-	(fset 'calendar-cursor-to-date oldf))))
+    (unwind-protect
+	(progn
+	  (fset 'calendar-cursor-to-date
+		(lambda (&optional error dummy)
+		  (calendar-gregorian-from-absolute
+		   (get-text-property point 'day))))
+	  (call-interactively cmd))
+      (fset 'calendar-cursor-to-date oldf))))
 
 (defun org-agenda-phases-of-moon ()
   "Display the phases of the moon for the 3 months around the cursor date."
@@ -8718,11 +8718,11 @@ This is a command that has to be installed in `calendar-mode-map'."
 	  (t (message "No entry to unmark here")))))
 
 (defun org-agenda-bulk-toggle ()
- "Toggle marking the entry at point for bulk action."
- (interactive)
- (if (org-agenda-bulk-marked-p)
-     (org-agenda-bulk-unmark)
-   (org-agenda-bulk-mark)))
+  "Toggle marking the entry at point for bulk action."
+  (interactive)
+  (if (org-agenda-bulk-marked-p)
+      (org-agenda-bulk-unmark)
+    (org-agenda-bulk-mark)))
 
 (defun org-agenda-bulk-remove-overlays (&optional beg end)
   "Remove the mark overlays between BEG and END in the agenda buffer.

+ 8 - 8
lisp/org-archive.el

@@ -101,14 +101,14 @@ the archived entry, with a prefix \"ARCHIVE_\", to remember this
 information."
   :group 'org-archive
   :type '(set :greedy t
-	  (const :tag "Time" time)
-	  (const :tag "File" file)
-	  (const :tag "Category" category)
-	  (const :tag "TODO state" todo)
-	  (const :tag "Priority" priority)
-	  (const :tag "Inherited tags" itags)
-	  (const :tag "Outline path" olpath)
-	  (const :tag "Local tags" ltags)))
+	      (const :tag "Time" time)
+	      (const :tag "File" file)
+	      (const :tag "Category" category)
+	      (const :tag "TODO state" todo)
+	      (const :tag "Priority" priority)
+	      (const :tag "Inherited tags" itags)
+	      (const :tag "Outline path" olpath)
+	      (const :tag "Local tags" ltags)))
 
 (defun org-get-local-archive-location ()
   "Get the archive location applicable at point."

+ 50 - 50
lisp/org-ascii.el

@@ -146,7 +146,7 @@ command to convert it."
     (save-window-excursion
       (if (derived-mode-p 'org-mode)
 	  (setq ascii (org-export-region-as-ascii
-		      beg end t 'string))
+		       beg end t 'string))
 	(setq reg (buffer-substring beg end)
 	      buf (get-buffer-create "*Org tmp*"))
 	(with-current-buffer buf
@@ -154,7 +154,7 @@ command to convert it."
 	  (insert reg)
 	  (org-mode)
 	  (setq ascii (org-export-region-as-ascii
-		      (point-min) (point-max) t 'string)))
+		       (point-min) (point-max) t 'string)))
 	(kill-buffer buf)))
     (delete-region beg end)
     (insert ascii)))
@@ -193,7 +193,7 @@ in a window.  A non-interactive call will only return the buffer."
 
 ;;;###autoload
 (defun org-export-as-ascii (arg &optional hidden ext-plist
-			       to-buffer body-only pub-dir)
+				to-buffer body-only pub-dir)
   "Export the outline as a pretty ASCII file.
 If there is an active region, export only the region.
 The prefix ARG specifies how many levels of the outline should become
@@ -373,54 +373,54 @@ publishing directory."
 	  (push (concat (make-string (string-width (nth 3 lang-words)) ?=)
 			"\n") thetoc)
 	  (mapc #'(lambda (line)
-		   (if (string-match org-todo-line-regexp
-				     line)
-		       ;; This is a headline
-		       (progn
-			 (setq have-headings t)
-			 (setq level (- (match-end 1) (match-beginning 1)
-					level-offset)
-			       level (org-tr-level level)
-			       txt (match-string 3 line)
-			       todo
-			       (or (and org-export-mark-todo-in-toc
-					(match-beginning 2)
-					(not (member (match-string 2 line)
-						     org-done-keywords)))
+		    (if (string-match org-todo-line-regexp
+				      line)
+			;; This is a headline
+			(progn
+			  (setq have-headings t)
+			  (setq level (- (match-end 1) (match-beginning 1)
+					 level-offset)
+				level (org-tr-level level)
+				txt (match-string 3 line)
+				todo
+				(or (and org-export-mark-todo-in-toc
+					 (match-beginning 2)
+					 (not (member (match-string 2 line)
+						      org-done-keywords)))
 					; TODO, not DONE
-				   (and org-export-mark-todo-in-toc
-					(= level umax-toc)
-					(org-search-todo-below
-					 line lines level))))
-			 (setq txt (org-html-expand-for-ascii txt))
-
-			 (while (string-match org-bracket-link-regexp txt)
-			   (setq txt
-				 (replace-match
-				  (match-string (if (match-end 2) 3 1) txt)
-				  t t txt)))
-
-			 (if (and (memq org-export-with-tags '(not-in-toc nil))
-				  (string-match
-				   (org-re "[ \t]+:[[:alnum:]_@#%:]+:[ \t]*$")
-				   txt))
-			     (setq txt (replace-match "" t t txt)))
-			 (if (string-match quote-re0 txt)
-			     (setq txt (replace-match "" t t txt 1)))
-
-			 (if org-export-with-section-numbers
-			     (setq txt (concat (org-section-number level)
-					       " " txt)))
-			 (if (<= level umax-toc)
-			     (progn
-			       (push
-				(concat
-				 (make-string
-				  (* (max 0 (- level org-min-level)) 4) ?\ )
-				 (format (if todo "%s (*)\n" "%s\n") txt))
-				thetoc)
-			       (setq org-last-level level))
-			   ))))
+				    (and org-export-mark-todo-in-toc
+					 (= level umax-toc)
+					 (org-search-todo-below
+					  line lines level))))
+			  (setq txt (org-html-expand-for-ascii txt))
+
+			  (while (string-match org-bracket-link-regexp txt)
+			    (setq txt
+				  (replace-match
+				   (match-string (if (match-end 2) 3 1) txt)
+				   t t txt)))
+
+			  (if (and (memq org-export-with-tags '(not-in-toc nil))
+				   (string-match
+				    (org-re "[ \t]+:[[:alnum:]_@#%:]+:[ \t]*$")
+				    txt))
+			      (setq txt (replace-match "" t t txt)))
+			  (if (string-match quote-re0 txt)
+			      (setq txt (replace-match "" t t txt 1)))
+
+			  (if org-export-with-section-numbers
+			      (setq txt (concat (org-section-number level)
+						" " txt)))
+			  (if (<= level umax-toc)
+			      (progn
+				(push
+				 (concat
+				  (make-string
+				   (* (max 0 (- level org-min-level)) 4) ?\ )
+				  (format (if todo "%s (*)\n" "%s\n") txt))
+				 thetoc)
+				(setq org-last-level level))
+			    ))))
 		lines)
 	  (setq thetoc (if have-headings (nreverse thetoc) nil))))
 

+ 5 - 5
lisp/org-attach.el

@@ -162,7 +162,7 @@ i       Make children of the current entry inherit its attachment directory.")))
        ((memq c '(?l ?\C-l))
 	(let ((org-attach-method 'ln)) (call-interactively 'org-attach-attach)))
        ((memq c '(?y ?\C-y))
-	(let ((org-attach-method 'lns)) (call-interactively 'org-attach-attach)))       
+	(let ((org-attach-method 'lns)) (call-interactively 'org-attach-attach)))
        ((memq c '(?n ?\C-n)) (call-interactively 'org-attach-new))
        ((memq c '(?z ?\C-z)) (call-interactively 'org-attach-sync))
        ((memq c '(?o ?\C-o)) (call-interactively 'org-attach-open))
@@ -259,9 +259,9 @@ This checks for the existence of a \".git\" directory in that directory."
 	(shell-command "git add .")
 	(shell-command "git ls-files --deleted" t)
 	(mapc #'(lambda (file)
-		 (unless (string= file "")
-		   (shell-command
-		    (concat "git rm \"" file "\""))))
+		  (unless (string= file "")
+		    (shell-command
+		     (concat "git rm \"" file "\""))))
 	      (split-string (buffer-string) "\n"))
 	(shell-command "git commit -m 'Synchronized attachments'")))))
 
@@ -429,7 +429,7 @@ If IN-EMACS is non-nil, force opening in Emacs."
 	 (file (if (= (length files) 1)
 		   (car files)
 		 (org-icompleting-read "Open attachment: "
-				  (mapcar 'list files) nil t))))
+				       (mapcar 'list files) nil t))))
     (org-open-file (expand-file-name file attach-dir) in-emacs)))
 
 (defun org-attach-open-in-emacs ()

+ 1 - 1
lisp/org-bbdb.el

@@ -109,7 +109,7 @@
 (declare-function bbdb-record-getprop "ext:bbdb" (record property))
 (declare-function bbdb-record-name "ext:bbdb" (record))
 (declare-function bbdb-records "ext:bbdb"
-          (&optional dont-check-disk already-in-db-buffer))
+		  (&optional dont-check-disk already-in-db-buffer))
 (declare-function bbdb-split "ext:bbdb" (string separators))
 (declare-function bbdb-string-trim "ext:bbdb" (string))
 (declare-function bbdb-record-get-field "ext:bbdb" (record field))

+ 11 - 11
lisp/org-beamer.el

@@ -87,7 +87,7 @@ BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}."
 
 (defconst org-beamer-column-widths
   "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
-"The column widths that should be installed as allowed property values.")
+  "The column widths that should be installed as allowed property values.")
 
 (defconst org-beamer-transitions
   "\transblindsvertical \transblindshorizontal \transboxin \transboxout \transdissolve \transduration \transglitter \transsplithorizontalin \transsplithorizontalout \transsplitverticalin \transsplitverticalout \transwipe :ETC"
@@ -118,7 +118,7 @@ These are just a completion help.")
 These are the defaults - for user definitions, see
 `org-beamer-environments-extra'.
 \"normal\" is a special fake environment, which emit the heading as
-normal text. It is needed when an environment should be surrounded
+normal text.  It is needed when an environment should be surrounded
 by normal text.  Since beamer export converts nodes into environments,
 you need to have a node to end the environment.
 For example
@@ -495,13 +495,13 @@ The effect is that these values will be accessible during export."
 	   (if (and (not (assoc "BEAMER_env" props))
 		    (looking-at ".*?:B_\\(note\\(NH\\)?\\):"))
 	       (push (cons "BEAMER_env" (match-string 1)) props))
-          (when (org-bound-and-true-p org-beamer-inherited-properties)
-            (mapc (lambda (p)
-		    (unless (assoc p props)
-                      (let ((v (org-entry-get nil p 'inherit)))
-                        (and v (push (cons p v) props)))))
-                  org-beamer-inherited-properties))
-	  (put-text-property (point-at-bol) (point-at-eol) 'org-props props)))
+	   (when (org-bound-and-true-p org-beamer-inherited-properties)
+	     (mapc (lambda (p)
+		     (unless (assoc p props)
+		       (let ((v (org-entry-get nil p 'inherit)))
+			 (and v (push (cons p v) props)))))
+		   org-beamer-inherited-properties))
+	   (put-text-property (point-at-bol) (point-at-eol) 'org-props props)))
        (setq org-export-latex-options-plist
 	     (plist-put org-export-latex-options-plist :tags nil))))))
 
@@ -533,7 +533,7 @@ This function will run in the final LaTeX document."
   :group 'org-beamer
   :version "24.1"
   :type '(string :tag "Outline frame title")
-)
+  )
 
 (defcustom org-beamer-outline-frame-options nil
   "Outline frame options appended after \\begin{frame}.
@@ -542,7 +542,7 @@ include square brackets."
   :group 'org-beamer
   :version "24.1"
   :type '(string :tag "Outline frame options")
-)
+  )
 
 (defun org-beamer-fix-toc ()
   "Fix the table of contents by removing the vspace line."

+ 15 - 15
lisp/org-bibtex.el

@@ -184,26 +184,26 @@
   "Bibtex entry types with required and optional parameters.")
 
 (defvar org-bibtex-fields
-  '((:address      . "Usually the address of the publisher or other type of institution. For major publishing houses, van Leunen recommends omitting the information entirely.  For small publishers, on the other hand, you can help the reader by giving the complete address.")
-    (:annote       . "An annotation. It is not used by the standard bibliography styles, but may be used by others that produce an annotated bibliography.")
+  '((:address      . "Usually the address of the publisher or other type of institution.  For major publishing houses, van Leunen recommends omitting the information entirely.  For small publishers, on the other hand, you can help the reader by giving the complete address.")
+    (:annote       . "An annotation.  It is not used by the standard bibliography styles, but may be used by others that produce an annotated bibliography.")
     (:author       . "The name(s) of the author(s), in the format described in the LaTeX book.  Remember, all names are separated with the and keyword, and not commas.")
-    (:booktitle    . "Title of a book, part of which is being cited. See the LaTeX book for how to type titles. For book entries, use the title field instead.")
+    (:booktitle    . "Title of a book, part of which is being cited.  See the LaTeX book for how to type titles.  For book entries, use the title field instead.")
     (:chapter      . "A chapter (or section or whatever) number.")
     (:crossref     . "The database key of the entry being cross referenced.")
-    (:edition      . "The edition of a book for example, 'Second'. This should be an ordinal, and should have the first letter capitalized, as shown here; the standard styles convert to lower case when necessary.")
-    (:editor       . "Name(s) of editor(s), typed as indicated in the LaTeX book. If there is also an author field, then the editor field gives the editor of the book or collection in which the reference appears.")
-    (:howpublished . "How something strange has been published. The first word should be capitalized.")
+    (:edition      . "The edition of a book for example, 'Second'.  This should be an ordinal, and should have the first letter capitalized, as shown here; the standard styles convert to lower case when necessary.")
+    (:editor       . "Name(s) of editor(s), typed as indicated in the LaTeX book.  If there is also an author field, then the editor field gives the editor of the book or collection in which the reference appears.")
+    (:howpublished . "How something strange has been published.  The first word should be capitalized.")
     (:institution  . "The sponsoring institution of a technical report.")
     (:journal      . "A journal name.")
-    (:key          . "Used for alphabetizing, cross-referencing, and creating a label when the author information is missing. This field should not be confused with the key that appears in the \cite command and at the beginning of the database entry.")
-    (:month        . "The month in which the work was published or, for an unpublished work, in which it was written. You should use the standard three-letter abbreviation,")
-    (:note         . "Any additional information that can help the reader. The first word should be capitalized.")
-    (:number       . "Any additional information that can help the reader. The first word should be capitalized.")
+    (:key          . "Used for alphabetizing, cross-referencing, and creating a label when the author information is missing.  This field should not be confused with the key that appears in the \cite command and at the beginning of the database entry.")
+    (:month        . "The month in which the work was published or, for an unpublished work, in which it was written.  You should use the standard three-letter abbreviation,")
+    (:note         . "Any additional information that can help the reader.  The first word should be capitalized.")
+    (:number       . "Any additional information that can help the reader.  The first word should be capitalized.")
     (:organization . "The organization that sponsors a conference or that publishes a manual.")
     (:pages        . "One or more page numbers or range of numbers, such as 42-111 or 7,41,73-97 or 43+ (the ‘+’ in this last example indicates pages following that don’t form simple range). BibTEX requires double dashes for page ranges (--).")
     (:publisher    . "The publisher’s name.")
     (:school       . "The name of the school where a thesis was written.")
-    (:series       . "The name of a series or set of books. When citing an entire book, the the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published.")
+    (:series       . "The name of a series or set of books.  When citing an entire book, the the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published.")
     (:title        . "The work’s title, typed as explained in the LaTeX book.")
     (:type         . "The type of a technical report for example, 'Research Note'.")
     (:volume       . "The volume of a journal or multi-volume book.")
@@ -229,7 +229,7 @@ For example setting to 'BIB_' would allow interoperability with fireforg."
 (defcustom org-bibtex-treat-headline-as-title t
   "Treat headline text as title if title property is absent.
 If an entry is missing a title property, use the headline text as
-the property. If this value is t, `org-bibtex-check' will ignore
+the property.  If this value is t, `org-bibtex-check' will ignore
 a missing title field."
   :group 'org-bibtex
   :version "24.1"
@@ -247,7 +247,7 @@ not placed in the exported bibtex entry."
 (defcustom org-bibtex-key-property "CUSTOM_ID"
   "Property that holds the bibtex key.
 By default, this is CUSTOM_ID, which enables easy linking to
-bibtex headlines from within an org file. This can be set to ID
+bibtex headlines from within an org file.  This can be set to ID
 to enable global links, but only with great caution, as global
 IDs must be unique."
   :group 'org-bibtex
@@ -263,12 +263,12 @@ IDs must be unique."
 (defcustom org-bibtex-tags-are-keywords nil
   "Convert the value of the keywords field to tags and vice versa.
 If set to t, comma-separated entries in a bibtex entry's keywords
-field will be converted to org tags. Note: spaces will be escaped
+field will be converted to org tags.  Note: spaces will be escaped
 with underscores, and characters that are not permitted in org
 tags will be removed.
 
 If t, local tags in an org entry will be exported as a
-comma-separated string of keywords when exported to bibtex. Tags
+comma-separated string of keywords when exported to bibtex.  Tags
 defined in `org-bibtex-tags' or `org-bibtex-no-export-tags' will
 not be exported."
   :group 'org-bibtex

+ 69 - 69
lisp/org-capture.el

@@ -101,7 +101,7 @@ description  A short string describing the template, will be shown during
              selection.
 
 type         The type of entry.  Valid types are:
-               entry       an Org-mode node, with a headline. Will be
+               entry       an Org-mode node, with a headline.  Will be
                            filed as the child of the target entry or as
                            a top-level entry.
                item        a plain list item, will be placed in the
@@ -184,11 +184,11 @@ properties are:
                      other value is 1.
 
  :empty-lines-before Set this to the number of lines the should be inserted
-                     before the new item. Overrides :empty-lines for the
+                     before the new item.  Overrides :empty-lines for the
                      number lines inserted before.
 
  :empty-lines-after  Set this to the number of lines the should be inserted
-                     after the new item. Overrides :empty-lines for the
+                     after the new item.  Overrides :empty-lines for the
                      number of lines inserted after.
 
  :clock-in           Start the clock in this item.
@@ -276,71 +276,71 @@ calendar                |  %:type %:date"
   :type
   '(repeat
     (choice :value ("" "" entry (file "~/org/notes.org") "")
-     (list :tag "Multikey description"
-	   (string :tag "Keys       ")
-	   (string :tag "Description"))
-     (list :tag "Template entry"
-	   (string :tag "Keys           ")
-	   (string :tag "Description    ")
-	   (choice :tag "Capture Type   " :value entry
-		   (const :tag "Org entry" entry)