]> git.eshelyaron.com Git - emacs.git/commitdiff
(lisp-fill-paragraph): Use fill-comment-paragraph.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 3 Nov 2002 03:46:56 +0000 (03:46 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 3 Nov 2002 03:46:56 +0000 (03:46 +0000)
lisp/ChangeLog
lisp/ChangeLog.7
lisp/emacs-lisp/lisp-mode.el

index 4a5e76d61514750929e6505a95f83ae07ea935e2..4b7bf68ea769419d7beda18193ff48d064de0b9f 100644 (file)
@@ -1,3 +1,26 @@
+2002-11-02  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * textmodes/fill.el (fill-paragraph-handle-comment): New var.
+       (fill-comment-paragraph): New fun (generalizes of lisp-fill-paragraph).
+       (fill-paragraph): Use them.
+
+       * emacs-lisp/lisp-mode.el (lisp-fill-paragraph):
+       Use fill-comment-paragraph.
+
+2002-11-02  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * bindings.el (mode-line-change-eol)
+       (mode-line-eol-desc-cache, mode-line-eol-desc): New.
+       (mode-line-mule-info): Use them for the EOL part of the modeline.
+
+       * server.el (server-sentinel): Kill buffers if applicable.
+       (server-temp-file-p): Make arg optional.
+       (server-done): Use it to simplify.
+       (server-switch-buffer): If server-window is a function, use it.
+
+       * mail/undigest.el (rmail-digest-end-regexps): Simplify.
+       (undigestify-rmail-message): Fix paren-bug and simplify.
+
 2002-11-02  Kim F. Storm  <storm@cua.dk>
 
        * info.el (Info-hide-note-references): nil value now does no
@@ -24,7 +47,7 @@
 
 2002-10-31  Kim F. Storm  <storm@cua.dk>
 
-       * shell.el (explicit-bash-args): Bash 1.x doesn't grook
+       * shell.el (explicit-bash-args): Bash 1.x doesn't grok
        --noediting option; added run-time check to exclude it.
 
        * info.el (Info-follow-reference, Info-next-reference)
index aa5e5a196a3580bed930e21760cdce595b9f4184..b266c5e696441811bf00bf39fc1f7b3eac491547 100644 (file)
        * format.el (format-deannotate-region): Don't change extents of
        enclosing annotations of the same kind.
 
-       * format.el (format-deannotate-region): Use
-       property-increment-region to add to numeric properties.
+       * format.el (format-deannotate-region):
+       Use property-increment-region to add to numeric properties.
 
 1997-08-29  Richard Stallman  <rms@psilocin.gnu.ai.mit.edu>
 
 
        * progmodes/awk-mode.el (awk-mode): Require cc-mode, not cc-langs.
 
-       * wid-edit.el (widget-single-line-display-table): Variable
-       commented out; don't use it either.
+       * wid-edit.el (widget-single-line-display-table):
+       Variable commented out; don't use it either.
 
        * case-table.el: Delete autoload cookies (file is preloaded).
 
 
        * progmodes/cc-mode.el (idl-mode): Support for CORBA's IDL language.
 
-       * progmodes/cc-mode.el (c-initialize-cc-mode): move the calling of
+       * progmodes/cc-mode.el (c-initialize-cc-mode): Move the calling of
        c-make-styles-buffer-local into c-initialize-builtin-style.
 
        * progmodes/cc-mode.el (c-initialize-cc-mode): Run the
 1997-08-08  Boris Goldowsky  <boris@gnu.ai.mit.edu>
 
        * format.el (format-annotate-single-property-change,
-       format-annotate-atomic-property-change): move code that interprets
+       format-annotate-atomic-property-change): Move code that interprets
        nil as 0 inside test that property is numeric.
 
 1997-08-08  Valery Alexeev  <valery@math.uga.edu>
        (describe-fontset): Likewise.  Doc-string modified.
        (list-fontsets): Likewise.
 
-       * international/encoded-kb.el (encoded-kbd-mode): Call
-       coding-system-XXX instead of coding-vector-XXX.
+       * international/encoded-kb.el (encoded-kbd-mode):
+       Call coding-system-XXX instead of coding-vector-XXX.
 
 1997-07-09  Richard Stallman  <rms@psilocin.gnu.ai.mit.edu>
 
        (type-break-cancel-function-timers): New function.
        All callers of cancel-function-timers changed.
        (type-break-check-post-command-hook): New function.
-       (type-break-mode, type-break-schedule, type-break-alarm,
-       type-break-time-warning-alarm): Call it.
+       (type-break-mode, type-break-schedule, type-break-alarm)
+       (type-break-time-warning-alarm): Call it.
        (type-break-mode-line-countdown-or-break): New function.
        (type-break): Call it.
        (type-break-time-warning-schedule): Put type-break-time-warning
        calling function, not setting variable.
        (enriched-encode): New argument ORIG-BUF; evaluate
        enriched-initial-annotation in that buffer.
-       (enriched-decode): Turn on use-hard-newlines with function.  Use
-       new `set-hard-newline-properties' function.  Set fill-column from
+       (enriched-decode): Turn on use-hard-newlines with function.
+       Use new `set-hard-newline-properties' function.  Set fill-column from
        File-Width header; re-fill paragraphs only if there is no
        File-Width header.
 
index 6bdb92dd28497e31ee25361e3605d082541e5620..46f59dd57218cc30bbf1ec158a77e67e135563dd 100644 (file)
@@ -1060,99 +1060,23 @@ If any of the current line is a comment, fill the comment or the
 paragraph of it that point is in, preserving the comment's indentation
 and initial semicolons."
   (interactive "P")
-  (let (
-       ;; Non-nil if the current line contains a comment.
-       has-comment
-
-       ;; Non-nil if the current line contains code and a comment.
-       has-code-and-comment
-
-       ;; If has-comment, the appropriate fill-prefix for the comment.
-       comment-fill-prefix
-       )
-
-    ;; Figure out what kind of comment we are looking at.
-    (save-excursion
-      (beginning-of-line)
-      (cond
-
-       ;; A line with nothing but a comment on it?
-       ((looking-at "[ \t]*;[; \t]*")
-       (setq has-comment t
-             comment-fill-prefix (match-string 0)))
-
-       ;; A line with some code, followed by a comment?  Remember that the
-       ;; semi which starts the comment shouldn't be part of a string or
-       ;; character.
-       ((let ((state (syntax-ppss (line-end-position))))
-         (when (nth 4 state)
-           (goto-char (nth 8 state))
-           (looking-at ";+[\t ]*")))
-       (setq has-comment t has-code-and-comment t)
-       (setq comment-fill-prefix
-             (concat (make-string (/ (current-column) tab-width) ?\t)
-                     (make-string (% (current-column) tab-width) ?\ )
-                     (match-string 0))))))
-
-    (if (not has-comment)
-        ;; `paragraph-start' is set here (not in the buffer-local
-        ;; variable so that `forward-paragraph' et al work as
-        ;; expected) so that filling (doc) strings works sensibly.
-        ;; Adding the opening paren to avoid the following sexp being
-        ;; filled means that sexps generally aren't filled as normal
-        ;; text, which is probably sensible.  The `;' and `:' stop the
-        ;; filled para at following comment lines and keywords
-        ;; (typically in `defcustom').
-       (let ((paragraph-start (concat paragraph-start
-                                       "\\|\\s-*[\(;:\"]"))
-             ;; Avoid filling the first line of docstring.
-             (paragraph-separate
-              (concat paragraph-separate "\\|\\s-*\".*\\.$")))
-          (fill-paragraph justify))
-
-      ;; Narrow to include only the comment, and then fill the region.
-      (save-excursion
-       (save-restriction
-         (beginning-of-line)
-         (narrow-to-region
-          ;; Find the first line we should include in the region to fill.
-          (save-excursion
-            (while (and (zerop (forward-line -1))
-                        (looking-at "[ \t]*;")))
-            ;; We may have gone too far.  Go forward again.
-            (or (looking-at ".*;")
-                (forward-line 1))
-            (point))
-          ;; Find the beginning of the first line past the region to fill.
-          (save-excursion
-            (while (progn (forward-line 1)
-                          (looking-at "[ \t]*;")))
-            (point)))
-
-         ;; Lines with only semicolons on them can be paragraph boundaries.
-         (let* ((paragraph-separate (concat paragraph-separate "\\|[ \t;]*$"))
-                (paragraph-ignore-fill-prefix nil)
-                (fill-prefix comment-fill-prefix)
-                (after-line (if has-code-and-comment
-                                (line-beginning-position 2)))
-                (end (progn
-                       (forward-paragraph)
-                       (or (bolp) (newline 1))
-                       (point)))
-                ;; If this comment starts on a line with code,
-                ;; include that like in the filling.
-                (beg (progn (backward-paragraph)
-                            (if (eq (point) after-line)
-                                (forward-line -1))
-                            (point))))
-           (fill-region-as-paragraph beg end
-                                     justify nil
-                                     (save-excursion
-                                       (goto-char beg)
-                                       (if (looking-at fill-prefix)
-                                           nil
-                                         (re-search-forward comment-start-skip))))))))
-    t))
+  (or (fill-comment-paragraph justify)
+      ;; `paragraph-start' is set here (not in the buffer-local
+      ;; variable so that `forward-paragraph' et al work as
+      ;; expected) so that filling (doc) strings works sensibly.
+      ;; Adding the opening paren to avoid the following sexp being
+      ;; filled means that sexps generally aren't filled as normal
+      ;; text, which is probably sensible.  The `;' and `:' stop the
+      ;; filled para at following comment lines and keywords
+      ;; (typically in `defcustom').
+      (let ((paragraph-start (concat paragraph-start
+                                    "\\|\\s-*[\(;:\"]"))
+           ;; Avoid filling the first line of docstring.
+           (paragraph-separate
+            (concat paragraph-separate "\\|\\s-*\".*\\.$")))
+       (fill-paragraph justify))
+      ;; Never return nil.
+      t))
 
 (defun indent-code-rigidly (start end arg &optional nochange-regexp)
   "Indent all lines of code, starting in the region, sideways by ARG columns.