Mercurial > hg > xemacs-beta
changeset 4555:20c32e489235
Add #'query-coding-clear-highlights.
2008-05-11 Aidan Kehoe <kehoea@parhasard.net>
* coding.el (query-coding-clear-highlights):
New function--clear any face information added by
`query-coding-region'.
(default-query-coding-region): Use it.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 11 May 2008 19:50:10 +0200 |
parents | 4953b7353349 |
children | a1f8c5c250c2 |
files | lisp/ChangeLog lisp/coding.el |
diffstat | 2 files changed, 23 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat May 03 13:09:06 2008 +0200 +++ b/lisp/ChangeLog Sun May 11 19:50:10 2008 +0200 @@ -1,3 +1,10 @@ +2008-05-11 Aidan Kehoe <kehoea@parhasard.net> + + * coding.el (query-coding-clear-highlights): + New function--clear any face information added by + `query-coding-region'. + (default-query-coding-region): Use it. + 2008-04-13 Henry S. Thompson <ht@inf.ed.ac.uk>, Mike Sperber <mike@xemacs.org> * window-xemacs.el (save-window-excursion/mapping,
--- a/lisp/coding.el Sat May 03 13:09:06 2008 +0200 +++ b/lisp/coding.el Sun May 11 19:50:10 2008 +0200 @@ -286,6 +286,20 @@ #s(hash-table test equal data ()) "A map from list of charsets to `skip-chars-forward' arguments for them.") +(defsubst query-coding-clear-highlights (begin end &optional buffer) + "Remove extent faces added by `query-coding-region' between BEGIN and END. + +Optional argument BUFFER is the buffer to use, and defaults to the current +buffer. + +The HIGHLIGHTP argument to `query-coding-region' indicates that it should +display unencodable characters using `query-coding-warning-face'. After +this function has been called, this will no longer be the case. " + (map-extents #'(lambda (extent ignored-arg) + (when (eq 'query-coding-warning-face + (extent-face extent)) + (delete-extent extent))) buffer begin end)) + (defun default-query-coding-region (begin end coding-system &optional buffer errorp highlightp) "The default `query-coding-region' implementation. @@ -319,10 +333,7 @@ safe-charsets "") default-query-coding-region-safe-charset-skip-chars-map))) (when highlightp - (map-extents #'(lambda (extent ignored-arg) - (when (eq 'query-coding-warning-face - (extent-face extent)) - (delete-extent extent))) buffer begin end)) + (query-coding-clear-highlights begin end buffer)) (if (and (zerop (length skip-chars-arg)) (null safe-chars)) (progn ;; Uh-oh, nothing known about this coding system. Fail. @@ -384,7 +395,7 @@ (values nil ranges) (values t nil)))))) -(defsubst query-coding-region (start end coding-system &optional buffer +(defun query-coding-region (start end coding-system &optional buffer errorp highlight) "Work out whether CODING-SYSTEM can losslessly encode a region.