浏览代码

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

Carsten Dominik 15 年之前
父节点
当前提交
e7a3e1a223

+ 1 - 1
contrib/babel/lisp/langs/org-babel-R.el

@@ -89,7 +89,7 @@ called by `org-babel-execute-src-block'."
 	   vars)))
 	   vars)))
     (org-babel-comint-in-buffer session
     (org-babel-comint-in-buffer session
       (mapc (lambda (var)
       (mapc (lambda (var)
-              (move-end-of-line 1) (insert var) (comint-send-input nil t)
+              (end-of-line 1) (insert var) (comint-send-input nil t)
               (org-babel-comint-wait-for-output session)) var-lines))
               (org-babel-comint-wait-for-output session)) var-lines))
     session))
     session))
 
 

+ 1 - 1
contrib/babel/lisp/langs/org-babel-octave.el

@@ -92,7 +92,7 @@ specifying a variable of the same value."
                      vars)))
                      vars)))
     (org-babel-comint-in-buffer session
     (org-babel-comint-in-buffer session
       (mapc (lambda (var)
       (mapc (lambda (var)
-              (move-end-of-line 1) (insert var) (comint-send-input nil t)
+              (end-of-line 1) (insert var) (comint-send-input nil t)
               (org-babel-comint-wait-for-output session)) var-lines))
               (org-babel-comint-wait-for-output session)) var-lines))
     session))
     session))
 
 

+ 34 - 13
contrib/babel/lisp/langs/org-babel-python.el

@@ -30,6 +30,8 @@
 
 
 ;;; Code:
 ;;; Code:
 (require 'org-babel)
 (require 'org-babel)
+(require 'org-babel-tangle)
+(require 'org-babel-comint)
 (require (if (featurep 'xemacs) 'python-mode 'python))
 (require (if (featurep 'xemacs) 'python-mode 'python))
 
 
 (org-babel-add-interpreter "python")
 (org-babel-add-interpreter "python")
@@ -75,7 +77,7 @@ called by `org-babel-execute-src-block'."
                      vars)))
                      vars)))
     (org-babel-comint-in-buffer session
     (org-babel-comint-in-buffer session
       (mapc (lambda (var)
       (mapc (lambda (var)
-              (move-end-of-line 1) (insert var) (comint-send-input nil t)
+              (end-of-line 1) (insert var) (comint-send-input)
               (org-babel-comint-wait-for-output session)) var-lines))
               (org-babel-comint-wait-for-output session)) var-lines))
     session))
     session))
 
 
@@ -123,7 +125,21 @@ then create.  Return the initialized session."
   (save-window-excursion
   (save-window-excursion
     (let* ((session (if session (intern session) :default))
     (let* ((session (if session (intern session) :default))
            (python-buffer (org-babel-python-session-buffer session)))
            (python-buffer (org-babel-python-session-buffer session)))
-      (run-python)
+      (cond
+       ((fboundp 'run-python) ; python.el
+	(run-python))
+       ((fboundp 'py-shell) ; python-mode.el
+	;; `py-shell' creates a buffer whose name is the value of
+	;; `py-which-bufname' with '*'s at the beginning and end
+	(let* ((bufname (if python-buffer
+			    (replace-regexp-in-string "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer) ; zap surrounding *
+			  (concat "Python-" (symbol-name session))))
+	       (py-which-bufname bufname)) ; avoid making a mess with buffer-local
+	  (py-shell)
+	  (setq python-buffer (concat "*" bufname "*"))))
+       (t
+	(error "No function available for running an inferior python.")))
+	
       (setq org-babel-python-buffers (cons (cons session python-buffer)
       (setq org-babel-python-buffers (cons (cons session python-buffer)
 					   (assq-delete-all session org-babel-python-buffers)))
 					   (assq-delete-all session org-babel-python-buffers)))
       session)))
       session)))
@@ -200,19 +216,24 @@ last statement in BODY, as elisp."
     (org-babel-comint-in-buffer buffer
     (org-babel-comint-in-buffer buffer
       (let* ((raw (org-babel-comint-with-output buffer org-babel-python-eoe-indicator t
       (let* ((raw (org-babel-comint-with-output buffer org-babel-python-eoe-indicator t
                     ;; for some reason python is fussy, and likes enters after every input
                     ;; for some reason python is fussy, and likes enters after every input
-                    (mapc (lambda (statement) (insert statement) (comint-send-input nil t))
-                          (split-string (org-babel-trim full-body) "[\r\n]+"))
-                    (comint-send-input nil t) (comint-send-input nil t)
-                    (if (member "pp" result-params)
-                        (mapc (lambda (statement) (insert statement) (comint-send-input nil t))
-                              org-babel-python-pp-last-value-eval)
-                      (insert org-babel-python-last-value-eval))
-                    (comint-send-input nil t) (comint-send-input nil t)
-                    (insert org-babel-python-eoe-indicator)
-                    (comint-send-input nil t)))
+		    (let ((comint-process-echoes nil))
+		      (mapc (lambda (statement) (insert statement) (comint-send-input))
+			    (split-string (org-babel-trim body) "[\r\n]+"))
+		      (comint-send-input) (comint-send-input)
+		      (if (member "pp" result-params)
+			  (mapc (lambda (statement) (insert statement) (comint-send-input))
+				org-babel-python-pp-last-value-eval)
+			(insert org-babel-python-last-value-eval))
+		      (comint-send-input) (comint-send-input)
+		      (insert org-babel-python-eoe-indicator)
+		      (comint-send-input))))
+	     (raw (apply #'append ; split further
+			 (mapcar #'(lambda (r)
+				     (split-string r "[\r\n]+"))
+				 raw)))
              (results (delete org-babel-python-eoe-indicator
              (results (delete org-babel-python-eoe-indicator
                               (cdr (member org-babel-python-eoe-indicator
                               (cdr (member org-babel-python-eoe-indicator
-                                           (reverse (mapcar #'org-babel-trim raw)))))))
+                                           (mapcar #'org-babel-trim raw))))))
         (unless (or (member "code" result-params) (member "pp" result-params))
         (unless (or (member "code" result-params) (member "pp" result-params))
           (setq results (mapcar #'org-babel-python-read-string results)))
           (setq results (mapcar #'org-babel-python-read-string results)))
         (case result-type
         (case result-type

+ 2 - 1
contrib/babel/lisp/org-babel-exp.el

@@ -137,7 +137,8 @@ options are taken from `org-babel-default-header-args'."
       ('inline (format "=%s=" body))
       ('inline (format "=%s=" body))
       ('block
       ('block
           (let ((str (format "#+BEGIN_SRC %s %s\n%s%s#+END_SRC\n" lang switches body
           (let ((str (format "#+BEGIN_SRC %s %s\n%s%s#+END_SRC\n" lang switches body
-                             (if (string-match "\n$" body) "" "\n"))))
+                             (if (and body (string-match "\n$" body))
+				 "" "\n"))))
             (when name (add-text-properties 0 (length str)
             (when name (add-text-properties 0 (length str)
                                            (list 'org-caption
                                            (list 'org-caption
                                                  (format "%s(%s)"
                                                  (format "%s(%s)"

+ 0 - 1
contrib/babel/lisp/org-babel-keys.el

@@ -56,7 +56,6 @@ functions.")
 (defvar org-babel-key-bindings
 (defvar org-babel-key-bindings
   '(("\C-p" . org-babel-expand-src-block)
   '(("\C-p" . org-babel-expand-src-block)
     ("p" . org-babel-expand-src-block)
     ("p" . org-babel-expand-src-block)
-    ("\C-g" . org-babel-goto-named-source-block)
     ("g" . org-babel-goto-named-source-block)
     ("g" . org-babel-goto-named-source-block)
     ("\C-b" . org-babel-execute-buffer)
     ("\C-b" . org-babel-execute-buffer)
     ("b" . org-babel-execute-buffer)
     ("b" . org-babel-execute-buffer)

+ 1 - 1
contrib/babel/lisp/org-babel-lob.el

@@ -90,7 +90,7 @@ should be renamed to bring out this similarity, perhaps involving
 the word 'call'."
 the word 'call'."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
     (save-excursion
     (save-excursion
-      (move-beginning-of-line 1)
+      (beginning-of-line 1)
       (if (looking-at org-babel-lob-one-liner-regexp)
       (if (looking-at org-babel-lob-one-liner-regexp)
           (mapcar #'org-babel-clean-text-properties 
           (mapcar #'org-babel-clean-text-properties 
 		  (list (format "%s(%s)" (match-string 1) (match-string 2))
 		  (list (format "%s(%s)" (match-string 1) (match-string 2))

+ 5 - 3
contrib/babel/lisp/org-babel-tangle.el

@@ -139,6 +139,8 @@ exported source code blocks by language."
 			  (goto-char (point-max))
 			  (goto-char (point-max))
 			  (insert content)
 			  (insert content)
 			  (write-region nil nil file-name))))
 			  (write-region nil nil file-name))))
+		    ;; if files contain she-bangs, then make the executable
+		    (when she-bang (set-file-modes file-name ?\755))
                     ;; update counter
                     ;; update counter
                     (setq block-counter (+ 1 block-counter))
                     (setq block-counter (+ 1 block-counter))
                     (add-to-list 'path-collector file-name)))))
                     (add-to-list 'path-collector file-name)))))
@@ -158,8 +160,8 @@ references."
   (goto-char (point-min))
   (goto-char (point-min))
   (while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t)
   (while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t)
              (re-search-forward "<<[^[:space:]]*>>" nil t))
              (re-search-forward "<<[^[:space:]]*>>" nil t))
-    (delete-region (save-excursion (move-beginning-of-line 1) (point))
-                   (save-excursion (move-end-of-line 1) (forward-char 1) (point)))))
+    (delete-region (save-excursion (beginning-of-line 1) (point))
+                   (save-excursion (end-of-line 1) (forward-char 1) (point)))))
 
 
 (defun org-babel-tangle-collect-blocks (&optional lang)
 (defun org-babel-tangle-collect-blocks (&optional lang)
   "Collect all source blocks in the current org-mode file.
   "Collect all source blocks in the current org-mode file.
@@ -219,7 +221,7 @@ form
                          (when commentable
                          (when commentable
                            (insert "\n")
                            (insert "\n")
                            (comment-region (point) (progn (insert text) (point)))
                            (comment-region (point) (progn (insert text) (point)))
-                           (move-end-of-line nil)
+                           (end-of-line nil)
                            (insert "\n"))))
                            (insert "\n"))))
     (let ((link (first spec))
     (let ((link (first spec))
           (source-name (second spec))
           (source-name (second spec))

+ 24 - 22
contrib/babel/lisp/org-babel.el

@@ -246,7 +246,7 @@ block."
           (if (and (not arg) new-hash (equal new-hash old-hash))
           (if (and (not arg) new-hash (equal new-hash old-hash))
               (save-excursion ;; return cached result
               (save-excursion ;; return cached result
                 (goto-char (org-babel-where-is-src-block-result nil info))
                 (goto-char (org-babel-where-is-src-block-result nil info))
-                (move-end-of-line 1) (forward-char 1)
+                (end-of-line 1) (forward-char 1)
                 (setq result (org-babel-read-result))
                 (setq result (org-babel-read-result))
                 (message (replace-regexp-in-string "%" "%%"
                 (message (replace-regexp-in-string "%" "%%"
                                                    (format "%S" result))) result)
                                                    (format "%S" result))) result)
@@ -305,7 +305,7 @@ session.  After loading the body this pops open the session."
     (pop-to-buffer
     (pop-to-buffer
      (funcall (intern (concat "org-babel-load-session:" lang))
      (funcall (intern (concat "org-babel-load-session:" lang))
               session body params))
               session body params))
-    (move-end-of-line 1)))
+    (end-of-line 1)))
 
 
 (defun org-babel-switch-to-session (&optional arg info)
 (defun org-babel-switch-to-session (&optional arg info)
   "Switch to the session of the current source-code block.
   "Switch to the session of the current source-code block.
@@ -333,7 +333,7 @@ of the source block to the kill ring."
     (pop-to-buffer
     (pop-to-buffer
      (funcall (intern (format "org-babel-%s-initiate-session" lang))
      (funcall (intern (format "org-babel-%s-initiate-session" lang))
               session params))
               session params))
-    (move-end-of-line 1)))
+    (end-of-line 1)))
 
 
 (defalias 'org-babel-pop-to-session 'org-babel-switch-to-session)
 (defalias 'org-babel-pop-to-session 'org-babel-switch-to-session)
 
 
@@ -349,7 +349,7 @@ results already exist."
       (goto-char (or (and (not re-run) (org-babel-where-is-src-block-result))
       (goto-char (or (and (not re-run) (org-babel-where-is-src-block-result))
                      (progn (org-babel-execute-src-block)
                      (progn (org-babel-execute-src-block)
                             (org-babel-where-is-src-block-result))))
                             (org-babel-where-is-src-block-result))))
-      (move-end-of-line 1) (forward-char 1)
+      (end-of-line 1) (forward-char 1)
       ;; open the results
       ;; open the results
       (if (looking-at org-bracket-link-regexp)
       (if (looking-at org-bracket-link-regexp)
           ;; file results
           ;; file results
@@ -371,12 +371,14 @@ results already exist."
 the current buffer."
 the current buffer."
   (interactive "P")
   (interactive "P")
   (save-excursion
   (save-excursion
-    (goto-char (point-min))
-    (while (re-search-forward org-babel-src-block-regexp nil t)
-      (let ((pos-end (match-end 0)))
-	(goto-char (match-beginning 0))
-	(org-babel-execute-src-block arg)
-	(goto-char pos-end)))))
+    (org-save-outline-visibility t
+      (goto-char (point-min))
+      (show-all)
+      (while (re-search-forward org-babel-src-block-regexp nil t)
+	(let ((pos-end (match-end 0)))
+	  (goto-char (match-beginning 0))
+	  (org-babel-execute-src-block arg)
+	  (goto-char pos-end))))))
 
 
 (defun org-babel-execute-subtree (&optional arg)
 (defun org-babel-execute-subtree (&optional arg)
   "Call `org-babel-execute-src-block' on every source block in
   "Call `org-babel-execute-src-block' on every source block in
@@ -766,8 +768,8 @@ If the point is not on a source block then return nil."
         (re-search-backward "^[ \t]*#\\+begin_src" nil t) (setq top (point))
         (re-search-backward "^[ \t]*#\\+begin_src" nil t) (setq top (point))
         (re-search-forward "^[ \t]*#\\+end_src" nil t) (setq bottom (point))
         (re-search-forward "^[ \t]*#\\+end_src" nil t) (setq bottom (point))
         (< top initial) (< initial bottom)
         (< top initial) (< initial bottom)
-        (goto-char top) (move-beginning-of-line 1)
-        (looking-at org-babel-src-block-regexp)
+        (progn (goto-char top) (beginning-of-line 1)
+	       (looking-at org-babel-src-block-regexp))
         (point))))))
         (point))))))
 
 
 (defun org-babel-goto-named-source-block (&optional name)
 (defun org-babel-goto-named-source-block (&optional name)
@@ -800,7 +802,7 @@ buffer or nil if no such result exists."
     (when (re-search-forward
     (when (re-search-forward
            (concat org-babel-result-regexp
            (concat org-babel-result-regexp
                    "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t)
                    "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t)
-      (move-beginning-of-line 0) (point))))
+      (beginning-of-line 0) (point))))
 
 
 (defun org-babel-where-is-src-block-result (&optional insert info hash)
 (defun org-babel-where-is-src-block-result (&optional insert info hash)
   "Return the point at the beginning of the result of the current
   "Return the point at the beginning of the result of the current
@@ -816,13 +818,13 @@ following the source block."
       (when head (goto-char head))
       (when head (goto-char head))
       (or (and name (org-babel-find-named-result name))
       (or (and name (org-babel-find-named-result name))
           (and (or on-lob-line (re-search-forward "^[ \t]*#\\+end_src" nil t))
           (and (or on-lob-line (re-search-forward "^[ \t]*#\\+end_src" nil t))
-               (progn (move-end-of-line 1)
+               (progn (end-of-line 1)
 		      (if (eobp) (insert "\n") (forward-char 1))
 		      (if (eobp) (insert "\n") (forward-char 1))
 		      (setq end (point))
 		      (setq end (point))
                       (or (and (not name)
                       (or (and (not name)
 			       (progn ;; unnamed results line already exists
 			       (progn ;; unnamed results line already exists
 				 (re-search-forward "[^ \f\t\n\r\v]" nil t)
 				 (re-search-forward "[^ \f\t\n\r\v]" nil t)
-				 (move-beginning-of-line 1)
+				 (beginning-of-line 1)
                                  (looking-at
                                  (looking-at
                                   (concat org-babel-result-regexp "\n"))))
                                   (concat org-babel-result-regexp "\n"))))
 			  ;; or (with optional insert) back up and
 			  ;; or (with optional insert) back up and
@@ -835,7 +837,7 @@ following the source block."
                                             (when hash (concat "["hash"]"))
                                             (when hash (concat "["hash"]"))
                                             ":"
                                             ":"
                                             (when name (concat " " name)) "\n"))
                                             (when name (concat " " name)) "\n"))
-                            (move-beginning-of-line 0)
+                            (beginning-of-line 0)
                             (if hash (org-babel-hide-hash)) t)))
                             (if hash (org-babel-hide-hash)) t)))
                (point))))))
                (point))))))
 
 
@@ -1026,8 +1028,7 @@ directory then expand relative links."
 (defun org-babel-examplize-region (beg end &optional results-switches)
 (defun org-babel-examplize-region (beg end &optional results-switches)
   "Comment out region using the ': ' org example quote."
   "Comment out region using the ': ' org example quote."
   (interactive "*r")
   (interactive "*r")
-  (let ((size (abs (- (line-number-at-pos end)
-		      (line-number-at-pos beg)))))
+  (let ((size (count-lines beg end)))
     (save-excursion
     (save-excursion
       (cond ((= size 0)
       (cond ((= size 0)
 	     (error (concat "This should be impossible:"
 	     (error (concat "This should be impossible:"
@@ -1035,7 +1036,7 @@ directory then expand relative links."
 	    ((< size org-babel-min-lines-for-block-output)
 	    ((< size org-babel-min-lines-for-block-output)
 	     (goto-char beg)
 	     (goto-char beg)
 	     (dotimes (n size)
 	     (dotimes (n size)
-	       (move-beginning-of-line 1) (insert ": ") (forward-line 1)))
+	       (beginning-of-line 1) (insert ": ") (forward-line 1)))
 	    (t
 	    (t
 	     (goto-char beg)
 	     (goto-char beg)
 	     (insert (if results-switches
 	     (insert (if results-switches
@@ -1192,7 +1193,7 @@ block but are passed literally to the \"example-block\"."
             (setq prefix
             (setq prefix
                   (buffer-substring (match-beginning 0)
                   (buffer-substring (match-beginning 0)
                                     (save-excursion
                                     (save-excursion
-                                      (move-beginning-of-line 1) (point)))))
+                                      (beginning-of-line 1) (point)))))
           ;; add interval to new-body (removing noweb reference)
           ;; add interval to new-body (removing noweb reference)
           (goto-char (match-beginning 0))
           (goto-char (match-beginning 0))
           (nb-add (buffer-substring index (point)))
           (nb-add (buffer-substring index (point)))
@@ -1260,7 +1261,7 @@ This is taken almost directly from `org-read-prop'."
 
 
 (defun org-babel-number-p (string)
 (defun org-babel-number-p (string)
   "Return t if STRING represents a number"
   "Return t if STRING represents a number"
-  (if (and (string-match "^-?[[:digit:]]*\\.?[[:digit:]]*$" string)
+  (if (and (string-match "^-?[0-9]*\\.?[0-9]*$" string)
            (= (match-end 0) (length string)))
            (= (match-end 0) (length string)))
       (string-to-number string)))
       (string-to-number string)))
 
 
@@ -1413,7 +1414,8 @@ specifies the value of ERROR-BUFFER."
 	 (if error-buffer
 	 (if error-buffer
 	     (make-temp-file
 	     (make-temp-file
 	      (expand-file-name "scor"
 	      (expand-file-name "scor"
-				(or small-temporary-file-directory
+				(or (unless (featurep 'xemacs)
+				      small-temporary-file-directory)
 				    temporary-file-directory)))
 				    temporary-file-directory)))
 	   nil))
 	   nil))
 	exit-status)
 	exit-status)

+ 9 - 9
doc/orgcard.tex

@@ -477,15 +477,15 @@ formula, \kbd{:=} a field formula.
 
 
 \key{execute code block at point}{C-c C-c}
 \key{execute code block at point}{C-c C-c}
 \key{open results of code block at point}{C-c C-o}
 \key{open results of code block at point}{C-c C-o}
-\key{preview body of code block at point}{C-c C-v C-p}
-\key{go to named code block}{C-c C-v C-g}
-\key{execute all code blocks in current buffer}{C-c C-v C-b}
-\key{execute all code blocks in current subtree}{C-c C-v C-s}
-\key{tangle code blocks in current file}{C-c C-v C-t}
-\key{tangle code blocks in supplied file}{C-c C-v C-T}
-\key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v C-l}
-\key{switch to the session of the current code block}{C-c C-v C-z}
-\key{view sha1 hash of the current code block}{C-c C-v C-h}
+\key{preview body of code block at point}{C-c C-v p}
+\key{go to named code block}{C-c C-v g}
+\key{execute all code blocks in current buffer}{C-c C-v b}
+\key{execute all code blocks in current subtree}{C-c C-v s}
+\key{tangle code blocks in current file}{C-c C-v t}
+\key{tangle code blocks in supplied file}{C-c C-v f}
+\key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v l}
+\key{switch to the session of the current code block}{C-c C-v z}
+\key{view sha1 hash of the current code block}{C-c C-v a}
 
 
 % \section{Remember-mode Integration}
 % \section{Remember-mode Integration}
 
 

+ 6 - 0
lisp/ChangeLog

@@ -3,6 +3,12 @@
 	* org-timer.el (org-timer-set-timer): Fix bug about cancelling
 	* org-timer.el (org-timer-set-timer): Fix bug about cancelling
 	timers.
 	timers.
 
 
+2010-05-22  David Maus  <dmaus@ictsoc.de>
+
+	* org-w3m.el (org-w3m-copy-for-org-mode)
+	(org-w3m-get-next-link-start, org-w3m-get-prev-link-start):
+	Get text property directly, not using macro `w3m-anchor'.
+
 2010-05-21  Carsten Dominik  <carsten.dominik@gmail.com>
 2010-05-21  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org.el (org-emph-re): Document the match groups.
 	* org.el (org-emph-re): Document the match groups.

+ 5 - 4
lisp/org-html.el

@@ -405,10 +405,10 @@ with a link to this URL."
 ;;; Variables, constants, and parameter plists
 ;;; Variables, constants, and parameter plists
 
 
 (defvar org-export-html-preamble nil
 (defvar org-export-html-preamble nil
-  "Preamble, to be inserted just before <body>.  Set by publishing functions.
+  "Preamble, to be inserted just after <body>.  Set by publishing functions.
 This may also be a function, building and inserting the preamble.")
 This may also be a function, building and inserting the preamble.")
 (defvar org-export-html-postamble nil
 (defvar org-export-html-postamble nil
-  "Preamble, to be inserted just after </body>.  Set by publishing functions.
+  "Preamble, to be inserted just before </body>.  Set by publishing functions.
 This may also be a function, building and inserting the postamble.")
 This may also be a function, building and inserting the postamble.")
 (defvar org-export-html-auto-preamble t
 (defvar org-export-html-auto-preamble t
   "Should default preamble be inserted?  Set by publishing functions.")
   "Should default preamble be inserted?  Set by publishing functions.")
@@ -640,7 +640,8 @@ MAY-INLINE-P allows inlining it as an image."
 	 (setq thefile 
 	 (setq thefile 
 	    (let
 	    (let
 	       ((str (org-export-html-format-href thefile)))
 	       ((str (org-export-html-format-href thefile)))
-	      (if (and type (string-match "^//" str))
+	      (if (and type (not (string= "file" type))
+		       (string-match "^//" str))
 		  (concat type ":" str)
 		  (concat type ":" str)
 		  str)))
 		  str)))
 
 
@@ -913,7 +914,7 @@ lang=\"%s\" xml:lang=\"%s\">
 		      "")
 		      "")
 		  (or charset "iso-8859-1"))
 		  (or charset "iso-8859-1"))
 		 language language
 		 language language
-		 (org-html-expand title)
+		 title
 		 (or charset "iso-8859-1")
 		 (or charset "iso-8859-1")
 		 date author description keywords
 		 date author description keywords
 		 style
 		 style

+ 2 - 2
lisp/org-id.el

@@ -330,9 +330,9 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
 	    (substring rnd 13 16)
 	    (substring rnd 13 16)
 	    (format "%x"
 	    (format "%x"
 		    (logior
 		    (logior
-		     #B10000000
+		     #b10000000
 		     (logand
 		     (logand
-		      #B10111111
+		      #b10111111
 		      (string-to-number
 		      (string-to-number
 		       (substring rnd 16 18) 16))))
 		       (substring rnd 16 18) 16))))
 	    (substring rnd 18 20)
 	    (substring rnd 18 20)

+ 4 - 5
lisp/org-w3m.el

@@ -41,7 +41,6 @@
 ;;
 ;;
 
 
 (require 'org)
 (require 'org)
-(declare-function w3m-anchor "ext:w3m-util" (position))
 
 
 (defun org-w3m-copy-for-org-mode ()
 (defun org-w3m-copy-for-org-mode ()
   "Copy current buffer content or active region with `org-mode' style links.
   "Copy current buffer content or active region with `org-mode' style links.
@@ -68,7 +67,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
         ;; store current point before jump next anchor
         ;; store current point before jump next anchor
         (setq temp-position (point))
         (setq temp-position (point))
         ;; move to next anchor when current point is not at anchor
         ;; move to next anchor when current point is not at anchor
-        (or (w3m-anchor (point)) (org-w3m-get-next-link-start))
+        (or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start))
         (if (<= (point) transform-end)  ; if point is inside transform bound
         (if (<= (point) transform-end)  ; if point is inside transform bound
             (progn
             (progn
               ;; get content between two links.
               ;; get content between two links.
@@ -77,7 +76,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
                                                (buffer-substring
                                                (buffer-substring
                                                 temp-position (point)))))
                                                 temp-position (point)))))
               ;; get link location at current point.
               ;; get link location at current point.
-              (setq link-location (w3m-anchor (point)))
+              (setq link-location (get-text-property (point) 'w3m-href-anchor))
               ;; get link title at current point.
               ;; get link title at current point.
               (setq link-title (buffer-substring (point)
               (setq link-title (buffer-substring (point)
                                                  (org-w3m-get-anchor-end)))
                                                  (org-w3m-get-anchor-end)))
@@ -115,7 +114,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
     (while (next-single-property-change (point) 'w3m-anchor-sequence)
     (while (next-single-property-change (point) 'w3m-anchor-sequence)
       ;; jump to next anchor
       ;; jump to next anchor
       (goto-char (next-single-property-change (point) 'w3m-anchor-sequence))
       (goto-char (next-single-property-change (point) 'w3m-anchor-sequence))
-      (when (w3m-anchor (point))
+      (when (get-text-property (point) 'w3m-href-anchor)
         ;; return point when current is valid link
         ;; return point when current is valid link
         (throw 'reach nil))))
         (throw 'reach nil))))
   (point))
   (point))
@@ -126,7 +125,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
     (while (previous-single-property-change (point) 'w3m-anchor-sequence)
     (while (previous-single-property-change (point) 'w3m-anchor-sequence)
       ;; jump to previous anchor
       ;; jump to previous anchor
       (goto-char (previous-single-property-change (point) 'w3m-anchor-sequence))
       (goto-char (previous-single-property-change (point) 'w3m-anchor-sequence))
-      (when (w3m-anchor (point))
+      (when (get-text-property (point) 'w3m-href-anchor)
         ;; return point when current is valid link
         ;; return point when current is valid link
         (throw 'reach nil))))
         (throw 'reach nil))))
   (point))
   (point))

+ 32 - 34
lisp/org.el

@@ -5977,6 +5977,7 @@ This means that the buffer may change while running BODY,
 but it also means that the buffer should stay alive
 but it also means that the buffer should stay alive
 during the operation, because otherwise all these markers will
 during the operation, because otherwise all these markers will
 point nowhere."
 point nowhere."
+  (declare (indent 1))
   `(let ((data (org-outline-overlay-data ,use-markers)))
   `(let ((data (org-outline-overlay-data ,use-markers)))
      (unwind-protect
      (unwind-protect
 	 (progn
 	 (progn
@@ -7216,30 +7217,18 @@ and still retain the repeater to cover future instances of the task."
       (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
       (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
     (goto-char end)
     (goto-char end)
     (loop for n from nmin to nmax do
     (loop for n from nmin to nmax do
-	  (if (not doshift)
-	      (setq task (if (not idprop) template
-			   (with-temp-buffer
-			     (insert template)
-			     (org-mode)
-			     (goto-char (point-min))
-			     (if org-clone-delete-id
-				 (org-entry-delete nil "ID")
-			       (org-id-get-create t))
-			     (while (re-search-forward
-				     org-property-drawer-re nil t)
-			       (org-remove-empty-drawer-at
-				"PROPERTIES" (point)))
-			     (buffer-string))))
-	    (with-temp-buffer
-	      (insert template)
-	      (org-mode)
-	      (goto-char (point-min))
-	      (and idprop (if org-clone-delete-id
-			      (org-entry-delete nil "ID")
-			    (org-id-get-create t)))
-	      (while (re-search-forward org-property-drawer-re nil t)
-		(org-remove-empty-drawer-at "PROPERTIES" (point)))
-	      (goto-char (point-min))
+	  ;; prepare clone
+	  (with-temp-buffer
+	    (insert template)
+	    (org-mode)
+	    (goto-char (point-min))
+	    (and idprop (if org-clone-delete-id
+			    (org-entry-delete nil "ID")
+			  (org-id-get-create t)))
+	    (while (re-search-forward org-property-drawer-re nil t)
+	      (org-remove-empty-drawer-at "PROPERTIES" (point)))
+	    (goto-char (point-min))
+	    (when doshift
 	      (while (re-search-forward org-ts-regexp-both nil t)
 	      (while (re-search-forward org-ts-regexp-both nil t)
 		(org-timestamp-change (* n shift-n) shift-what))
 		(org-timestamp-change (* n shift-n) shift-what))
 	      (unless (= n n-no-remove)
 	      (unless (= n n-no-remove)
@@ -7248,8 +7237,8 @@ and still retain the repeater to cover future instances of the task."
 		  (save-excursion
 		  (save-excursion
 		    (goto-char (match-beginning 0))
 		    (goto-char (match-beginning 0))
 		    (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)")
 		    (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)")
-			(delete-region (match-beginning 1) (match-end 1))))))
-	      (setq task (buffer-string))))
+			(delete-region (match-beginning 1) (match-end 1)))))))
+	    (setq task (buffer-string)))
 	  (insert task))
 	  (insert task))
     (goto-char beg)))
     (goto-char beg)))
 
 
@@ -9539,13 +9528,14 @@ on the system \"/user@host:\"."
 
 
 (defun org-refile-cache-check-set (set)
 (defun org-refile-cache-check-set (set)
   "Check if all the markers in the cache still have live buffers."
   "Check if all the markers in the cache still have live buffers."
-  (catch 'exit
-    (while set
-      (if (not (marker-buffer (nth 3 (pop set))))
-	  (progn
-	    (message "not found") (sit-for 3)
-	    (throw 'exit nil))))
-    t))
+  (let (marker)
+    (catch 'exit
+      (while (and set (setq marker (nth 3 (pop set))))
+	;; if org-refile-use-outline-path is 'file, marker may be nil
+	(when (and marker (null (marker-buffer marker)))
+	  (message "not found") (sit-for 3)
+	  (throw 'exit nil)))
+      t)))
 
 
 (defun org-refile-cache-put (set &rest identifiers)
 (defun org-refile-cache-put (set &rest identifiers)
   "Push the refile targets SET into the cache, under IDENTIFIERS."
   "Push the refile targets SET into the cache, under IDENTIFIERS."
@@ -9663,7 +9653,8 @@ on the system \"/user@host:\"."
 		     (when (= (point) pos0)
 		     (when (= (point) pos0)
 		       ;; verification function has not moved point
 		       ;; verification function has not moved point
 		       (goto-char (point-at-eol))))))))
 		       (goto-char (point-at-eol))))))))
-	    (org-refile-cache-put tgs (buffer-file-name) descre)
+	    (when org-refile-use-cache
+	      (org-refile-cache-put tgs (buffer-file-name) descre))
 	    (setq targets (append tgs targets))
 	    (setq targets (append tgs targets))
 	    ))))
 	    ))))
     (message "Getting targets...done")
     (message "Getting targets...done")
@@ -15044,6 +15035,13 @@ used by the agenda files.  If ARCHIVE is `ifmode', do this only if
       (setq files (org-add-archive-files files)))
       (setq files (org-add-archive-files files)))
     files))
     files))
 
 
+(defun org-agenda-file-p (&optional file)
+  "Return non-nil, if FILE is an agenda file.
+If FILE is omitted, use the file associated with the current
+buffer."
+  (member (or file (buffer-file-name))
+          (org-agenda-files t)))
+
 (defun org-edit-agenda-file-list ()
 (defun org-edit-agenda-file-list ()
   "Edit the list of agenda files.
   "Edit the list of agenda files.
 Depending on setup, this either uses customize to edit the variable
 Depending on setup, this either uses customize to edit the variable