You can customize GNU Emacs by defining key bindings and/or Emacs-Lisp
functions in a special GNU Emacs initialization file called .emacs
,
which must be kept in your home directory.
To locate it, do ^x ^f and type ~/.emacs
as the
filename. (Windows users: the ~
character is a abbreviation,
inherited from UNIX, for your home directory.)
When GNU Emacs is started, it loads your GNU Emacs initialization file, if you have one, before loading the Emacs-Lisp files defining the editor interface. This means that any key bindings that you make in this file may be overridden by the editor interface package. However, you can tailor the interface, if you wish, by defining one or both of the following "hook functions":
prolog-startup-hook
prolog-mode-hook
.pl
extension, and can also be entered by using the
command <ESC> x prolog-mode.
For example, if you don't like incremental search, and you prefer to use <ESC> e for moving to the end of a sentence, rather than for enlarging the current window, then you should add the following function definition to your initialization file:
(defun prolog-startup-hook () (global-set-key "\C-s" 'search-forward) (global-set-key "\C-r" 'search-reverse) (global-set-key "\ee" 'forward-sentence) (global-set-key "\e\e" 'enlarge-window))
Note that the command strings could be written as : "\C-s"
(Backslash
C-s
) for example. This version of prolog-startup-hook
also binds
the useful enlarge-window
command, which is normally on
<ESC> e in this interface, to <ESC> <ESC>.
If you wish to change key bindings in Prolog mode, you should use
local-set-key
rather than global-set-key
, because the effect of Prolog
mode is local to a particular window. For example, if you don't like the
way <LFD> works in Prolog mode, you can define
(defun prolog-mode-hook () (local-set-key "\C-j" 'newline-and-indent))
This restores the default binding of <LFD>.