[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: custom-set-variables fails to set variable
From: |
Luc Teirlinck |
Subject: |
Re: custom-set-variables fails to set variable |
Date: |
Sat, 12 Nov 2005 17:36:00 -0600 (CST) |
Richard Stallman wrote:
Meanwhile, another point occurs to me.
Why is the defvar that comes from the define-derived-mode
executed before the defcustom? Could that be solved
by putting the defcustom earlier in the file?
Yes, but with the current code, the defvar's docstring would overwrite
the defcustom's. Also, I would rather not rely on all Elisp authors
to be perfectly aware of this issue.
We don't want the automatically generated doc string to override
an explicit one, so perhaps the define-derived-mode should generate
(unless (get VAR 'variable-documentation)
(put VAR 'variable-documentation STRING))
I believe that this is a much more solid alternative. The patch below
implements this. I can install if it looks OK.
But remember that the original confusion which let to the defvar was
not that outline-mode-hook had no docs. I believe that the OP was
perfectly aware of the fact that outline-mode-hook was run at the end
of outline-mode. What really confused him was the fact that
outline-mode was unbound. So I propose to expand the docstring to
explain that this is no problem.
After my patch `C-h v paragraph-indent-text-mode-hook' results in:
paragraph-indent-text-mode-hook is void as a variable.
Documentation:
Hook run when entering Parindent mode.
No problems result if this hook is not bound.
`add-hook' automatically binds it. (This is true for all hook variables.)
Patch:
===File ~/derived-diff======================================
*** derived.el 06 Aug 2005 13:23:00 -0500 1.12
--- derived.el 12 Nov 2005 17:31:33 -0600
***************
*** 194,200 ****
parent child docstring syntax abbrev))
`(progn
! (defvar ,hook nil ,(format "Hook run when entering %s mode." name))
(defvar ,map (make-sparse-keymap))
,(if declare-syntax
`(defvar ,syntax (make-syntax-table)))
--- 194,205 ----
parent child docstring syntax abbrev))
`(progn
! (unless (get ',hook 'variable-documentation)
! (put ',hook 'variable-documentation
! ,(format "Hook run when entering %s mode.
! No problems result if this hook is not bound.
! `add-hook' automatically binds it. (This is true for all hook variables.)"
! name)))
(defvar ,map (make-sparse-keymap))
,(if declare-syntax
`(defvar ,syntax (make-syntax-table)))
============================================================