unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C-h v fails when a symbol has variable documentation yet is unbound
@ 2005-11-09 11:24 Alan Mackenzie
  2005-11-09 14:05 ` Stefan Monnier
  2005-11-10  2:09 ` Richard M. Stallman
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Mackenzie @ 2005-11-09 11:24 UTC (permalink / raw)


When a symbol has variable documentation yet is unbound, "C-h v"'s
interactive specification prevents a user from displaying this
documentation.  This is not nice.

The variable I am thinking of is c-syntactic-context.  Normally, this
variable is unbound (indeed, MUST be unbound), but it gets dynamically
bound when calling auto-newline brace "action functions", auto-newline
semicolon/comma "criteria functions", "line-up" functions and
c-special-indent-hook-functions.  A user writing such a function should
be able to get c-syntactic-context's doc-string with C-h v.

The following patch fixes this.

 
2005-11-09  Alan Mackenzie  <acm@muc.de>

	* help-fns.el (describe-variable): Make C-h v work when a variable
	has variable documentation yet is unbound.


Index: help-fns.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help-fns.el,v
retrieving revision 1.79
diff -c -r1.79 help-fns.el
*** help-fns.el	31 Oct 2005 17:06:00 -0000	1.79
--- help-fns.el	9 Nov 2005 11:18:25 -0000
***************
*** 496,502 ****
  				    (format
  				     "Describe variable (default %s): " v)
  				  "Describe variable: ")
! 				obarray 'boundp t nil nil
  				(if (symbolp v) (symbol-name v))))
       (list (if (equal val "")
  	       v (intern val)))))
--- 496,506 ----
  				    (format
  				     "Describe variable (default %s): " v)
  				  "Describe variable: ")
! 				obarray
! 				'(lambda (vv)
! 				   (or (boundp vv)
! 				       (get vv 'variable-documentation)))
! 				t nil nil
  				(if (symbolp v) (symbol-name v))))
       (list (if (equal val "")
  	       v (intern val)))))



-- 
Alan Mackenzie (Munich, Germany)

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

* Re: C-h v fails when a symbol has variable documentation yet is unbound
  2005-11-09 11:24 C-h v fails when a symbol has variable documentation yet is unbound Alan Mackenzie
@ 2005-11-09 14:05 ` Stefan Monnier
  2005-11-10  2:09 ` Richard M. Stallman
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2005-11-09 14:05 UTC (permalink / raw)
  Cc: emacs-devel

> When a symbol has variable documentation yet is unbound, "C-h v"'s
> interactive specification prevents a user from displaying this
> documentation.  This is not nice.

To get an unbound var with doc, you either have to do

   (defvar foo nil "doc")
   (makunbound 'foo)
or
   (put 'foo 'variable-documentation "doc")

both of which are rather ugly and feel like workarounds.
So I'm not sure how important this is.


        Stefan

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

* Re: C-h v fails when a symbol has variable documentation yet is unbound
  2005-11-09 11:24 C-h v fails when a symbol has variable documentation yet is unbound Alan Mackenzie
  2005-11-09 14:05 ` Stefan Monnier
@ 2005-11-10  2:09 ` Richard M. Stallman
  2005-11-10  8:25   ` Alan Mackenzie
  1 sibling, 1 reply; 4+ messages in thread
From: Richard M. Stallman @ 2005-11-10  2:09 UTC (permalink / raw)
  Cc: emacs-devel

This change seems correct.  Would you please install it?

Meanwhile, why is it necessary for c-syntactic-context to be unbound
most of the time?  Couldn't it have some innocuous global value?

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

* Re: C-h v fails when a symbol has variable documentation yet is unbound
  2005-11-10  2:09 ` Richard M. Stallman
@ 2005-11-10  8:25   ` Alan Mackenzie
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2005-11-10  8:25 UTC (permalink / raw)
  Cc: emacs-devel

Good Morning!

On Wed, 9 Nov 2005, Richard M. Stallman wrote:

>This change seems correct.  Would you please install it?

Done.  (My very first commission to the Emacs repository.  :-)

>Meanwhile, why is it necessary for c-syntactic-context to be unbound
>most of the time?  Couldn't it have some innocuous global value?

Hmm.  Thinking about it, yes, it could indeed have been nil.  There are
several places in CC Mode which test (boundp 'c-syntactic-context).  But
there might now also be code in derived modes which test this too.  So it
seems inadvisable to change it.

But it would have been better, right from ancient history, to have used
nil rather than unboundedness here.

-- 
Alan Mackenzie (Munich, Germany)

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

end of thread, other threads:[~2005-11-10  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-09 11:24 C-h v fails when a symbol has variable documentation yet is unbound Alan Mackenzie
2005-11-09 14:05 ` Stefan Monnier
2005-11-10  2:09 ` Richard M. Stallman
2005-11-10  8:25   ` Alan Mackenzie

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