Berkeley CSUA MOTD:Entry 27817
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2024/11/23 [General] UID:1000 Activity:popular
11/23   

2003/3/23-24 [Computer/SW/Editors/Emacs] UID:27817 Activity:high
3/23    Is there a way to create a shortcut keys in emacs so that I can
        have it insert a certain word/phrase whenever I hit the shortcut
        keys? Thanks.
        \_ Emacs is this amazing piece of software where almost anything is
           possible.  The problem is figuring out how to do it.  Instead of
           asking if emacs can do something you should ask how.  Like so:
           How to create shortcut keys in emacs so insert word hitting keys?
        \_ Here is one way:
                (defun my-insert nil
                  "Insert a string"
                  (interactive)
                  (insert "<your phrase here>"))

                (global-set-key "\C-c5" 'my-insert)
                \- see abbrev and dabbrev. if you have a chance to see RMS'
                   .emacs his use of this is kind of humorous. --psb