GNU bug report logs - #8297
expand self-documentation to show where things are redefined, etc

Previous Next

Package: emacs;

Reported by: Florian Beck <fb <at> miszellen.de>

Date: Sun, 20 Mar 2011 01:06:01 UTC

Severity: wishlist

To reply to this bug, email your comments to 8297 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8297; Package emacs. (Sun, 20 Mar 2011 01:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Florian Beck <fb <at> miszellen.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 20 Mar 2011 01:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Florian Beck <fb <at> miszellen.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Request: Better Emacs self-documentation for customization
Date: Sun, 20 Mar 2011 01:07:46 +0100
Emacs integrates any function I write into its documentation; the help 
function provides a link to the source.

What I would like is for Emacs to track my customisations:

 - When I redefine an Emacs function I would like a link to the 
previous/original definition, `describe-function' only provides a link 
to the current one.
 - 'describe-variable', on the other hand, remembers the original 
definition, but doesn't remember the place where I changed the value.
 - `describe-key' only provides a link to the function, not to the 
place the key was defined.

Obviously, this is not easy, because evaluations don't necessarily have 
a fixed place and key bindings can be defined in many ways. Regardless, 
I think this is something on which Emacs could improve.

-- 
Florian Beck




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8297; Package emacs. (Tue, 22 Mar 2011 00:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 8297 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Florian Beck <fb <at> miszellen.de>
Cc: 8297 <at> debbugs.gnu.org
Subject: Re: bug#8297: Request: Better Emacs self-documentation for
	customization
Date: Mon, 21 Mar 2011 18:00:09 -0400
severity 8297 wishlist
thanks

> What I would like is for Emacs to track my customisations:

>  - When I redefine an Emacs function I would like a link to the
> previous/original definition, `describe-function' only provides a link to
> the current one.

I'd like to improve the support for redefinition of functions, indeed.
I'm more interested in getting unload-feature to work more reliably, but
it could work for this as well: basically remember the
previous definitions.

Note that for your case, another option is to use a defadvice, and
indeed defadvice should also add a hyperlink to the advice.

>  - 'describe-variable', on the other hand, remembers the original
> definition, but doesn't remember the place where I changed the value.

That might turn out to be more difficult to track, but at least for some
simple cases (e.g. when the vlue is changed via `custom' functions rather
than via `setq') that should definitely be doable.  If the var was set
via `setq' it's more difficult since `setq' is a very low-level
primitive that needs to run fast.  But maybe we could somehow handle
`setq' outside of functions in a special way (these shouldn't impact
performance since they can't be in loops).

>  - `describe-key' only provides a link to the function, not to the place the
> key was defined.

That's also more difficult because OT1H `define-key' does not get much
information (it can check load-file-name, but it doesn't know the line
number, nor the name of the map it receives and neither does it know
reliably what the key description looks like in the source file, so it's
hard to do a regexp-search), and OTOH there's no place currently to
store that information, tho I guess we could keep it in some side
hash-table.

> Obviously, this is not easy, because evaluations don't necessarily
> have a fixed place and key bindings can be defined in many ways. Regardless,
> I think this is something on which Emacs could improve.

Agreed.  It's not high on my todo list, but I'll be happy to take
patches for those.  For defadvice it should be pretty easy, and for
function re-definitions it shouldn't be too hard either.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8297; Package emacs. (Tue, 22 Mar 2011 07:00:04 GMT) Full text and rfc822 format available.

Message #11 received at 8297 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Florian Beck <fb <at> miszellen.de>, 8297 <at> debbugs.gnu.org
Subject: Re: bug#8297: Request: Better Emacs self-documentation for
	customization
Date: Tue, 22 Mar 2011 07:59:10 +0100
On Mon, Mar 21, 2011 at 11:00 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>
>>  - `describe-key' only provides a link to the function, not to the place the
>> key was defined.
>
> That's also more difficult because OT1H `define-key' does not get much
> information (it can check load-file-name, but it doesn't know the line
> number, nor the name of the map it receives and neither does it know
> reliably what the key description looks like in the source file, so it's
> hard to do a regexp-search), and OTOH there's no place currently to
> store that information, tho I guess we could keep it in some side
> hash-table.

That would be good.

I have a hack that at least try to guess the map where a key is
defined. This is the function `describe-key-and-map-briefly' in
ourcomments-util.el in nXhtml. (It is a replacement for
`describe-key-briefly'.)




Changed bug title to 'expand self-documentation to show where things are redefined, etc' from 'Request: Better Emacs self-documentation for customization' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 22 Mar 2011 07:22:01 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8297; Package emacs. (Wed, 23 Mar 2011 09:00:04 GMT) Full text and rfc822 format available.

Message #16 received at 8297 <at> debbugs.gnu.org (full text, mbox):

From: Florian Beck <fb <at> miszellen.de>
To: 8297 <at> debbugs.gnu.org
Subject: Re: bug#8297: Request: Better Emacs self-documentation for
	customization
Date: Wed, 23 Mar 2011 09:59:37 +0100
On 03/21/2011 11:00 PM, Stefan Monnier wrote:

> Note that for your case, another option is to use a defadvice, and
> indeed defadvice should also add a hyperlink to the advice.

Right. So that one is not so urgent. It is only that I already have 
quite some redefined functions (from the emacs source or from 
third-party packages) and finding the original definition can be 
surprisingly difficult.

>
>>   - 'describe-variable', on the other hand, remembers the original
>> definition, but doesn't remember the place where I changed the value.
>
> That might turn out to be more difficult to track, but at least for some
> simple cases (e.g. when the vlue is changed via `custom' functions rather
> than via `setq') that should definitely be doable.  If the var was set
> via `setq' it's more difficult since `setq' is a very low-level
> primitive that needs to run fast.

Understood. Again, unfortunatly `setq' is what I have. Perhaps an 
old-fashioned but definitly valid way of customizing.

> But maybe we could somehow handle
> `setq' outside of functions in a special way (these shouldn't impact
> performance since they can't be in loops).

That would be great indeed.

>
>>   - `describe-key' only provides a link to the function, not to the place the
>> key was defined.
>
> That's also more difficult because OT1H `define-key' does not get much
> information (it can check load-file-name, but it doesn't know the line
> number, nor the name of the map it receives and neither does it know
> reliably what the key description looks like in the source file, so it's
> hard to do a regexp-search), and OTOH there's no place currently to
> store that information, tho I guess we could keep it in some side
> hash-table.

This one, on the other hand, is a major annoyance. Say, I use 
`global-set-key' to customize a key binding. I continue working with my 
emacs session, maybe for day. But the next time I start emacs, the 
binding is overwritten, because I defined the same key in some other file.

>
>> Obviously, this is not easy, because evaluations don't necessarily
>> have a fixed place and key bindings can be defined in many ways. Regardless,
>> I think this is something on which Emacs could improve.
>
> Agreed.  It's not high on my todo list, but I'll be happy to take
> patches for those.  For defadvice it should be pretty easy, and for
> function re-definitions it shouldn't be too hard either.
>
>
>          Stefan
>
>
>
>





This bug report was last modified 14 years and 85 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.