lutz@nsebln.UUCP (Lutz Hilken) (11/14/89)
Hi Netland, I have a question: Is there a proper way to bind two functions to one key? Ok, I can write a new function wich calls that one I like to execute, but... I would like something like (define-key CSI-map "<some sequence>" 'funtion 1 'function 2). Can you help me? Thanks. Keep on using Emacs... ------------------------------------------------------------------------------- ***************************** __ _ __ __ ______ Snail : Lutz Hilken | \ | | | \ / | | ____| Mail Nixdorf Microprocessor Engineering GmbH | \ | | | \/ | | |__ Gustav-Meyer-Allee 1 | |\ \| | | |\ /| | | __| D-1000 Berlin 65 (West Germany) | | \ | | | \/ | | | |____ Phone : [nation] 30 46007 141 |_| \__| |_| |_| |______| Eunet : hilken.bln@nixpbe.uucp ***************************** Usenet : hilken.bln@nixbur.uucp -------------------------------------------------------------------------------
nhess@oracle.uucp (Nate Hess) (11/18/89)
In article <86@nixbln.UUCP> lutz@nsebln.UUCP (Lutz Hilken) writes: >I have a question: > > Is there a proper way to bind two functions to one key? Ok, I can > write a new function wich calls that one I like to execute, but... > I would like something like > (define-key CSI-map "<some sequence>" 'funtion 1 'function 2). > >Can you help me? I can try... A binding like this seems to work: (define-key <a-map> "<some sequence>" '(lambda () (interactive) (backward-char 4) (forward-char 1))) I would imagine that you could use this to execute any Elisp you cared to. Hope this helps, --woodstock "What I like is when you're looking and thinking and looking and thinking...and suddenly you wake up." - Hobbes nhess@dvlseq.oracle.com or ...!uunet!oracle!nhess or (415) 598-8114
montnaro@sprite.crd.ge.com (Skip Montanaro) (11/18/89)
In article <86@nixbln.UUCP> lutz@nsebln.UUCP (Lutz Hilken) writes:
Is there a proper way to bind two functions to one key? Ok, I can
write a new function wich calls that one I like to execute, but...
I would like something like
(define-key CSI-map "<some sequence>" 'funtion 1 'function 2).
How would you know which got executed? If you'd execute both, how would they
decide how to split up any arguments? Why not just
(defun function-wrapper ()
(interactive ...)
(function1 ...)
(function2 ...))
(define-key CSI-map "<some sequence>" 'function-wrapper)
--
Skip Montanaro (montanaro@crdgw1.ge.com)
merlyn@iwarp.intel.com (Randal Schwartz) (11/20/89)
In article <86@nixbln.UUCP>, lutz@nsebln (Lutz Hilken) writes: | Is there a proper way to bind two functions to one key? Ok, I can | write a new function wich calls that one I like to execute, but... | I would like something like | (define-key CSI-map "<some sequence>" 'funtion 1 'function 2). I presume that what you mean is to execute function-1 followed by function-2. Try: (define-key CSI-map "<some sequence>" '(lambda () (interactive) (function-1) (function-2))) which essentially does what you asked (creates a new function calling the ones you like), but doesn't give it a name. Just another Elisp hacker, -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/
merlyn@omepd.UUCP (Randal Schwartz) (11/20/89)
In article <86@nixbln.UUCP>, lutz@nsebln (Lutz Hilken) writes: | Is there a proper way to bind two functions to one key? Ok, I can | write a new function wich calls that one I like to execute, but... | I would like something like | (define-key CSI-map "<some sequence>" 'funtion 1 'function 2). I presume that what you mean is to execute function-1 followed by function-2. Try: (define-key CSI-map "<some sequence>" '(lambda () (interactive) (function-1) (function-2))) which essentially does what you asked (creates a new function calling the ones you like), but doesn't give it a name. Just another Elisp hacker, -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/