* RE: describe-variable with string arg [not found] <46045DA3.9000709@gmail.com> @ 2007-03-23 23:15 ` Drew Adams 0 siblings, 0 replies; 5+ messages in thread From: Drew Adams @ 2007-03-23 23:15 UTC (permalink / raw) To: Emacs-Devel Lennart asked me: > Don't you mean intern-soft? OK. ^ permalink raw reply [flat|nested] 5+ messages in thread
* describe-variable with string arg @ 2007-03-23 22:37 Drew Adams 2007-03-23 22:52 ` Stefan Monnier 2007-03-23 22:57 ` Drew Adams 0 siblings, 2 replies; 5+ messages in thread From: Drew Adams @ 2007-03-23 22:37 UTC (permalink / raw) To: Emacs-Devel describe-variable expects a symbol, not a symbol-name (string). In Emacs 20, passing it a symbol name leads to an error message. Starting with Emacs 21, the message is displayed via `message', not `error'. AFAICT, no Emacs code depends on this use of `message' instead of `error'. The latter makes more sense to me. Beyond that, why not let `describe-variable' try a little harder, to use `intern' applied to its arg, if that is a string? That would be friendlier to possible 3rd-party code that might generically apply a function such as `describe-variable' to an arg that might be a symbol name instead of a symbol. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: describe-variable with string arg 2007-03-23 22:37 Drew Adams @ 2007-03-23 22:52 ` Stefan Monnier 2007-03-23 22:57 ` Drew Adams 1 sibling, 0 replies; 5+ messages in thread From: Stefan Monnier @ 2007-03-23 22:52 UTC (permalink / raw) To: Drew Adams; +Cc: Emacs-Devel > That would be friendlier to possible 3rd-party code that might generically > apply a function such as `describe-variable' to an arg that might be a > symbol name instead of a symbol. I see no reason to encourage sloppiness, Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: describe-variable with string arg 2007-03-23 22:37 Drew Adams 2007-03-23 22:52 ` Stefan Monnier @ 2007-03-23 22:57 ` Drew Adams 2007-03-23 23:57 ` Drew Adams 1 sibling, 1 reply; 5+ messages in thread From: Drew Adams @ 2007-03-23 22:57 UTC (permalink / raw) To: Emacs-Devel I said: > describe-variable expects a symbol, not a symbol-name (string). > > In Emacs 20, passing it a symbol name leads to an error message. Starting > with Emacs 21, the message is displayed via `message', not > `error'. AFAICT, no Emacs code depends on this use of `message' instead > of `error'. The latter makes more sense to me. Let me be clearer. This is a type error, and it should be treated as an error. To inform the user via a message is fine, but code that calls `describe-variable' should be able to use `condition-case' to detect and handle a `wrong-type-argument' error. Yes, such code could also check the arg type itself, but that assumes that it knows that it is dealing with `describe-variable' and that that function expects a symbol arg. If there were some important reason why `describe-variable' should not raise an error in this context, I would understand why `error' was changed to `message'. For example, if a return value were tested in code that calls `describe-variable'. But I don't see that happening anywhere in the Emacs code. What's more, the return value is a string in either case (`message' returns the message; otherwise, the help string is returned), so the return type cannot be tested. I see no reason that an error shouldn't be raised. > Beyond that, why not let `describe-variable' try a little harder, to use > `intern' applied to its arg, if that is a string? > > That would be friendlier to possible 3rd-party code that might generically > apply a function such as `describe-variable' to an arg that might be a > symbol name instead of a symbol. In sum, I'd like to see the treatment of an arg that is not a bound symbol be: . If an unbound symbol, raise an error saying so. . If a string, intern it and try again using the resulting symbol. . If any other type, raise a type error. ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: describe-variable with string arg 2007-03-23 22:57 ` Drew Adams @ 2007-03-23 23:57 ` Drew Adams 0 siblings, 0 replies; 5+ messages in thread From: Drew Adams @ 2007-03-23 23:57 UTC (permalink / raw) To: Emacs-Devel Similarly, I think it would be good if `describe-function' tried to see if a string arg was the name of a function, before interpreting the arg as a keyboard macro. That is, it would be useful for (describe-function "forward-char") to do the same thing that (describe-function 'forward-char) does. Instead, it insists that its arg is a keyboard macro, and displays this: "forward-char" is a keyboard macro. Macro: f o r w a r d - c h a r Keyboard macro. I don't think that's particularly helpful, but first trying to intern its arg and see if that symbol has a function definition would be useful. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-03-23 23:57 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <46045DA3.9000709@gmail.com> 2007-03-23 23:15 ` describe-variable with string arg Drew Adams 2007-03-23 22:37 Drew Adams 2007-03-23 22:52 ` Stefan Monnier 2007-03-23 22:57 ` Drew Adams 2007-03-23 23:57 ` Drew Adams
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.