unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Starnge comment in Custom Theme code.
Date: Sat, 24 Dec 2005 19:45:26 -0600 (CST)	[thread overview]
Message-ID: <200512250145.jBP1jQK15586@raven.dms.auburn.edu> (raw)
In-Reply-To: <87bqz6h0lw.fsf@stupidchicken.com> (message from Chong Yidong on Sat, 24 Dec 2005 12:21:47 -0500)

>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))
  \f
  ;;; 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))
  \f
  ;;; 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.
  
============================================================

  parent reply	other threads:[~2005-12-25  1:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-24 16:30 Starnge comment in Custom Theme code Luc Teirlinck
2005-12-24 17:21 ` Chong Yidong
2005-12-24 18:02   ` Luc Teirlinck
2005-12-24 18:35     ` Chong Yidong
2005-12-24 18:39       ` Luc Teirlinck
2005-12-24 18:42         ` Chong Yidong
2005-12-24 18:53           ` Luc Teirlinck
2005-12-24 18:49       ` Luc Teirlinck
2005-12-25  2:32       ` Luc Teirlinck
2005-12-26  2:20         ` Richard M. Stallman
2005-12-26  4:21           ` Luc Teirlinck
2005-12-26 21:57             ` Richard M. Stallman
2005-12-26 18:05           ` Luc Teirlinck
2005-12-24 18:30   ` Luc Teirlinck
2005-12-24 19:04   ` Luc Teirlinck
2005-12-24 20:58   ` Luc Teirlinck
2005-12-25  1:45   ` Luc Teirlinck [this message]
2005-12-26  2:20     ` Richard M. Stallman
2005-12-26  3:29       ` Luc Teirlinck
2005-12-27  4:55         ` Richard M. Stallman
2005-12-26  4:26       ` Luc Teirlinck
2005-12-26 18:43       ` Richard M. Stallman
2005-12-27  2:13         ` Luc Teirlinck
2005-12-25  2:52 ` Richard M. Stallman
2005-12-25  3:03   ` Luc Teirlinck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200512250145.jBP1jQK15586@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).