From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Mitchell Subject: [BUG/PATCH] Set fill-indent-according-to-mode to nil in Org buffers Date: Fri, 21 Jan 2011 10:47:43 +0000 Message-ID: <1295606863-16627-1-git-send-email-wence@gmx.li> Return-path: Received: from [140.186.70.92] (port=52129 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PgEXC-0003DP-Vb for emacs-orgmode@gnu.org; Fri, 21 Jan 2011 05:48:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PgEXB-0001gE-P2 for emacs-orgmode@gnu.org; Fri, 21 Jan 2011 05:48:02 -0500 Received: from e450.epcc.ed.ac.uk ([129.215.56.230]:45935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PgEXB-0001fp-Eh for emacs-orgmode@gnu.org; Fri, 21 Jan 2011 05:48:01 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Lawrence Mitchell * lisp/org.el (org-mode): Locally set `fill-indent-according-to-mode' to nil. `org-adaptive-fill-function' attempts to correctly pick up a fill prefix for hand-indented paragraphs and lists. This is defeated by the indentation code, which does not recognise sublists correctly and gets the indentation wrong. By setting `fill-indent-according-to-mode' to nil, we tell Emacs' filling code to pay attention to `adaptive-fill-prefix' rather than using `indent-line-function'. This is not a perfect solution, since refilling a list entry still does not work correctly unless the entire item is on a single line. --- The filling code is a maze of twisty passages all alike, so I don't really understand what's going on. The problem is demonstrated with auto-fill-mode on when typing sublist entries that wrap over more than a single line #+begin_src org * Header - List + Sublist entry with lots and lots and lots and lots of text is wrapped like this #+end_src org And "like this" is incorrectly considered to be be part of the "List" entry, rather than the "Sublist" entry. This change fixes this problem for auto-fill-mode wrapping, but it doesn't work correctly for refilling, for reasons that are unclear to me. Cheers, Lawrence lisp/org.el | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index fcdf245..268223b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4716,6 +4716,7 @@ The following commands are available: ;; Paragraphs and auto-filling (org-set-autofill-regexps) (setq indent-line-function 'org-indent-line-function) + (set (make-local-variable 'fill-indent-according-to-mode) nil) (org-update-radio-target-regexp) ;; Beginning/end of defun (org-set-local 'beginning-of-defun-function 'org-beginning-of-defun) -- 1.7.4.rc1.7.g2cf08