[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#7234: 24.0.50; strange message after text-scale-adjust
From: |
Kenichi Handa |
Subject: |
Re: bug#7234: 24.0.50; strange message after text-scale-adjust |
Date: |
Tue, 19 Oct 2010 09:37:18 +0900 |
In article <address@hidden>, Stefan Monnier <address@hidden> writes:
> > It would be better that read-event call in
> > text-scale-adjust has some prompt:
> > e.g. (read-event "+,-,0 for further adjustment: ")
> Agreed.
Shall I install that change, or do you have a better prompt
string, or should we wait for your alternative
implementation?
> > For non-interactive use, you should probably also be using
> > `text-scale-set' or `text-scale-increase' instead.
> BTW, I've been playing around with an alternative implementation for
> such things. The reason is that the use of
> read-event/read-char/read-key has surprising side-effects: in those
> cases I'm concerned with, the user expects that the command is already
> finished and the behavior is somewhat consistent with that expectation,
> but not completely: indeed typing "any" key sequence (except for a few
> special ones) runs the usual corresponding command, but OTOH
> post-command-hook and friends aren't run when expected.
I think the situation is similar to isearch. How does
isearch solve it?
> So, instead I use a new function set-temporary-overlay-map which sets up
> a keymap that's only active for a short period of time (by default just
> for the next key-sequence):
> ;; ----------------------------------------------------------------
> --- 294,317 ----
> `text-scale-decrease' may be more appropriate."
> (interactive "p")
> (let ((first t)
> (ev last-command-event)
> (echo-keystrokes nil))
> ! (let* ((base (event-basic-type ev))
> ! (step
> ! (case base
> ! ((?+ ?=) inc)
> ! (?- (- inc))
> ! (?0 0)
> ! (t inc))))
> (text-scale-increase step)
> ! (set-temporary-overlay-map
> ! (let ((map (make-sparse-keymap)))
> ! (define-key map [?=] 'text-scale-increase)
> ! (define-key map [?0] (lambda () (interactive) (text-scale-increase
> 0)))
> ! (define-key map [?+] 'text-scale-increase)
> ! (define-key map [?-] 'text-scale-decrease)
> ! map)
> ! t))))
With that, how to show the prompt?
---
Kenichi Handa
address@hidden