unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bugs in (loop for ... being the key-codes|key-seqs ...)
@ 2008-03-10 13:28 Jonas Bernoulli
  2008-03-10 14:27 ` Johan Bockgård
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Bernoulli @ 2008-03-10 13:28 UTC (permalink / raw)
  To: bug-gnu-emacs

Both 22.1 and 23.0.60 are affected.

(loop for key being the key-seqs of
      (let ((map (make-sparse-keymap)))
	(define-key map "a" 'a-97)
	(define-key map "b" 'b-98)
	map)
      collect key)

=> ([97] [97])

but should be:

=> ([98] [97])


(loop for key being the key-codes of
      (let ((map (make-sparse-keymap)))
	(define-key map "a" 'a-97)
	(define-key map "b" 'b-98)
	(set-keymap-parent map
			   (let ((map (make-sparse-keymap)))
			     (define-key map "c" 'c-99)
			     map))
	map)
      collect key)

=> (98 97 99)

but should be:

=> (98 97)

`for VAR being the key-codes of KEYMAP'
     This clause iterates over the entries in KEYMAP.  The iteration
     does not enter nested keymaps or inherited (parent) keymaps.

-- jonas




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bugs in (loop for ... being the key-codes|key-seqs ...)
  2008-03-10 13:28 bugs in (loop for ... being the key-codes|key-seqs ...) Jonas Bernoulli
@ 2008-03-10 14:27 ` Johan Bockgård
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Bockgård @ 2008-03-10 14:27 UTC (permalink / raw)
  To: bug-gnu-emacs

"Jonas Bernoulli" <jonas@bernoulli.cc> writes:

> Both 22.1 and 23.0.60 are affected.
>
> (loop for key being the key-seqs of
>       (let ((map (make-sparse-keymap)))
> 	(define-key map "a" 'a-97)
> 	(define-key map "b" 'b-98)
> 	map)
>       collect key)
>
> => ([97] [97])
>
> but should be:
>
> => ([98] [97])

  `for VAR being the key-seqs of KEYMAP'
       This clause iterates over all key sequences defined by KEYMAP and
       its nested keymaps, where VAR takes on values which are vectors.
       The strings or vectors are reused for each iteration, so you must
       copy them if you wish to keep them permanently.
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-- 
Johan Bockgård





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-10 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 13:28 bugs in (loop for ... being the key-codes|key-seqs ...) Jonas Bernoulli
2008-03-10 14:27 ` Johan Bockgård

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).