Commit 98c414c7 authored by Miles Bader's avatar Miles Bader
Browse files

Revision: emacs@sv.gnu.org/emacs--devo--0--patch-27

Creator:  Michael Olson <mwolson@gnu.org>

Merge ERC-related Viper hacks into Viper.
parent 07e334ea
......@@ -47,6 +47,15 @@
mh-tool-bar.el, mh-xface.el. Remove mh-customize.el, mh-init.el.
(mh-autoloads): Don't use comments on otherwise empty lines.
 
2006-01-29 Edward O'Connor <ted@oconnor.cx>
* emulation/viper.el (viper-major-mode-modifier-list): Add
insert-state and vi-state entries for erc-mode.
(viper-go-away, viper-set-hooks): Add and remove
viper-comint-mode-hook from erc-mode-hook as appropriate.
* emulation/viper.el (viper-insert-state-mode-list): Add erc-mode.
2006-01-29 Juanma Barranquero <lekktu@gmail.com>
 
* bs.el (bs--format-aux): Implement `middle' alignment as
......
......@@ -458,6 +458,7 @@ unless it is coming up in a wrong Viper state."
'(internal-ange-ftp-mode
comint-mode
inferior-emacs-lisp-mode
erc-mode
eshell-mode
shell-mode)
"*A list of major modes that should come up in Vi Insert state."
......@@ -494,6 +495,8 @@ unless it is coming up in a wrong Viper state."
(gnus-summary-mode emacs-state viper-gnus-modifier-map)
(Info-mode emacs-state viper-slash-and-colon-map)
(Buffer-menu-mode emacs-state viper-slash-and-colon-map)
(erc-mode insert-state viper-comint-mode-modifier-map)
(erc-mode vi-state viper-comint-mode-modifier-map)
)
"List specifying how to modify the various major modes to enable some Viperisms.
The list has the structure: ((mode viper-state keymap) (mode viper-state
......@@ -768,6 +771,7 @@ It also can't undo some Viper settings."
;; remove all hooks set by viper
(mapatoms 'viper-remove-hooks)
(remove-hook 'comint-mode-hook 'viper-comint-mode-hook)
(remove-hook 'erc-mode-hook 'viper-comint-mode-hook)
(remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
(remove-hook 'change-major-mode-hook 'viper-major-mode-change-sentinel)
(remove-hook 'post-command-hook 'viper-minibuffer-post-command-hook)
......@@ -913,6 +917,7 @@ It also can't undo some Viper settings."
;; Emacs shell, ange-ftp, and comint-based modes
(add-hook 'comint-mode-hook 'viper-comint-mode-hook) ; comint
(add-hook 'erc-mode-hook 'viper-comint-mode-hook) ; ERC
(add-hook 'eshell-mode-hook
(lambda () (setq viper-auto-indent nil)))
......
......@@ -17,6 +17,11 @@
sections may be skipped if using the version of ERC that comes
with Emacs.
2006-01-29 Edward O'Connor <ted@oconnor.cx>
* erc-viper.el: Remove. Now that ERC is included in Emacs, these
work-arounds live in Viper itself.
2006-01-28 Michael Olson <mwolson@gnu.org>
* erc-*.el, erc.texi, NEWS: Add Arch taglines as per Emacs
......@@ -200,7 +205,8 @@
* erc.el, erc-backend.el, erc-ezbounce.el, erc-list.el,
erc-log.el, erc-match.el, erc-nets.el, erc-netsplit.el,
erc-nicklist.el, erc-nickserv.el, erc-notify.el, erc-pcomplete.el:
Use (eval-when-compile 'cl), so that compilation doesn't fail.
Use (eval-when-compile (require 'cl)), so that compilation doesn't
fail.
* erc-fill.el, erc-truncate.el: Whitespace munging.
......
;;; erc-viper.el --- Viper compatibility hacks for ERC
;; Copyright (C) 2005 Free Software Foundation, Inc.
;; Author: Edward O'Connor <ted@oconnor.cx>
;; Keywords: emulation
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; Viper is a VI emulation mode for Emacs. ERC and Viper don't quite get
;; along by default; the code in this file fixes that. A simple
;; (require 'erc-viper)
;; in your ~/.ercrc.el should be all it takes for you to use ERC and
;; Viper together happily.
;;; Code:
(require 'viper)
;; We need this for `erc-mode-hook' and `erc-buffer-list'. Perhaps it
;; would be better to use an `eval-after-load', so that there could be
;; some autodetection / loading of this file from within erc.el?
(require 'erc)
;; Fix RET in ERC buffers, by telling Viper to pass RET through to the
;; normal keymap.
(add-to-list 'viper-major-mode-modifier-list
'(erc-mode insert-state viper-comint-mode-modifier-map))
(add-to-list 'viper-major-mode-modifier-list
'(erc-mode vi-state viper-comint-mode-modifier-map))
(viper-apply-major-mode-modifiers)
;; Ensure that ERC buffers come up in insert state.
(add-to-list 'viper-insert-state-mode-list 'erc-mode)
;; Fix various local variables in Viper.
(add-hook 'erc-mode-hook 'viper-comint-mode-hook)
;; Fix ERC buffers that already exist (buffers in which `erc-mode-hook'
;; has already been run).
(mapc (lambda (buf)
(with-current-buffer buf
(viper-comint-mode-hook)
;; If there *is* a final newline in this buffer, delete it, as
;; it interferes with ERC /-commands.
(let ((last (1- (point-max))))
(when (eq (char-after last) ?\n)
(goto-char last)
(delete-char 1)))))
(erc-buffer-list))
(provide 'erc-viper)
;; arch-tag: 659fa645-e9ad-428c-ad53-8304d9f900f6
;;; erc-viper.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment