bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4395: 23.1; byte-compiler loses top-level (put 'x...)


From: Drew Adams
Subject: bug#4395: 23.1; byte-compiler loses top-level (put 'x...)
Date: Thu, 10 Sep 2009 17:04:59 -0700

1. 
 
emacs -Q
 
Put these sexps somewhere at the top level of a file foo.el:
 
(require 'bar)
...
(put 'thevar 'variable-documentation "The new doc string")
...
(provide 'foo)
 
Put these sexps in file bar.el:
 
(defvar thevar 42 "Original doc string.")
...
(provide 'bar)
 
Byte-compile the files.
 
emacs -Q
 
Load library foo.
 
C-h v the-var
 
The doc shown is the original doc string. The top-level `put' had no
effect.
 
Doing the same thing using the *.el instead of *.elc works - no
problem.
 
It also works, with the byte-compiled files, if you wrap the `put'
sexp in `when':
 
(when t (put 'foovar 'variable-documentation "The new doc string"))
 
(Actually, I tried with (require 'XXX) instead of t.)
 

2. It also works with the byte-compiled files, if you add a vacuous
defvar to foo.el:
 
(defvar thevar)
(put 'thevar 'variable-documentation "The new doc string")
 
That is the approach used in library cc-vars.el. If this is a
recommended cliche, or is the only good way to change the doc string
of a var, then it needs to be documented in the Elisp manual.
 

3. Feature request: Have something similar to defadvice for a
variable, at least to be able to add to its doc string.
 
 
 

In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
 of 2009-07-29 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'
 







reply via email to

[Prev in Thread] Current Thread [Next in Thread]