Yoshiki Hayashi wrote:
doesn't work here either. The problem is that
fill-paragraph-function should return non-nil when it does
actual filling work but cperl-fill-paragraph always returns
nil. Probably the function is only designed for replacing
M-q and not for fill-paragraph-function. But binding
fill-paragraph-function is the right way to achieve the same
goal so I suggest you also change that function to return t.
OK, I followed both
your suggestions, it works, I'm sending
a patch. Note that cperl-mode.el still rebinds M-q, for some
versions of xemacs - I don't think I should be changing anything
there...
Bye
Vasek
P.S.: To recap: To see the difference before and after the patch,
open the attached test file.pl (in cperl-mode, which should happen
by default), put the point into the multi-line comment (say, on
':') of the attached test file and press M-q (which should be
bound to fill-paragraph-or-region).
--- cperl-mode.el Mon Dec 3 20:57:07 2001
+++ xemacs-packages/lisp/prog-modes/cperl-mode.el Wed Dec 5 19:58:47 2001
@@ -2619,6 +2619,7 @@
'(t (cperl-fontify-syntaxically))
'(t)))))
(make-local-variable 'cperl-old-style)
+ (setq fill-paragraph-function 'cperl-fill-paragraph)
(or (fboundp 'cperl-old-auto-fill-mode)
(progn
(fset 'cperl-old-auto-fill-mode (symbol-function 'auto-fill-mode))
@@ -5269,7 +5270,7 @@
(delete-char -1))))))))
;; Stolen from lisp-mode with a lot of improvements
-
+;; 5Dec2001: modified to always return t
(defun cperl-fill-paragraph (&optional justify iteration)
"Like \\[fill-paragraph], but handle CPerl comments.
If any of the current line is a comment, fill the comment or the
@@ -5352,7 +5353,8 @@
(setq comment-column c)
(indent-for-comment)
;; Repeat once more, flagging as iteration
- (cperl-fill-paragraph justify t)))))))
+ (cperl-fill-paragraph justify t))))))
+ t)
(defun cperl-do-auto-fill ()
;; Break out if the line is short enough
2001-12-05 Vaclav Barta <vbar(a)comp.cz>
* cperl-mode.pl: Got fill-paragraph-or-region to use
cperl-fill-paragraph.