From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: find-file-hook as illustration of Custom problems Date: Thu, 10 Feb 2005 18:09:57 -0600 (CST) Message-ID: <200502110009.j1B09vg07281@raven.dms.auburn.edu> References: <200502040036.j140atb03430@raven.dms.auburn.edu> <200502060150.j161oqh15336@raven.dms.auburn.edu> <200502080150.j181oMf07339@raven.dms.auburn.edu> <200502100512.j1A5CLJ29641@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1108080873 31586 80.91.229.2 (11 Feb 2005 00:14:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Feb 2005 00:14:33 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 11 01:14:33 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1CzOS3-0004AQ-CU for ged-emacs-devel@m.gmane.org; Fri, 11 Feb 2005 01:14:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CzOgs-0001N9-Mc for ged-emacs-devel@m.gmane.org; Thu, 10 Feb 2005 19:29:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CzOeL-0000Kk-CP for emacs-devel@gnu.org; Thu, 10 Feb 2005 19:27:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CzOeJ-0000Ja-Hn for emacs-devel@gnu.org; Thu, 10 Feb 2005 19:27:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CzOeJ-0000Id-43 for emacs-devel@gnu.org; Thu, 10 Feb 2005 19:27:07 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CzOPF-0004h8-JR; Thu, 10 Feb 2005 19:11:33 -0500 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 j1B0BX9N009441; Thu, 10 Feb 2005 18:11:33 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j1B09vg07281; Thu, 10 Feb 2005 18:09:57 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Thu, 10 Feb 2005 13:40:52 -0500) 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 X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33226 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33226 My previously posted patch was indeed not very good. Among other things `C-h v blinking-cursor-mode' did not find the defcustom. The patch you proposed has a similar problem. Also cus-start.el is meant for variables defined in the C code. I believe that we should avoid using it for Lisp variables, if possible. I now believe that the following patch to frame.el would be better. I believe that Per designed the standard value to be an unevaluated expression exactly to allow what the patch below does. The accompanying patch to startup.el is now very minor. ===File ~/frame.el-diff===================================== *** frame.el 09 Feb 2005 15:59:13 -0600 1.215 --- frame.el 10 Feb 2005 17:42:44 -0600 *************** *** 1253,1262 **** (defvar blink-cursor-timer nil "Timer started from `blink-cursor-start'. ! This timer calls `blink-cursor' every `blink-cursor-interval' seconds.") ! (defvar blink-cursor-mode nil ! "Non-nil means blinking cursor is active.") (defun blink-cursor-mode (arg) "Toggle blinking cursor mode. --- 1253,1289 ---- (defvar blink-cursor-timer nil "Timer started from `blink-cursor-start'. ! This timer calls `blink-cursor-timer-function' every ! `blink-cursor-interval' seconds.") ! ;; The strange sequence below is meant to set both the right temporary ! ;; value and the right "standard expression" , according to Custom, ! ;; for blink-cursor-mode. We do not know the concrete standard ! ;; _evaluated_ value yet, because the standard expression uses values ! ;; that are not yet set. Evaluating it now would yield an error, but ! ;; we make sure that it is not evaluated, by making sure that ! ;; blink-cursor-mode is set before the defcustom is evaluated and by ! ;; using the right :initialize function. The correct evaluated ! ;; standard value will be installed in startup.el using exactly the ! ;; same expression as in the defcustom. ! (defvar blink-cursor-mode) ! (unless (boundp 'blink-cursor-mode) (setq blink-cursor-mode nil)) ! (defcustom blink-cursor-mode ! (not (or noninteractive ! emacs-quick-startup ! (eq system-type 'ms-dos) ! (not (memq window-system '(x w32))))) ! "*Non-nil means Blinking Cursor mode is active." ! :group 'cursor ! :tag "Blinking cursor" ! :type 'boolean ! :initialize 'custom-initialize-set ! :set #'(lambda (symbol value) ! (set-default symbol value) ! (blink-cursor-mode (or value 0)))) ! ! (defvaralias 'blink-cursor 'blink-cursor-mode) ! (make-obsolete-variable 'blink-cursor 'blink-cursor-mode "22.1") (defun blink-cursor-mode (arg) "Toggle blinking cursor mode. *************** *** 1289,1306 **** (setq blink-cursor-mode t)) (internal-show-cursor nil t)))) - ;; Note that this is really initialized from startup.el before - ;; the init-file is read. - - (defcustom blink-cursor nil - "*Non-nil means blinking cursor mode is active." - :group 'cursor - :tag "Blinking cursor" - :type 'boolean - :set #'(lambda (symbol value) - (set-default symbol value) - (blink-cursor-mode (or value 0)))) - (defun blink-cursor-start () "Timer function called from the timer `blink-cursor-idle-timer'. This starts the timer `blink-cursor-timer', which makes the cursor blink --- 1316,1321 ---- ============================================================ ===File ~/startup.el-diff=================================== *** startup.el 28 Dec 2004 09:50:38 -0600 1.337 --- startup.el 10 Feb 2005 17:18:09 -0600 *************** *** 735,746 **** (<= (frame-parameter nil 'tool-bar-lines) 0)) (tool-bar-mode 1)) ! ;; Can't do this init in defcustom because window-system isn't set. (unless (or noninteractive emacs-quick-startup (eq system-type 'ms-dos) (not (memq window-system '(x w32)))) - (setq-default blink-cursor t) (blink-cursor-mode 1)) (unless noninteractive --- 735,748 ---- (<= (frame-parameter nil 'tool-bar-lines) 0)) (tool-bar-mode 1)) ! ;; Can't do this init in defcustom because the relevant variables ! ;; are not set. If you make any changes to the `or' form below, ! ;; you should also change the corresponding expression in the ! ;; defcustom in frame.el, or Custom will be badly confused. (unless (or noninteractive emacs-quick-startup (eq system-type 'ms-dos) (not (memq window-system '(x w32)))) (blink-cursor-mode 1)) (unless noninteractive ============================================================