From 6b22d19c0870b8f05e682ab7a96e0b43b1f38d0c Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 18 Oct 2004 21:36:10 +0000 Subject: [PATCH] * riece-yank.el: New add-on from Masatake YAMATO . * COMPILE (riece-modules): Add riece-yank. * Makefile.am (EXTRA_DIST): Add riece-yank.el. --- lisp/COMPILE | 3 ++- lisp/ChangeLog | 6 +++++ lisp/Makefile.am | 2 +- lisp/riece-yank.el | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 lisp/riece-yank.el diff --git a/lisp/COMPILE b/lisp/COMPILE index 0b5240d..9e87444 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -70,7 +70,8 @@ riece-ignore riece-hangman riece-biff - riece-kakasi)))) + riece-kakasi + riece-yank)))) (defun riece-compile-modules (modules) (let ((load-path (cons nil load-path))) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6216261..4664edc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2004-10-18 Daiki Ueno + + * riece-yank.el: New add-on from Masatake YAMATO . + * COMPILE (riece-modules): Add riece-yank. + * Makefile.am (EXTRA_DIST): Add riece-yank.el. + 2004-10-11 Daiki Ueno * Riece: Version 1.0.4 released. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index c63edb8..d4d6eaa 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -12,7 +12,7 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-guess.el riece-history.el riece-button.el riece-keyword.el \ riece-menu.el riece-icon.el riece-async.el riece-lsdb.el \ riece-xface.el riece-ctlseq.el riece-ignore.el riece-hangman.el \ - riece-biff.el riece-kakasi.el riece-foolproof.el + riece-biff.el riece-kakasi.el riece-foolproof.el riece-yank.el CLEANFILES = auto-autoloads.el custom-load.el *.elc FLAGS ?= -batch -q -no-site-file diff --git a/lisp/riece-yank.el b/lisp/riece-yank.el new file mode 100644 index 0000000..e92f499 --- /dev/null +++ b/lisp/riece-yank.el @@ -0,0 +1,74 @@ +;;; riece-kill.el --- enter the element in kill-ring +;; Copyright (C) 2004 Masatake YAMATO + +;; Author: Masatake YAMATO +;; Keywords: IRC, riece + +;; This program 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. + +;; This program 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., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; In riece's command buffer, you can send the top element of kill-ring +;; by C-c y. +;; Don't forget do (riece-command-enable-addon 'riece-yank). +;; +;;; Code: +(require 'riece-commands) + +(defgroup riece-yank nil + "Enter the element of `kill-ring'" + :tag "Yank" + :prefix "riece-" + :group 'riece) + +(defcustom riece-yank-tick 1 + "Time span in second to send multiple lines." + :type 'number + :group 'riece-yank) + +(defvar riece-yank-enabled nil) + +(defun riece-yank-insinuate () + ) + +(defun riece-yank-enable () + (define-key riece-command-mode-map "\C-cy" 'riece-command-yank) + (setq riece-yank-enabled t)) +(defun riece-yank-disable () + (define-key riece-command-mode-map "\C-cy" 'undefined) + (setq riece-yank-enabled nil)) + +(defun riece-command-yank (prefix) + (interactive "sPrefix: ") + (when (or (not prefix) + (string= prefix "")) + (setq prefix " ")) + (let* ((kill (current-kill 0)) + msg) + (unless kill + (error "Nothing to send in kill-ring")) + (setq msg (split-string kill "\n")) + (when (y-or-n-p (format "Send \"%s\"\n? " kill)) + (mapcar + (lambda (x) + (riece-command-send-message (concat prefix x) nil) + ;; Without next line, you will be kicked out from ircd. + ;; It may means "Don't send much data at once." + (sit-for riece-yank-tick)) + msg)))) + +(provide 'riece-yank) +;;; riece-yank.el ends here -- 1.7.10.4