diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-09-04 23:46:34 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-09-04 23:46:34 -0400 |
commit | c0458e0b21bf507b6a9273189c58a6b97efa2db2 (patch) | |
tree | 95213e4e50168354bcc87c901d98bf9976ba1db1 /lisp/international | |
parent | 6c42fc3efbbf590fca00b866859fbfa13d34b70a (diff) | |
download | emacs-c0458e0b21bf507b6a9273189c58a6b97efa2db2.tar.gz |
* lisp/subr.el (pop): Use `car-safe'.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Remove hack
to detect unused `pop' return value.
* lisp/emacs-lisp/advice.el (defadvice): Add indent rule.
* lisp/international/mule-cmds.el: Require CL.
(find-coding-systems-for-charsets): Avoid add-to-list.
(sanitize-coding-system-list): New function, extracted from
select-safe-coding-system-interactively.
(select-safe-coding-system-interactively): Use it.
(read-input-method-name): Accept symbols for `default'.
* lisp/progmodes/python.el (python-nav-beginning-of-block): Remove unused
var `block-regexp'.
(python-nav--forward-sexp): Remove unused var `re-search-fn'.
(python-fill-string): Remove unused var `marker'.
(python-skeleton-add-menu-items): Remove unused var `items'.
Diffstat (limited to 'lisp/international')
-rw-r--r-- | lisp/international/mule-cmds.el | 68 |
1 files changed, 37 insertions, 31 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 34b1576d23e..588460b657b 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -30,6 +30,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defvar dos-codepage) (autoload 'widget-value "wid-edit") @@ -548,7 +550,7 @@ Emacs, but is unlikely to be what you really want now." (coding-system-charset-list cs))) (charsets charsets)) (if (coding-system-get cs :ascii-compatible-p) - (add-to-list 'cs-charsets 'ascii)) + (cl-pushnew 'ascii cs-charsets)) (if (catch 'ok (when cs-charsets (while charsets @@ -636,6 +638,36 @@ The meaning is the same as the argument ACCEPT-DEFAULT-P of the function `select-safe-coding-system' (which see). This variable overrides that argument.") +(defun sanitize-coding-system-list (codings) + "Return a list of coding systems presumably more user-friendly than CODINGS." + ;; Change each safe coding system to the corresponding + ;; mime-charset name if it is also a coding system. Such a name + ;; is more friendly to users. + (setq codings + (mapcar (lambda (cs) + (let ((mime-charset (coding-system-get cs 'mime-charset))) + (if (and mime-charset (coding-system-p mime-charset) + (coding-system-equal cs mime-charset)) + mime-charset cs))) + codings)) + + ;; Don't offer variations with locking shift, which you + ;; basically never want. + (let (l) + (dolist (elt codings (setq codings (nreverse l))) + (unless (or (eq 'coding-category-iso-7-else + (coding-system-category elt)) + (eq 'coding-category-iso-8-else + (coding-system-category elt))) + (push elt l)))) + + ;; Remove raw-text, emacs-mule and no-conversion unless nothing + ;; else is available. + (or (delq 'raw-text + (delq 'emacs-mule + (delq 'no-conversion (copy-sequence codings)))) + codings)) + (defun select-safe-coding-system-interactively (from to codings unsafe &optional rejected default) "Select interactively a coding system for the region FROM ... TO. @@ -667,35 +699,7 @@ DEFAULT is the coding system to use by default in the query." from to coding 11))))) unsafe))) - ;; Change each safe coding system to the corresponding - ;; mime-charset name if it is also a coding system. Such a name - ;; is more friendly to users. - (let ((l codings) - mime-charset) - (while l - (setq mime-charset (coding-system-get (car l) :mime-charset)) - (if (and mime-charset (coding-system-p mime-charset) - (coding-system-equal (car l) mime-charset)) - (setcar l mime-charset)) - (setq l (cdr l)))) - - ;; Don't offer variations with locking shift, which you - ;; basically never want. - (let (l) - (dolist (elt codings (setq codings (nreverse l))) - (unless (or (eq 'coding-category-iso-7-else - (coding-system-category elt)) - (eq 'coding-category-iso-8-else - (coding-system-category elt))) - (push elt l)))) - - ;; Remove raw-text, emacs-mule and no-conversion unless nothing - ;; else is available. - (setq codings - (or (delq 'raw-text - (delq 'emacs-mule - (delq 'no-conversion codings))) - '(raw-text emacs-mule no-conversion))) + (setq codings (sanitize-coding-system-list codings)) (let ((window-configuration (current-window-configuration)) (bufname (buffer-name)) @@ -1421,7 +1425,9 @@ The return value is a string." ;; buffer local. (input-method (completing-read prompt input-method-alist nil t nil 'input-method-history - default))) + (if (and default (symbolp default)) + (symbol-name default) + default)))) (if (and input-method (symbolp input-method)) (setq input-method (symbol-name input-method))) (if (> (length input-method) 0) |