Mercurial > emacs
changeset 53779:5b728a418323
(cperl-mode-map, cperl-do-auto-fill, cperl-menu): Use fill-paragraph,
not cperl-fill-paragraph.
(cperl-mode): Set fill-paragraph-function.
(cperl-fill-paragraph): Make it non-interactive.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 02 Feb 2004 15:22:39 +0000 |
parents | 7898852aa054 |
children | 6c059bf40adc |
files | lisp/progmodes/cperl-mode.el |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/cperl-mode.el Mon Feb 02 12:50:49 2004 +0000 +++ b/lisp/progmodes/cperl-mode.el Mon Feb 02 15:22:39 2004 +0000 @@ -1,6 +1,6 @@ ;;; cperl-mode.el --- Perl code editing commands for Emacs -;; Copyright (C) 1985, 86, 87, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2003 +;; Copyright (C) 1985,86,87,91,92,93,94,95,96,97,98,99,2000,03,2004 ;; Free Software Foundation, Inc. ;; Author: Ilya Zakharevich and Bob Olson @@ -1064,9 +1064,6 @@ 'indent-sexp 'cperl-indent-exp cperl-mode-map global-map) (substitute-key-definition - 'fill-paragraph 'cperl-fill-paragraph - cperl-mode-map global-map) - (substitute-key-definition 'indent-region 'cperl-indent-region cperl-mode-map global-map) (substitute-key-definition @@ -1086,7 +1083,7 @@ ["End of function" end-of-defun t] ["Mark function" mark-defun t] ["Indent expression" cperl-indent-exp t] - ["Fill paragraph/comment" cperl-fill-paragraph t] + ["Fill paragraph/comment" fill-paragraph t] "----" ["Line up a construction" cperl-lineup (cperl-use-region-p)] ["Invert if/unless/while etc" cperl-invert-if-unless t] @@ -1464,6 +1461,7 @@ (setq paragraph-separate paragraph-start) (make-local-variable 'paragraph-ignore-fill-prefix) (setq paragraph-ignore-fill-prefix t) + (set (make-local-variable 'fill-paragraph-function) 'cperl-fill-paragraph) (make-local-variable 'indent-line-function) (setq indent-line-function 'cperl-indent-line) (make-local-variable 'require-final-newline) @@ -4255,11 +4253,11 @@ ;; Stolen from lisp-mode with a lot of improvements (defun cperl-fill-paragraph (&optional justify iteration) - "Like \\[fill-paragraph], but handle CPerl comments. + "Like `fill-paragraph', but handle CPerl comments. If any of the current line is a comment, fill the comment or the block of it that point is in, preserving the comment's initial indentation and initial hashes. Behaves usually outside of comment." - (interactive "P") + ;; (interactive "P") ; Only works when called from fill-paragraph. -stef (let (;; Non-nil if the current line contains a comment. has-comment @@ -4346,9 +4344,11 @@ (let ((c (save-excursion (beginning-of-line) (cperl-to-comment-or-eol) (point))) (s (memq (following-char) '(?\ ?\t))) marker) - (if (>= c (point)) nil + (if (>= c (point)) + ;; Don't break line inside code: only inside comment. + nil (setq marker (point-marker)) - (cperl-fill-paragraph) + (fill-paragraph nil) (goto-char marker) ;; Is not enough, sometimes marker is a start of line (if (bolp) (progn (re-search-forward "#+[ \t]*")