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: Re: Starnge comment in Custom Theme code. Date: Sat, 24 Dec 2005 19:45:26 -0600 (CST) Message-ID: <200512250145.jBP1jQK15586@raven.dms.auburn.edu> References: <200512241630.jBOGU6H09878@raven.dms.auburn.edu> <87bqz6h0lw.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1135475268 18943 80.91.229.2 (25 Dec 2005 01:47:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Dec 2005 01:47:48 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 25 02:47:47 2005 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EqKz6-0006an-H4 for ged-emacs-devel@m.gmane.org; Sun, 25 Dec 2005 02:47:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EqL0E-0005aw-FN for ged-emacs-devel@m.gmane.org; Sat, 24 Dec 2005 20:48:50 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EqL04-0005ap-PH for emacs-devel@gnu.org; Sat, 24 Dec 2005 20:48:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EqL04-0005ad-7x for emacs-devel@gnu.org; Sat, 24 Dec 2005 20:48:40 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EqL04-0005aa-0z for emacs-devel@gnu.org; Sat, 24 Dec 2005 20:48:40 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EqKzc-0000wF-TT for emacs-devel@gnu.org; Sat, 24 Dec 2005 20:48:13 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.13.3+Sun/8.13.3) with ESMTP id jBP1lS0D014848; Sat, 24 Dec 2005 19:47:28 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id jBP1jQK15586; Sat, 24 Dec 2005 19:45:26 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: cyd@stupidchicken.com In-reply-to: <87bqz6h0lw.fsf@stupidchicken.com> (message from Chong Yidong on Sat, 24 Dec 2005 12:21:47 -0500) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.1 (manatee.dms.auburn.edu [131.204.53.104]); Sat, 24 Dec 2005 19:47:28 -0600 (CST) 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:48338 Archived-At: >>From my previous reply: For instance, take custom-save-variables. We see: (custom-save-delete 'custom-load-themes) (custom-save-delete 'custom-reset-variables) (custom-save-delete 'custom-set-variables) (custom-save-loaded-themes) (custom-save-resets 'theme-value 'custom-reset-variables nil) I understand the third line. What about the other four? I took a closer look at this myself now and apparently that code is trying to make the user theme mess with other themes in a way that it should not be messing. I propose that we comment out that code, as well as all related code, and if nobody misses it, eventually remove it. More precisely, I propose the following two patches, which I can install if desired. ===File ~/cus-edit-diff===================================== *** cus-edit.el 24 Dec 2005 09:51:55 -0600 1.260 --- cus-edit.el 24 Dec 2005 18:03:27 -0600 *************** *** 4069,4079 **** (defun custom-save-variables () "Save all customized variables in `custom-file'." (save-excursion ! (custom-save-delete 'custom-load-themes) ! (custom-save-delete 'custom-reset-variables) (custom-save-delete 'custom-set-variables) ! (custom-save-loaded-themes) ! (custom-save-resets 'theme-value 'custom-reset-variables nil) (let ((standard-output (current-buffer)) (saved-list (make-list 1 0)) sort-fold-case) --- 4069,4079 ---- (defun custom-save-variables () "Save all customized variables in `custom-file'." (save-excursion ! ;; (custom-save-delete 'custom-load-themes) ! ;; (custom-save-delete 'custom-reset-variables) (custom-save-delete 'custom-set-variables) ! ;; (custom-save-loaded-themes) ! ;; (custom-save-resets 'theme-value 'custom-reset-variables nil) (let ((standard-output (current-buffer)) (saved-list (make-list 1 0)) sort-fold-case) *************** *** 4134,4142 **** (defun custom-save-faces () "Save all customized faces in `custom-file'." (save-excursion ! (custom-save-delete 'custom-reset-faces) (custom-save-delete 'custom-set-faces) ! (custom-save-resets 'theme-face 'custom-reset-faces '(default)) (let ((standard-output (current-buffer)) (saved-list (make-list 1 0)) sort-fold-case) --- 4134,4142 ---- (defun custom-save-faces () "Save all customized faces in `custom-file'." (save-excursion ! ;; (custom-save-delete 'custom-reset-faces) (custom-save-delete 'custom-set-faces) ! ;; (custom-save-resets 'theme-face 'custom-reset-faces '(default)) (let ((standard-output (current-buffer)) (saved-list (make-list 1 0)) sort-fold-case) *************** *** 4188,4230 **** (unless (looking-at "\n") (princ "\n"))))) ! (defun custom-save-resets (property setter special) ! (let (started-writing ignored-special) ! ;; (custom-save-delete setter) Done by caller ! (let ((standard-output (current-buffer)) ! (mapper `(lambda (object) ! (let ((spec (car-safe (get object (quote ,property))))) ! (when (and (not (memq object ignored-special)) ! (eq (nth 0 spec) 'user) ! (eq (nth 1 spec) 'reset)) ! ;; Do not write reset statements unless necessary. ! (unless started-writing ! (setq started-writing t) ! (unless (bolp) ! (princ "\n")) ! (princ "(") ! (princ (quote ,setter)) ! (princ "\n '(") ! (prin1 object) ! (princ " ") ! (prin1 (nth 3 spec)) ! (princ ")"))))))) ! (mapc mapper special) ! (setq ignored-special special) ! (mapatoms mapper) ! (when started-writing ! (princ ")\n"))))) ! (defun custom-save-loaded-themes () ! (let ((themes (reverse (get 'user 'theme-loads-themes))) ! (standard-output (current-buffer))) ! (when themes ! (unless (bolp) (princ "\n")) ! (princ "(custom-load-themes") ! (mapc (lambda (theme) ! (princ "\n '") ! (prin1 theme)) themes) ! (princ " )\n")))) ;;;###autoload (defun customize-save-customized () --- 4188,4230 ---- (unless (looking-at "\n") (princ "\n"))))) ! ;; (defun custom-save-resets (property setter special) ! ;; (let (started-writing ignored-special) ! ;; ;; (custom-save-delete setter) Done by caller ! ;; (let ((standard-output (current-buffer)) ! ;; (mapper `(lambda (object) ! ;; (let ((spec (car-safe (get object (quote ,property))))) ! ;; (when (and (not (memq object ignored-special)) ! ;; (eq (nth 0 spec) 'user) ! ;; (eq (nth 1 spec) 'reset)) ! ;; ;; Do not write reset statements unless necessary. ! ;; (unless started-writing ! ;; (setq started-writing t) ! ;; (unless (bolp) ! ;; (princ "\n")) ! ;; (princ "(") ! ;; (princ (quote ,setter)) ! ;; (princ "\n '(") ! ;; (prin1 object) ! ;; (princ " ") ! ;; (prin1 (nth 3 spec)) ! ;; (princ ")"))))))) ! ;; (mapc mapper special) ! ;; (setq ignored-special special) ! ;; (mapatoms mapper) ! ;; (when started-writing ! ;; (princ ")\n"))))) ! ;; (defun custom-save-loaded-themes () ! ;; (let ((themes (reverse (get 'user 'theme-loads-themes))) ! ;; (standard-output (current-buffer))) ! ;; (when themes ! ;; (unless (bolp) (princ "\n")) ! ;; (princ "(custom-load-themes") ! ;; (mapc (lambda (theme) ! ;; (princ "\n '") ! ;; (prin1 theme)) themes) ! ;; (princ " )\n")))) ;;;###autoload (defun customize-save-customized () ============================================================ ===File ~/custom-diff======================================= *** custom.el 24 Dec 2005 09:51:55 -0600 1.110 --- custom.el 24 Dec 2005 19:21:27 -0600 *************** *** 1121,1131 **** (push theme themes-loaded)) (put by-theme 'theme-loads-themes themes-loaded))) ! (defun custom-load-themes (&rest body) ! "Load themes for the USER theme as specified by BODY. ! See `custom-theme-load-themes' for more information on BODY." ! (apply 'custom-theme-load-themes 'user body)) ;;; Enabling and disabling loaded themes. --- 1121,1131 ---- (push theme themes-loaded)) (put by-theme 'theme-loads-themes themes-loaded))) ! ;; (defun custom-load-themes (&rest body) ! ;; "Load themes for the USER theme as specified by BODY. ! ;; See `custom-theme-load-themes' for more information on BODY." ! ;; (apply 'custom-theme-load-themes 'user body)) ;;; Enabling and disabling loaded themes. *************** *** 1232,1247 **** (dolist (arg args) (custom-push-theme 'theme-value (car arg) theme 'reset (cadr arg)))) ! (defun custom-reset-variables (&rest args) ! "Reset the specs of some variables to their values in certain themes. ! This creates settings in the `user' theme. ! Each of the arguments ARGS has this form: ! (VARIABLE FROM-THEME) ! This means reset VARIABLE to its value in FROM-THEME." ! (apply 'custom-theme-reset-variables 'user args)) ;;; The End. --- 1232,1247 ---- (dolist (arg args) (custom-push-theme 'theme-value (car arg) theme 'reset (cadr arg)))) ! ;; (defun custom-reset-variables (&rest args) ! ;; "Reset the specs of some variables to their values in certain themes. ! ;; This creates settings in the `user' theme. ! ;; Each of the arguments ARGS has this form: ! ;; (VARIABLE FROM-THEME) ! ;; This means reset VARIABLE to its value in FROM-THEME." ! ;; (apply 'custom-theme-reset-variables 'user args)) ;;; The End. ============================================================