unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: "Nicolas P. Rougier (inria)" <nicolas.rougier@inria.fr>
Cc: emacs-devel@gnu.org
Subject: Re: call-interactively behavior
Date: Sat, 11 Mar 2023 11:52:36 +0100	[thread overview]
Message-ID: <87zg8jpnkb.fsf@gmail.com> (raw)
In-Reply-To: <m14jqslbbd.fsf@inria.fr> (Nicolas P. Rougier's message of "Fri,  10 Mar 2023 19:16:27 +0100")

I suppose you want to use `execute-kbd-macro'?

On Fri, 10 Mar 2023 at 19:16, Nicolas P. Rougier (inria) wrote:

> Nicolas P. Rougier (inria) [2023-03-10 at 07:38] wrote:
>> Hi all,
>> 
>> I'm trying to use call-interactively using the following code:
>> 
>> #+begin_src 
>> (with-current-buffer (get-buffer-create "hippie-test")
>>   (setq-local hippie-expand-try-functions-list
>>               '(try-complete-file-name-partially
>>                 try-complete-file-name))
>>   (text-mode)
>>   (use-local-map (copy-keymap text-mode-map))
>>   (local-set-key (kbd "TAB") 'hippie-expand)
>> 
>>   (insert "~/D")
>>   (call-interactively (key-binding (kbd "TAB")))
>>   (call-interactively (key-binding (kbd "TAB")))
>>   (call-interactively (key-binding (kbd "TAB"))))
>> #+end_src
>> 
>> In my home root, there are 3 directoriess: ~/Desktop, 
>> ~/Downloads 
>> and ~/Documents.
>> 
>> When I execute the code above, the final content in the buffer 
>> is:
>> ~/Desktop/../../
>> 
>> If I switch to the buffer, insert "~/D" and hit tab three times, 
>> I 
>> cycle over the three directories above, which is the expected 
>> behavior. My question is thus: why I don't get the same behavior 
>> and what would be the proper way to simulate the tab key press 
>> (or 
>> any other key)?
>> 
>> Nicolas
>
> Partially answering my question, it seems that evaluating 
> repeatedly the code works but it is not clear why. Maybe some 
> events need to be flushed?
>
> #+begin_src
> (with-current-buffer "hippie-test"
>   (call-interactively (key-binding (kbd "TAB"))))
> #+end_sc
>
> Nicolas



  reply	other threads:[~2023-03-11 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  6:38 call-interactively behavior Nicolas P. Rougier (inria)
2023-03-10 18:16 ` Nicolas P. Rougier (inria)
2023-03-11 10:52   ` Augusto Stoffel [this message]
2023-03-11 11:12     ` Nicolas P. Rougier (inria)

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg8jpnkb.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=nicolas.rougier@inria.fr \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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