info-gnus-english
[Top][All Lists]
Advanced

[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 18:17:16 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Cecil Westerhof <address@hidden> writes:

> Found it:
>     (defmacro gnus-group-jump-bind (key-binding group-to-jump-to)
>       `(define-key gnus-group-mode-map ,key-binding
>         (lambda ()
>           (interactive)
>           (gnus-group-jump-to-group ,group-to-jump-to))))
>
> When you know it, it is not difficult.
>
> But I am still not out of the woods.
> Instead of using:
>     (gnus-group-jump-bind "vjd" "nndraft:drafts")
>
> I want to do something like:
>     (gnus-group-jump-bind this-key this-group)
>
> But that does not work because the macro then does not receive a string,
> but a symbol. I tried to work with symbol-value, but that did not work.
> If you -or someone else- has another pointer ...

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))))

    (gnus-group-do-jump-bind)

And this does what I want. A problem could be that:
     (gnus-group-jump-bind "vjd" "nndraft:drafts")

does not work anymore, but just always use variables solves that
'problem'.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


reply via email to

[Prev in Thread] Current Thread [Next in Thread]