unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: help-gnu-emacs@gnu.org
Subject: Re: key map entry for shift-return?
Date: Fri, 10 Jul 2009 08:01:11 +0000 (UTC)	[thread overview]
Message-ID: <h36sg7$n2c$1@colin2.muc.de> (raw)
In-Reply-To: buoy6qxfhyp.fsf@dhlpc061.dev.necel.com

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	other threads:[~2009-07-10  8:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2050.1247045493.2239.help-gnu-emacs@gnu.org>
2009-07-09 12:34 ` key map entry for shift-return? Xah Lee
2009-07-09 13:51   ` Alan Mackenzie
2009-07-09 14:27     ` Miles Bader
2009-07-09 16:01       ` Xah Lee
2009-07-09 17:21         ` despen
2009-07-09 17:56           ` Xah Lee
2009-07-09 20:48             ` despen
2009-07-09 18:02           ` Alan Mackenzie
2009-07-09 21:19             ` Peter Dyballa
     [not found]             ` <mailman.2177.1247174372.2239.help-gnu-emacs@gnu.org>
2009-07-09 22:14               ` Alan Mackenzie
2009-07-10  1:24                 ` Miles Bader
2009-07-10  8:01                   ` Alan Mackenzie [this message]
2009-07-10 10:14                     ` Miles Bader
2009-07-10 12:45                       ` Alan Mackenzie
2009-07-08  9:31 Chris Withers
2009-07-08  9:51 ` Peter Dyballa
2009-07-08  9:53   ` Chris Withers
2009-07-08 11:08     ` Peter Dyballa
2009-07-08 11:51       ` Chris Withers
2009-07-08 12:42         ` Peter Dyballa
2009-07-08 13:39           ` Chris Withers
2009-07-08 14:49             ` Peter Dyballa
     [not found]       ` <mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org>
2009-07-08 12:17         ` Teemu Likonen
     [not found]   ` <mailman.2052.1247046795.2239.help-gnu-emacs@gnu.org>
2009-07-09  7:28     ` Alan Mackenzie

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='h36sg7$n2c$1@colin2.muc.de' \
    --to=acm@muc.de \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).