From: Tim Johnson <tim@akwebsoft.com>
To: Emacs <Help-gnu-emacs@gnu.org>
Subject: Keystrokes sending digit prefixes
Date: Wed, 28 Sep 2016 16:11:28 -0800 [thread overview]
Message-ID: <20160929001128.GA2607@mail.akwebsoft.com> (raw)
This is less of a problem than (perhaps) an interesting
opportunity.
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
respectively.
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
modifiers.
The following test function produced which I expected :
(defun test-kp (arg)
"Test the value of an universal digit argument"
(interactive "P")
(if arg
(cond
((= 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
(cond
((= arg 40) ;; sent by keypad (
(tj-strip-all-trailing-whitespace))
((= arg 41) ;; sent by keypad )
(tj-fixup-whitespace-in-line))
((= arg 61) ;; sent by keypad =
(tj-reduce-indentation))
(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
observations.
Any ideas or remarks about the utilization of this? Obviously, it's not portable ...
thanks
--
Tim
http://www.akwebsoft.com, http://www.tj49.com
next reply other threads:[~2016-09-29 0:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 0:11 Tim Johnson [this message]
2016-09-29 5:49 ` Keystrokes sending digit prefixes Yuri Khan
2016-09-29 15:11 ` Tim Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160929001128.GA2607@mail.akwebsoft.com \
--to=tim@akwebsoft.com \
--cc=Help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.