*** textmodes/fill.el.~1.191.~ Fri Sep 8 18:07:28 2006 --- textmodes/fill.el Fri Oct 6 19:42:22 2006 *************** *** 520,526 **** ;; Ok, skip at least one word or one \c| character. ;; Meanwhile, don't stop at a period followed by one space. (let ((to (line-end-position)) - (fill-nobreak-predicate nil) ;to break sooner. (first t)) (goto-char linebeg) (while (and (< (point) to) (or first (fill-nobreak-p))) --- 520,525 ---- *** newcomment.el.~1.96.~ Mon Aug 21 14:35:24 2006 --- newcomment.el Sat Oct 7 20:19:18 2006 *************** *** 238,244 **** (defcustom comment-empty-lines nil "If nil, `comment-region' does not comment out empty lines. If t, it always comments out empty lines. ! if `eol' it only comments out empty lines if comments are terminated by the end of line (i.e. `comment-end' is empty)." :type '(choice (const :tag "Never" nil) (const :tag "Always" t) --- 238,244 ---- (defcustom comment-empty-lines nil "If nil, `comment-region' does not comment out empty lines. If t, it always comments out empty lines. ! If `eol' it only comments out empty lines if comments are terminated by the end of line (i.e. `comment-end' is empty)." :type '(choice (const :tag "Never" nil) (const :tag "Always" t) *************** *** 1124,1135 **** :group 'comment) (defun comment-valid-prefix-p (prefix compos) ! (or ! ;; Accept any prefix if the current comment is not EOL-terminated. ! (save-excursion (goto-char compos) (comment-forward) (not (bolp))) ! ;; Accept any prefix that starts with a comment-start marker. ! (string-match (concat "\\`[ \t]*\\(?:" comment-start-skip "\\)") ! prefix))) ;;;###autoload (defun comment-indent-new-line (&optional soft) --- 1124,1152 ---- :group 'comment) (defun comment-valid-prefix-p (prefix compos) ! (if compos ! (and ! (or ! ;; Accept any prefix if the current comment is not EOL-terminated. ! (save-excursion (goto-char compos) (comment-forward) (not (bolp))) ! ;; Accept any prefix that starts with a comment-start marker. ! (string-match (concat "\\`[ \t]*\\(?:" comment-start-skip "\\)") ! prefix)) ! ;; Don't accept a prefix in an end-of-line comment that doesn't start at ! ;; line beginning or whose start sequence doesn't match the prefix. ! ;; This should work around a bug where `do-auto-fill' determines the ! ;; prefix from the beginning of the paragraph but doesn't pay attention ! ;; to comments. ! (or (not (string-equal comment-end "")) ! (and (<= compos (line-beginning-position 0)) ! (save-excursion ! (goto-char compos) ! (looking-at (regexp-quote prefix)))))) ! ;; Don't accept a prefix if we are not in a comment and the adaptive prefix ! ;; matches `comment-start-skip'. This should work around the `do-auto-fill' ! ;; bug cited above which may cause code put inadvertently inside a comment. ! (or (null comment-start) ! (not (string-match comment-start-skip prefix))))) ;;;###autoload (defun comment-indent-new-line (&optional soft) *************** *** 1179,1189 **** (setq comin (point)))) (cond ! ;; If there's an adaptive prefix, use it unless we're inside ! ;; a comment and the prefix is not a comment starter. ! ((and fill-prefix ! (or (not compos) ! (comment-valid-prefix-p fill-prefix compos))) (indent-to-left-margin) (insert-and-inherit fill-prefix)) ;; If we're not inside a comment, just try to indent. --- 1196,1203 ---- (setq comin (point)))) (cond ! ;; If there's an adaptive prefix, use it provided it's valid. ! ((and fill-prefix (comment-valid-prefix-p fill-prefix compos)) (indent-to-left-margin) (insert-and-inherit fill-prefix)) ;; If we're not inside a comment, just try to indent. *** emacs-lisp/lisp-mode.el.~1.194.~ Tue Aug 15 10:00:52 2006 --- emacs-lisp/lisp-mode.el Sat Oct 7 20:30:42 2006 *************** *** 210,215 **** --- 210,223 ---- ;; because lisp-fill-paragraph should do the job. ;; I believe that newcomment's auto-fill code properly deals with it -stef ;;(set (make-local-variable 'adaptive-fill-mode) nil) + (set (make-local-variable 'fill-nobreak-predicate) + ;; Try to avoid that auto-fill breaks strings. + (lambda () + (and (eq (get-text-property (point) 'face) + 'font-lock-string-face) + (or (= (point) (point-min)) + (eq (get-text-property (1- (point)) 'face) + 'font-lock-string-face))))) (make-local-variable 'indent-line-function) (setq indent-line-function 'lisp-indent-line) (make-local-variable 'indent-region-function)