Date: 22 Jul 2003 18:04:26 -0700 From: LLeweLLyn Reese <llewelly@lifesupport.shutdown.com> To: "Fredrik =?iso-8859-1?q?Carl=E9n?=" <baterista@arrhythmetic.net> Cc: freebsd-questions@freebsd.org Subject: Re: Off-topic Emacs question Message-ID: <x3k7aa12at.fsf@lifesupport.shutdown.com> In-Reply-To: <WorldClient-F200307222004.AA04520296@arrhythmetic.net> References: <WorldClient-F200307222004.AA04520296@arrhythmetic.net>
next in thread | previous in thread | raw e-mail | index | archive | help
"Fredrik Carl=E9n" <baterista@arrhythmetic.net> writes: > I know, this is non-specific to FreeBSD, but I have learned to love you=20 > all on this list, and this should be an easy nut to crack (as we say=20 > idiomatically at least here in Sweden...): >=20 > I want to define key bindings for the function sgml-tag > like this > (global-set-key "\C-t" 'sgml-tag) >=20 > But I don't want it to be interactive: For speedy markup, I would like to= =20 > be able to do something like=20 > (sgml-tag "head" -1) >=20 > ...but I need to do it when defining a key binding, something like this I= =20 > thought, but Emacs tells me "No": > (global-set-key "\C-t" (sgml-tag "head" -1)) >=20 > Isn't it possible to bind complete function calls to keys? It must > be... (global-set-key "\C-t" (lambda () (interactive) (sgml-tag "head" -1))) 'lambda' is necessary to create a function. '()' means it takes no arguments. '(interactive)' means the function may be called interactivly.=20 >=20 > The doc for global-set-key only says > ------------------------------------------------- > global-set-key is an interactive compiled Lisp function in `subr'. > (global-set-key KEY COMMAND) [snip] C-h i g (emacs) Init Rebinding or=20 http://www.gnu.org/manual/emacs/html_node/emacs_497.html#SEC497 for general rebinding instructions. C-h i g (emacs-lisp-intro) Interactive or http://www.gnu.org/manual/emacs-lisp-intro/html_node/Interactive.html for writing interactive functions. Note: the second emacs command may require # cd /usr/ports/lang/emacs-lisp-intro # make install clean =20=20=20=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?x3k7aa12at.fsf>