* idle timer and current syntax-table
@ 2017-05-18 17:17 Yuri D'Elia
2017-05-18 17:45 ` Dmitry Gutov
0 siblings, 1 reply; 4+ messages in thread
From: Yuri D'Elia @ 2017-05-18 17:17 UTC (permalink / raw)
To: emacs-devel
When setting up some function to run with an idle timer, I noticed the
(syntax-table) is empty while calling the timer.
It somehow makes sense, since there's no buffer associated with it.
However, it breaks code in very subtle ways. For example, any regexp
won't recognize the usual word boundaries.
When used with replace-regexp-in-string it might not be immediately
apparent why the regular expression is failing to match.
Wouldn't it make sense to set the standard-syntax-table during the
invocation of the timer?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: idle timer and current syntax-table
2017-05-18 17:17 idle timer and current syntax-table Yuri D'Elia
@ 2017-05-18 17:45 ` Dmitry Gutov
2017-05-19 9:12 ` Yuri D'Elia
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2017-05-18 17:45 UTC (permalink / raw)
To: Yuri D'Elia, emacs-devel
On 18.05.2017 20:17, Yuri D'Elia wrote:
> When setting up some function to run with an idle timer, I noticed the
> (syntax-table) is empty while calling the timer.
I've just evaluated this is the scratch buffer:
(run-with-idle-timer 1 nil (lambda () (message "%s" (syntax-table))))
And the message came with a normal, non-empty syntax table value.
> It somehow makes sense, since there's no buffer associated with it.
It normally runs in whatever buffer is current in the selected window.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: idle timer and current syntax-table
2017-05-18 17:45 ` Dmitry Gutov
@ 2017-05-19 9:12 ` Yuri D'Elia
2017-05-19 12:30 ` Dmitry Gutov
0 siblings, 1 reply; 4+ messages in thread
From: Yuri D'Elia @ 2017-05-19 9:12 UTC (permalink / raw)
To: emacs-devel
On Thu, May 18 2017, Dmitry Gutov wrote:
>> It somehow makes sense, since there's no buffer associated with it.
>
> It normally runs in whatever buffer is current in the selected window.
Current when the timer is registered, or when fired?
I'm seeing this when setting an idle timer from a dbus method hook _and_
the idle timer is fired when I'm a message.el buffer.
The message buffer has a working syntax table, but this is not what I'm
seeing in the timer func. _Another_ buffer must be current.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: idle timer and current syntax-table
2017-05-19 9:12 ` Yuri D'Elia
@ 2017-05-19 12:30 ` Dmitry Gutov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2017-05-19 12:30 UTC (permalink / raw)
To: Yuri D'Elia, emacs-devel
On 19.05.2017 12:12, Yuri D'Elia wrote:
>> It normally runs in whatever buffer is current in the selected window.
>
> Current when the timer is registered, or when fired?
When fired.
> I'm seeing this when setting an idle timer from a dbus method hook _and_
> the idle timer is fired when I'm a message.el buffer.
Not sure what's going on over there.
> The message buffer has a working syntax table, but this is not what I'm
> seeing in the timer func. _Another_ buffer must be current.
Try also this snippet:
(run-with-idle-timer 1 nil
(lambda () (message "%s %s"
(current-buffer)
(eq (syntax-table)
emacs-lisp-mode-syntax-table))))
I evaluate it in the minibuffer. When I'm in the scratch buffer after a
second, it prints "-scratch- t". When I switch to a different buffer
(*Messages*), it prints "*Messages* nil".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-19 12:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-18 17:17 idle timer and current syntax-table Yuri D'Elia
2017-05-18 17:45 ` Dmitry Gutov
2017-05-19 9:12 ` Yuri D'Elia
2017-05-19 12:30 ` Dmitry Gutov
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.