[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get value of parameter in macro
From: |
Cecil Westerhof |
Subject: |
Re: How to get value of parameter in macro |
Date: |
Wed, 06 Jan 2010 21:10:16 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
Cecil Westerhof <Cecil@decebal.nl> writes:
> And solved this problem also:
> (setq gnus-group-jump-list
> (list
> '("d" "nndraft:drafts")
> ))
>
> (defmacro gnus-group-jump-bind (key-binding group-to-jump-to)
> `(define-key gnus-group-mode-map ,(symbol-value key-binding)
> (lambda ()
> (interactive)
> (gnus-group-jump-to-group ,(symbol-value group-to-jump-to)))))
>
> (defun gnus-group-do-jump-bind ()
> (dolist (this-jump gnus-group-jump-list)
> (let ((this-group (second this-jump))
> (this-key (concat "vj" (first this-jump))))
> (gnus-group-jump-bind this-key this-group))))
Pascal Bourguignon told me that it was not necessary to use a macro. So
I rewrote it without using a macro:
(defun gnus-group-jump-bind ()
"Define the key bindings for jumping to groups;"
(dolist (this-jump gnus-group-jump-list)
(let ((this-description (second this-jump))
(this-group (third this-jump))
(this-key (concat "vj" (first this-jump))))
(define-key gnus-group-mode-map this-key
`(lambda ()
,this-description
(interactive)
(gnus-group-jump-to-group ,this-group))))))
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof