[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: call-interactively behavior
From: |
Augusto Stoffel |
Subject: |
Re: call-interactively behavior |
Date: |
Sat, 11 Mar 2023 11:52:36 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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