Browse Source

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

Eric Schulte 15 years ago
parent
commit
8fac7aa38b
6 changed files with 77 additions and 34 deletions
  1. 6 0
      contrib/babel/lisp/langs/org-babel-R.el
  2. 20 14
      contrib/babel/lisp/org-babel.el
  3. 11 8
      doc/org.texi
  4. 5 0
      lisp/ChangeLog
  5. 31 10
      lisp/org-timer.el
  6. 4 2
      lisp/org.el

+ 6 - 0
contrib/babel/lisp/langs/org-babel-R.el

@@ -35,6 +35,12 @@
 
 (add-to-list 'org-babel-tangle-langs '("R" "R" "#!/usr/bin/env Rscript"))
 
+(defconst org-babel-header-arg-names:R
+  '(width height bg units pointsize antialias quality compression
+	  res type family title fonts version paper encoding
+	  pagecentre colormodel useDingbats horizontal)
+  "R-specific header arguments.")
+
 (defun org-babel-expand-body:R (body params &optional processed-params)
   (let* ((processed-params (or processed-params
                                (org-babel-process-params params)))

+ 20 - 14
contrib/babel/lisp/org-babel.el

@@ -571,21 +571,27 @@ with C-c C-c."
          (goto-char (match-end 0))))
      (unless visited-p (kill-buffer (file-name-nondirectory ,file)))))
 
-(defun org-babel-params-from-properties ()
+(defun org-babel-params-from-properties (&optional lang)
   "Return an association list of any source block params which
 may be specified in the properties of the current outline entry."
   (save-match-data
-    (delq nil
-          (mapcar
-           (lambda (header-arg)
-             (let ((val (or (condition-case nil
-                                (org-entry-get (point) header-arg t)
-                              (error nil))
-                            (cdr (assoc header-arg org-file-properties)))))
-               (when val
-                 ;; (message "prop %s=%s" header-arg val) ;; debugging
-                 (cons (intern (concat ":" header-arg)) val))))
-           (mapcar 'symbol-name org-babel-header-arg-names)))))
+    (let (val sym)
+      (delq nil
+	    (mapcar
+	     (lambda (header-arg)
+	       (and (setq val
+			  (or (condition-case nil
+				  (org-entry-get (point) header-arg t)
+				(error nil))
+			      (cdr (assoc header-arg org-file-properties))))
+		    (cons (intern (concat ":" header-arg)) val)))
+	     (mapcar
+	      'symbol-name
+	      (append
+	       org-babel-header-arg-names
+	       (progn
+		 (setq sym (intern (concat "org-babel-header-arg-names:" lang)))
+		 (and (boundp sym) (eval sym))))))))))
 
 (defun org-babel-parse-src-block-match ()
   (let* ((lang (org-babel-clean-text-properties (match-string 1)))
@@ -603,7 +609,7 @@ may be specified in the properties of the current outline entry."
               (buffer-string)))
 	  (org-babel-merge-params
 	   org-babel-default-header-args
-           (org-babel-params-from-properties)
+           (org-babel-params-from-properties lang)
 	   (if (boundp lang-headers) (eval lang-headers) nil)
 	   (org-babel-parse-header-arguments
             (org-babel-clean-text-properties (or (match-string 3) ""))))
@@ -617,7 +623,7 @@ may be specified in the properties of the current outline entry."
            (org-babel-clean-text-properties (match-string 5)))
           (org-babel-merge-params
            org-babel-default-inline-header-args
-           (org-babel-params-from-properties)
+           (org-babel-params-from-properties lang)
            (if (boundp lang-headers) (eval lang-headers) nil)
            (org-babel-parse-header-arguments
             (org-babel-clean-text-properties (or (match-string 4) "")))))))

+ 11 - 8
doc/org.texi

@@ -11140,14 +11140,17 @@ more text                        |          more text
 @end example
 
 @noindent
-If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind
-of view can be achieved dynamically at display time using
-@code{org-indent-mode}.  In this minor mode, all lines are prefixed for
-display with the necessary amount of space@footnote{@code{org-indent-mode}
-also sets the @code{wrap-prefix} property, such that @code{visual-line-mode}
-(or purely setting @code{word-wrap}) wraps long lines (including headlines)
-correctly indented.  }.  Also headlines are prefixed with additional stars,
-so that the amount of indentation shifts by two@footnote{See the variable
+
+If you are using at least Emacs 23.2 and version 6.29 of Org, this kind of
+view can be achieved dynamically at display time using
+@code{org-indent-mode}.  @i{Using this with earlier versions of Emacs can
+lead to crashes.} In this minor
+mode, all lines are prefixed for display with the necessary amount of
+space@footnote{@code{org-indent-mode} also sets the @code{wrap-prefix}
+property, such that @code{visual-line-mode} (or purely setting
+@code{word-wrap}) wraps long lines (including headlines) correctly indented.
+}.  Also headlines are prefixed with additional stars, so that the amount of
+indentation shifts by two@footnote{See the variable
 @code{org-indent-indentation-per-level}.}  spaces per level.  All headline
 stars but the last one are made invisible using the @code{org-hide}
 face@footnote{Turning on @code{org-indent-mode} sets

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2010-05-28  Bastien Guerry  <bzg@altern.org>
+
+	* org-timer.el (org-timer-set-timer): Use a prefix argument.
+	See the docstring of the function.
+
 2010-05-24  Bastien Guerry  <bzg@altern.org>
 
 	* org-timer.el (org-timer-set-timer): Fix bug about cancelling

+ 31 - 10
lisp/org-timer.el

@@ -305,15 +305,35 @@ VALUE can be `on', `off', or `pause'."
       (message "%d minute(s) %d seconds left before next time out"
 	       rmins rsecs))))
 
+(defun bzg-test (&optional test)
+  (interactive "P")
+  test)
+
 ;;;###autoload
-(defun org-timer-set-timer ()
-  "Set a timer."
-  (interactive)
-  (let ((minutes 
-	 (read-from-minibuffer 
-	  "How many minutes left? "
-	  (if (not (eq org-timer-default-timer 0))
-	      (number-to-string org-timer-default-timer)))))
+(defun org-timer-set-timer (&optional opt)
+  "Prompt for a duration and set a timer.
+
+If `org-timer-default-timer' is not zero, suggest this value as
+the default duration for the timer.  If a timer is already set,
+prompt the use if she wants to replace it.
+
+Called with a numeric prefix argument, use this numeric value as
+the duration of the timer.
+
+Called with a `C-u' prefix argument, use `org-timer-default-timer' 
+without prompting the user for a duration.
+
+With two `C-u' prefix argument, use `org-timer-default-timer'
+without prompting the user for a duration and automatically
+replace any running timer."
+  (interactive "P")
+  (let ((minutes (or (and (numberp opt) (number-to-string opt))
+		     (and (listp opt) (not (null opt))
+			  (number-to-string org-timer-default-timer))
+		     (read-from-minibuffer 
+		      "How many minutes left? "
+		      (if (not (eq org-timer-default-timer 0))
+			  (number-to-string org-timer-default-timer))))))
     (if (not (string-match "[0-9]+" minutes))
 	(org-timer-show-remaining-time)
     (let* ((mins (string-to-number (match-string 0 minutes)))
@@ -335,8 +355,9 @@ VALUE can be `on', `off', or `pause'."
 		(t (error "Not in an Org buffer"))))
 	   timer-set)
       (if (or (and org-timer-current-timer
-		     (y-or-n-p "Replace current timer? "))
-		(not org-timer-current-timer))
+		   (or (equal opt '(16))
+		       (y-or-n-p "Replace current timer? ")))
+	      (not org-timer-current-timer))
 	  (progn
 	    (when org-timer-current-timer
 	      (cancel-timer org-timer-current-timer))

+ 4 - 2
lisp/org.el

@@ -7962,7 +7962,9 @@ For file links, arg negates `org-context-in-file-links'."
 		   (get-text-property (point) 'org-marker))))
 	(when m
 	  (org-with-point-at m
-	    (call-interactively 'org-store-link)))))
+	    (if (interactive-p)
+		(call-interactively 'org-store-link)
+	      (org-store-link nil))))))
 
      ((eq major-mode 'calendar-mode)
       (let ((cd (calendar-cursor-to-date)))
@@ -11683,7 +11685,7 @@ that the match should indeed be shown."
     cnt))
 
 (defun org-show-context (&optional key)
-  "Make sure point and context and visible.
+  "Make sure point and context are visible.
 How much context is shown depends upon the variables
 `org-show-hierarchy-above', `org-show-following-heading'. and
 `org-show-siblings'."