unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4395: 23.1; byte-compiler loses top-level (put 'x...)
@ 2009-09-11  0:04 Drew Adams
  2009-09-11  2:22 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2009-09-11  0:04 UTC (permalink / raw)
  To: bug-gnu-emacs

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)'
 







^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-11 20:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-11  0:04 bug#4395: 23.1; byte-compiler loses top-level (put 'x...) Drew Adams
2009-09-11  2:22 ` Stefan Monnier
2009-09-11 14:23   ` Drew Adams
2009-09-11 18:59     ` Stefan Monnier
2009-09-11 20:31       ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).