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: More about blink-cursor-mode Date: Mon, 21 Feb 2005 19:24:32 -0600 (CST) Message-ID: <200502220124.j1M1OWK19942@raven.dms.auburn.edu> References: <200502200155.j1K1thb29289@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1109036173 2337 80.91.229.2 (22 Feb 2005 01:36:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Feb 2005 01:36:13 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 22 02:36:12 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D3Oxu-0004eg-K3 for ged-emacs-devel@m.gmane.org; Tue, 22 Feb 2005 02:35:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D3PEx-0005Yb-Lk for ged-emacs-devel@m.gmane.org; Mon, 21 Feb 2005 20:53:31 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D3PCv-0004zq-6T for emacs-devel@gnu.org; Mon, 21 Feb 2005 20:51:26 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D3PCp-0004vp-G1 for emacs-devel@gnu.org; Mon, 21 Feb 2005 20:51:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D3PCl-0004rI-4l for emacs-devel@gnu.org; Mon, 21 Feb 2005 20:51:15 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D3Oou-0001RA-Ai for emacs-devel@gnu.org; Mon, 21 Feb 2005 20:26:36 -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 j1M1QZ9N018116; Mon, 21 Feb 2005 19:26:35 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j1M1OWK19942; Mon, 21 Feb 2005 19:24:32 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: monnier@iro.umontreal.ca In-reply-to: (message from Stefan on Sun, 20 Feb 2005 16:38:37 -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:33710 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33710 Stefan Monnier wrote: Any objection? Well, you already installed it, but there are some problems. I replied earlier that I would look at it today. You removed: (defvar blink-cursor-mode) (unless (boundp 'blink-cursor-mode) (setq blink-cursor-mode nil)) which ensured that the value when evaluated before startup.el was loaded would be nil. Now it turns out that removing this actually works, unlike the person who wrote the initial code, and later me, thought. There are several variables in the form that are not yet defined. However, at the time the code is executed, noninteractive appears to be always t. Because this is the first expression in the `or' form, the `or' evalutes to t, without evaluating the other, not yet defined, variables in the `or' form, thereby avoiding the error. Because the `or' is preceded by not, the temporary value that `blink-cursor-mode' gets is nil, as it should be. All of this is not necessarily less tricky than the two lines of code above. We must make sure that anybody trying to change the expression knows about the importance of the noniteractive trick and about the fact that he should also change the identical expression in startup.el, where noninteractive may be nil (unless running in batch mode) and the real value is established. Also, after your change, the user options `blink-cursor-mode' and `blink-cursor-mode-hook' wind up in a special group, blink-cursor, which has no parent group and which browsing Custom will hence never find. They should be in the cursor group, together with other options related to cursor blinking. In any case all this round-about hack seems completely unnecessary It will be necessary for other options that still need to be given a correct Custom standard expression and for which the noninteractive coincidence will not happen. and if really the standard expression signals an error if it is evaluated too early, then we can just wrap it with a (condition-case nil ... (error nil)) or some such. One _definitely_ does not want to rap a Custom standard expression in a condition-case. Seems like a much better option than this nasty unexplained stuff we have now. The comment tried to explain it. The comment left after your change does not make a lot of sense any more. Maybe it is better to put the: (defvar blink-cursor-mode) (unless (default-boundp 'blink-cursor-mode) (setq-default blink-cursor-mode nil)) with something like the original comment back in, to protect against future code changes, that might undo the current lucky coincidence. If not, I believe that the comment in the patch below should be added. The :group _definitely_ should be changed back to 'cursor, as the patch below does. ===File ~/frame.el-newdiff================================== *** frame.el 21 Feb 2005 14:18:13 -0600 1.217 --- frame.el 21 Feb 2005 18:35:09 -0600 *************** *** 1256,1265 **** This timer calls `blink-cursor-timer-function' every `blink-cursor-interval' seconds.") ! ;; We do not know the standard _evaluated_ value yet, because the standard ! ;; expression uses values that are not yet set. The correct evaluated ! ;; standard value will be installed in startup.el using exactly the same ! ;; expression as in the defcustom. (define-minor-mode blink-cursor-mode "Toggle blinking cursor mode. With a numeric argument, turn blinking cursor mode on iff ARG is positive. --- 1256,1271 ---- This timer calls `blink-cursor-timer-function' every `blink-cursor-interval' seconds.") ! ;; The :init-value given below is evaluated at startup, before ! ;; startup.el is loaded. At that time, the variables it uses do not ! ;; yet have their correct values. Because noninteractive is t at the ! ;; time, the :init-value evaluates to nil. The code in the ! ;; :init-value will be evaluated again in startup.el, at which time ! ;; all values will be correct. If you change the :init-value below, ! ;; you should also change the expression used in startup.el. The two ! ;; expressions need to be identical or Custom will be very confused. ! ;; You should also make sure that the new expression still evaluates ! ;; to nil before startup.el is loaded. (define-minor-mode blink-cursor-mode "Toggle blinking cursor mode. With a numeric argument, turn blinking cursor mode on iff ARG is positive. *************** *** 1273,1278 **** --- 1279,1285 ---- emacs-quick-startup (eq system-type 'ms-dos) (not (memq window-system '(x w32))))) + :group 'cursor :global t (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) (if blink-cursor-timer (cancel-timer blink-cursor-timer)) ============================================================ LocalWords: noninteractive evalutes noniteractive newdiff