From 543927ed9338ee4f06f7678c96498d66b328e767 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 28 May 2008 03:55:31 +0000 Subject: [PATCH] * riece-options.el (riece-server-alist): Simplify custom-type. * riece-coding.el: Move defcustom to riece-options; require 'riece-options. --- lisp/ChangeLog | 6 +++ lisp/riece-coding.el | 19 +------- lisp/riece-options.el | 102 ++++++++++++++++++++++++++++-------------- 3 files changed, 75 insertions(+), 52 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4bb8a31..766c112 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2008-05-28 Daiki Ueno + + * riece-options.el (riece-server-alist): Simplify custom-type. + * riece-coding.el: Move defcustom to riece-options; require + 'riece-options. + 2008-05-27 Daiki Ueno * riece-menu.el (riece-menu-create-channels-menu): Remove diff --git a/lisp/riece-coding.el b/lisp/riece-coding.el index c0d1ac6..f6d9dda 100644 --- a/lisp/riece-coding.el +++ b/lisp/riece-coding.el @@ -25,24 +25,7 @@ ;;; Code: (require 'riece-globals) - -(defgroup riece-coding nil - "Coding system." - :tag "Coding" - :prefix "riece-" - :group 'riece) - -(defcustom riece-default-coding-system - (if (featurep 'mule) - (cons 'ctext 'iso-2022-jp-2)) - "Coding system for process I/O. -The value is a coding system, or a cons cell (DECODING . ENCODING) -specifying the coding systems for decoding and encoding respectively." - :type '(choice (symbol :tag "Coding system") - (cons (symbol :tag "Input coding system") - (symbol :tag "Output coding system")) - (const nil :tag "No conversion")) - :group 'riece-coding) +(require 'riece-options) (defun riece-encode-coding-string (string) (if (and (local-variable-p 'riece-coding-system (current-buffer)) diff --git a/lisp/riece-options.el b/lisp/riece-options.el index 0406914..9e7b113 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -149,43 +149,77 @@ way is to put Riece variables on .emacs or file loaded from there." :prefix "riece-" :group 'riece) -(define-widget 'riece-service-spec 'radio - "Edit service spec entries" - :convert-widget 'riece-service-spec-convert) - -(defun riece-service-spec-convert (widget) - (widget-put widget :args '((integer :tag "Port Number") - (string :tag "Name"))) - widget) - -(define-widget 'riece-server-spec 'repeat - "Edit server spec entries" - :match (lambda (widget value) - (eval `(and ,@(mapcar - (lambda (entry) - (or (stringp (cdr entry)) - (listp (cdr entry)))) - value)))) - :convert-widget 'riece-server-spec-convert) - -(defun riece-server-spec-convert (widget) - (let* ((host '(const :format "" :value :host)) - (service '(const :format "" :value :service)) - (host - `(group :inline t ,host (string :tag "Host"))) - (service - `(group :inline t ,service riece-service-spec)) - (spec - `(cons (string :tag "Name") - (radio (string :tag "Host") - (list ,host ,service)))) - (args (list spec))) - (widget-put widget :args args) - widget)) +(defgroup riece-coding nil + "Coding system." + :tag "Coding" + :prefix "riece-" + :group 'riece) + +(defcustom riece-default-coding-system + (if (featurep 'mule) + (cons 'ctext 'iso-2022-jp-2)) + "Coding system for process I/O. +The value is a coding system, or a cons cell (DECODING . ENCODING) +specifying the coding systems for decoding and encoding respectively." + :type '(choice (symbol :tag "Coding system") + (cons (symbol :tag "Input coding system") + (symbol :tag "Output coding system")) + (const nil :tag "No conversion")) + :group 'riece-coding) (defcustom riece-server-alist nil "An alist mapping server names to plist." - :type 'riece-server-spec + :type '(repeat + (group + (string :tag "Server") + (list :inline t :tag "Host" + :format "%{%t%}: %v" + (const :tag "" :value :host) + string) + (repeat :inline t :tag "Options" + (choice :inline t :value nil + (list :inline t :tag "Port" + :format "%{%t%}: %v" + (const :tag "" :value :service) + (choice (const :tag "Default" 6667) + string)) + (list :inline t :tag "Nickname" + :format "%{%t%}: %v" + (const :tag "" :value :nickname) + (choice (const :tag "Default" riece-nickname) + string)) + (list :inline t :tag "Realname" + :format "%{%t%}: %v" + (const :tag "" :value :realname) + (choice (const :tag "Default" riece-realname) + string)) + (list :inline t :tag "Username" + :format "%{%t%}: %v" + (const :tag "" :value :host) + (choice (const :tag "Default" riece-username) + string)) + (list :inline t :tag "Password" + :format "%{%t%}: %v" + (const :tag "" :value :host) + string) + (list :inline t :tag "Function" + :format "%{%t%}: %v" + (const :tag "" :value :host) + (choice + (const :tag "Default" + riece-default-open-connection-function) + function)) + (list :inline t :tag "Coding system" + :format "%{%t%}: %v" + (const :tag "" :value :host) + (choice + (const :tag "Default" + riece-default-coding-system) + (choice + (symbol :tag "Coding system") + (cons (symbol :tag "Input coding system") + (symbol :tag "Output coding system")) + (const nil :tag "No conversion")))))))) :group 'riece-server) (defcustom riece-server (getenv "IRCSERVER") -- 2.25.1