aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2003-02-11 21:24:35 +0000
committerStefan Monnier2003-02-11 21:24:35 +0000
commita8c9594b988ba6677bc7e109a35c7684d5fbab12 (patch)
tree5179d7ce240862b16f23f7646de26498988f1740 /lisp
parent9fce950d2888b3915d237d47a79654a477a67a70 (diff)
downloademacs-a8c9594b988ba6677bc7e109a35c7684d5fbab12.tar.gz
emacs-a8c9594b988ba6677bc7e109a35c7684d5fbab12.zip
(meta-fill-paragraph): Remove.
(meta-common-initialization): Don't set fill-paragraph-function now that fill-paragraph takes care of comments.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/meta-mode.el88
1 files changed, 0 insertions, 88 deletions
diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el
index fc34a2aac7e..7e036e55dcb 100644
--- a/lisp/progmodes/meta-mode.el
+++ b/lisp/progmodes/meta-mode.el
@@ -685,92 +685,6 @@ If the list was changed, sort the list and remove duplicates first."
685 685
686 686
687 687
688;;; Filling paragraphs.
689
690(defun meta-fill-paragraph (&optional justify)
691 "Like \\[fill-paragraph], but handle Metafont or MetaPost comments.
692If any part of the current line is a comment, fill the comment or the
693paragraph of it that point is in, preserving the comment's indentation
694and initial semicolons."
695 (interactive "P")
696 (let (has-comment ; Non-nil if line contains a comment.
697 has-code-and-comment ; Non-nil if line contains code and a comment.
698 comment-fill-prefix ; If has-comment, fill-prefix for the comment.
699 )
700 ;; Figure out what kind of comment we are looking at.
701 (save-excursion
702 (beginning-of-line)
703 (cond
704 ;; A line with nothing but a comment on it?
705 ((looking-at (concat "[ \t]*" comment-start-skip))
706 (setq has-comment t)
707 (setq comment-fill-prefix
708 (buffer-substring (match-beginning 0) (match-end 0))))
709 ;; A line with some code, followed by a comment?
710 ((condition-case nil
711 (save-restriction
712 (narrow-to-region (point-min)
713 (save-excursion (end-of-line) (point)))
714 (while (not (looking-at (concat comment-start "\\|$")))
715 (skip-chars-forward (concat "^" comment-start "\n\"\\\\"))
716 (cond
717 ((eq (char-after (point)) ?\\) (forward-char 2))
718 ((eq (char-after (point)) ?\") (forward-sexp 1))))
719 (looking-at comment-start-skip))
720 (error nil))
721 (setq has-comment t
722 has-code-and-comment t)
723 (setq comment-fill-prefix
724 (concat (make-string (/ (current-column) 8) ?\t)
725 (make-string (% (current-column) 8) ?\ )
726 (buffer-substring (match-beginning 0) (match-end 0)))))
727 ))
728 (if (not has-comment)
729 (fill-paragraph justify)
730 ;; Narrow to include only the comment, and then fill the region.
731 (save-excursion
732 (save-restriction
733 (beginning-of-line)
734 (narrow-to-region
735 ;; Find the first line we should include in the region to fill.
736 (save-excursion
737 (while (and (zerop (forward-line -1))
738 (looking-at (concat "^[ \t]*" comment-start))))
739 (or (looking-at (concat ".*" comment-start))
740 (forward-line 1))
741 (point))
742 ;; Find the beginning of the first line past the region to fill.
743 (save-excursion
744 (while (progn (forward-line 1)
745 (looking-at (concat "^[ \t]*" comment-start))))
746 (point)))
747 (let* ((paragraph-start
748 (concat paragraph-start "\\|[ \t%]*$"))
749 (paragraph-separate
750 (concat paragraph-start "\\|[ \t%]*$"))
751 (paragraph-ignore-fill-prefix nil)
752 (fill-prefix comment-fill-prefix)
753 (after-line (if has-code-and-comment
754 (save-excursion (forward-line 1) (point))))
755 (end (progn (forward-paragraph)
756 (or (bolp) (newline 1))
757 (point)))
758 (beg (progn (backward-paragraph)
759 (if (eq (point) after-line) (forward-line -1))
760 (point)))
761 (after-pos (save-excursion
762 (goto-char beg)
763 (if (not (looking-at fill-prefix))
764 (progn
765 (re-search-forward comment-start-skip)
766 (point)))))
767 )
768 (fill-region-as-paragraph beg end justify nil after-pos))
769 )))
770 t))
771
772
773
774;;; Editing commands. 688;;; Editing commands.
775 689
776(defcustom meta-begin-defun-regexp 690(defcustom meta-begin-defun-regexp
@@ -1041,8 +955,6 @@ The environment marked is the one that contains point or follows point."
1041 955
1042 (make-local-variable 'comment-indent-function) 956 (make-local-variable 'comment-indent-function)
1043 (setq comment-indent-function 'meta-comment-indent) 957 (setq comment-indent-function 'meta-comment-indent)
1044 (make-local-variable 'fill-paragraph-function)
1045 (setq fill-paragraph-function 'meta-fill-paragraph)
1046 (make-local-variable 'indent-line-function) 958 (make-local-variable 'indent-line-function)
1047 (setq indent-line-function 'meta-indent-line) 959 (setq indent-line-function 'meta-indent-line)
1048 ;; No need to define a mode-specific 'indent-region-function. 960 ;; No need to define a mode-specific 'indent-region-function.