From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: find-file-hook as illustration of Custom problems
Date: Wed, 9 Feb 2005 23:12:21 -0600 (CST) [thread overview]
Message-ID: <200502100512.j1A5CLJ29641@raven.dms.auburn.edu> (raw)
In-Reply-To: <E1Cymvu-0005SV-C7@fencepost.gnu.org> (message from Richard Stallman on Wed, 09 Feb 2005 03:10:46 -0500)
Richard Stallman wrote:
This is the wrong solution. The right solution for variables such as
minibuffer-prompt-properties is to set up a valid expression for its
standard value. It may be necessary to store the current default
value in a new variable so that the standard value can use that
variable. This is easy and simple, it's just that each variable needs
to be looked at separately. Would you like to do this for some
of the variables?
Yes, for some. Here is a try at one.
Actually, I started out with my least favorite Emacs feature,
`blink-cursor'. Reason for that is that this one had a very
intriguing bug. This extra bug is unrelated to the stuff we have been
discussing here, but we should fix it anyway. It is confusing and
annoying.
Description of bug:
Do `emacs -q --eval "(blink-cursor-mode 0)" &'. Then:
M-x customize-rogue (actually, `C-h v blink-cursor' works too).
We now see that blink-cursor is t, even though the cursor does not blink.
If we do `M-x load-library RET frame", the cursor _does_ start blinking.
(Courtesy of custom-initialize-reset. I looked away as fast as I
could and typed `C-x C-c'.)
The problem is that the function `blink-cursor-mode' sets the value of
the variable blink-cursor-mode, but not of blink-cursor. The patch
below does get rid of blink-cursor altogether and uses
blink-cursor-mode instead. I know there must have been some reason
why that was not done all along, but I guess it must have been related
to the fake defcustom stuff, which the patch also gets rid of (that
was the original purpose).
One problem is that this will mess things up for the (I suppose many)
people who have set blink-cursor to nil_in their custom-set-variables
form. The patch keeps blink-cursor as an alias for blink-cursor-mode,
but Custom does apparently not recognize aliases. (That is probably
something we could and should fix still for Emacs 22.)
I do not know whether the combination phony-defvar, then
defvar-mimicking setq, then makunbound, then non-top-level defcustom
in startup.el is acceptable. It seems to do the job. The problem
with a temporary variable, as you suggested, seems to be that code
should use the same variable during startup and after that, so it did
not seem like it would work very well.
As a minor detail:
`blink-cursor-timer' now seems to call `blink-cursor-timer-function'
instead of `blink-cursor'. The patch addresses this too.
===File ~/frame.el-diff=====================================
*** frame.el 09 Feb 2005 15:59:13 -0600 1.215
--- frame.el 09 Feb 2005 22:50:04 -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,1267 ----
(defvar blink-cursor-timer nil
"Timer started from `blink-cursor-start'.
! This timer calls `blink-cursor-timer-function' every
! `blink-cursor-interval' seconds.")
! ;; This will be unbound and defcustomed in startup.el. We can not
! ;; defcustom it here because the default depends on the operating system.
! (defvar blink-cursor-mode)
! (defvaralias 'blink-cursor 'blink-cursor-mode)
! (make-obsolete-variable 'blink-cursor 'blink-cursor-mode "22.1")
! (unless (boundp 'blink-cursor-mode) (setq blink-cursor-mode nil))
(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
--- 1294,1299 ----
============================================================
===File ~/startup.el-diff===================================
*** startup.el 28 Dec 2004 09:50:38 -0600 1.337
--- startup.el 09 Feb 2005 19:46:22 -0600
***************
*** 735,747 ****
(<= (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
;; DOS/Windows systems have a PC-type keyboard which has both
--- 735,753 ----
(<= (frame-parameter nil 'tool-bar-lines) 0))
(tool-bar-mode 1))
! (makunbound 'blink-cursor-mode)
! (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
! :set #'(lambda (symbol value)
! (set-default symbol value)
! (blink-cursor-mode (or value 0))))
(unless noninteractive
;; DOS/Windows systems have a PC-type keyboard which has both
============================================================
LocalWords: defvar
next prev parent reply other threads:[~2005-02-10 5:12 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-04 0:36 find-file-hook as illustration of Custom problems Luc Teirlinck
2005-02-04 7:16 ` Lennart Borgman
2005-02-05 17:38 ` Richard Stallman
2005-02-05 18:54 ` Luc Teirlinck
2005-02-06 21:01 ` Richard Stallman
2005-02-06 22:19 ` Lennart Borgman
2005-02-05 19:43 ` Lennart Borgman
2005-02-05 20:56 ` Popup when buffer file is changed on disk moheb missaghi
2005-02-05 22:57 ` Eli Zaretskii
2005-02-06 0:51 ` Lennart Borgman
2005-02-06 7:20 ` Eli Zaretskii
2005-02-06 9:02 ` Lennart Borgman
2005-02-06 9:53 ` Eli Zaretskii
2005-02-06 10:41 ` Lennart Borgman
2005-02-06 16:34 ` Luc Teirlinck
2005-02-06 17:52 ` Lennart Borgman
2005-02-06 17:04 ` Luc Teirlinck
2005-02-11 0:33 ` Luc Teirlinck
2005-02-11 15:40 ` Eli Zaretskii
2005-02-11 16:51 ` David Kastrup
2005-02-11 19:38 ` Luc Teirlinck
2005-02-12 11:03 ` Eli Zaretskii
2005-02-12 8:37 ` Richard Stallman
2005-02-13 1:41 ` Luc Teirlinck
2005-02-13 4:36 ` Eli Zaretskii
2005-02-15 3:05 ` Luc Teirlinck
2005-02-15 4:59 ` Eli Zaretskii
2005-02-16 2:59 ` moheb missaghi
2005-02-16 9:31 ` Richard Stallman
2005-02-16 10:37 ` David Kastrup
2005-02-16 15:06 ` Luc Teirlinck
2005-02-16 15:21 ` David Kastrup
2005-02-17 1:08 ` Luc Teirlinck
2005-02-06 12:42 ` Richard Stallman
2005-02-06 18:00 ` Lennart Borgman
2005-02-06 18:17 ` Jan D.
2005-02-06 19:59 ` Lennart Borgman
2005-02-06 20:40 ` Jan D.
2005-02-07 4:34 ` Eli Zaretskii
2005-02-07 4:04 ` Luc Teirlinck
2005-02-06 18:11 ` Luc Teirlinck
2005-02-06 18:45 ` Luc Teirlinck
2005-02-06 13:24 ` Jason Rumney
2005-02-06 13:54 ` Lennart Borgman
2005-02-06 7:23 ` Eli Zaretskii
2005-02-06 21:01 ` find-file-hook as illustration of Custom problems Richard Stallman
2005-02-06 1:50 ` Luc Teirlinck
2005-02-06 3:26 ` Luc Teirlinck
2005-02-06 4:02 ` Luc Teirlinck
2005-02-06 21:02 ` Richard Stallman
2005-02-08 1:50 ` Luc Teirlinck
2005-02-09 8:10 ` Richard Stallman
2005-02-09 10:42 ` Kim F. Storm
2005-02-10 18:39 ` Richard Stallman
2005-02-10 21:42 ` Kim F. Storm
2005-02-12 8:37 ` Richard Stallman
2005-02-10 5:12 ` Luc Teirlinck [this message]
2005-02-10 18:40 ` Richard Stallman
2005-02-11 0:09 ` Luc Teirlinck
2005-02-12 8:37 ` Richard Stallman
2005-02-11 0:21 ` Luc Teirlinck
2005-02-11 14:59 ` Luc Teirlinck
2005-02-10 5:26 ` Luc Teirlinck
2005-02-06 2:07 ` Luc Teirlinck
2005-02-06 3:16 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200502100512.j1A5CLJ29641@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.