unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Binding functions and parameters
@ 2003-01-28 14:05 Bruce Ashfield
  0 siblings, 0 replies; 2+ messages in thread
From: Bruce Ashfield @ 2003-01-28 14:05 UTC (permalink / raw)


Hi all,

I've been madly searching through the emacs lisp manuals and other
online resources, but I can't figure out how to do exactly what I
want. The answer may be that it isn't possible, but that's why I'm
posting :)

What I'd like to do is create a series of menu entries (or toolbar
buttons) that trigger different actions. It's no problem creating
the entries, it's the binding of the function I'd like them to call
that is causing the problem. I don't know how many entries I'll have
so I'm creating a single function that takes one argument. I'm 
triggering on the argument to figure out what to do.

I'd rather not go brute force and limit myself to "x" functions that
I bind, but would like to bind the function name an an argument.

Has anyone seen examples of this, I can't find it in any source or
online resources. I've included an example of what I'd like to do
that processes the open buffers. Any help is greatly appreciated,
since I'm not 100 % comfortable hacking in lisp.

(defun buffer-to-toolbar ()
  (interactive)
    (let (
         (i 0)
         (max (length (buffer-list)))
         (buffers (buffer-list))
        )
      ( while (< i max)
        (let (
                (buf (nth i buffers))
                (b-name (buffer-name (nth i buffers)))
              )         
            (print b-name)
            (define-key global-map (vector 'tool-bar i)
;; I need to figure out how to bind a function call + arguments ... 
;; I want to say "switch-to-buffer <blah> -----------------
;;                                                        |
;;                                                        v
                (list 'menu-item b-name 'switcher-test 
                   :image (create-image "~/openterm.xpm" 'xpm))             
             )             
         )
        (setq i (+ i 1))
     )
   )
)

Bruce


-- 
Bruce Ashfield         | "Thou shalt not follow the NULL pointer, for
ashfield@computer.org  |  chaos and madness await thee at its end."
bruce@zedd.org         |       - unknown

^ permalink raw reply	[flat|nested] 2+ messages in thread
[parent not found: <mailman.1080.1043762793.21513.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2003-01-28 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-28 14:05 Binding functions and parameters Bruce Ashfield
     [not found] <mailman.1080.1043762793.21513.help-gnu-emacs@gnu.org>
2003-01-28 14:56 ` Christopher J. White

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