From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: More bugs in Custom themes Date: Wed, 29 Jun 2005 20:52:11 -0500 (CDT) Message-ID: <200506300152.j5U1qBo01566@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1120098979 3987 80.91.229.2 (30 Jun 2005 02:36:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Jun 2005 02:36:19 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 30 04:36:18 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DnouA-0007bB-Oe for ged-emacs-devel@m.gmane.org; Thu, 30 Jun 2005 04:35:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dnp2K-0003tu-Pq for ged-emacs-devel@m.gmane.org; Wed, 29 Jun 2005 22:44:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dnozn-0002Sm-PF for emacs-devel@gnu.org; Wed, 29 Jun 2005 22:41:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DnooC-0007mk-OY for emacs-devel@gnu.org; Wed, 29 Jun 2005 22:29:54 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DnooA-0007Wu-MH for emacs-devel@gnu.org; Wed, 29 Jun 2005 22:29:43 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DnoKP-0005Ls-AG for emacs-devel@gnu.org; Wed, 29 Jun 2005 21:58:57 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j5U1s0CK027725 for ; Wed, 29 Jun 2005 20:54:00 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j5U1qBo01566; Wed, 29 Jun 2005 20:52:11 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:39927 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39927 As I already said in another message, things are still a _lot_ worse than I thought yesterday. The Custom themes feature in its current form is actually completely unusable and it seems impossible to make it usable without a substantial effort in correcting porting errors and finishing off the porting work (and then documenting it). As I already pointed out, I am not the right person for this. First new bug. After requiring a theme and then setting and saving some option through Custom, all my customizations for all options for which the theme specified a value were deleted. I lost part of my Custom file this way and had to recreate it. This is a serious bug. It probably can be fixed one way or the other, but the three unfixed bugs I am currently aware of are guaranteed to be only three of very many. Every time I try out something new, I find new bugs. The current Custom themes stuff is completely dysfunctional. The current code in custom.el appears to be incoherent. Second new bug: `custom-create-theme' can not handle variables with a defcustom that needs a :require and there are a lot of those. At present, people should not be using Custom themes, because you risk loosing part of your customizations by doing that. This stuff should definitely not be documented in the Emacs manual at present. I guess it still makes sense to apply my patches. In case somebody sooner or later manages to fix the mess in custom.el, they still fix a few of the many bugs, thereby making that person's job at least somewhat easier. I definitely no longer want to make `require-theme' interactive, because using it, at present, can lead to loss of part of your Custom file. Until things get fixed (if ever), I would make `custom-theme-directory' into a defvar instead of a defcustom, because we do not want to advertise a package with serious bugs. I could install my patch to custom.el with these changes. My patch to cus-theme.el would document the bugs and tell people it is currently only meant for developpers wanting to debug the Custom themes machinery. Anybody who manages to correct these and other bugs enough to make Custom Themes safely usable can delete that warning. New proposed cus-theme.el patch: ===File ~/cus-theme.el-new-diff============================= *** cus-theme.el 17 Apr 2005 15:28:09 -0500 1.8 --- cus-theme.el 29 Jun 2005 20:32:47 -0500 *************** *** 31,36 **** --- 31,48 ---- (eval-when-compile (require 'wid-edit)) + (define-derived-mode custom-new-theme-mode nil "New-Theme" + "Major mode for the buffer created by `customize-create-theme'. + Do not call this mode function yourself. It is only meant for internal + use by `customize-create-theme'." + (set-keymap-parent custom-new-theme-mode-map widget-keymap)) + (put 'custom-new-theme-mode 'mode-class 'special) + + (defvar custom-theme-name) + (defvar custom-theme-variables) + (defvar custom-theme-faces) + (defvar custom-theme-description) + ;;;###autoload (defun customize-create-theme () "Create a custom theme." *************** *** 38,52 **** (if (get-buffer "*New Custom Theme*") (kill-buffer "*New Custom Theme*")) (switch-to-buffer "*New Custom Theme*") ! (kill-all-local-variables) (make-local-variable 'custom-theme-name) (make-local-variable 'custom-theme-variables) (make-local-variable 'custom-theme-faces) (make-local-variable 'custom-theme-description) - (let ((inhibit-read-only t)) - (erase-buffer)) (widget-insert "This buffer helps you write a custom theme elisp file. ! This will help you share your customizations with other people.\n\n") (widget-insert "Theme name: ") (setq custom-theme-name (widget-create 'editable-field --- 50,81 ---- (if (get-buffer "*New Custom Theme*") (kill-buffer "*New Custom Theme*")) (switch-to-buffer "*New Custom Theme*") ! (let ((inhibit-read-only t)) ! (erase-buffer)) ! (custom-new-theme-mode) (make-local-variable 'custom-theme-name) (make-local-variable 'custom-theme-variables) (make-local-variable 'custom-theme-faces) (make-local-variable 'custom-theme-description) (widget-insert "This buffer helps you write a custom theme elisp file. ! This will help you share your customizations with other people. ! ! Just insert the names of all variables and faces you want the theme ! to include. Then clicking mouse-2 or pressing RET on the [Done] button ! will write a theme file that sets all these variables and faces to their ! current global values. It will write that file into the directory given ! by the variable `custom-theme-directory', usually \"~/.emacs.d/\". ! ! To undo all your edits to the buffer, use the [Reset] button. ! ! *Please Note*: This buffer and the theme files written by it, as well as ! the entire Custom themes feature, are experimental. They are currently ! only meant for use by developers who want to debug it. The most serious ! known bug is that requiring a theme and then setting and saving some option ! through Custom may erase part of your Custom file. (It erases the options ! for which the theme specifies a value.) Another, less serious bug is that ! the file created by this buffer will not work for options defined with ! a defcustom that uses :require.\n\n") (widget-insert "Theme name: ") (setq custom-theme-name (widget-create 'editable-field *************** *** 81,87 **** (bury-buffer)) "Bury Buffer") (widget-insert "\n") - (use-local-map widget-keymap) (widget-setup)) (defun custom-theme-write (&rest ignore) --- 110,115 ---- *************** *** 90,95 **** --- 118,127 ---- (variables (widget-value custom-theme-variables)) (faces (widget-value custom-theme-faces))) (switch-to-buffer (concat name "-theme.el")) + (emacs-lisp-mode) + (unless (file-exists-p custom-theme-directory) + (make-directory (file-name-as-directory custom-theme-directory) t)) + (setq default-directory custom-theme-directory) (setq buffer-file-name (expand-file-name (concat name "-theme.el"))) (let ((inhibit-read-only t)) (erase-buffer)) *************** *** 100,106 **** (insert ")\n") (custom-theme-write-variables name variables) (custom-theme-write-faces name faces) ! (insert "\n(provide-theme '" name ")\n"))) (defun custom-theme-write-variables (theme vars) "Write a `custom-theme-set-variables' command for THEME. --- 132,139 ---- (insert ")\n") (custom-theme-write-variables name variables) (custom-theme-write-faces name faces) ! (insert "\n(provide-theme '" name ")\n") ! (save-buffer))) (defun custom-theme-write-variables (theme vars) "Write a `custom-theme-set-variables' command for THEME. ============================================================