(format-decode): Be careful with the order in `format'.
This commit is contained in:
parent
9a9e711ed3
commit
be227f220d
2 changed files with 31 additions and 24 deletions
|
@ -1,10 +1,18 @@
|
|||
2002-11-07 Stefan Monnier <monnier@cs.yale.edu>
|
||||
|
||||
* format.el (format-decode): Be careful with the order in `format'.
|
||||
|
||||
* eshell/esh-cmd.el (function-p-func): Avoid `xemacs-p'.
|
||||
|
||||
* eshell/em-glob.el: Require esh-util.
|
||||
(eshell-glob-initialize): Don't assume
|
||||
eshell-special-chars-outside-quoting is available.
|
||||
|
||||
* textmodes/fill.el (fill-paragraph): Consider a comment-start as
|
||||
a paragraph starter when filling non-comments.
|
||||
(fill-comment-paragraph): Use comment-search-forward.
|
||||
(fill-comment-paragraph): Don't narrow while doing the fill.
|
||||
Recognize paragraph starters and separators within comments.
|
||||
Use adaptive-fill-prefix when it works. Don't narrow while doing the fill.
|
||||
Use adaptive-fill-prefix when it works. Use comment-search-forward.
|
||||
|
||||
* progmodes/compile.el (grep-default-command): New fun.
|
||||
(grep): Use it.
|
||||
|
|
|
@ -246,8 +246,8 @@ for another match.
|
|||
|
||||
Second arg LENGTH is the number of characters following point to operate on.
|
||||
If optional third arg VISIT-FLAG is true, set `buffer-file-format'
|
||||
to the list of formats used, and call any mode functions defined for those
|
||||
formats.
|
||||
to the reverted list of formats used, and call any mode functions defined
|
||||
for those formats.
|
||||
|
||||
Returns the new length of the decoded region.
|
||||
|
||||
|
@ -269,7 +269,7 @@ For most purposes, consider using `format-decode-region' instead."
|
|||
(if (and regexp (looking-at regexp)
|
||||
(< (match-end 0) (+ begin length)))
|
||||
(progn
|
||||
(setq format (cons (car f) format))
|
||||
(push (car f) format)
|
||||
;; Decode it
|
||||
(if (nth 3 f)
|
||||
(setq end (format-decode-run-method (nth 3 f) begin end)))
|
||||
|
@ -291,7 +291,9 @@ For most purposes, consider using `format-decode-region' instead."
|
|||
(setq end (format-decode-run-method (nth 3 f) begin end)))
|
||||
;; Call visit function if required
|
||||
(if (and visit-flag (nth 6 f)) (funcall (nth 6 f) 1))
|
||||
(setq do (cdr do)))))
|
||||
(setq do (cdr do))))
|
||||
;; Encode in the opposite order.
|
||||
(setq format (reverse format)))
|
||||
(if visit-flag
|
||||
(setq buffer-file-format format)))
|
||||
|
||||
|
@ -613,7 +615,7 @@ to write these unknown annotations back into the file."
|
|||
(delete-region loc end)
|
||||
(cond
|
||||
;; Positive annotations are stacked, remembering location
|
||||
(positive (setq open-ans (cons `(,name ((,loc . nil))) open-ans)))
|
||||
(positive (push `(,name ((,loc . nil))) open-ans))
|
||||
;; It is a negative annotation:
|
||||
;; Close the top annotation & add its text property.
|
||||
;; 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."
|
|||
;; Not a property, but a function.
|
||||
(let ((rtn
|
||||
(apply value start loc params)))
|
||||
(if rtn (setq todo (cons rtn todo)))))
|
||||
(if rtn (push rtn todo))))
|
||||
(t
|
||||
;; Normal property/value pair
|
||||
(setq todo
|
||||
|
@ -758,12 +760,12 @@ yet known."
|
|||
(cond
|
||||
;; The minuend starts after the subtrahend ends; keep it.
|
||||
((> (car m) (cdr s))
|
||||
(setq results (cons m results)
|
||||
minuend (cdr minuend)
|
||||
(push m results)
|
||||
(setq minuend (cdr minuend)
|
||||
m (car minuend)))
|
||||
;; The minuend extends beyond the end of the subtrahend. Chop it off.
|
||||
((or (null (cdr m)) (> (cdr m) (cdr s)))
|
||||
(setq results (cons (cons (1+ (cdr s)) (cdr m)) results))
|
||||
(push (cons (1+ (cdr s)) (cdr m)) results)
|
||||
(setcdr m (cdr s)))
|
||||
;; The subtrahend starts after the minuend ends; throw it away.
|
||||
((< (cdr m) (car s))
|
||||
|
@ -878,7 +880,7 @@ The same TRANSLATIONS structure can be used in reverse for reading files."
|
|||
(while (not (equal (car neg-ans) (car open-ans)))
|
||||
;; To close anno. N, need to first close ans 1 to N-1,
|
||||
;; remembering to re-open them later.
|
||||
(setq pos-ans (cons (car open-ans) pos-ans))
|
||||
(push (car open-ans) pos-ans)
|
||||
(setq all-ans
|
||||
(cons (cons loc (funcall format-fn (car open-ans) nil))
|
||||
all-ans))
|
||||
|
@ -886,17 +888,15 @@ The same TRANSLATIONS structure can be used in reverse for reading files."
|
|||
;; Now remove the one we're really interested in from open list.
|
||||
(setq open-ans (cdr open-ans))
|
||||
;; And put the closing annotation here.
|
||||
(setq all-ans
|
||||
(cons (cons loc (funcall format-fn (car neg-ans) nil))
|
||||
all-ans)))
|
||||
(push (cons loc (funcall format-fn (car neg-ans) nil))
|
||||
all-ans))
|
||||
(setq neg-ans (cdr neg-ans)))
|
||||
;; Now deal with positive (opening) annotations
|
||||
(let ((p pos-ans))
|
||||
(while pos-ans
|
||||
(setq open-ans (cons (car pos-ans) open-ans))
|
||||
(setq all-ans
|
||||
(cons (cons loc (funcall format-fn (car pos-ans) t))
|
||||
all-ans))
|
||||
(push (car pos-ans) open-ans)
|
||||
(push (cons loc (funcall format-fn (car pos-ans) t))
|
||||
all-ans)
|
||||
(setq pos-ans (cdr pos-ans))))))
|
||||
|
||||
;; Close any annotations still open
|
||||
|
@ -937,17 +937,16 @@ either strings, or lists of the form (PARAMETER VALUE)."
|
|||
(setq p before-plist)
|
||||
(while p
|
||||
(if (not (memq (car p) props))
|
||||
(setq props (cons (car p) props)))
|
||||
(push (car p) props))
|
||||
(setq p (cdr (cdr p))))
|
||||
(setq p after-plist)
|
||||
(while p
|
||||
(if (not (memq (car p) props))
|
||||
(setq props (cons (car p) props)))
|
||||
(push (car p) props))
|
||||
(setq p (cdr (cdr p))))
|
||||
|
||||
(while props
|
||||
(setq prop (car props)
|
||||
props (cdr props))
|
||||
(setq prop (pop props))
|
||||
(if (memq prop ignore)
|
||||
nil ; If it's been ignored before, ignore it now.
|
||||
(let ((before (if all nil (car (cdr (memq prop before-plist)))))
|
||||
|
@ -957,7 +956,7 @@ either strings, or lists of the form (PARAMETER VALUE)."
|
|||
(let ((result (format-annotate-single-property-change
|
||||
prop before after translations)))
|
||||
(if (not result)
|
||||
(setq not-found (cons prop not-found))
|
||||
(push prop not-found)
|
||||
(setq negatives (nconc negatives (car result))
|
||||
positives (nconc positives (cdr result)))))))))
|
||||
(vector negatives positives not-found)))
|
||||
|
|
Loading…
Add table
Reference in a new issue