From af963429f3344c2aa27bb8e0139d1987270896c9 Mon Sep 17 00:00:00 2001 From: "Michael W. Olson" Date: Mon, 8 Oct 2007 16:32:37 -0400 Subject: [PATCH] muse-mode: Use two spaces when filling definition list terms * lisp/muse-mode.el (muse-mode): Set fill-paragraph-function. (muse-mode-fill-paragraph): New function that fills the paragraph at point. If a definition list term is on the same line, then prefix subsequent lines with two spaces when filling. Otherwise, return nil, so that normal filling can take place. --- ChangeLog | 8 ++++++++ lisp/muse-mode.el | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0358184..9eba85e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-10-08 Michael Olson + + * lisp/muse-mode.el (muse-mode): Set fill-paragraph-function. + (muse-mode-fill-paragraph): New function that fills the paragraph + at point. If a definition list term is on the same line, then + prefix subsequent lines with two spaces when filling. Otherwise, + return nil, so that normal filling can take place. + 2007-10-03 Michael Olson * lisp/muse-colors.el (muse-unhighlight-region): Remove diff --git a/lisp/muse-mode.el b/lisp/muse-mode.el index 9eeb878..11c40a5 100644 --- a/lisp/muse-mode.el +++ b/lisp/muse-mode.el @@ -238,6 +238,8 @@ index at intervals." (concat paragraph-start "\\|" regexp)) (set (make-local-variable 'paragraph-separate) (concat paragraph-separate "\\|\\*+\\s-+"))) + (set (make-local-variable 'fill-paragraph-function) + 'muse-mode-fill-paragraph) ;; Comment syntax is `; comment' (set (make-local-variable 'comment-start) @@ -280,6 +282,21 @@ fill mode." (string= (or (match-string 0) "") "[["))))) +(defun muse-mode-fill-paragraph (arg) + "If a definition list is at point, use special filling rules for it. +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))))) + (defun muse-mode-flyspell-p () "Return non-nil if we should allow spell-checking to occur at point. Otherwise return nil. -- 2.11.4.GIT