emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Starnge comment in Custom Theme code.


From: Luc Teirlinck
Subject: Re: Starnge comment in Custom Theme code.
Date: Sat, 24 Dec 2005 19:45:26 -0600 (CST)

>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.
  
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]