- (when (and _execute_command_keys_
- ;; Wait for a while, so the user can see a message
- ;; printed, if any.
- (sit-for 1))
- (display-message
- 'no-log
- (format "Command `%s' is bound to key%s: %s"
- _execute_command_name_
- (if (cdr _execute_command_keys_) "s" "")
- (sorted-key-descriptions _execute_command_keys_)))
- (sit-for teach-extended-commands-timeout)
- (clear-message 'no-log)))
+ (when _execute_command_keys_
+ ;; Normally the region is adjusted in post_command_hook;
+ ;; however, it is not called until after we finish. It
+ ;; looks ugly for the region to get updated after the
+ ;; delays, so we do it now. The code below is a Lispified
+ ;; copy of code in event-stream.c:post_command_hook().
+ (if (and (not zmacs-region-stays)
+ (or (not (eq (selected-window) (minibuffer-window)))
+ (eq (zmacs-region-buffer) (current-buffer))))
+ (zmacs-deactivate-region)
+ (zmacs-update-region))
+ ;; Wait for a while, so the user can see a message printed,
+ ;; if any.
+ (when (sit-for 1)
+ (display-message
+ 'no-log
+ (format (if (cdr _execute_command_keys_)
+ "Command `%s' is bound to keys: %s"
+ "Command `%s' is bound to key: %s")
+ _execute_command_name_
+ (sorted-key-descriptions _execute_command_keys_)))
+ (sit-for teach-extended-commands-timeout)
+ (clear-message 'no-log))))