[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shift on console
From: |
Alan Mackenzie |
Subject: |
Re: Shift on console |
Date: |
Mon, 17 Mar 2008 23:31:05 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Robert!
On Mon, Mar 17, 2008 at 12:49:27AM +0000, Robert J. Chassell wrote:
> Alan Mackenzie <address@hidden> asked
> Where "console" = ????
> /dev/tty2, also known by the Debian folks and others as a `virtual
> console'. It does not have X or any other windowing system and is
> what we once called a `terminal'.
> This problem is going to become really problematic if "shift-movement
> selection" becomes the Emacs default".
> Perhaps others expect a graphical windowing environment in all
> circumstances.
> When I SSH to gnu.org and log into it with an RXVT shell on my local
> machine, and invoke Emacs on fp.gnu.org, I can run C-M-S-v
> (scroll-other-window-down), that is to say, the shift key succeeds;
> but when I do the same in a plain console -- no RXVT shell -- I
> cannot.
In my last post when I said "GNU tty", I actually meant "Linux tty".
Sorry! (Who's been getting me confused between GNU and Linux? ;-)
There is actually a feature/bug/misfeature (I'd say bug), in
event-apply-modifier (simple.el), which forces C-a and C-A (possibly
with more modifiers) to be identical, namely 0x01. I've been using the
following function instead, which sets b25 (the <shift> bit) on C-S-a:
("kn" stands for Kalle Niemitalo, BTW, who worked out most of this stuff
~10 years ago).
(defun kn-event-apply-modifier (event symbol lshiftby prefix)
"Apply a modifier flag to event EVENT.
Unlike the core Emacs function `event-apply-modifier', when both
<control> and <shift> are modifying a\(n English\) letter in an
event, b25 is set (for shift), and the LSB contains C-<letter>.
SYMBOL is the name of this modifier, as a symbol.
LSHIFTBY is the bit position of the modifier bit; e.g. 25 means 0x2000000.
PREFIX is the string that represents this modifier in an event type symbol."
(if (numberp event)
(let ((letter (logand event 4194303))) ; 2^22 - 1
(if (eq symbol 'control)
(cond ((and (>= letter ?A) (<= letter ?Z))
(- (logior (lsh 1 25) event) ?A -1)) ; add <shift>
((and (>= letter ?a) (<= letter ?z))
(- event ?a -1))
((and (>= letter ?\C-a) (<= letter ?\C-z))) ; do nothing
(t (logior (lsh 1 lshiftby) event)))
(logior (lsh 1 lshiftby) event)))
(if (memq symbol (event-modifiers event))
event
(let ((event-type (if (symbolp event) event (car event))))
(setq event-type (intern (concat prefix (symbol-name event-type))))
(if (symbolp event)
event-type
(cons event-type (cdr event)))))))
> Robert J. Chassell
--
Alan Mackenzie (Nuremberg, Germany).