1

I have two buffers open in Emacs, each in their own window, and one of those buffers is the *Messages* buffer (for the sake of example, let's say the other buffer is *scratch*). Most things printed to the echo area are immediately visible in the *Messages* buffer. In other words, if I'm in *scratch* and press C-g then "Quit" is printed to the *Messages* buffer right away. If I enter (message "hi") into the *scratch* buffer and eval it, the *Messages* buffer is also updated right away.

However, when I try to call the message function from an SMIE rules-function, the *Messages* buffer is not updated right away, and I have to switch to it (C-x o) in order to see it updated, or scroll it from the other buffer (C-M-v).

This is obviously trivial to work around, but printing stuff with messages is damn useful when debugging an SMIE indentation rules function, which is what I'm doing. When I hit tab in a particular place in my source code, sometimes this function is called more than once, with different parameters (:before and :after for the same token, for instance), resulting in more than one line printed to *Messages*.

Maybe I'm barking up the wrong tree, and in actual fact the SMIE rules function should never be called more than once?? In that case I guess this would be a bug in the lexical spec for this SMIE mode? I'm fiddling with sml-mode.el and it's called twice when the point is on a line after a "definitional equals" for instance:

val x =
|

where the point is |

4

1 に答える 1

1

rules 関数が 2 回呼び出されるのは正常です。メッセージが同じように *Messages* に表示されない理由はわかりませんが、SMIE が何か特別なことを行っているためではありません。smie ルールをデバッグするには、私は個人的に Edebug を使用します (C-u C-M-xデバッグする必要がある smie-rules 関数でヒットします)。

于 2013-01-09T19:11:33.297 に答える