diff options
| author | Stefan Monnier | 2002-11-08 02:38:54 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-11-08 02:38:54 +0000 |
| commit | be227f220d37b729c81f3837d53a971753cbe3d4 (patch) | |
| tree | 0d4ba228e8da89475542e5f609ae2593ad984425 | |
| parent | 9a9e711ed379d23c270d1ee6164e55ed9c781bba (diff) | |
| download | emacs-be227f220d37b729c81f3837d53a971753cbe3d4.tar.gz emacs-be227f220d37b729c81f3837d53a971753cbe3d4.zip | |
(format-decode): Be careful with the order in `format'.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/format.el | 43 |
2 files changed, 31 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e13675042d0..7ac99920274 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,10 +1,18 @@ | |||
| 1 | 2002-11-07 Stefan Monnier <monnier@cs.yale.edu> | 1 | 2002-11-07 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 2 | ||
| 3 | * format.el (format-decode): Be careful with the order in `format'. | ||
| 4 | |||
| 5 | * eshell/esh-cmd.el (function-p-func): Avoid `xemacs-p'. | ||
| 6 | |||
| 7 | * eshell/em-glob.el: Require esh-util. | ||
| 8 | (eshell-glob-initialize): Don't assume | ||
| 9 | eshell-special-chars-outside-quoting is available. | ||
| 10 | |||
| 3 | * textmodes/fill.el (fill-paragraph): Consider a comment-start as | 11 | * textmodes/fill.el (fill-paragraph): Consider a comment-start as |
| 4 | a paragraph starter when filling non-comments. | 12 | a paragraph starter when filling non-comments. |
| 5 | (fill-comment-paragraph): Use comment-search-forward. | 13 | (fill-comment-paragraph): Don't narrow while doing the fill. |
| 6 | Recognize paragraph starters and separators within comments. | 14 | Recognize paragraph starters and separators within comments. |
| 7 | Use adaptive-fill-prefix when it works. Don't narrow while doing the fill. | 15 | Use adaptive-fill-prefix when it works. Use comment-search-forward. |
| 8 | 16 | ||
| 9 | * progmodes/compile.el (grep-default-command): New fun. | 17 | * progmodes/compile.el (grep-default-command): New fun. |
| 10 | (grep): Use it. | 18 | (grep): Use it. |
diff --git a/lisp/format.el b/lisp/format.el index 715374bb50f..0d538c25df7 100644 --- a/lisp/format.el +++ b/lisp/format.el | |||
| @@ -246,8 +246,8 @@ for another match. | |||
| 246 | 246 | ||
| 247 | Second arg LENGTH is the number of characters following point to operate on. | 247 | Second arg LENGTH is the number of characters following point to operate on. |
| 248 | If optional third arg VISIT-FLAG is true, set `buffer-file-format' | 248 | If optional third arg VISIT-FLAG is true, set `buffer-file-format' |
| 249 | to the list of formats used, and call any mode functions defined for those | 249 | to the reverted list of formats used, and call any mode functions defined |
| 250 | formats. | 250 | for those formats. |
| 251 | 251 | ||
| 252 | Returns the new length of the decoded region. | 252 | Returns the new length of the decoded region. |
| 253 | 253 | ||
| @@ -269,7 +269,7 @@ For most purposes, consider using `format-decode-region' instead." | |||
| 269 | (if (and regexp (looking-at regexp) | 269 | (if (and regexp (looking-at regexp) |
| 270 | (< (match-end 0) (+ begin length))) | 270 | (< (match-end 0) (+ begin length))) |
| 271 | (progn | 271 | (progn |
| 272 | (setq format (cons (car f) format)) | 272 | (push (car f) format) |
| 273 | ;; Decode it | 273 | ;; Decode it |
| 274 | (if (nth 3 f) | 274 | (if (nth 3 f) |
| 275 | (setq end (format-decode-run-method (nth 3 f) begin end))) | 275 | (setq end (format-decode-run-method (nth 3 f) begin end))) |
| @@ -291,7 +291,9 @@ For most purposes, consider using `format-decode-region' instead." | |||
| 291 | (setq end (format-decode-run-method (nth 3 f) begin end))) | 291 | (setq end (format-decode-run-method (nth 3 f) begin end))) |
| 292 | ;; Call visit function if required | 292 | ;; Call visit function if required |
| 293 | (if (and visit-flag (nth 6 f)) (funcall (nth 6 f) 1)) | 293 | (if (and visit-flag (nth 6 f)) (funcall (nth 6 f) 1)) |
| 294 | (setq do (cdr do))))) | 294 | (setq do (cdr do)))) |
| 295 | ;; Encode in the opposite order. | ||
| 296 | (setq format (reverse format))) | ||
| 295 | (if visit-flag | 297 | (if visit-flag |
| 296 | (setq buffer-file-format format))) | 298 | (setq buffer-file-format format))) |
| 297 | 299 | ||
| @@ -613,7 +615,7 @@ to write these unknown annotations back into the file." | |||
| 613 | (delete-region loc end) | 615 | (delete-region loc end) |
| 614 | (cond | 616 | (cond |
| 615 | ;; Positive annotations are stacked, remembering location | 617 | ;; Positive annotations are stacked, remembering location |
| 616 | (positive (setq open-ans (cons `(,name ((,loc . nil))) open-ans))) | 618 | (positive (push `(,name ((,loc . nil))) open-ans)) |
| 617 | ;; It is a negative annotation: | 619 | ;; It is a negative annotation: |
| 618 | ;; Close the top annotation & add its text property. | 620 | ;; Close the top annotation & add its text property. |
| 619 | ;; If the file's nesting is messed up, the close might not match | 621 | ;; If the file's nesting is messed up, the close might not match |
| @@ -693,7 +695,7 @@ to write these unknown annotations back into the file." | |||
| 693 | ;; Not a property, but a function. | 695 | ;; Not a property, but a function. |
| 694 | (let ((rtn | 696 | (let ((rtn |
| 695 | (apply value start loc params))) | 697 | (apply value start loc params))) |
| 696 | (if rtn (setq todo (cons rtn todo))))) | 698 | (if rtn (push rtn todo)))) |
| 697 | (t | 699 | (t |
| 698 | ;; Normal property/value pair | 700 | ;; Normal property/value pair |
| 699 | (setq todo | 701 | (setq todo |
| @@ -758,12 +760,12 @@ yet known." | |||
| 758 | (cond | 760 | (cond |
| 759 | ;; The minuend starts after the subtrahend ends; keep it. | 761 | ;; The minuend starts after the subtrahend ends; keep it. |
| 760 | ((> (car m) (cdr s)) | 762 | ((> (car m) (cdr s)) |
| 761 | (setq results (cons m results) | 763 | (push m results) |
| 762 | minuend (cdr minuend) | 764 | (setq minuend (cdr minuend) |
| 763 | m (car minuend))) | 765 | m (car minuend))) |
| 764 | ;; The minuend extends beyond the end of the subtrahend. Chop it off. | 766 | ;; The minuend extends beyond the end of the subtrahend. Chop it off. |
| 765 | ((or (null (cdr m)) (> (cdr m) (cdr s))) | 767 | ((or (null (cdr m)) (> (cdr m) (cdr s))) |
| 766 | (setq results (cons (cons (1+ (cdr s)) (cdr m)) results)) | 768 | (push (cons (1+ (cdr s)) (cdr m)) results) |
| 767 | (setcdr m (cdr s))) | 769 | (setcdr m (cdr s))) |
| 768 | ;; The subtrahend starts after the minuend ends; throw it away. | 770 | ;; The subtrahend starts after the minuend ends; throw it away. |
| 769 | ((< (cdr m) (car s)) | 771 | ((< (cdr m) (car s)) |
| @@ -878,7 +880,7 @@ The same TRANSLATIONS structure can be used in reverse for reading files." | |||
| 878 | (while (not (equal (car neg-ans) (car open-ans))) | 880 | (while (not (equal (car neg-ans) (car open-ans))) |
| 879 | ;; To close anno. N, need to first close ans 1 to N-1, | 881 | ;; To close anno. N, need to first close ans 1 to N-1, |
| 880 | ;; remembering to re-open them later. | 882 | ;; remembering to re-open them later. |
| 881 | (setq pos-ans (cons (car open-ans) pos-ans)) | 883 | (push (car open-ans) pos-ans) |
| 882 | (setq all-ans | 884 | (setq all-ans |
| 883 | (cons (cons loc (funcall format-fn (car open-ans) nil)) | 885 | (cons (cons loc (funcall format-fn (car open-ans) nil)) |
| 884 | all-ans)) | 886 | all-ans)) |
| @@ -886,17 +888,15 @@ The same TRANSLATIONS structure can be used in reverse for reading files." | |||
| 886 | ;; Now remove the one we're really interested in from open list. | 888 | ;; Now remove the one we're really interested in from open list. |
| 887 | (setq open-ans (cdr open-ans)) | 889 | (setq open-ans (cdr open-ans)) |
| 888 | ;; And put the closing annotation here. | 890 | ;; And put the closing annotation here. |
| 889 | (setq all-ans | 891 | (push (cons loc (funcall format-fn (car neg-ans) nil)) |
| 890 | (cons (cons loc (funcall format-fn (car neg-ans) nil)) | 892 | all-ans)) |
| 891 | all-ans))) | ||
| 892 | (setq neg-ans (cdr neg-ans))) | 893 | (setq neg-ans (cdr neg-ans))) |
| 893 | ;; Now deal with positive (opening) annotations | 894 | ;; Now deal with positive (opening) annotations |
| 894 | (let ((p pos-ans)) | 895 | (let ((p pos-ans)) |
| 895 | (while pos-ans | 896 | (while pos-ans |
| 896 | (setq open-ans (cons (car pos-ans) open-ans)) | 897 | (push (car pos-ans) open-ans) |
| 897 | (setq all-ans | 898 | (push (cons loc (funcall format-fn (car pos-ans) t)) |
| 898 | (cons (cons loc (funcall format-fn (car pos-ans) t)) | 899 | all-ans) |
| 899 | all-ans)) | ||
| 900 | (setq pos-ans (cdr pos-ans)))))) | 900 | (setq pos-ans (cdr pos-ans)))))) |
| 901 | 901 | ||
| 902 | ;; Close any annotations still open | 902 | ;; Close any annotations still open |
| @@ -937,17 +937,16 @@ either strings, or lists of the form (PARAMETER VALUE)." | |||
| 937 | (setq p before-plist) | 937 | (setq p before-plist) |
| 938 | (while p | 938 | (while p |
| 939 | (if (not (memq (car p) props)) | 939 | (if (not (memq (car p) props)) |
| 940 | (setq props (cons (car p) props))) | 940 | (push (car p) props)) |
| 941 | (setq p (cdr (cdr p)))) | 941 | (setq p (cdr (cdr p)))) |
| 942 | (setq p after-plist) | 942 | (setq p after-plist) |
| 943 | (while p | 943 | (while p |
| 944 | (if (not (memq (car p) props)) | 944 | (if (not (memq (car p) props)) |
| 945 | (setq props (cons (car p) props))) | 945 | (push (car p) props)) |
| 946 | (setq p (cdr (cdr p)))) | 946 | (setq p (cdr (cdr p)))) |
| 947 | 947 | ||
| 948 | (while props | 948 | (while props |
| 949 | (setq prop (car props) | 949 | (setq prop (pop props)) |
| 950 | props (cdr props)) | ||
| 951 | (if (memq prop ignore) | 950 | (if (memq prop ignore) |
| 952 | nil ; If it's been ignored before, ignore it now. | 951 | nil ; If it's been ignored before, ignore it now. |
| 953 | (let ((before (if all nil (car (cdr (memq prop before-plist))))) | 952 | (let ((before (if all nil (car (cdr (memq prop before-plist))))) |
| @@ -957,7 +956,7 @@ either strings, or lists of the form (PARAMETER VALUE)." | |||
| 957 | (let ((result (format-annotate-single-property-change | 956 | (let ((result (format-annotate-single-property-change |
| 958 | prop before after translations))) | 957 | prop before after translations))) |
| 959 | (if (not result) | 958 | (if (not result) |
| 960 | (setq not-found (cons prop not-found)) | 959 | (push prop not-found) |
| 961 | (setq negatives (nconc negatives (car result)) | 960 | (setq negatives (nconc negatives (car result)) |
| 962 | positives (nconc positives (cdr result))))))))) | 961 | positives (nconc positives (cdr result))))))))) |
| 963 | (vector negatives positives not-found))) | 962 | (vector negatives positives not-found))) |