summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-09-28 00:13:15 +0200
committerBastien Guerry <bzg@altern.org>2012-09-28 00:13:15 +0200
commit5ba6bd859a5f42c7692abca1326470023389dad8 (patch)
treee667b4e872e7d4b12c8e5a5a283a0b04b84f0259
parentb04e66a6f832aba3dc6cfd02784e9ff0f65d13e0 (diff)
parent001d2d92ba5937a2f3681cd2ee004c1807a97136 (diff)
downloadorg-mode-5ba6bd859a5f42c7692abca1326470023389dad8.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/ob.el5
-rwxr-xr-xlisp/org-agenda.el11
-rw-r--r--lisp/org-lparse.el28
-rw-r--r--lisp/org-src.el24
-rw-r--r--lisp/org.el25
5 files changed, 65 insertions, 28 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index 1316893..cbbda20 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -1937,9 +1937,10 @@ code ---- the results are extracted in the syntax of the source
((member "prepend" result-params)))) ; already there
(setq 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 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))
(setq end (point-marker))))
(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)
(funcall wrap "#+BEGIN_LaTeX" "#+END_LaTeX"))
((member "org" result-params)
- (funcall wrap "#+BEGIN_SRC org" "#+END_SRC"))
+ (funcall wrap "#+BEGIN_SRC org" "#+END_SRC" t))
((member "code" result-params)
(funcall wrap (format "#+BEGIN_SRC %s%s" (or lang "none") results-switches)
"#+END_SRC"))
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index cd35bf5..f7e490b 100755
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1985,7 +1985,7 @@ The following commands are available:
(easy-menu-add org-agenda-menu)
(if org-startup-truncated (setq truncate-lines t))
(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)
;; Make sure properties are removed when copying text
(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))
-(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
(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 ()
"Move cursor to the next line, and show if follow mode is active."
diff --git a/lisp/org-lparse.el b/lisp/org-lparse.el
index 9d1e034..7024912 100644
--- a/lisp/org-lparse.el
+++ b/lisp/org-lparse.el
@@ -435,6 +435,10 @@ PUB-DIR specifies the publishing directory."
(let* ((org-lparse-backend (intern native-backend))
(org-lparse-other-backend (and 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)
(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
(format "via %s" native-backend)))
(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
"Control flashing of messages logged with `org-lparse-warn'.
@@ -1712,7 +1720,12 @@ information."
(org-lparse-end-paragraph)
(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."
(goto-char (point-min))
(while (re-search-forward
@@ -1725,10 +1738,12 @@ information."
(format "ORG-%s-END %s" (upcase (match-string 2))
(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.
Stripping happens only when the exported backend is not one of
\"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)
(replace-match "" t t))))))
-(add-hook 'org-export-preprocess-hook
- 'org-lparse-strip-experimental-blocks-maybe-hook)
-
(defvar org-lparse-list-table-p nil
"Non-nil if `org-do-lparse' is within a list-table.")
diff --git a/lisp/org-src.el b/lisp/org-src.el
index c110f32..62115ba 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -272,8 +272,9 @@ buffer."
(setq line (org-current-line)
col (current-column)))
(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)
(when 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)
(end org-edit-src-end-marker)
(ovl org-edit-src-overlay)
+ (bufstr (buffer-string))
(buffer (current-buffer))
(single (org-bound-and-true-p org-edit-src-force-single-line))
(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)
(setq total-nindent (+ total-nindent 2)))
(setq code (buffer-string))
+ (when (eq context 'save)
+ (erase-buffer)
+ (insert bufstr))
(set-buffer-modified-p nil))
(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)
(when allow-write-back-p
- (delete-region beg end)
+ (delete-region beg (1- end))
(insert code)
+ (delete-char 1)
(goto-char beg)
(if single (just-one-space)))
(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
(org-goto-line (1- (+ (org-current-line) line)))
(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)
(when 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
(concat " org-src-fontification:" (symbol-name lang-mode)))
(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))
(font-lock-fontify-buffer)
(setq pos (point-min))
(while (setq next (next-single-property-change pos 'face))
(put-text-property
- (+ start (1- pos)) (+ start next) 'face
+ (+ start (1- pos)) (1- (+ start next)) 'face
(get-text-property pos 'face) org-buffer)
(setq pos next)))
(add-text-properties
diff --git a/lisp/org.el b/lisp/org.el
index d033253..ab7b43b 100644
--- a/lisp/org.el
+++ b/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.")
(defun org-font-lock-hook (limit)
+ "Run `org-font-lock-hook' within LIMIT."
(run-hook-with-args 'org-font-lock-hook limit))
(defun org-set-font-lock-defaults ()
+ "Set font lock defaults for the current buffer."
(let* ((em org-fontify-emphasized-text)
(lk org-activate-links)
(org-font-lock-extra-keywords
@@ -9808,7 +9810,9 @@ application the system uses for this file type."
(or (org-offer-links-in-entry arg)
(progn (require 'org-attach) (org-attach-reveal 'if-exists))))
((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))
(not (org-in-regexp org-bracket-link-regexp)))
(org-footnote-action))
@@ -17983,10 +17987,13 @@ BEG and END default to the buffer boundaries."
(overlay-put ov 'face 'default)
(overlay-put ov 'org-image-overlay t)
(overlay-put ov 'modification-hooks
- (list 'org-display-inline-modification-hook))
+ (list 'org-display-inline-remove-overlay))
(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."
(let ((inhibit-modification-hooks t))
(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-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.
`org-speed-commands-default' specifies a minimal command set.
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
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."
(when (and (bolp) (looking-at org-babel-src-block-regexp))
(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.
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
:version "24.1"
:type 'hook)