(org-agenda-use-time-grid): Fix typo in docstring.
[emacs.git] / lisp / erc / erc-viper.el
blob0d6ff04ff923ba1c4ca8d8d6564d537428f679ea
1 ;;; erc-viper.el --- Viper compatibility hacks for ERC
3 ;; Copyright (C) 2005 Free Software Foundation, Inc.
5 ;; Author: Edward O'Connor <ted@oconnor.cx>
6 ;; Keywords: emulation
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
25 ;;; Commentary:
27 ;; Viper is a VI emulation mode for Emacs. ERC and Viper don't quite get
28 ;; along by default; the code in this file fixes that. A simple
29 ;; (require 'erc-viper)
30 ;; in your ~/.ercrc.el should be all it takes for you to use ERC and
31 ;; Viper together happily.
33 ;;; Code:
35 (require 'viper)
37 ;; We need this for `erc-mode-hook' and `erc-buffer-list'. Perhaps it
38 ;; would be better to use an `eval-after-load', so that there could be
39 ;; some autodetection / loading of this file from within erc.el?
40 (require 'erc)
42 ;; Fix RET in ERC buffers, by telling Viper to pass RET through to the
43 ;; normal keymap.
45 (add-to-list 'viper-major-mode-modifier-list
46 '(erc-mode insert-state viper-comint-mode-modifier-map))
47 (add-to-list 'viper-major-mode-modifier-list
48 '(erc-mode vi-state viper-comint-mode-modifier-map))
50 (viper-apply-major-mode-modifiers)
52 ;; Ensure that ERC buffers come up in insert state.
53 (add-to-list 'viper-insert-state-mode-list 'erc-mode)
55 ;; Fix various local variables in Viper.
56 (add-hook 'erc-mode-hook 'viper-comint-mode-hook)
58 ;; Fix ERC buffers that already exist (buffers in which `erc-mode-hook'
59 ;; has already been run).
60 (mapc (lambda (buf)
61 (with-current-buffer buf
62 (viper-comint-mode-hook)
63 ;; If there *is* a final newline in this buffer, delete it, as
64 ;; it interferes with ERC /-commands.
65 (let ((last (1- (point-max))))
66 (when (eq (char-after last) ?\n)
67 (goto-char last)
68 (delete-char 1)))))
69 (erc-buffer-list))
71 (provide 'erc-viper)
73 ;; arch-tag: 659fa645-e9ad-428c-ad53-8304d9f900f6
74 ;;; erc-viper.el ends here