From 91939998bc1c5e466dcf5ce895258efee749756b Mon Sep 17 00:00:00 2001 From: "Michael W. Olson" Date: Fri, 12 Oct 2007 18:53:34 -0400 Subject: [PATCH] muse-mode: Take initial whitespace in front of terms into account when filling * lisp/muse-mode.el (muse-mode-fill-paragraph): Take into account any indentation that is already in front of the term. --- ChangeLog | 2 ++ lisp/muse-mode.el | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 040445e..ff99f7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ that specifies the initial text to use when reading a URL. Thanks to Seweryn Kokot for the suggestion. (muse-insert-url): Use it. + (muse-mode-fill-paragraph): Take into account any indentation that + is already in front of the term. * lisp/muse-project.el (muse-project-determine-last-mod): New function split from muse-project-file-alist. diff --git a/lisp/muse-mode.el b/lisp/muse-mode.el index d8039ab..9f93437 100644 --- a/lisp/muse-mode.el +++ b/lisp/muse-mode.el @@ -288,14 +288,19 @@ Otherwise return nil to let the normal filling function take care of things. ARG is passed to `fill-paragraph'." - (and (not (muse-mode-fill-nobreak-p)) - (save-excursion - (beginning-of-line) - (looking-at muse-dl-term-regexp)) - (let ((fill-prefix " ") - (fill-paragraph-function nil)) - (prog1 t - (fill-paragraph arg))))) + (let ((count 2)) + (and (not (muse-mode-fill-nobreak-p)) + (save-excursion + (beginning-of-line) + (and (looking-at muse-dl-term-regexp) + (prog1 t + ;; Take initial whitespace into account + (when (looking-at (concat "[" muse-regexp-blank "]+")) + (setq count (+ count (length (match-string 0)))))))) + (let ((fill-prefix (make-string count ?\ )) + (fill-paragraph-function nil)) + (prog1 t + (fill-paragraph arg)))))) (defun muse-mode-flyspell-p () "Return non-nil if we should allow spell-checking to occur at point. -- 2.11.4.GIT