unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: A problem with eval-after-load
Date: Sat, 19 Oct 2013 02:43:27 +0200	[thread overview]
Message-ID: <87hacedr93.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: mailman.4208.1382039548.10748.help-gnu-emacs@gnu.org

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

> Wow, now I feel guilty of wasting your time on this
> lengthy email...  Thanks for the tips!

No, on the contrary! I love to talk about such
things. All those shortcuts were setup when I needed
them - they are from my initialization files.

If I put them at one place, as I just did, perhaps I can
detect some new things, or someone else will comment,
etc. So it is useful for me too.

I have had *a lot* of troubles with those keys, but now
everything works (and has for some time), so for this
reason I was a bit surprised there was zero consistency
how it was done.

> No need to add/update after writing my code - but my
> solution was indeed a bit faster, as I mentioned.

Did you re-write the key map in the original mode
source? Share if you like. Did you do that in root or
user space? I wonder if an update of Emacs will
overwrite those changes?

>> (define-key input-decode-map [?\u0113] [S-caps])
>> (global-set-key (kbd "<S-caps>") 'buffer-menu)
>> 
>> To get weird keys to work. You have to set them up in
>> the ttys (or "the Linux VTs" so they will send those
>> Unicode chars instead of what they normally do).

> I'm not sure I fully understand this, but it seems to
> me to low-level for me.

If you use Emacs in a tty, some of the keystrokes are
undetectable in Emacs unless you have them send
something else, that *is* detectable. In the above case,
shift plus the caps lock key is made to send the Unicode
char (described by the code, whatever that is) and
*this* in turn is used to setup the shortcut. This hack
is one of the coolest and most useful I ever saw, and I
learned it on this very list. More on this, and other
remapping:

http://user.it.uu.se/~embe8573/conf/remap.inc

>> (defun init-C-o-prefix ()
>>   (interactive)
>>   (define-prefix-command 'C-o-prefix)
>>   (global-set-key "\C-o" 'C-o-prefix)
>>   (init-C-o-keys) )
>> (add-hook 'after-init-hook 'init-C-o-prefix)
>> 
>> A new prefix key. Initialized after everything is done,
>> probably so not to get reset by something else, later.
>> 
>> (defun init-C-o-keys ()
>>   (interactive)
>>   (let ((the-map (current-global-map)))
>>     (define-key the-map "\C-od"     'eval-defun)
>>     (define-key the-map "\C-o\C-om" 'man) ; etc.
>> 
>> How that happens (same old).
>
> Did not understand this.  (I could RTFM, of course,
> but I'm too lazy after a day's work...  I'll look into
> this later.)

You know the M-x prefix, that is used for "long"
shortcuts. If you are running out of M-x [whatever]
shortcuts, *or* you think the M-x is located at an
un-ergonomic place, you can setup new prefixes (prefix
keys) wherever you want. Above, C-o is made such a
prefix.

> This is more or less what I wanted to achieve in the
> first place.
>
>> (global-set-key [(control x) (k)] 'kill-this-buffer)
>> 
>> Yet another notation.
>
> And an interesting one.

Yeah, I don't know what separates all those
styles. Perhaps if you move around different systems
a lot, it matters. To me, they seem the same.

>> (defun sentmail ()
>>   "Dired the outbox directory, then focus the most recent mail."
>>   (interactive)
>>   (dired "~/Mail/sent")
>>   (local-set-key (kbd "I") 'sentmail-show-prev-mail)
>>   (local-set-key (kbd "K") 'sentmail-show-next-mail)
>>   (revert-buffer)
>>   (end-of-buffer)
>>   (dotimes (i 7) (backward-word)) )
>> 
>> Set keys *locally*.
>
> "Locally" in the sense of "this mode", not "this
> buffer", I guess?

No, the buffer. You see, that way it won't affect
regular Dired use. That was a workaround to use Dired as
a "sent mail" archive viewer. Now, thankfully I use Gnus
so I manage without it.

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573


      parent reply	other threads:[~2013-10-19  0:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16  9:13 A problem with eval-after-load Marcin Borkowski
2013-10-16 17:48 ` Michael Heerdegen
2013-10-16 18:31   ` Marcin Borkowski
     [not found]   ` <mailman.4156.1381948316.10748.help-gnu-emacs@gnu.org>
2013-10-17  2:37     ` Emanuel Berg
2013-10-17 19:52       ` Marcin Borkowski
     [not found]       ` <mailman.4208.1382039548.10748.help-gnu-emacs@gnu.org>
2013-10-19  0:43         ` Emanuel Berg [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

  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=87hacedr93.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --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).