all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Robert J. Chassell" <bob@rattlesnake.com>
Cc: emacs-devel@gnu.org
Subject: Re: Shift on console
Date: Mon, 17 Mar 2008 23:31:05 +0000	[thread overview]
Message-ID: <20080317233104.GA1824@muc.de> (raw)
In-Reply-To: <m1Jb3Xb-002K4LC@rattlesnake.com>

Hi, Robert!

On Mon, Mar 17, 2008 at 12:49:27AM +0000, Robert J. Chassell wrote:
> Alan Mackenzie <acm@muc.de> 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).
 




      reply	other threads:[~2008-03-17 23:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-16 18:34 Shift on console Robert J. Chassell
2008-03-16 19:23 ` Alan Mackenzie
2008-03-17  0:49   ` Robert J. Chassell
2008-03-17 23:31     ` Alan Mackenzie [this message]

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=20080317233104.GA1824@muc.de \
    --to=acm@muc.de \
    --cc=bob@rattlesnake.com \
    --cc=emacs-devel@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.