[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Keystrokes sending digit prefixes

From: Tim Johnson
Subject: Keystrokes sending digit prefixes
Date: Wed, 28 Sep 2016 16:11:28 -0800
User-agent: Mutt/1.7.0 (2016-08-17)

This is less of a problem than (perhaps) an interesting

I'm using emacs 25.1.1 on ubuntu 14.04

I just got a Jelly Comb Keypad. My prefered means of input is a small
footprint "60%" keyboard like a HHK Lite2 (which I've used for
decades) or a qisan mechanical keyboard which I use now -  with a
trackball on the right and a keypad on the left.

The Jelly Comb has three "non-typical" keys: left parens, right
parens and equals.

These keys are not being translated as characters by linux. At the
gnome console, '(' prints 040, ')' prints 041, and '=' prints 061
The python interpreter acts the same way.

xev reads multiple keysyms and keycodes from each press.

Emacs (in Gui mode) handles these keys in an interesting fashion -
at least interesting to me.

On emacs, these three keys produce digit prefixes: 40, 41 and 60

Speaking as an emacs noob (always, and forever a noob), it seems to
me that these keys can function like an escape prefix or as ersatz

The following test function produced which I expected :

(defun test-kp (arg)
  "Test the value of an universal digit argument"
  (interactive "P")
  (if arg
       ((= arg 40)
        (message "kp_leftparen"))
       ((= arg 41)
        (message "kp_rightparen"))
       ((= arg 61)
        (message "kp_equal"))
       (t (message "invalid argument")))
    (message "no arg")))

Next is an example of a lisp function which could be bound
to the backspace key. The code is untested:

(defun tj-backspace (arg)
  "Combine backspace with digit prefixes sent by
  the keypad ( and ) and = keys"
  (interactive "P")
  (if arg
       ((= arg 40) ;; sent by keypad (
       ((= arg 41) ;; sent by keypad )
       ((= arg 61) ;; sent by keypad =
       (t (error "invalid argument")))
    (delete-char -1))) ;; No argument, destructive backspace

(global-set-key (kbd "DEL") 'tj-backspace)

I repeat, untested code, but I'm interested in any comments or

Any ideas or remarks about the utilization of this? Obviously, it's not 
portable ...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]