GNU bug report logs - #13599
24.2; (max-char) is too low (and hard to change)

Previous Next

Package: emacs;

Reported by: Magnar Sveen <magnars <at> gmail.com>

Date: Thu, 31 Jan 2013 18:44:02 UTC

Severity: minor

Merged with 1042, 32562

Found in version 24.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 13599 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Magnar Sveen <magnars <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 13599 <at> debbugs.gnu.org
Subject: Re: bug#13599: 24.2; (max-char) is too low (and hard to change)
Date: Fri, 01 Feb 2013 09:24:39 -0500
> Yes, I've been using
>     (define-key key-translation-map (kbd "s-8") (kbd "["))
> It works in most cases. But unfortunately read-char does not care about
> this translation, leaving lots of functions broken. That lead me to
> keyboard-translate, then here.

I think the problem is in read-char.

You might like to try the following redefinition of read-char, which I've
been using locally for a while (i.e. tested for a reasonably long time
but only by a single user):

   (defun read-char (&optional prompt) ;; (inherit-input-method seconds)
     "Read a character from the command input (keyboard or macro).
   It is returned as a number.
   If the character has modifiers, they are resolved and reflected to the
   character code if possible (e.g. C-SPC -> 0).
   
   If the user generates an event which is not a character (i.e. a mouse
   click or function key event), `read-char' signals an error.  As an
   exception, switch-frame events are put off until non-character events
   can be read.
   If you want to read non-character events, or ignore them, call
   `read-event' or `read-char-exclusive' instead.
   
   If the optional argument PROMPT is non-nil, display that as a prompt.
   If the optional argument INHERIT-INPUT-METHOD is non-nil and some
   input method is turned on in the current buffer, that input method
   is used for reading a character.
   If the optional argument SECONDS is non-nil, it should be a number
   specifying the maximum number of seconds to wait for input.  If no
   input arrives in that time, return nil.  SECONDS may be a
   floating-point value."
     ;; if (! NILP (prompt))
     ;;   message_with_string ("%s", prompt, 0);
     ;; val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method),
     ;;                            seconds);
     ;; return (NILP (val) ? Qnil
     ;;         : make_number (char_resolve_modifier_mask (XINT (val))));
     (let ((inherit-input-method nil) (seconds nil))
       ;; `read-key' doesn't explicitly inhibit the input method, but in
       ;; practice it disables at least quail input methods because it
       ;; binds overriding-terminal-local-map.
       (if inherit-input-method (error "Not implemented"))
       (catch 'read-char-exclusive
         (let ((timer (when seconds
                        (run-with-timer seconds nil
                                        (lambda ()
                                          (throw 'read-char-exclusive nil))))))
           (unwind-protect
               (let ((event (read-key prompt)))
                 (if (numberp event)
                     event
                   (setq unread-command-events
                         (nconc (mapcar 'identity (this-single-command-raw-keys))
                                unread-command-events))
                   (error "Non-character input-event")))
             (when timer (cancel-timer timer)))))))

-- Stefan




This bug report was last modified 6 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.