summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-12-18 12:49:49 +0100
committerBastien Guerry <bzg@altern.org>2012-12-18 12:49:49 +0100
commit9d4dd69b30a5fabf03728e46c194b64e1a9fd4e8 (patch)
tree798b5a431c2fa6da9f97c8b53a1bcd2fbb6245d6
parent20839ced710269d4c40eadaf480a71723ca41807 (diff)
downloadorg-mode-9d4dd69b30a5fabf03728e46c194b64e1a9fd4e8.tar.gz
org.el (org-fill-paragraph): Fill correctly in source code block.
* org.el (org-fill-paragraph): Fill correctly in source code block. Thanks to Sébastien Vauban for reporting this.
-rw-r--r--lisp/org.el30
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/org.el b/lisp/org.el
index c6d9393..8c6f7ec 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20995,19 +20995,23 @@ width for filling.
For convenience, when point is at a plain list, an item or
a footnote definition, try to fill the first paragraph within."
- ;; Falls back on message-fill-paragraph when necessary
(interactive)
- (if (and (derived-mode-p 'message-mode)
- (or (not (message-in-body-p))
- (save-excursion (move-beginning-of-line 1)
- (looking-at message-cite-prefix-regexp))))
- (let ((fill-paragraph-function
- (cadadr (assoc 'fill-paragraph-function org-fb-vars)))
- (fill-prefix (cadadr (assoc 'fill-prefix org-fb-vars)))
- (paragraph-start (cadadr (assoc 'paragraph-start org-fb-vars)))
- (paragraph-separate
- (cadadr (assoc 'paragraph-separate org-fb-vars))))
- (fill-paragraph nil))
+ (cond ;; First ensure filling in correct in message-mode
+ ((and (derived-mode-p 'message-mode)
+ (or (not (message-in-body-p))
+ (save-excursion (move-beginning-of-line 1)
+ (looking-at message-cite-prefix-regexp))))
+ (let ((fill-paragraph-function
+ (cadadr (assoc 'fill-paragraph-function org-fb-vars)))
+ (fill-prefix (cadadr (assoc 'fill-prefix org-fb-vars)))
+ (paragraph-start (cadadr (assoc 'paragraph-start org-fb-vars)))
+ (paragraph-separate
+ (cadadr (assoc 'paragraph-separate org-fb-vars))))
+ (fill-paragraph nil)))
+ ;; Correct filling in source block
+ ((org-in-src-block-p)
+ (org-babel-do-key-sequence-in-edit-buffer (kbd "M-q")))
+ (t
(save-excursion
;; Move to end of line in order to get the first paragraph
;; within a plain list or a footnote definition.
@@ -21093,7 +21097,7 @@ a footnote definition, try to fill the first paragraph within."
;; Fill comments.
(comment (fill-comment-paragraph justify))
;; Ignore every other element.
- (otherwise t)))))))
+ (otherwise t))))))))
(defun org-auto-fill-function ()
"Auto-fill function."