From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.bugs Subject: bug#6599: 23.2; cl.texi docs loop hash-values Date: Sat, 10 Jul 2010 09:58:03 +1000 Message-ID: <87mxu0i4xg.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1278721817 6980 80.91.229.12 (10 Jul 2010 00:30:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Jul 2010 00:30:17 +0000 (UTC) To: 6599@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 10 02:30:16 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNxN-0003ro-Mr for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Jul 2010 02:30:14 +0200 Original-Received: from localhost ([127.0.0.1]:35060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXNxN-0002St-0x for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Jul 2010 20:30:13 -0400 Original-Received: from [140.186.70.92] (port=48349 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXNxF-0002SI-FB for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 20:30:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXNxE-0008QU-2o for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 20:30:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57352) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNxE-0008QP-0A for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 20:30:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OXNen-0000Kh-MU; Fri, 09 Jul 2010 20:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kevin Ryde Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Jul 2010 00:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6599 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.12787206131266 (code B ref -1); Sat, 10 Jul 2010 00:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Jul 2010 00:10:13 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNe1-0000KN-GZ for submit@debbugs.gnu.org; Fri, 09 Jul 2010 20:10:13 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNdy-0000KI-H2 for submit@debbugs.gnu.org; Fri, 09 Jul 2010 20:10:11 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:52891) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OXNdu-00032Z-OQ for submit@debbugs.gnu.org; Fri, 09 Jul 2010 20:10:06 -0400 Original-Received: from [140.186.70.92] (port=43988 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXNdr-0005fC-Ea for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 20:10:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXNSf-0004e3-PV for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 19:58:31 -0400 Original-Received: from mailout1-3.pacific.net.au ([61.8.2.210]:40465 helo=mailout1.pacific.net.au) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNSf-0004dc-4i for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 19:58:29 -0400 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id 0D2EE5BD713 for ; Sat, 10 Jul 2010 09:58:25 +1000 (EST) Original-Received: from blah.blah (ppp2CED.dyn.pacific.net.au [61.8.44.237]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 08F1B27406 for ; Sat, 10 Jul 2010 09:58:24 +1000 (EST) Original-Received: from gg by blah.blah with local (Exim 4.72) (envelope-from ) id 1OXNSF-0005a9-Dd for bug-gnu-emacs@gnu.org; Sat, 10 Jul 2010 09:58:03 +1000 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 09 Jul 2010 20:11:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38328 Archived-At: --=-=-= In the cl.texi docs for the `loop' macro I had to read a few times before noticing the way hash values are accessed. I think showing as items and adding an example would make it easier for the newcomer :-). 2010-07-09 Kevin Ryde * cl.texi (For Clauses): @items for hash-values and key-bindings to make them more visible when skimming. Add examples of `using' clause to them, examples being clearer than a description in words. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=cl.texi.hash-values.diff --- cl.texi.~1.15.~ 2009-11-27 18:28:09.000000000 +1100 +++ cl.texi 2010-07-10 09:50:54.000000000 +1000 @@ -2476,22 +2476,33 @@ or @code{while}. @item for @var{var} being the hash-keys of @var{hash-table} -This clause iterates over the entries in @var{hash-table}. For each -hash table entry, @var{var} is bound to the entry's key. If you write -@samp{the hash-values} instead, @var{var} is bound to the values -of the entries. The clause may be followed by the additional -term @samp{using (hash-values @var{var2})} (where @code{hash-values} -is the opposite word of the word following @code{the}) to cause -@var{var} and @var{var2} to be bound to the two parts of each -hash table entry. +@itemx for @var{var} being the hash-values of @var{hash-table} +This clause iterates over the entries in @var{hash-table} with +@var{var} bound to each key, or value. A @samp{using} clause can bind +a second variable to the opposite part. + +@example +(loop for k being the hash-keys of h + using (hash-values v) + do + (message "key %S -> value %S" k v)) +@end example @item for @var{var} being the key-codes of @var{keymap} +@itemx for @var{var} being the key-bindings of @var{keymap} This clause iterates over the entries in @var{keymap}. The iteration does not enter nested keymaps but does enter inherited (parent) keymaps. -You can use @samp{the key-bindings} to access the commands bound to -the keys rather than the key codes, and you can add a @code{using} -clause to access both the codes and the bindings together. +A @code{using} clause can access both the codes and the bindings +together. + +@example +(loop for c being the key-codes of (current-local-map) + using (key-bindings b) + do + (message "key %S -> binding %S" c b)) +@end example + @item for @var{var} being the key-seqs of @var{keymap} This clause iterates over all key sequences defined by @var{keymap} --=-=-= In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-05-16 on raven, modified by Debian configured using `configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_AU value of $XMODIFIERS: nil locale-coding-system: iso-latin-1-unix default enable-multibyte-characters: t --=-=-=--