help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: key map entry for shift-return?


From: Alan Mackenzie
Subject: Re: key map entry for shift-return?
Date: Fri, 10 Jul 2009 08:01:11 +0000 (UTC)
User-agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386))

Hi, Miles!

Miles Bader <miles@gnu.org> wrote:
> Alan Mackenzie <acm@muc.de> writes:
>> The guy who wrote it, Kalle Niemitalo, doesn't much like GPL-3, and
>> doesn't want to assign it to the FSF, so it can't become part of Emacs.

> Sounds worth rewriting to get around the ass-hattery...

The what?  It sounds somewhat derogatory, whatever it means.

I really can't bring myself to disparage Kalle, who supplied me what I
needed at a time (over a decade ago) when I could barely even formulate
the problem, never mind solve it.  Dislike of the GPLs and aversion to
assigning copyright to the FSF aren't exactly uncommon, though I
personally disagree with these stances.

Rewriting it would indeed be worth it, though I think I'd have to leave
it to other people since I know KN's code too well.  People ask about
"control arrow keys on a tty" quite a lot.

There's one problem in Emacs at the moment: the function
`event-apply-modifier' strips out the upper-caseity from C-S-<letter>.
I don't know why it does this, but my own personal fix hasn't caused
me any problems:

(defun acm-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)
                        (not (memq letter '(?\C-i ?\C-m))))) ; Can by typed 
without <ctrl>
                  (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)))))))


> -Miles

-- 
Alan Mackenzie (Nuernberg).



reply via email to

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