From: Daiki Ueno Date: Tue, 19 Aug 2003 23:44:02 +0000 (+0000) Subject: * riece-layout.el: New add-on. X-Git-Url: http://cgit.sxemacs.org/?p=riece;a=commitdiff_plain;h=362d89b3057069361a40b93223a8173471bc3387 * riece-layout.el: New add-on. * COMPILE (riece-modules): Add riece-layout. * Makefile.am (EXTRA_DIST): Add riece-layout.el --- diff --git a/lisp/COMPILE b/lisp/COMPILE index d5473c2..0232d62 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -47,7 +47,8 @@ riece-url riece-unread riece-doctor - riece-alias)))) + riece-alias + riece-layout)))) (defun riece-compile-modules (modules) (let ((load-path (cons nil load-path))) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e2f91f6..2782d38 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2003-08-19 Daiki Ueno + + * riece-layout.el: New add-on. + * COMPILE (riece-modules): Add riece-layout. + * Makefile.am (EXTRA_DIST): Add riece-layout.el + 2003-08-17 Daiki Ueno * riece-options.el (riece-quit-timeout): New user option. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index 8439371..34f3974 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -8,7 +8,7 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-xemacs.el riece.el \ riece-ctcp.el riece-url.el riece-unread.el \ riece-ndcc.el riece-rdcc.el riece-log.el riece-mini.el \ - riece-doctor.el riece-alias.el + riece-doctor.el riece-alias.el riece-layout.el CLEANFILES = auto-autoloads.el custom-load.el *.elc FLAGS ?= -batch -q -no-site-file diff --git a/lisp/riece-layout.el b/lisp/riece-layout.el new file mode 100644 index 0000000..39c2d7c --- /dev/null +++ b/lisp/riece-layout.el @@ -0,0 +1,82 @@ +;;; riece-layout.el --- layout manager add-on +;; Copyright (C) 1998-2003 Daiki Ueno + +;; Author: Daiki Ueno +;; Keywords: IRC, riece + +;; This file is part of 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. + +;; This add-on allows you to switch window configurations by their names. + +;; To use, add the following line to your ~/.riece/init.el: +;; (add-to-list 'riece-addons 'riece-layout) + +;;; Code: + +(require 'riece-display) + +(defgroup riece-layout nil + "Manage window layouts" + :prefix "riece-" + :group 'riece) + +(defcustom riece-default-layout "default" + "The default layout name." + :type 'string + :group 'riece-layout) + +(defcustom riece-layout riece-default-layout + "Current layout setting." + :type 'string + :group 'riece-layout) + +(defcustom riece-layout-alist + '(("default" riece-configure-windows riece-configure-windows-predicate)) + "An alist mapping the names to configure/predicate functions." + :type 'list + :group 'riece-layout) + +(defun riece-layout-option-set-function (symbol value) + "Function called when setting `riece-layout'." + (let ((layout (cdr (assoc value riece-layout-alist)))) + (unless layout + (error "No such layout!")) + (setq riece-configure-windows-function (car layout) + riece-configure-windows-predicate (nth 1 layout)) + (riece-redisplay-buffers t))) + +(defun riece-command-change-layout (name) + "Select a layout-name from all current available layouts and change +the layout to the selected layout-name." + (interactive (list (completing-read "Layout: " riece-layout-alist))) + (customize-set-variable 'riece-layout name)) + +(defvar riece-dialogue-mode-map) + +(defun riece-layout-insinuate () + (define-key riece-dialogue-mode-map "\C-tl" #'riece-command-change-layout) + ;; Delay setting `riece-layout' using riece-layout-option-set-function. + (add-hook 'riece-startup-hook + (lambda () + (put 'riece-layout 'custom-set + 'riece-layout-option-set-function) + (riece-layout-option-set-function 'riece-layout riece-layout)))) + +(provide 'riece-layout) + +;;; riece-layout.el ends here \ No newline at end of file