浏览代码

Merge branch 'maint'

Bastien Guerry 12 年之前
父节点
当前提交
5ba6bd859a
共有 5 个文件被更改,包括 65 次插入28 次删除
  1. 3 2
      lisp/ob.el
  2. 7 4
      lisp/org-agenda.el
  3. 20 8
      lisp/org-lparse.el
  4. 16 8
      lisp/org-src.el
  5. 19 6
      lisp/org.el

+ 3 - 2
lisp/ob.el

@@ -1937,9 +1937,10 @@ code ---- the results are extracted in the syntax of the source
 	   ((member "prepend" result-params)))) ; already there
 	   ((member "prepend" result-params)))) ; already there
 	(setq results-switches
 	(setq results-switches
 	      (if results-switches (concat " " results-switches) ""))
 	      (if results-switches (concat " " results-switches) ""))
-	(let ((wrap (lambda (start finish)
+	(let ((wrap (lambda (start finish &optional escape)
 		      (goto-char end) (insert (concat finish "\n"))
 		      (goto-char end) (insert (concat finish "\n"))
 		      (goto-char beg) (insert (concat start "\n"))
 		      (goto-char beg) (insert (concat start "\n"))
+		      (if escape (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))
 		      (goto-char end) (goto-char (point-at-eol))
 		      (goto-char end) (goto-char (point-at-eol))
 		      (setq end (point-marker))))
 		      (setq end (point-marker))))
 	      (proper-list-p (lambda (it) (and (listp it) (null (cdr (last it)))))))
 	      (proper-list-p (lambda (it) (and (listp it) (null (cdr (last it)))))))
@@ -1986,7 +1987,7 @@ code ---- the results are extracted in the syntax of the source
 	   ((member "latex" result-params)
 	   ((member "latex" result-params)
 	    (funcall wrap "#+BEGIN_LaTeX" "#+END_LaTeX"))
 	    (funcall wrap "#+BEGIN_LaTeX" "#+END_LaTeX"))
 	   ((member "org" result-params)
 	   ((member "org" result-params)
-	    (funcall wrap "#+BEGIN_SRC org" "#+END_SRC"))
+	    (funcall wrap "#+BEGIN_SRC org" "#+END_SRC" t))
 	   ((member "code" result-params)
 	   ((member "code" result-params)
 	    (funcall wrap (format "#+BEGIN_SRC %s%s" (or lang "none") results-switches)
 	    (funcall wrap (format "#+BEGIN_SRC %s%s" (or lang "none") results-switches)
 		     "#+END_SRC"))
 		     "#+END_SRC"))

+ 7 - 4
lisp/org-agenda.el

@@ -1985,7 +1985,7 @@ The following commands are available:
   (easy-menu-add org-agenda-menu)
   (easy-menu-add org-agenda-menu)
   (if org-startup-truncated (setq truncate-lines t))
   (if org-startup-truncated (setq truncate-lines t))
   (org-set-local 'line-move-visual nil)
   (org-set-local 'line-move-visual nil)
-  (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
+  (org-add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
   (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   ;; Make sure properties are removed when copying text
   ;; Make sure properties are removed when copying text
   (make-local-variable 'filter-buffer-substring-functions)
   (make-local-variable 'filter-buffer-substring-functions)
@@ -7480,11 +7480,14 @@ When called with a prefix argument, include all archive files as well."
 		"")))
 		"")))
   (force-mode-line-update))
   (force-mode-line-update))
 
 
-(defun org-agenda-post-command-hook ()
+(define-obsolete-function-alias
+  'org-agenda-post-command-hook 'org-agenda-update-agenda-type "24.3")
+
+(defun org-agenda-update-agenda-type ()
+  "Update the agenda type after each command."
   (setq org-agenda-type
   (setq org-agenda-type
 	(or (get-text-property (point) 'org-agenda-type)
 	(or (get-text-property (point) 'org-agenda-type)
-	    (get-text-property (max (point-min) (1- (point)))
-			       'org-agenda-type))))
+	    (get-text-property (max (point-min) (1- (point))) 'org-agenda-type))))
 
 
 (defun org-agenda-next-line ()
 (defun org-agenda-next-line ()
   "Move cursor to the next line, and show if follow mode is active."
   "Move cursor to the next line, and show if follow mode is active."

+ 20 - 8
lisp/org-lparse.el

@@ -435,6 +435,10 @@ PUB-DIR specifies the publishing directory."
   (let* ((org-lparse-backend (intern native-backend))
   (let* ((org-lparse-backend (intern native-backend))
 	 (org-lparse-other-backend (and target-backend
 	 (org-lparse-other-backend (and target-backend
 					(intern target-backend))))
 					(intern target-backend))))
+    (add-hook 'org-export-preprocess-hook
+	      'org-lparse-strip-experimental-blocks-maybe)
+    (add-hook 'org-export-preprocess-after-blockquote-hook
+	      'org-lparse-preprocess-after-blockquote)
     (unless (org-lparse-backend-is-native-p native-backend)
     (unless (org-lparse-backend-is-native-p native-backend)
       (error "Don't know how to export natively to backend %s" native-backend))
       (error "Don't know how to export natively to backend %s" native-backend))
 
 
@@ -443,7 +447,11 @@ PUB-DIR specifies the publishing directory."
       (error "Don't know how to export to backend %s %s" target-backend
       (error "Don't know how to export to backend %s %s" target-backend
 	     (format "via %s" native-backend)))
 	     (format "via %s" native-backend)))
     (run-hooks 'org-export-first-hook)
     (run-hooks 'org-export-first-hook)
-    (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir)))
+    (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir)
+    (remove-hook 'org-export-preprocess-hook
+		 'org-lparse-strip-experimental-blocks-maybe)
+    (remove-hook 'org-export-preprocess-after-blockquote-hook
+		 'org-lparse-preprocess-after-blockquote)))
 
 
 (defcustom org-lparse-use-flashy-warning nil
 (defcustom org-lparse-use-flashy-warning nil
   "Control flashing of messages logged with `org-lparse-warn'.
   "Control flashing of messages logged with `org-lparse-warn'.
@@ -1712,7 +1720,12 @@ information."
   (org-lparse-end-paragraph)
   (org-lparse-end-paragraph)
   (org-lparse-end-list-item (or type "u")))
   (org-lparse-end-list-item (or type "u")))
 
 
-(defun org-lparse-preprocess-after-blockquote-hook ()
+(define-obsolete-function-alias
+  'org-lparse-preprocess-after-blockquote-hook
+  'org-lparse-preprocess-after-blockquote
+  "24.3")
+
+(defun org-lparse-preprocess-after-blockquote ()
   "Treat `org-lparse-special-blocks' specially."
   "Treat `org-lparse-special-blocks' specially."
   (goto-char (point-min))
   (goto-char (point-min))
   (while (re-search-forward
   (while (re-search-forward
@@ -1725,10 +1738,12 @@ information."
 	 (format "ORG-%s-END %s" (upcase (match-string 2))
 	 (format "ORG-%s-END %s" (upcase (match-string 2))
 		 (match-string 3))) t t))))
 		 (match-string 3))) t t))))
 
 
-(add-hook 'org-export-preprocess-after-blockquote-hook
-	  'org-lparse-preprocess-after-blockquote-hook)
+(define-obsolete-function-alias
+  'org-lparse-strip-experimental-blocks-maybe-hook
+  'org-lparse-strip-experimental-blocks-maybe
+  "24.3")
 
 
-(defun org-lparse-strip-experimental-blocks-maybe-hook ()
+(defun org-lparse-strip-experimental-blocks-maybe ()
   "Strip \"list-table\" and \"annotation\" blocks.
   "Strip \"list-table\" and \"annotation\" blocks.
 Stripping happens only when the exported backend is not one of
 Stripping happens only when the exported backend is not one of
 \"odt\" or \"xhtml\"."
 \"odt\" or \"xhtml\"."
@@ -1743,9 +1758,6 @@ Stripping happens only when the exported backend is not one of
 	(when (member (match-string 1) org-lparse-special-blocks)
 	(when (member (match-string 1) org-lparse-special-blocks)
 	  (replace-match "" t t))))))
 	  (replace-match "" t t))))))
 
 
-(add-hook 'org-export-preprocess-hook
-	  'org-lparse-strip-experimental-blocks-maybe-hook)
-
 (defvar org-lparse-list-table-p nil
 (defvar org-lparse-list-table-p nil
   "Non-nil if `org-do-lparse' is within a list-table.")
   "Non-nil if `org-do-lparse' is within a list-table.")
 
 

+ 16 - 8
lisp/org-src.el

@@ -272,8 +272,9 @@ buffer."
 	(setq line (org-current-line)
 	(setq line (org-current-line)
 	      col (current-column)))
 	      col (current-column)))
       (if (and (setq buffer (org-edit-src-find-buffer beg end))
       (if (and (setq buffer (org-edit-src-find-buffer beg end))
-	       (if org-src-ask-before-returning-to-edit-buffer
-		   (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? ") t))
+	       (or (eq context 'save)
+		   (if org-src-ask-before-returning-to-edit-buffer
+		       (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? ") t)))
 	  (org-src-switch-to-buffer buffer 'return)
 	  (org-src-switch-to-buffer buffer 'return)
 	(when buffer
 	(when buffer
 	  (with-current-buffer buffer
 	  (with-current-buffer buffer
@@ -598,6 +599,7 @@ the language, a switch telling if the content should be in a single line."
   (let* ((beg org-edit-src-beg-marker)
   (let* ((beg org-edit-src-beg-marker)
 	 (end org-edit-src-end-marker)
 	 (end org-edit-src-end-marker)
 	 (ovl org-edit-src-overlay)
 	 (ovl org-edit-src-overlay)
+	 (bufstr (buffer-string))
 	 (buffer (current-buffer))
 	 (buffer (current-buffer))
 	 (single (org-bound-and-true-p org-edit-src-force-single-line))
 	 (single (org-bound-and-true-p org-edit-src-force-single-line))
 	 (macro (eq single 'macro-definition))
 	 (macro (eq single 'macro-definition))
@@ -651,13 +653,18 @@ the language, a switch telling if the content should be in a single line."
       (if (org-bound-and-true-p org-edit-src-picture)
       (if (org-bound-and-true-p org-edit-src-picture)
 	  (setq total-nindent (+ total-nindent 2)))
 	  (setq total-nindent (+ total-nindent 2)))
       (setq code (buffer-string))
       (setq code (buffer-string))
+      (when (eq context 'save)
+	(erase-buffer)
+	(insert bufstr))
       (set-buffer-modified-p nil))
       (set-buffer-modified-p nil))
     (org-src-switch-to-buffer (marker-buffer beg) (or context 'exit))
     (org-src-switch-to-buffer (marker-buffer beg) (or context 'exit))
-    (kill-buffer buffer)
+    (if (eq context 'save) (save-buffer)
+      (kill-buffer buffer))
     (goto-char beg)
     (goto-char beg)
     (when allow-write-back-p
     (when allow-write-back-p
-      (delete-region beg end)
+      (delete-region beg (1- end))
       (insert code)
       (insert code)
+      (delete-char 1)
       (goto-char beg)
       (goto-char beg)
       (if single (just-one-space)))
       (if single (just-one-space)))
     (if (memq t (mapcar (lambda (overlay)
     (if (memq t (mapcar (lambda (overlay)
@@ -669,8 +676,9 @@ the language, a switch telling if the content should be in a single line."
       ;; Block is visible, put point where it was in the code buffer
       ;; Block is visible, put point where it was in the code buffer
       (org-goto-line (1- (+ (org-current-line) line)))
       (org-goto-line (1- (+ (org-current-line) line)))
       (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))))
       (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))))
-    (move-marker beg nil)
-    (move-marker end nil))
+    (unless (eq context 'save)
+      (move-marker beg nil)
+      (move-marker end nil)))
   (unless (eq context 'save)
   (unless (eq context 'save)
     (when org-edit-src-saved-temp-window-config
     (when org-edit-src-saved-temp-window-config
       (set-window-configuration org-edit-src-saved-temp-window-config)
       (set-window-configuration org-edit-src-saved-temp-window-config)
@@ -805,13 +813,13 @@ fontification of code blocks see `org-src-fontify-block' and
 	      (get-buffer-create
 	      (get-buffer-create
 	       (concat " org-src-fontification:" (symbol-name lang-mode)))
 	       (concat " org-src-fontification:" (symbol-name lang-mode)))
 	    (delete-region (point-min) (point-max))
 	    (delete-region (point-min) (point-max))
-	    (insert (concat string " ")) ;; so there's a final property change
+	    (insert string)
 	    (unless (eq major-mode lang-mode) (funcall lang-mode))
 	    (unless (eq major-mode lang-mode) (funcall lang-mode))
 	    (font-lock-fontify-buffer)
 	    (font-lock-fontify-buffer)
 	    (setq pos (point-min))
 	    (setq pos (point-min))
 	    (while (setq next (next-single-property-change pos 'face))
 	    (while (setq next (next-single-property-change pos 'face))
 	      (put-text-property
 	      (put-text-property
-	       (+ start (1- pos)) (+ start next) 'face
+	       (+ start (1- pos)) (1- (+ start next)) 'face
 	       (get-text-property pos 'face) org-buffer)
 	       (get-text-property pos 'face) org-buffer)
 	      (setq pos next)))
 	      (setq pos next)))
 	  (add-text-properties
 	  (add-text-properties

+ 19 - 6
lisp/org.el

@@ -5882,9 +5882,11 @@ it is installed to be used by font lock.  This can be useful if something
 needs to be inserted at a specific position in the font-lock sequence.")
 needs to be inserted at a specific position in the font-lock sequence.")
 
 
 (defun org-font-lock-hook (limit)
 (defun org-font-lock-hook (limit)
+  "Run `org-font-lock-hook' within LIMIT."
   (run-hook-with-args 'org-font-lock-hook limit))
   (run-hook-with-args 'org-font-lock-hook limit))
 
 
 (defun org-set-font-lock-defaults ()
 (defun org-set-font-lock-defaults ()
+  "Set font lock defaults for the current buffer."
   (let* ((em org-fontify-emphasized-text)
   (let* ((em org-fontify-emphasized-text)
 	 (lk org-activate-links)
 	 (lk org-activate-links)
 	 (org-font-lock-extra-keywords
 	 (org-font-lock-extra-keywords
@@ -9808,7 +9810,9 @@ application the system uses for this file type."
       (or (org-offer-links-in-entry arg)
       (or (org-offer-links-in-entry arg)
 	  (progn (require 'org-attach) (org-attach-reveal 'if-exists))))
 	  (progn (require 'org-attach) (org-attach-reveal 'if-exists))))
      ((run-hook-with-args-until-success 'org-open-at-point-functions))
      ((run-hook-with-args-until-success 'org-open-at-point-functions))
-     ((org-at-timestamp-p t) (org-follow-timestamp-link))
+     ((and (org-at-timestamp-p t)
+	   (not (org-in-regexp org-bracket-link-regexp)))
+      (org-follow-timestamp-link))
      ((and (or (org-footnote-at-reference-p) (org-footnote-at-definition-p))
      ((and (or (org-footnote-at-reference-p) (org-footnote-at-definition-p))
 	   (not (org-in-regexp org-bracket-link-regexp)))
 	   (not (org-in-regexp org-bracket-link-regexp)))
       (org-footnote-action))
       (org-footnote-action))
@@ -17983,10 +17987,13 @@ BEG and END default to the buffer boundaries."
 		(overlay-put ov 'face 'default)
 		(overlay-put ov 'face 'default)
 		(overlay-put ov 'org-image-overlay t)
 		(overlay-put ov 'org-image-overlay t)
 		(overlay-put ov 'modification-hooks
 		(overlay-put ov 'modification-hooks
-			     (list 'org-display-inline-modification-hook))
+			     (list 'org-display-inline-remove-overlay))
 		(push ov org-inline-image-overlays)))))))))
 		(push ov org-inline-image-overlays)))))))))
 
 
-(defun org-display-inline-modification-hook (ov after beg end &optional len)
+(define-obsolete-function-alias
+  'org-display-inline-modification-hook 'org-display-inline-remove-overlay "24.3")
+
+(defun org-display-inline-remove-overlay (ov after beg end &optional len)
   "Remove inline-display overlay if a corresponding region is modified."
   "Remove inline-display overlay if a corresponding region is modified."
   (let ((inhibit-modification-hooks t))
   (let ((inhibit-modification-hooks t))
     (when (and ov after)
     (when (and ov after)
@@ -18364,7 +18371,10 @@ If not, return to the original position and throw an error."
 (defvar org-table-auto-blank-field) ; defined in org-table.el
 (defvar org-table-auto-blank-field) ; defined in org-table.el
 (defvar org-speed-command nil)
 (defvar org-speed-command nil)
 
 
-(defun org-speed-command-default-hook (keys)
+(define-obsolete-function-alias
+  'org-speed-command-default-hook 'org-speed-command-activate "24.3")
+
+(defun org-speed-command-activate (keys)
   "Hook for activating single-letter speed commands.
   "Hook for activating single-letter speed commands.
 `org-speed-commands-default' specifies a minimal command set.
 `org-speed-commands-default' specifies a minimal command set.
 Use `org-speed-commands-user' for further customization."
 Use `org-speed-commands-user' for further customization."
@@ -18374,7 +18384,10 @@ Use `org-speed-commands-user' for further customization."
     (cdr (assoc keys (append org-speed-commands-user
     (cdr (assoc keys (append org-speed-commands-user
 			     org-speed-commands-default)))))
 			     org-speed-commands-default)))))
 
 
-(defun org-babel-speed-command-hook (keys)
+(define-obsolete-function-alias
+  'org-babel-speed-command-hook 'org-babel-speed-command-activate "24.3")
+
+(defun org-babel-speed-command-activate (keys)
   "Hook for activating single-letter code block commands."
   "Hook for activating single-letter code block commands."
   (when (and (bolp) (looking-at org-babel-src-block-regexp))
   (when (and (bolp) (looking-at org-babel-src-block-regexp))
     (cdr (assoc keys org-babel-key-bindings))))
     (cdr (assoc keys org-babel-key-bindings))))
@@ -18393,7 +18406,7 @@ and return nil or a valid handler as appropriate.  Handler could
 be one of an interactive command, a function, or a form.
 be one of an interactive command, a function, or a form.
 
 
 Set `org-use-speed-commands' to non-nil value to enable this
 Set `org-use-speed-commands' to non-nil value to enable this
-hook.  The default setting is `org-speed-command-default-hook'."
+hook.  The default setting is `org-speed-command-activate'."
   :group 'org-structure
   :group 'org-structure
   :version "24.1"
   :version "24.1"
   :type 'hook)
   :type 'hook)