[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] semi-colons and filling
From: |
Jim Ottaway |
Subject: |
[emacs-wiki-discuss] semi-colons and filling |
Date: |
Tue, 13 Dec 2005 02:30:40 +0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
I have come across some anomalous cases of paragraph filling involving
text with semi-colons in it. For example, this text
Markets, then, are an interface between different calculative agencies; they
supply a structure within which differences between strangers may be brought
into some sort of a relation, and into a relation which is ordered.
ends up like this
Markets, then, are an interface between different calculative agencies;
; they
; supply
; a
;
structure
; within
; which
;
differences
; between
;
strangers
; may
... etc., etc. Clearly, the text after the semi-colon is being handled as if
it were a comment.
This happens when the fill-column is greater than the end of the
comment-start string in the line, which is '; ' for muse mode.
It also appears that if the fill-column is less than the beginning position
of the comment-start string that an error is raised: "fill-delete-prefix:
fill-prefix too long for specified width".
I am tremendously fond of the semi-colon, so I have come up with this
solution. I implemented it as a hook to muse-mode; it could easily be
worked into the muse-mode function itself.
(defun muse-fill-paragraph (arg)
(unless
(save-excursion
(goto-char (muse-line-beginning-position))
(looking-at comment-start))
(let ((fill-paragraph-handle-comment nil)
(fill-paragraph-function nil))
(fill-paragraph arg))))
(defun muse-mode-fix-paragraph-filling ()
(set (make-local-variable 'fill-paragraph-function) #'muse-fill-paragraph))
(add-hook 'muse-mode-hook #'muse-mode-fix-paragraph-filling)
Regards,
--
Jim Ottaway
- [emacs-wiki-discuss] semi-colons and filling,
Jim Ottaway <=