From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/78537 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: cl functions in gnus-registry.el Date: Mon, 18 Apr 2011 16:02:18 +0900 Organization: Emacsen advocacy group Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1303110312 17644 80.91.229.12 (18 Apr 2011 07:05:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Apr 2011 07:05:12 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M26840@lists.math.uh.edu Mon Apr 18 09:05:09 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QBiWC-0000cm-T2 for ding-account@gmane.org; Mon, 18 Apr 2011 09:05:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1QBiUE-0005F9-1f; Mon, 18 Apr 2011 02:03:06 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1QBiUA-0005En-8A for ding@lists.math.uh.edu; Mon, 18 Apr 2011 02:03:02 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1QBiU4-0006St-9u for ding@lists.math.uh.edu; Mon, 18 Apr 2011 02:02:57 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1QBiU2-0004FL-30 for ding@gnus.org; Mon, 18 Apr 2011 09:02:54 +0200 Original-Received: from localhost ([127.0.0.1]:51366) by orlando.hostforweb.net with esmtpa (Exim 4.69) (envelope-from ) id 1QBiTt-0006Tj-AE for ding@gnus.org; Mon, 18 Apr 2011 02:02:45 -0500 X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (cygwin) Cancel-Lock: sha1:Ym3aNk6x3oMrOd2AvE8y36vu6E0= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:78537 Archived-At: --=-=-= Hi, When performing `make bootstrap' on Emacs head, the byte compiler warns about cl functions used in gnus-registry.el: gnus-registry.el:MMM:NN:Warning: function `mapcan' from cl package called at runtime gnus-registry.el:985:58:Warning: function `delete*' from cl package called at runtime As for this, how about the attached patch? In addition, I got the following when compiling registry.el: registry.el:439:1:Warning: the following functions are not known to be defined: registry-lookup-secondary, registry-lookup-secondary-value, registry-size, registry-delete, registry-insert, registry-lookup, registry-lookup-breaks-before-lexbind, registry-search, registry-prune I guess surrounding all the defmethod forms with `eval-and-compile' may be a solution (see the second patch). Regards, --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: gnus-registry_el-eliminate-cl-fns.patch --- gnus-registry.el~ 2011-04-17 21:54:48.718750000 +0000 +++ gnus-registry.el 2011-04-18 06:50:37.640625000 +0000 @@ -303,15 +303,9 @@ (defun gnus-registry-action (action data-header from &optional to method) (let* ((id (mail-header-id data-header)) (subject (mail-header-subject data-header)) - (recipients (sort (mapcan 'gnus-registry-extract-addresses - (list - (or (ignore-errors - (mail-header "Cc" data-header)) - "") - (or (ignore-errors - (mail-header "To" data-header)) - ""))) - 'string-lessp)) + (recipients (gnus-registry-sort-addresses + (or (ignore-errors (mail-header "Cc" data-header)) "") + (or (ignore-errors (mail-header "To" data-header)) ""))) (sender (nth 0 (gnus-registry-extract-addresses (mail-header-from data-header)))) (from (gnus-group-guess-full-name-from-command-method from)) @@ -329,11 +323,9 @@ (defun gnus-registry-spool-action (id group &optional subject sender recipients) (let ((to (gnus-group-guess-full-name-from-command-method group)) (recipients (or recipients - (sort (mapcan 'gnus-registry-extract-addresses - (list - (or (message-fetch-field "cc") "") - (or (message-fetch-field "to") ""))) - 'string-lessp))) + (gnus-registry-sort-addresses + (or (message-fetch-field "cc") "") + (or (message-fetch-field "to") "")))) (subject (or subject (message-fetch-field "subject"))) (sender (or sender (message-fetch-field "from")))) (when (and (stringp id) (string-match "\r$" id)) @@ -409,11 +401,9 @@ ;; these may not be used, but the code is cleaner having them up here (sender (gnus-string-remove-all-properties (message-fetch-field "from"))) - (recipients (sort (mapcan 'gnus-registry-extract-addresses - (list - (or (message-fetch-field "cc") "") - (or (message-fetch-field "to") ""))) - 'string-lessp)) + (recipients (gnus-registry-sort-addresses + (or (message-fetch-field "cc") "") + (or (message-fetch-field "to") ""))) (subject (gnus-string-remove-all-properties (gnus-registry-simplify-subject (message-fetch-field "subject")))) @@ -719,6 +709,11 @@ (format "%s <%s>" name addr)))) (mail-extract-address-components text t))) +(defun gnus-registry-sort-addresses (&rest addresses) + "Return a normalized and sorted list of ADDRESSES." + (sort (apply 'nconc (mapcar 'gnus-registry-extract-addresses addresses)) + 'string-lessp)) + (defun gnus-registry-simplify-subject (subject) (if (stringp subject) (gnus-simplify-subject subject) @@ -738,15 +733,9 @@ (gnus-registry-fetch-header-fast "from" article)) (defun gnus-registry-fetch-recipients-fast (article) - (sort (mapcan 'gnus-registry-extract-addresses - (list - (or (ignore-errors - (gnus-registry-fetch-header-fast "Cc" article)) - "") - (or (ignore-errors - (gnus-registry-fetch-header-fast "To" article)) - ""))) - 'string-lessp)) + (gnus-registry-sort-addresses + (or (ignore-errors (gnus-registry-fetch-header-fast "Cc" article)) "") + (or (ignore-errors (gnus-registry-fetch-header-fast "To" article)) ""))) (defun gnus-registry-fetch-header-fast (article header) "Fetch the HEADER quickly, using the internal gnus-data-list function" @@ -982,7 +971,8 @@ collect p)) extra-cell key val) ;; remove all the strings from the entry - (delete* nil rest :test (lambda (a b) (stringp b))) + (dolist (elem rest) + (if (stringp elem) (setq rest (delq elem rest)))) (gnus-registry-set-id-key id 'group groups) ;; just use the first extra element (setq rest (car-safe rest)) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: registry_el+eval-and-compil.patch --- registry.el~ 2011-04-17 21:54:50.765625000 +0000 +++ registry.el 2011-04-18 06:50:37.642625000 +0000 @@ -131,6 +131,7 @@ :type hash-table :documentation "The data hashtable."))) +(eval-and-compile (defmethod initialize-instance :AFTER ((this registry-db) slots) "Set value of data slot of THIS after initialization." (with-slots (data tracker) this @@ -327,6 +328,7 @@ (setq candidates (cdr candidates))) (registry-delete db candidates nil))) +) (ert-deftest registry-instantiation-test () (should (registry-db "Testing"))) --=-=-=--