From f6cd01d6e1577a747c55e921003d1ce17968859c Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Mon, 11 Jul 2005 10:08:45 +0000 Subject: [PATCH] Make `muse-project-alist' more intuitively customizable. * examples/mwolson/muse-init.el (muse-project-alist): Resync with my settings. * lisp/muse-project.el: Thanks to jessealama on IRC for the suggestion. (muse-project-alist-get): New function that pre-parses `muse-projects-alist' before customization in order to work around an annoying limitation in the customize interface. (muse-project-alist-set): New function that takes the value that customize gave us and turns it into something Muse can use. (muse-project): New widget that outlines the form of the `muse-project-alist' variable. (muse-project-alist): Use the `muse-project' widget and specify :set and :get. git-archimport-id: mwolson@gnu.org--2005/muse--main--1.0--patch-125 --- ChangeLog | 25 ++++++++++++++ examples/mwolson/muse-init.el | 9 +++-- lisp/muse-project.el | 77 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 105 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index dee6f63..d6830b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,31 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0 # +2005-07-11 10:08:45 GMT Michael Olson patch-125 + + Summary: + Make `muse-project-alist' more intuitively customizable. + Revision: + muse--main--1.0--patch-125 + + * examples/mwolson/muse-init.el (muse-project-alist): Resync with my + settings. + + * lisp/muse-project.el: Thanks to jessealama on IRC for the suggestion. + (muse-project-alist-get): New function that pre-parses + `muse-projects-alist' before customization in order to work around an + annoying limitation in the customize interface. + (muse-project-alist-set): New function that takes the value that + customize gave us and turns it into something Muse can use. + (muse-project): New widget that outlines the form of the + `muse-project-alist' variable. + (muse-project-alist): Use the `muse-project' widget and specify :set + and :get. + + modified files: + ChangeLog examples/mwolson/muse-init.el lisp/muse-project.el + + 2005-07-10 22:41:49 GMT Michael Olson patch-124 Summary: diff --git a/examples/mwolson/muse-init.el b/examples/mwolson/muse-init.el index 96b8fb2..f7c0d32 100644 --- a/examples/mwolson/muse-init.el +++ b/examples/mwolson/muse-init.el @@ -43,16 +43,15 @@ (setq muse-project-alist `( - ("WebSite" - ("~/proj/wiki/web/" :default "WelcomePage" - :set 'muse-file-extension nil) + ("Website" + ("~/proj/wiki/web/" :default "WelcomePage") (:base "my-xhtml" - :path "~/proj/notmine/web-out")) + :path "~/personal-site/site/web")) ("Projects" ("~/proj/wiki/projects/" :default "WelcomePage") (:base "my-xhtml" - :path "~/proj/notmine/projects-out")) + :path "~/personal-site/site/projects")) ("Blog" (,@(muse-blosxom-project-alist-dirs "~/proj/wiki/blog") diff --git a/lisp/muse-project.el b/lisp/muse-project.el index 35364bb..793f4ed 100644 --- a/lisp/muse-project.el +++ b/lisp/muse-project.el @@ -52,11 +52,86 @@ Each function is passed the project object, a cons with the format :type 'hook :group 'muse-project) +(defun muse-project-alist-get (sym) + "Turn `muse-project-alist' into something we can customize easily." + (when (boundp sym) + (let* ((val (copy-alist (symbol-value sym))) + (head val)) + (while val + (let ((head (car (cdar val))) + res) + (while head + (cond ((stringp (car head)) + (add-to-list 'res (car head)) + (setq head (cdr head))) + ((and (symbolp (car head)) + (or (symbolp (cadr head)) + (stringp (cadr head)))) + (add-to-list 'res (list (car head) (cadr head)) t) + (setq head (cddr head))) + (t + (setq head (cdr head))))) + (setcdr (car val) (cons res (cdr (cdar val))))) + (setq val (cdr val))) + head))) + +(defun muse-project-alist-set (sym val) + "Turn customized version of `muse-project-alist' into something +Muse can make use of." + (set sym val) + (while val + (let ((head (car (cdar val))) + res) + (while head + (cond ((stringp (car head)) + (add-to-list 'res (car head) t)) + ((consp (car head)) + (add-to-list 'res (caar head) t) + (add-to-list 'res (car (cdar head)) t))) + (setq head (cdr head))) + (setcdr (car val) (cons res (cdr (cdar val))))) + (setq val (cdr val)))) + +(define-widget 'muse-project 'lazy + "A widget that defines a Muse project." + :tag "Project" + :type '(cons (repeat :tag "Contents" + (choice + (string :tag "Directory") + (list :tag "Setting" + (choice :tag "Property" + (const :book-chapter) + (const :book-end) + (const :book-funcall) + (const :book-part) + (const :book-style) + (const :default) + (const :major-mode) + (const :nochapters) + (const :set) + (const :visit-link)) + (choice :tag "Value" + (string) (symbol))))) + (repeat (repeat :tag "Style" + (group :inline t + (choice + :tag "Property" + (const :base) + (const :base-url) + (const :exclude) + (const :include) + (const :path)) + (string :tag "Value")))))) + (defcustom muse-project-alist nil "An alist of Muse projects. A project defines a fileset, and a list of custom attributes for use when publishing files in that project." - :type '(alist :key-type string :value sexp) + :type '(alist + :key-type (string :tag "Project name") + :value-type muse-project) + :get 'muse-project-alist-get + :set 'muse-project-alist-set :group 'muse-project) (defvar muse-project-file-alist nil -- 2.11.4.GIT