all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Cc: Michael Brand <michael.ch.brand@gmail.com>,
	Noam Postavsky <npostavs@gmail.com>
Subject: Re: C-[ is undefined
Date: Sun, 19 Aug 2018 18:02:39 +0200	[thread overview]
Message-ID: <CALn3zojGZEAdqHeR4CNSPzfOrWve2PObR+VO6+FMNMZbfJhcPA@mail.gmail.com> (raw)
In-Reply-To: <CALn3zohYro2r-DG_4Kbs7HPbJj-mTC61bCh_k0XSredOkW5aVg@mail.gmail.com>

Hi all

On Sun, Jul 29, 2018 at 1:40 AM, Michael Brand
<michael.ch.brand@gmail.com> wrote:

> According to the comment from Stefan in this thread I tried
> event-apply-modifier as
>
> #+begin_src emacs-lisp
>   (defun event-apply-modifier (event symbol lshiftby prefix)
>     "[...]"
>     (if (numberp event)
>         (cond ((eq symbol 'control)
>                (cond
>                 ;; C0 control characters (0 to 31, except 127).
>                 ((<= ?@ event ?_)
>                  (- event ?@))
>                 ;; A to Z from above as a to z.
>                 ((<= ?a event ?z)
>                  (- event ?a -1))
>                 (t
>                  (logior (lsh 1 lshiftby) event))))
>               ((eq symbol 'shift)
>                (if (<= ?a (downcase event) ?z)
>                    (upcase event)
>                  (logior (lsh 1 lshiftby) event)))
>               (t
>                (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)))))))
> #+end_src
>
> and it solves the issue for:
>
> - The minimal complete example with ~C-x @ c [ t~ for ~M-t~, ~C-x @ c
>   [ u~ for ~M-u~ and so on.
>
> - My use case with key-chord-mode ~en [ t~ for ~M-t~, ~en [ u~ for
>   ~M-u~ and so on. (I will try to change my current key chord ~en~ for
>   event-apply-control-modifier to ~[[~ so that quickly typing ~[[~ will
>   be the Control modifier and ~[[[~ will be the Meta modifier).

I have been using ~[[~ for the Control modifier and ~[[[~ for the Meta
modifier or ESC with the above modification of ~event-apply-modifier~
for some time
now and I like it. (If anyone wants to know more or try it out get
key-chord.el http://www.emacswiki.org/emacs/KeyChord and my setup
http://github.com/brandm/emacs.d)

Now I would like to know how to proceed with ~event-apply-modifier~:

1) Should I use an advice for this function?

2) Should there be a configuration to choose between the original, the
above and possibly even more different function behaviors?

3) Should the function be changed to something similar to the above?
What to tell the users that rely on the current behavior?

Michael



  reply	other threads:[~2018-08-19 16:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-07 19:52 C-[ is undefined Michael Brand
2018-07-26  2:00 ` Fwd: " Michael Brand
     [not found] ` <mailman.4231.1532570417.1292.help-gnu-emacs@gnu.org>
2018-07-26 12:38   ` Ben Bacarisse
2018-07-27  0:17     ` Michael Brand
     [not found]     ` <mailman.4284.1532650678.1292.help-gnu-emacs@gnu.org>
2018-07-27  1:33       ` Ben Bacarisse
2018-07-27 13:24         ` John Shahid
     [not found]         ` <mailman.4322.1532697888.1292.help-gnu-emacs@gnu.org>
2018-07-27 16:19           ` Ben Bacarisse
2018-07-27 13:12 ` Noam Postavsky
2018-07-27 20:38   ` Stefan Monnier
2018-07-28 23:40   ` Michael Brand
2018-08-19 16:02     ` Michael Brand [this message]
2018-08-19 16:12       ` Stefan Monnier
2018-08-19 17:01       ` Michael Brand

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=CALn3zojGZEAdqHeR4CNSPzfOrWve2PObR+VO6+FMNMZbfJhcPA@mail.gmail.com \
    --to=michael.ch.brand@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=npostavs@gmail.com \
    /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.