From: Sam Steingold Date: Tue, 1 Feb 2011 18:15:18 +0000 (-0500) Subject: * lisp/subr.el (purecopy-cons, purecopy-car): Add shortcuts. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~1048^2~34 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0b75349e7e197c3783153ca2231b2c206513812b;p=emacs.git * lisp/subr.el (purecopy-cons, purecopy-car): Add shortcuts. * lisp/faces.el (face-x-resources): Use `purecopy-cons'. * lisp/files.el (auto-mode-alist, interpreter-mode-alist): Use `purecopy-car'. * lisp/international/fontset.el (font-encoding-alist): Ditto. * lisp/international/mule-conf.el (file-coding-system-alist): Ditto. * lisp/international/mule.el (auto-coding-alist) (auto-coding-regexp-alist): Ditto. * lisp/mouse.el (mouse-buffer-menu-mode-groups): Use `purecopy-cons'. * lisp/term/x-win.el (x-gtk-stock-map): Ditto. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f018b43b44b..5b2011b108d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2011-02-01 Sam Steingold + + * subr.el (purecopy-cons, purecopy-car): Add shortcuts. + * faces.el (face-x-resources): Use `purecopy-cons'. + * files.el (auto-mode-alist, interpreter-mode-alist): Use + `purecopy-car'. + * international/fontset.el (font-encoding-alist): Ditto. + * international/mule-conf.el (file-coding-system-alist): Ditto. + * international/mule.el (auto-coding-alist) + (auto-coding-regexp-alist): Ditto. + * mouse.el (mouse-buffer-menu-mode-groups): Use `purecopy-cons'. + * term/x-win.el (x-gtk-stock-map): Ditto. + 2011-02-01 Chong Yidong * custom.el (load-theme): Define return value. Drop use of diff --git a/lisp/faces.el b/lisp/faces.el index a9d26de604b..9d6d3416c01 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -261,8 +261,7 @@ If FRAME is omitted or nil, use the selected frame." (mapcar (lambda (arg) ;; FIXME; can we purecopy some of the conses too? - (cons (car arg) - (cons (purecopy (car (cdr arg))) (purecopy (cdr (cdr arg)))))) + (cons (car arg) (purecopy-cons (cdr arg)))) '((:family (".attributeFamily" . "Face.AttributeFamily")) (:foundry (".attributeFoundry" . "Face.AttributeFoundry")) (:width (".attributeWidth" . "Face.AttributeWidth")) diff --git a/lisp/files.el b/lisp/files.el index 8b42eaaddb8..220870588fb 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2229,8 +2229,7 @@ since only a single case-insensitive search through the alist is made." ;; directives in that file. That way is discouraged since it ;; spreads out the definition of the initial value. (mapcar - (lambda (elt) - (cons (purecopy (car elt)) (cdr elt))) + 'purecopy-car `(;; do this first, so that .html.pl is Polish html, not Perl ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . html-mode) ("\\.svgz?\\'" . image-mode) @@ -2454,8 +2453,7 @@ and `magic-mode-alist', which determines modes based on file contents.") ;; file. That way is discouraged since it spreads out the ;; definition of the initial value. (mapcar - (lambda (l) - (cons (purecopy (car l)) (cdr l))) + 'purecopy-car '(("perl" . perl-mode) ("perl5" . perl-mode) ("miniperl" . perl-mode) diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 777779e5ec5..da82a15468b 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -33,8 +33,7 @@ ;; Setup font-encoding-alist for all known encodings. (setq font-encoding-alist - (mapcar (lambda (arg) - (cons (purecopy (car arg)) (cdr arg))) + (mapcar 'purecopy-car '(("iso8859-1$" . iso-8859-1) ("iso8859-2$" . iso-8859-2) ("iso8859-3$" . iso-8859-3) diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index 9ba95e4d11a..55a96b6cca1 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -1505,7 +1505,7 @@ for decoding and encoding files, process I/O, etc." ;; Tar files are not decoded at all, but we treat them as raw bytes. (setq file-coding-system-alist - (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg))) + (mapcar 'purecopy-car '(("\\.elc\\'" . utf-8-emacs) ("\\.utf\\(-8\\)?\\'" . utf-8) ("\\.xml\\'" . xml-find-file-coding-system) diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 4a387a233a0..2da15b5f9bd 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -1671,11 +1671,11 @@ in-place." (defcustom auto-coding-alist ;; .exe and .EXE are added to support archive-mode looking at DOS ;; self-extracting exe archives. - (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg))) - '(("\\.\\(\ + (mapcar 'purecopy-car + '(("\\.\\(\ arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" - . no-conversion-multibyte) + . no-conversion-multibyte) ("\\.\\(exe\\|EXE\\)\\'" . no-conversion) ("\\.\\(sx[dmicw]\\|odt\\|tar\\|tgz\\)\\'" . no-conversion) ("\\.\\(gz\\|Z\\|bz\\|bz2\\|xz\\|gpg\\)\\'" . no-conversion) @@ -1696,7 +1696,7 @@ and the contents of `file-coding-system-alist'." (symbol :tag "Coding system")))) (defcustom auto-coding-regexp-alist - (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg))) + (mapcar 'purecopy-car '(("\\`BABYL OPTIONS:[ \t]*-\\*-[ \t]*rmail[ \t]*-\\*-" . no-conversion) ("\\`\xFE\xFF" . utf-16be-with-signature) ("\\`\xFF\xFE" . utf-16le-with-signature) diff --git a/lisp/mouse.el b/lisp/mouse.el index c0b86d45028..45a43bb9aee 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1719,7 +1719,7 @@ a large number if you prefer a mixed multitude. The default is 4." :version "20.3") (defvar mouse-buffer-menu-mode-groups - (mapcar (lambda (arg) (cons (purecopy (car arg)) (purecopy (cdr arg)))) + (mapcar 'purecopy-cons '(("Info\\|Help\\|Apropos\\|Man" . "Help") ("\\bVM\\b\\|\\bMH\\b\\|Message\\|Mail\\|Group\\|Score\\|Summary\\|Article" . "Mail/News") diff --git a/lisp/subr.el b/lisp/subr.el index 3330fa20379..45afbb31286 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2320,6 +2320,13 @@ BEG and END default respectively to the beginning and end of buffer." ;;;; Miscellanea. +(defun purecopy-cons (arg) + "Purecopy both car and cdr of the pair argument." + (cons (purecopy (car arg)) (purecopy (cdr arg)))) +(defun purecopy-car (arg) + "Purecopy the car of the pair argument." + (cons (purecopy (car arg)) (cdr arg))) + (defvar suspend-hook nil "Normal hook run by `suspend-emacs', before suspending.") diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 1ec80d5c277..c966fc561cb 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1447,8 +1447,7 @@ Request data types in the order specified by `x-select-request-type'." (define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event) (defcustom x-gtk-stock-map - (mapcar (lambda (arg) - (cons (purecopy (car arg)) (purecopy (cdr arg)))) + (mapcar 'purecopy-cons '( ("etc/images/new" . "gtk-new") ("etc/images/open" . "gtk-open")