help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with macros


From: Cecil Westerhof
Subject: Re: Need help with macros
Date: Thu, 07 Jan 2010 11:35:49 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

address@hidden (Pascal J. Bourguignon) writes:

> 1- I'd like it better if gnus-group-jump-list was a parameter of the
>    function rather than a global variable.

Point taken and implemented. I'll look into my toggle functionality
also. Would be nice to implement it there also without global variables.


> 2- You could use destructuring-bind:
>
>     (defun gnus-group-jump-bind (jump-list)
>       "Define the key bindings for jumping to groups;"
>       (dolist (this-jump jump-list)
>         (destructuring-bind (this-key this-description this-group) this-jump
>           (let ((binding (concat "vj" this-key)))
>             (define-key gnus-group-mode-map binding 
>                `(lambda ()
>                    ,this-description
>                    (interactive)
>                    (gnus-group-jump-to-group ,this-group)))))))

I did not know destructuring-bind. I made it:
    (defun gnus-group-jump-bind (jump-list)
      "Define the key bindings for jumping to groups;"
      (dolist (this-jump jump-list)
        (destructuring-bind (this-key this-description this-group) this-jump
          (define-key gnus-group-mode-map (concat "vj" 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


reply via email to

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