From: netawater <netstandin-003@yahoo.com.cn>
To: help-gnu-emacs@gnu.org
Subject: Re: How to simulate pressing a key
Date: Sat, 20 Sep 2008 10:50:01 +0800 [thread overview]
Message-ID: <873ajvttt2.fsf@emacs.Arch.net> (raw)
In-Reply-To: mailman.19555.1221836708.18990.help-gnu-emacs@gnu.org
"Drew Adams" <drew.adams@oracle.com> writes:
>> I can not just call the function which key is binding for it may
>> have uncertainty parameter, like tab's function forward-button has
>> parameter, but lisp-indent-line does not.
>>
>> although execute-extended-command works perfect, but I can not use
>> it in my elisp function.
>
> I'm not sure I understand your question, but if I do, have a look at function
> `call-interactively'. It lets you call an interactive function (command) in
> such
> a way that the function's `interactive' spec is used to obtain the argument
> values.
>
> See the Elisp manual, node `Interactive Call'.
Thanks for your reply.
I do not want to interactive call a function but call it like pressing a key.
for example, press tab in help-mode will cause forward-button function which
has a parameter, however I do not need give it parameter and it get parameter
by itself.
my aim is to binding a funtion to tab key in every mode: if cursor is at
the end of word then call M-TAB's function, else call TAB's function.
(defun my-indent-or-complete ()
"if cursor is at
the end of word then call M-TAB's function, else call TAB's function."
(interactive)
;; ^C^t is binding to tab key's function in mode-hook.
(let ((TAB-func (key-binding "^C^t"))
(M-TAB-func (key-binding "\M-\t"))
)
(if (looking-at "\\>")
(apply M-TAB-func '())
(apply TAB-func '())
))
)
my way is only suitable for lisp-indent-line but not forward-button.
next prev parent reply other threads:[~2008-09-20 2:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-19 15:12 How to simulate pressing a key netawater
2008-09-19 15:05 ` Drew Adams
[not found] ` <mailman.19555.1221836708.18990.help-gnu-emacs@gnu.org>
2008-09-20 2:50 ` netawater [this message]
2008-09-20 6:19 ` Drew Adams
2008-09-20 6:55 ` Drew Adams
2008-09-20 7:08 ` Thierry Volpiatto
2008-09-20 10:59 ` Nikolaj Schumacher
[not found] ` <mailman.19594.1221891580.18990.help-gnu-emacs@gnu.org>
2008-09-20 14:37 ` netawater
2008-09-20 16:00 ` Drew Adams
[not found] ` <mailman.19618.1221926415.18990.help-gnu-emacs@gnu.org>
2008-09-26 13:18 ` netawater
[not found] ` <mailman.19605.1221908356.18990.help-gnu-emacs@gnu.org>
2008-09-20 14:43 ` netawater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873ajvttt2.fsf@emacs.Arch.net \
--to=netstandin-003@yahoo.com.cn \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.