emacs-devel
[Top][All Lists]
Advanced

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

Re: substitute-key-definition vs. define-key MAP [remap ...]


From: Stephen J. Turnbull
Subject: Re: substitute-key-definition vs. define-key MAP [remap ...]
Date: Sat, 24 Jul 2010 23:25:52 +0900

Miles Bader writes:
 > "Stephen J. Turnbull" <address@hidden> writes:
 > >  > And it's _extremely_ handy for some uses... e.g., one of my favorite
 > >  > tricks is little minor-modes that bind [remap self-insert-command]...
 > >
 > > It's a handy hack, I'm sure.  I think there are better ways to achieve
 > > the same end, that's all.
 > 
 > For instance?  Solutions as adding hooks/functions for to allow
 > mode-specific semantics for standard commands
 > (e.g. `fill-paragraph-function') are better for those cases, I think,
 > but they have far higher cost (they must be added by the emacs
 > developer), and are not really so nice for minor modes -- IOW, it
 > doesn't really achieve the same thing.

Use of defun is not restricted to emacs developers (and you will often
need to use it with [remap] anyway).

For handy hacks, I really don't see what's so horrible about

(define-minor-mode caps-lock-mode
  "Only useful with a Happy Hacker keyboard."
  :lighter "CapsLock")
(defadvice self-insert-command (before caps-lock-mode activate)
  "Make self-insert-command respect caps-lock-mode."
  (when caps-lock-mode
    (set last-command-key (upcase last-command-key))))

and I certainly don't think that concealing a limited advice
capability in the keymap lookup process is any better than advice
itself.




reply via email to

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