unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help hyperlinks only work when auto-compression-mode is enabled.
@ 2007-06-10 10:11 Alan Mackenzie
  2007-06-10 19:26 ` Stefan Monnier
  2007-06-10 21:00 ` Richard Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: Alan Mackenzie @ 2007-06-10 10:11 UTC (permalink / raw)
  To: emacs-devel

Hi, Emacs!

Emacs -Q
M-x auto-compression-mode
C-h f revert-buffer
C-x o    <tab>            ; Point is now over `files.el'
<CR>                      ; To go to the definition of `revert-buffer'

This gives the error message "Can't find library files.el".  The reason
for this is that the source is actually in files.el.gz, and this can
only be read when auto-compression-mode is enabled.  This is not good;
even though a-c-m is enabled by default, our help system should still
work if a user disables a-c-m (OUTCH!!! ;-).   This can even happen by
accident, for example when a user had "(auto-compression-mode)" in his
Emacs-21 .emacs when he really wanted "(auto-compression-mode 1)".

The solution is to surround the calls that visit the source with
`with-auto-compression-mode'.  Kudos to the genius who had the foresight
to write `with-auto-compression-mode', and thanks again to Johan
Bockgård who showed me yesterday where the help-mode source code was.

Here's a patch: I suggest I install it into both EMACS_22_BASE and the
trunk:


2007-06-10  Alan Mackenzie  <acm@muc.de>

	* help-mode.el (help-function-def, help-variable-def,
	help-face-def): Use `with-auto-compression-mode'.


Index: help-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help-mode.el,v
	retrieving revision 1.51
	diff -c -r1.51 help-mode.el
*** help-mode.el	21 Jan 2007 03:53:11 -0000	1.51
--- help-mode.el	10 Jun 2007 08:24:29 -0000
***************
*** 155,161 ****
  		   ;; Don't use find-function-noselect because it follows
  		   ;; aliases (which fails for built-in functions).
  		   (let ((location
! 			  (find-function-search-for-symbol fun nil file)))
  		     (pop-to-buffer (car location))
  		     (if (cdr location)
  			 (goto-char (cdr location))
--- 155,162 ----
  		   ;; Don't use find-function-noselect because it follows
  		   ;; aliases (which fails for built-in functions).
  		   (let ((location
! 			  (with-auto-compression-mode
! 			    (find-function-search-for-symbol fun nil file))))
  		     (pop-to-buffer (car location))
  		     (if (cdr location)
  			 (goto-char (cdr location))
***************
*** 167,173 ****
    'help-function (lambda (var &optional file)
  		   (when (eq file 'C-source)
  		     (setq file (help-C-file-name var 'var)))
! 		   (let ((location (find-variable-noselect var file)))
  		     (pop-to-buffer (car location))
  		     (if (cdr location)
  		       (goto-char (cdr location))
--- 168,176 ----
    'help-function (lambda (var &optional file)
  		   (when (eq file 'C-source)
  		     (setq file (help-C-file-name var 'var)))
! 		   (let ((location
! 			  (with-auto-compression-mode
! 			    (find-variable-noselect var file))))
  		     (pop-to-buffer (car location))
  		     (if (cdr location)
  		       (goto-char (cdr location))
***************
*** 181,187 ****
  		   ;; Don't use find-function-noselect because it follows
  		   ;; aliases (which fails for built-in functions).
  		   (let ((location
! 			  (find-function-search-for-symbol fun 'defface file)))
  		     (pop-to-buffer (car location))
  		     (if (cdr location)
  			 (goto-char (cdr location))
--- 184,191 ----
  		   ;; Don't use find-function-noselect because it follows
  		   ;; aliases (which fails for built-in functions).
  		   (let ((location
! 			  (with-auto-compression-mode
! 			    (find-function-search-for-symbol fun 'defface file))))
  		     (pop-to-buffer (car location))
  		     (if (cdr location)
  			 (goto-char (cdr location))



-- 
Alan Mackenzie (Ittersbach, Germany)

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-10 10:11 Help hyperlinks only work when auto-compression-mode is enabled Alan Mackenzie
@ 2007-06-10 19:26 ` Stefan Monnier
  2007-06-10 21:04   ` Alan Mackenzie
  2007-06-10 21:00 ` Richard Stallman
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-06-10 19:26 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

> Hi, Emacs!
> Emacs -Q
> M-x auto-compression-mode
> C-h f revert-buffer
> C-x o    <tab>            ; Point is now over `files.el'
> <CR>                      ; To go to the definition of `revert-buffer'

> This gives the error message "Can't find library files.el".  The reason
> for this is that the source is actually in files.el.gz, and this can
> only be read when auto-compression-mode is enabled.

Who compressed files.el?  I don't think this is a standard procedure.
Or were you using a version of Emacs packaged by some distribution
like Debian?  If so, please complain to them.

> This is not good; even though a-c-m is enabled by default, our help system
> should still work if a user disables a-c-m (OUTCH!!! ;-).

Most of the help still works.  You just can't jump to the source code
as easily.

I'm not absolutely opposed to your patch, but I don't really like it and
find its need very debatable.


        Stefan

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-10 10:11 Help hyperlinks only work when auto-compression-mode is enabled Alan Mackenzie
  2007-06-10 19:26 ` Stefan Monnier
@ 2007-06-10 21:00 ` Richard Stallman
  2007-06-10 23:49   ` Alan Mackenzie
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2007-06-10 21:00 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

    2007-06-10  Alan Mackenzie  <acm@muc.de>

	    * help-mode.el (help-function-def, help-variable-def,
	    help-face-def): Use `with-auto-compression-mode'.

The right way to format that, according to our conventions, is

    2007-06-10  Alan Mackenzie  <acm@muc.de>

	    * help-mode.el (help-function-def, help-variable-def)
	    (help-face-def): Use `with-auto-compression-mode'.

The code looks correct.  But would it be better to do this
in the subroutines in find-func.el?

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-10 19:26 ` Stefan Monnier
@ 2007-06-10 21:04   ` Alan Mackenzie
  2007-06-11  1:11     ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Mackenzie @ 2007-06-10 21:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

'Evening, Stefan!

On Sun, Jun 10, 2007 at 03:26:56PM -0400, Stefan Monnier wrote:
> > Emacs -Q
> > M-x auto-compression-mode
> > C-h f revert-buffer
> > C-x o    <tab>            ; Point is now over `files.el'
> > <CR>                      ; To go to the definition of `revert-buffer'

> > This gives the error message "Can't find library files.el".  The reason
> > for this is that the source is actually in files.el.gz, and this can
> > only be read when auto-compression-mode is enabled.

> Who compressed files.el?  I don't think this is a standard procedure.
> Or were you using a version of Emacs packaged by some distribution
> like Debian?  If so, please complain to them.

It's done by our very own "make install".  The change was made in
makefile.in V1.305 on 2005-09-15.  I'm not sure I like it either.

> > This is not good; even though a-c-m is enabled by default, our help
> > system should still work if a user disables a-c-m (OUTCH!!! ;-).

> Most of the help still works.  You just can't jump to the source code
> as easily.

You have to open it with C-x C-f.  You also have to type in something
like /usr/local/share/emacs/22.1/lisp/files.el (difficult to remember),
too.

> I'm not absolutely opposed to your patch, but I don't really like it and
> find its need very debatable.

Well, in that case, I think we should refrain from gzipping all the
source files.  But given how unhelpful the error message is and how
difficult it is to track the problem down, _something_ needs to be
fixed.

>         Stefan

-- 
Alan.

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-10 21:00 ` Richard Stallman
@ 2007-06-10 23:49   ` Alan Mackenzie
  2007-06-12 16:00     ` Richard Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Mackenzie @ 2007-06-10 23:49 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel

Hi, Richard.

On Sun, Jun 10, 2007 at 05:00:35PM -0400, Richard Stallman wrote:
>     2007-06-10  Alan Mackenzie  <acm@muc.de>
> 
> 	    * help-mode.el (help-function-def, help-variable-def,
> 	    help-face-def): Use `with-auto-compression-mode'.
> 
> The right way to format that, according to our conventions, is

>     2007-06-10  Alan Mackenzie  <acm@muc.de>
> 
> 	    * help-mode.el (help-function-def, help-variable-def)
> 	    (help-face-def): Use `with-auto-compression-mode'.

Sorry about that.
 
> The code looks correct.  But would it be better to do this in the
> subroutines in find-func.el?
 
I don't think so.  Anybody who's knowingly disabled auto-compression-mode
will have a good reason for doing so, and will surely know what she's
doing.  She won't want the find-func functions to find foo.el.gz.  Maybe
there's a stable foo.el.gz higher on the search path, and there's an
foo.el being actively developed.  Maybe some source files are being
compressed to hide them.

However, this user didn't ask for the Emacs-22 sources to be compressed,
any more than I did.  It just happened with the "make install".  So we're
entitled to see these sources on clicking the hyperlink in C-h f.

If we were to put the fix in `find-function-search-for-symbol' (or even
lower), this would identify these two cases which should remain distinct.

So I think the fix should be in help-mode.el.

-- 
Alan.

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-10 21:04   ` Alan Mackenzie
@ 2007-06-11  1:11     ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-06-11  1:11 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

>> Who compressed files.el?  I don't think this is a standard procedure.
>> Or were you using a version of Emacs packaged by some distribution
>> like Debian?  If so, please complain to them.

> It's done by our very own "make install".  The change was made in
> makefile.in V1.305 on 2005-09-15.  I'm not sure I like it either.

Duh!  I stand corrected.  Sorry about my rant, please just disregard it.


        Stefan

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-10 23:49   ` Alan Mackenzie
@ 2007-06-12 16:00     ` Richard Stallman
  2007-06-15 22:35       ` Alan Mackenzie
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2007-06-12 16:00 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

    I don't think so.  Anybody who's knowingly disabled auto-compression-mode
    will have a good reason for doing so, and will surely know what she's
    doing.

Yes.

	    She won't want the find-func functions to find foo.el.gz.

I am not convinced that follows.

    However, this user didn't ask for the Emacs-22 sources to be compressed,
    any more than I did.  It just happened with the "make install".  So we're
    entitled to see these sources on clicking the hyperlink in C-h f.

Yes, and the same argument applies to the functions in find-func.

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-12 16:00     ` Richard Stallman
@ 2007-06-15 22:35       ` Alan Mackenzie
  2007-06-16 18:50         ` Richard Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Mackenzie @ 2007-06-15 22:35 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel

'Evening, Richard!

[ Quick recap of the problem:  Disable auto-compression-mode; do C-h f
  revert-buffer <CR>.  Put point over `file.el' and press <CR>.  The
  source file doesn't appear, because Emacs-22's "make install"
  compresses our source. ]

On Tue, Jun 12, 2007 at 12:00:11PM -0400, Richard Stallman wrote:
>     I don't think so.  Anybody who's knowingly disabled auto-compression-mode
>     will have a good reason for doing so, and will surely know what she's
>     doing.
> 
> Yes.
> 
> 	    She won't want the find-func functions to find foo.el.gz.
> 
> I am not convinced that follows.
> 
>     However, this user didn't ask for the Emacs-22 sources to be compressed,
>     any more than I did.  It just happened with the "make install".  So we're
>     entitled to see these sources on clicking the hyperlink in C-h f.
> 
> Yes, and the same argument applies to the functions in find-func.

Apologies:  When I wrote my two posts in this thread, I'd convinced
myself that my patch fixed the problem purely for the Emacs sources.
Which is complete and utter nonsense, of course.

The only way to uncompress _only_ the emacs sources is to create some
variable containing "/usr/local/share/emacs/22.1/lisp" and test it.
YUCK!!  I don't think that's the right thing to do.

We either decide that that <CR> will ALWAYS find compressed files in
that context, or we accept the hit with C-h f and disabled a-c-m.  I
don't think the latter is acceptable, since we don't output an error
message which is at all helpful.

I think the best thing is NOT to compress our source files with "make
install".  The compressed lisp directory contains 9.5 Mb of .el.gz
files.  Uncompressed, it's a bit around 38.5 Mb.  This saving of ~30 Mb
doesn't seem worth the hassle it causes.

What do people think?

-- 
Alan Mackenzie (Ittersbach, Germany)

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

* Re: Help hyperlinks only work when auto-compression-mode is enabled.
  2007-06-15 22:35       ` Alan Mackenzie
@ 2007-06-16 18:50         ` Richard Stallman
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2007-06-16 18:50 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

    The only way to uncompress _only_ the emacs sources ...

I don't think we need to make it a goal to uncompress _only_ the Emacs
sources.

    We either decide that that <CR> will ALWAYS find compressed files in
    that context, or we accept the hit with C-h f and disabled a-c-m.

I think the former is a fine choice, and changing find-func is a fine
implementation.

    I think the best thing is NOT to compress our source files with "make
    install".  The compressed lisp directory contains 9.5 Mb of .el.gz
    files.  Uncompressed, it's a bit around 38.5 Mb.  This saving of ~30 Mb
    doesn't seem worth the hassle it causes.

It is not a lot of hassle, and 38mb is still significant.

How about making the fix in find-func?

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

end of thread, other threads:[~2007-06-16 18:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-10 10:11 Help hyperlinks only work when auto-compression-mode is enabled Alan Mackenzie
2007-06-10 19:26 ` Stefan Monnier
2007-06-10 21:04   ` Alan Mackenzie
2007-06-11  1:11     ` Stefan Monnier
2007-06-10 21:00 ` Richard Stallman
2007-06-10 23:49   ` Alan Mackenzie
2007-06-12 16:00     ` Richard Stallman
2007-06-15 22:35       ` Alan Mackenzie
2007-06-16 18:50         ` Richard Stallman

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