summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-05-05 08:13:43 +0200
committerBastien Guerry <bzg@altern.org>2012-05-05 08:13:43 +0200
commit578a7f5aa5e01ec847b9da4cbd31a4376fb946e2 (patch)
tree92e519759bab62f4d8d8ac2194666da6799a3872
parent61653a2c013f2172927471df1e0c8a162b190a29 (diff)
downloadorg-mode-578a7f5aa5e01ec847b9da4cbd31a4376fb946e2.tar.gz
New option `org-src-prevent-auto-filling' defaulting to nil.
* org.el (org-src-prevent-auto-filling): New option to prevent auto-filling in src blocks. This defaults to nil to avoid people being surprised that no auto-fill occurs in Org buffers where they use `auto-fill-mode'. (org-auto-fill-function): Use the new option. Thanks to Ken Williams for this feature request and to Charles C. Berry for a preliminary patch for this.
-rw-r--r--lisp/org.el32
1 files changed, 20 insertions, 12 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 8cdb799..5f707d7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5411,6 +5411,13 @@ will be prompted for."
:group 'org-appearance
:group 'org-babel)
+(defcustom org-src-prevent-auto-filling nil
+ "When non-nil, prevent auto-filling in src blocks."
+ :type 'boolean
+ :version "24.1"
+ :group 'org-appearance
+ :group 'org-babel)
+
(defun org-fontify-meta-lines-and-blocks (limit)
(condition-case nil
(org-fontify-meta-lines-and-blocks-1 limit)
@@ -20754,18 +20761,19 @@ the functionality can be provided as a fall-back.")
(defun org-auto-fill-function ()
"Auto-fill function."
- (let (itemp prefix)
- ;; When in a list, compute an appropriate fill-prefix and make
- ;; sure it will be used by `do-auto-fill'.
- (cond ((setq itemp (org-in-item-p))
- (progn
- (setq prefix (make-string (org-list-item-body-column itemp) ?\ ))
- (flet ((fill-context-prefix (from to &optional flr) prefix))
- (do-auto-fill))))
- (orgstruct-is-++
- (orgstruct++-ignore-org-filling
- (do-auto-fill)))
- (t (do-auto-fill)))))
+ (unless (and org-src-prevent-auto-filling (org-in-src-block-p))
+ (let (itemp prefix)
+ ;; When in a list, compute an appropriate fill-prefix and make
+ ;; sure it will be used by `do-auto-fill'.
+ (cond ((setq itemp (org-in-item-p))
+ (progn
+ (setq prefix (make-string (org-list-item-body-column itemp) ?\ ))
+ (flet ((fill-context-prefix (from to &optional flr) prefix))
+ (do-auto-fill))))
+ (orgstruct-is-++
+ (orgstruct++-ignore-org-filling
+ (do-auto-fill)))
+ (t (do-auto-fill))))))
;;; Other stuff.