소스 검색

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

Carsten Dominik 15 년 전
부모
커밋
a082001643
5개의 변경된 파일69개의 추가작업 그리고 25개의 파일을 삭제
  1. 6 0
      contrib/babel/lisp/langs/org-babel-R.el
  2. 7 1
      contrib/babel/lisp/org-babel-tangle.el
  3. 20 14
      contrib/babel/lisp/org-babel.el
  4. 5 0
      lisp/ChangeLog
  5. 31 10
      lisp/org-timer.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)))

+ 7 - 1
contrib/babel/lisp/org-babel-tangle.el

@@ -40,6 +40,11 @@ to use when writing out the language to file, and an optional
 fourth element is a flag which when true indicates that the
 language does not support comments.")
 
+(defvar org-babel-tangle-w-comments nil
+  "Control the insertion of comments into tangled code.  Non-nil
+value will result in the insertion of comments for those
+languages with comment support.")
+
 (defun org-babel-load-file (file)
   "Load the contents of the Emacs Lisp source code blocks in the
 org-mode formatted FILE.  This function will first export the
@@ -218,7 +223,8 @@ form
 
   (link source-name params body)"
   (flet ((insert-comment (text)
-                         (when commentable
+                         (when (and commentable
+				    org-babel-tangle-w-comments)
                            (insert "\n")
                            (comment-region (point) (progn (insert text) (point)))
                            (end-of-line nil)

+ 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) "")))))))

+ 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))