aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-11-03 03:46:56 +0000
committerStefan Monnier2002-11-03 03:46:56 +0000
commit833815e8a75611b7421ee675b76bb54e08b0df07 (patch)
treec9c75c6390c6b803afa86aa8fe1d23ada49da4c8
parent3d9ce27e7b78a77c360d9edf24ccdc444410e19f (diff)
downloademacs-833815e8a75611b7421ee675b76bb54e08b0df07.tar.gz
emacs-833815e8a75611b7421ee675b76bb54e08b0df07.zip
(lisp-fill-paragraph): Use fill-comment-paragraph.
-rw-r--r--lisp/ChangeLog25
-rw-r--r--lisp/ChangeLog.724
-rw-r--r--lisp/emacs-lisp/lisp-mode.el110
3 files changed, 53 insertions, 106 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4a5e76d6151..4b7bf68ea76 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,26 @@
12002-11-02 Stefan Monnier <monnier@cs.yale.edu>
2
3 * textmodes/fill.el (fill-paragraph-handle-comment): New var.
4 (fill-comment-paragraph): New fun (generalizes of lisp-fill-paragraph).
5 (fill-paragraph): Use them.
6
7 * emacs-lisp/lisp-mode.el (lisp-fill-paragraph):
8 Use fill-comment-paragraph.
9
102002-11-02 Stefan Monnier <monnier@cs.yale.edu>
11
12 * bindings.el (mode-line-change-eol)
13 (mode-line-eol-desc-cache, mode-line-eol-desc): New.
14 (mode-line-mule-info): Use them for the EOL part of the modeline.
15
16 * server.el (server-sentinel): Kill buffers if applicable.
17 (server-temp-file-p): Make arg optional.
18 (server-done): Use it to simplify.
19 (server-switch-buffer): If server-window is a function, use it.
20
21 * mail/undigest.el (rmail-digest-end-regexps): Simplify.
22 (undigestify-rmail-message): Fix paren-bug and simplify.
23
12002-11-02 Kim F. Storm <storm@cua.dk> 242002-11-02 Kim F. Storm <storm@cua.dk>
2 25
3 * info.el (Info-hide-note-references): nil value now does no 26 * info.el (Info-hide-note-references): nil value now does no
@@ -24,7 +47,7 @@
24 47
252002-10-31 Kim F. Storm <storm@cua.dk> 482002-10-31 Kim F. Storm <storm@cua.dk>
26 49
27 * shell.el (explicit-bash-args): Bash 1.x doesn't grook 50 * shell.el (explicit-bash-args): Bash 1.x doesn't grok
28 --noediting option; added run-time check to exclude it. 51 --noediting option; added run-time check to exclude it.
29 52
30 * info.el (Info-follow-reference, Info-next-reference) 53 * info.el (Info-follow-reference, Info-next-reference)
diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7
index aa5e5a196a3..b266c5e6964 100644
--- a/lisp/ChangeLog.7
+++ b/lisp/ChangeLog.7
@@ -11237,8 +11237,8 @@
11237 * format.el (format-deannotate-region): Don't change extents of 11237 * format.el (format-deannotate-region): Don't change extents of
11238 enclosing annotations of the same kind. 11238 enclosing annotations of the same kind.
11239 11239
11240 * format.el (format-deannotate-region): Use 11240 * format.el (format-deannotate-region):
11241 property-increment-region to add to numeric properties. 11241 Use property-increment-region to add to numeric properties.
11242 11242
112431997-08-29 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> 112431997-08-29 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
11244 11244
@@ -12431,8 +12431,8 @@
12431 12431
12432 * progmodes/awk-mode.el (awk-mode): Require cc-mode, not cc-langs. 12432 * progmodes/awk-mode.el (awk-mode): Require cc-mode, not cc-langs.
12433 12433
12434 * wid-edit.el (widget-single-line-display-table): Variable 12434 * wid-edit.el (widget-single-line-display-table):
12435 commented out; don't use it either. 12435 Variable commented out; don't use it either.
12436 12436
12437 * case-table.el: Delete autoload cookies (file is preloaded). 12437 * case-table.el: Delete autoload cookies (file is preloaded).
12438 12438
@@ -12452,7 +12452,7 @@
12452 12452
12453 * progmodes/cc-mode.el (idl-mode): Support for CORBA's IDL language. 12453 * progmodes/cc-mode.el (idl-mode): Support for CORBA's IDL language.
12454 12454
12455 * progmodes/cc-mode.el (c-initialize-cc-mode): move the calling of 12455 * progmodes/cc-mode.el (c-initialize-cc-mode): Move the calling of
12456 c-make-styles-buffer-local into c-initialize-builtin-style. 12456 c-make-styles-buffer-local into c-initialize-builtin-style.
12457 12457
12458 * progmodes/cc-mode.el (c-initialize-cc-mode): Run the 12458 * progmodes/cc-mode.el (c-initialize-cc-mode): Run the
@@ -12527,7 +12527,7 @@
125271997-08-08 Boris Goldowsky <boris@gnu.ai.mit.edu> 125271997-08-08 Boris Goldowsky <boris@gnu.ai.mit.edu>
12528 12528
12529 * format.el (format-annotate-single-property-change, 12529 * format.el (format-annotate-single-property-change,
12530 format-annotate-atomic-property-change): move code that interprets 12530 format-annotate-atomic-property-change): Move code that interprets
12531 nil as 0 inside test that property is numeric. 12531 nil as 0 inside test that property is numeric.
12532 12532
125331997-08-08 Valery Alexeev <valery@math.uga.edu> 125331997-08-08 Valery Alexeev <valery@math.uga.edu>
@@ -13793,8 +13793,8 @@
13793 (describe-fontset): Likewise. Doc-string modified. 13793 (describe-fontset): Likewise. Doc-string modified.
13794 (list-fontsets): Likewise. 13794 (list-fontsets): Likewise.
13795 13795
13796 * international/encoded-kb.el (encoded-kbd-mode): Call 13796 * international/encoded-kb.el (encoded-kbd-mode):
13797 coding-system-XXX instead of coding-vector-XXX. 13797 Call coding-system-XXX instead of coding-vector-XXX.
13798 13798
137991997-07-09 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> 137991997-07-09 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
13800 13800
@@ -14612,8 +14612,8 @@
14612 (type-break-cancel-function-timers): New function. 14612 (type-break-cancel-function-timers): New function.
14613 All callers of cancel-function-timers changed. 14613 All callers of cancel-function-timers changed.
14614 (type-break-check-post-command-hook): New function. 14614 (type-break-check-post-command-hook): New function.
14615 (type-break-mode, type-break-schedule, type-break-alarm, 14615 (type-break-mode, type-break-schedule, type-break-alarm)
14616 type-break-time-warning-alarm): Call it. 14616 (type-break-time-warning-alarm): Call it.
14617 (type-break-mode-line-countdown-or-break): New function. 14617 (type-break-mode-line-countdown-or-break): New function.
14618 (type-break): Call it. 14618 (type-break): Call it.
14619 (type-break-time-warning-schedule): Put type-break-time-warning 14619 (type-break-time-warning-schedule): Put type-break-time-warning
@@ -22779,8 +22779,8 @@
22779 calling function, not setting variable. 22779 calling function, not setting variable.
22780 (enriched-encode): New argument ORIG-BUF; evaluate 22780 (enriched-encode): New argument ORIG-BUF; evaluate
22781 enriched-initial-annotation in that buffer. 22781 enriched-initial-annotation in that buffer.
22782 (enriched-decode): Turn on use-hard-newlines with function. Use 22782 (enriched-decode): Turn on use-hard-newlines with function.
22783 new `set-hard-newline-properties' function. Set fill-column from 22783 Use new `set-hard-newline-properties' function. Set fill-column from
22784 File-Width header; re-fill paragraphs only if there is no 22784 File-Width header; re-fill paragraphs only if there is no
22785 File-Width header. 22785 File-Width header.
22786 22786
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 6bdb92dd284..46f59dd5721 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1060,99 +1060,23 @@ If any of the current line is a comment, fill the comment or the
1060paragraph of it that point is in, preserving the comment's indentation 1060paragraph of it that point is in, preserving the comment's indentation
1061and initial semicolons." 1061and initial semicolons."
1062 (interactive "P") 1062 (interactive "P")
1063 (let ( 1063 (or (fill-comment-paragraph justify)
1064 ;; Non-nil if the current line contains a comment. 1064 ;; `paragraph-start' is set here (not in the buffer-local
1065 has-comment 1065 ;; variable so that `forward-paragraph' et al work as
1066 1066 ;; expected) so that filling (doc) strings works sensibly.
1067 ;; Non-nil if the current line contains code and a comment. 1067 ;; Adding the opening paren to avoid the following sexp being
1068 has-code-and-comment 1068 ;; filled means that sexps generally aren't filled as normal
1069 1069 ;; text, which is probably sensible. The `;' and `:' stop the
1070 ;; If has-comment, the appropriate fill-prefix for the comment. 1070 ;; filled para at following comment lines and keywords
1071 comment-fill-prefix 1071 ;; (typically in `defcustom').
1072 ) 1072 (let ((paragraph-start (concat paragraph-start
1073 1073 "\\|\\s-*[\(;:\"]"))
1074 ;; Figure out what kind of comment we are looking at. 1074 ;; Avoid filling the first line of docstring.
1075 (save-excursion 1075 (paragraph-separate
1076 (beginning-of-line) 1076 (concat paragraph-separate "\\|\\s-*\".*\\.$")))
1077 (cond 1077 (fill-paragraph justify))
1078 1078 ;; Never return nil.
1079 ;; A line with nothing but a comment on it? 1079 t))
1080 ((looking-at "[ \t]*;[; \t]*")
1081 (setq has-comment t
1082 comment-fill-prefix (match-string 0)))
1083
1084 ;; A line with some code, followed by a comment? Remember that the
1085 ;; semi which starts the comment shouldn't be part of a string or
1086 ;; character.
1087 ((let ((state (syntax-ppss (line-end-position))))
1088 (when (nth 4 state)
1089 (goto-char (nth 8 state))
1090 (looking-at ";+[\t ]*")))
1091 (setq has-comment t has-code-and-comment t)
1092 (setq comment-fill-prefix
1093 (concat (make-string (/ (current-column) tab-width) ?\t)
1094 (make-string (% (current-column) tab-width) ?\ )
1095 (match-string 0))))))
1096
1097 (if (not has-comment)
1098 ;; `paragraph-start' is set here (not in the buffer-local
1099 ;; variable so that `forward-paragraph' et al work as
1100 ;; expected) so that filling (doc) strings works sensibly.
1101 ;; Adding the opening paren to avoid the following sexp being
1102 ;; filled means that sexps generally aren't filled as normal
1103 ;; text, which is probably sensible. The `;' and `:' stop the
1104 ;; filled para at following comment lines and keywords
1105 ;; (typically in `defcustom').
1106 (let ((paragraph-start (concat paragraph-start
1107 "\\|\\s-*[\(;:\"]"))
1108 ;; Avoid filling the first line of docstring.
1109 (paragraph-separate
1110 (concat paragraph-separate "\\|\\s-*\".*\\.$")))
1111 (fill-paragraph justify))
1112
1113 ;; Narrow to include only the comment, and then fill the region.
1114 (save-excursion
1115 (save-restriction
1116 (beginning-of-line)
1117 (narrow-to-region
1118 ;; Find the first line we should include in the region to fill.
1119 (save-excursion
1120 (while (and (zerop (forward-line -1))
1121 (looking-at "[ \t]*;")))
1122 ;; We may have gone too far. Go forward again.
1123 (or (looking-at ".*;")
1124 (forward-line 1))
1125 (point))
1126 ;; Find the beginning of the first line past the region to fill.
1127 (save-excursion
1128 (while (progn (forward-line 1)
1129 (looking-at "[ \t]*;")))
1130 (point)))
1131
1132 ;; Lines with only semicolons on them can be paragraph boundaries.
1133 (let* ((paragraph-separate (concat paragraph-separate "\\|[ \t;]*$"))
1134 (paragraph-ignore-fill-prefix nil)
1135 (fill-prefix comment-fill-prefix)
1136 (after-line (if has-code-and-comment
1137 (line-beginning-position 2)))
1138 (end (progn
1139 (forward-paragraph)
1140 (or (bolp) (newline 1))
1141 (point)))
1142 ;; If this comment starts on a line with code,
1143 ;; include that like in the filling.
1144 (beg (progn (backward-paragraph)
1145 (if (eq (point) after-line)
1146 (forward-line -1))
1147 (point))))
1148 (fill-region-as-paragraph beg end
1149 justify nil
1150 (save-excursion
1151 (goto-char beg)
1152 (if (looking-at fill-prefix)
1153 nil
1154 (re-search-forward comment-start-skip))))))))
1155 t))
1156 1080
1157(defun indent-code-rigidly (start end arg &optional nochange-regexp) 1081(defun indent-code-rigidly (start end arg &optional nochange-regexp)
1158 "Indent all lines of code, starting in the region, sideways by ARG columns. 1082 "Indent all lines of code, starting in the region, sideways by ARG columns.