unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* The source linke in the help buffer
@ 2008-09-24 10:16 Lennart Borgman (gmail)
  2008-09-24 12:18 ` martin rudalics
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-24 10:16 UTC (permalink / raw)
  To: Emacs Devel

The source link in the help buffer now includes th whole path. Is this
the intention now?

What happened with the possibility to go to a checked out source file
instead of the file in the installed elisp tree?




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

* Re: The source linke in the help buffer
  2008-09-24 10:16 The source linke in the help buffer Lennart Borgman (gmail)
@ 2008-09-24 12:18 ` martin rudalics
  2008-09-24 12:53   ` Lennart Borgman
  2008-09-24 14:31   ` Stefan Monnier
  0 siblings, 2 replies; 19+ messages in thread
From: martin rudalics @ 2008-09-24 12:18 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

 > The source link in the help buffer now includes th whole path. Is this
 > the intention now?

It was _my_ intention in reaction to bug#587 you filed.

 > What happened with the possibility to go to a checked out source file
 > instead of the file in the installed elisp tree?

How would Emacs reliably know where the "checked out" file is?  Where
would you want to go after an update from the repository but before you
remade or recompiled?  And where would you want to go when you redefine
a function from a checked-out file and evaluated that definition?

If people think that's useful we can introduce variables like
`emacs-lisp-source-directory' and `emacs-C-source-directory' and have
help go find them there if these are non-nil.  We can also make an
optional, second link for this in the help-buffer, let `find-function'
use the same approach (obsoleting `find-function-C-source-directory'),
and many more.

martin




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

* Re: The source linke in the help buffer
  2008-09-24 12:18 ` martin rudalics
@ 2008-09-24 12:53   ` Lennart Borgman
  2008-09-24 13:20     ` martin rudalics
  2008-09-24 14:31   ` Stefan Monnier
  1 sibling, 1 reply; 19+ messages in thread
From: Lennart Borgman @ 2008-09-24 12:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

On 9/24/08, martin rudalics <rudalics@gmx.at> wrote:
> > The source link in the help buffer now includes th whole path. Is this
> > the intention now?
>
> It was _my_ intention in reaction to bug#587 you filed.

Hi Martin, thanks for fixing it. I did not follow the discussion that
closely. I remembered that someone said that the directory was
stripped to early, but maybe the full path is not needed if the file
belongs to Emacs?


> > What happened with the possibility to go to a checked out source file
> > instead of the file in the installed elisp tree?
>
> How would Emacs reliably know where the "checked out" file is?  Where
> would you want to go after an update from the repository but before you
> remade or recompiled?  And where would you want to go when you redefine
> a function from a checked-out file and evaluated that definition?

I was more thinking about a way to go to the checked out elisp source
file from the elisp file you are visiting. That is pretty useful for
me at least. This is what I use now:

  (defun find-emacs-source-file ()
    "Find checked out Emacs source corresponding to buffer file.
  Display it in other window."
    (interactive)
    (let* ((install-directory
           (file-name-as-directory (expand-file-name
                                    ".." exec-directory)))
           (relative-install
            (file-relative-name (buffer-file-name)
                                install-directory))
           source-file)
      (when (string= ".." (substring relative-install
                                     0 2))
        (error "This file is not in Emacs lisp tree"))
      (setq source-file (expand-file-name
                         relative-install
                         source-directory))
      (find-file-other-window source-file)))

Maybe it could go to the same line etc.

> If people think that's useful we can introduce variables like
> `emacs-lisp-source-directory' and `emacs-C-source-directory' and have
> help go find them there if these are non-nil.  We can also make an
> optional, second link for this in the help-buffer, let `find-function'
> use the same approach (obsoleting
> `find-function-C-source-directory'),
> and many more.
>
> martin
>




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

* Re: The source linke in the help buffer
  2008-09-24 12:53   ` Lennart Borgman
@ 2008-09-24 13:20     ` martin rudalics
  2008-09-24 13:51       ` Lennart Borgman
  0 siblings, 1 reply; 19+ messages in thread
From: martin rudalics @ 2008-09-24 13:20 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs Devel

 > I was more thinking about a way to go to the checked out elisp source
 > file from the elisp file you are visiting. That is pretty useful for
 > me at least. This is what I use now:
 >
 >   (defun find-emacs-source-file ()

In which context do you use this now?

martin




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

* Re: The source linke in the help buffer
  2008-09-24 13:20     ` martin rudalics
@ 2008-09-24 13:51       ` Lennart Borgman
  2008-09-24 13:53         ` martin rudalics
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman @ 2008-09-24 13:51 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

On 9/24/08, martin rudalics <rudalics@gmx.at> wrote:
> > I was more thinking about a way to go to the checked out elisp source
> > file from the elisp file you are visiting. That is pretty useful for
> > me at least. This is what I use now:
> >
> >   (defun find-emacs-source-file ()
>
> In which context do you use this now?


I usually test different changes in the installed Emacs tree and then
I move them to the checked out sources.

To do that I may call the function I sent and then for example use ediff.




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

* Re: The source linke in the help buffer
  2008-09-24 13:51       ` Lennart Borgman
@ 2008-09-24 13:53         ` martin rudalics
  2008-09-24 14:05           ` Lennart Borgman
  0 siblings, 1 reply; 19+ messages in thread
From: martin rudalics @ 2008-09-24 13:53 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs Devel

 > I usually test different changes in the installed Emacs tree and then
 > I move them to the checked out sources.
 >
 > To do that I may call the function I sent and then for example use ediff.

I understand that such a function can be useful.  But how does this
relate to _help buffers_?

martin




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

* Re: The source linke in the help buffer
  2008-09-24 13:53         ` martin rudalics
@ 2008-09-24 14:05           ` Lennart Borgman
  2008-09-24 14:12             ` martin rudalics
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman @ 2008-09-24 14:05 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

On 9/24/08, martin rudalics <rudalics@gmx.at> wrote:
> > I usually test different changes in the installed Emacs tree and then
> > I move them to the checked out sources.
> >
> > To do that I may call the function I sent and then for example use ediff.
>
> I understand that such a function can be useful.  But how does this
> relate to _help buffers_?

It doesn't of course, sorry for the bad mixing of things here.
(However before your changes the link in the help buffer could lead
either to the installed tree or the checked out tree.)




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

* Re: The source linke in the help buffer
  2008-09-24 14:05           ` Lennart Borgman
@ 2008-09-24 14:12             ` martin rudalics
  2008-09-24 16:05               ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 19+ messages in thread
From: martin rudalics @ 2008-09-24 14:12 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs Devel

 > It doesn't of course, sorry for the bad mixing of things here.
 > (However before your changes the link in the help buffer could lead
 > either to the installed tree or the checked out tree.)

But your function doesn't check these links.  So what can I do to help
you?  The function you're using seems to accomplish all you need.

martin




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

* Re: The source linke in the help buffer
  2008-09-24 12:18 ` martin rudalics
  2008-09-24 12:53   ` Lennart Borgman
@ 2008-09-24 14:31   ` Stefan Monnier
  2008-09-24 14:57     ` martin rudalics
  1 sibling, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2008-09-24 14:31 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman (gmail), Emacs Devel

>> The source link in the help buffer now includes th whole path. Is this
>> the intention now?
> It was _my_ intention in reaction to bug#587 you filed.

I think it's a bad change.  We should only print the file name relative
to the load-path.


        Stefan




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

* Re: The source linke in the help buffer
  2008-09-24 14:31   ` Stefan Monnier
@ 2008-09-24 14:57     ` martin rudalics
  2008-09-24 15:42       ` Chong Yidong
  2008-09-24 16:46       ` Stefan Monnier
  0 siblings, 2 replies; 19+ messages in thread
From: martin rudalics @ 2008-09-24 14:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lennart Borgman (gmail), Emacs Devel

> I think it's a bad change.  We should only print the file name relative
> to the load-path.

And the absolute name when the file is not in the load-path?

martin





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

* Re: The source linke in the help buffer
  2008-09-24 14:57     ` martin rudalics
@ 2008-09-24 15:42       ` Chong Yidong
  2008-09-24 16:15         ` martin rudalics
  2008-09-24 16:46       ` Stefan Monnier
  1 sibling, 1 reply; 19+ messages in thread
From: Chong Yidong @ 2008-09-24 15:42 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman (gmail), Stefan Monnier, Emacs Devel

martin rudalics <rudalics@gmx.at> writes:

>> I think it's a bad change.  We should only print the file name relative
>> to the load-path.
>
> And the absolute name when the file is not in the load-path?

I think the idea is to put the absolute name in the button property, and
to print the relative name in the buffer itself.




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

* Re: The source linke in the help buffer
  2008-09-24 14:12             ` martin rudalics
@ 2008-09-24 16:05               ` Lennart Borgman (gmail)
  2008-09-24 21:48                 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-24 16:05 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

martin rudalics wrote:
>> It doesn't of course, sorry for the bad mixing of things here.
>> (However before your changes the link in the help buffer could lead
>> either to the installed tree or the checked out tree.)
> 
> But your function doesn't check these links.  So what can I do to help
> you?  The function you're using seems to accomplish all you need.

Sorry for beeing unclear. I was (a bit too implicity) saying that
instead of the variables you suggested to make the help buffer link go
to either the install or the source tree it would suffice with a
function like the one I provided.

I think it would be good if this function shared room with find-function
and its relatives inside Emacs.




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

* Re: The source linke in the help buffer
  2008-09-24 15:42       ` Chong Yidong
@ 2008-09-24 16:15         ` martin rudalics
  2008-09-24 16:51           ` Chong Yidong
  0 siblings, 1 reply; 19+ messages in thread
From: martin rudalics @ 2008-09-24 16:15 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Lennart Borgman (gmail), Stefan Monnier, Emacs Devel

> I think the idea is to put the absolute name in the button property, and
> to print the relative name in the buffer itself.

OK.  I did that.

martin





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

* Re: The source linke in the help buffer
  2008-09-24 14:57     ` martin rudalics
  2008-09-24 15:42       ` Chong Yidong
@ 2008-09-24 16:46       ` Stefan Monnier
  2008-09-25  9:11         ` martin rudalics
  1 sibling, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2008-09-24 16:46 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman (gmail), Emacs Devel

>> I think it's a bad change.  We should only print the file name relative
>> to the load-path.

> And the absolute name when the file is not in the load-path?

Yes.


        Stefan




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

* Re: The source linke in the help buffer
  2008-09-24 16:15         ` martin rudalics
@ 2008-09-24 16:51           ` Chong Yidong
  0 siblings, 0 replies; 19+ messages in thread
From: Chong Yidong @ 2008-09-24 16:51 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman (gmail), Stefan Monnier, Emacs Devel

martin rudalics <rudalics@gmx.at> writes:

>> I think the idea is to put the absolute name in the button property, and
>> to print the relative name in the buffer itself.
>
> OK.  I did that.

Looks good.  Thanks!




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

* Re: The source linke in the help buffer
  2008-09-24 16:05               ` Lennart Borgman (gmail)
@ 2008-09-24 21:48                 ` Lennart Borgman (gmail)
  2008-09-25  9:11                   ` martin rudalics
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-24 21:48 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

Lennart Borgman (gmail) wrote:
> martin rudalics wrote:
>>> It doesn't of course, sorry for the bad mixing of things here.
>>> (However before your changes the link in the help buffer could lead
>>> either to the installed tree or the checked out tree.)
>> But your function doesn't check these links.  So what can I do to help
>> you?  The function you're using seems to accomplish all you need.
> 
> Sorry for beeing unclear. I was (a bit too implicity) saying that
> instead of the variables you suggested to make the help buffer link go
> to either the install or the source tree it would suffice with a
> function like the one I provided.
> 
> I think it would be good if this function shared room with find-function
> and its relatives inside Emacs.

But I think this version would live a more pleasant and longer life there:

(defun find-emacs-other-file (display-file)
  "Find corresponding file to source or installed elisp file.
If you have checked out and compiled Emacs yourself you may have
Emacs lisp files in two places, the checked out source tree and
the installed Emacs tree.  If buffer contains an Emacs elisp file
in one of these places then find the corresponding elisp file in
the other place. Return the file name of this file.

When DISPLAY-FILE is non-nil display this file in other window
and go to the same line number as in the current buffer."
  (interactive (list t))
  (unless (buffer-file-name)
    (error "This buffer is not visiting a file"))
  (unless source-directory
    (error "Can't find the checked out Emacs sources"))
  (let* ((installed-directory (file-name-as-directory
                               (expand-file-name ".." exec-directory)))
         (relative-installed (file-relative-name
                              (buffer-file-name) installed-directory))
         (relative-source (file-relative-name
                           (buffer-file-name) source-directory))
         (name-nondir (file-name-nondirectory (buffer-file-name)))
         source-file
         installed-file
         other-file
         (line-num (line-number-at-pos)))
    (cond
     ((and relative-installed
           (not (string= name-nondir relative-installed))
           (not (file-name-absolute-p relative-installed))
           (not (string= ".." (substring relative-installed 0 2))))
      (setq source-file (expand-file-name relative-installed
source-directory)))
     ((and relative-source
           (not (string= name-nondir relative-source))
           (not (file-name-absolute-p relative-source))
           (not (string= ".." (substring relative-source 0 2))))
      (setq installed-file (expand-file-name relative-source
installed-directory))))
    (setq other-file (or source-file installed-file))
    (unless other-file
      (error "This file is not in Emacs source or installed lisp tree"))
    (unless (file-exists-p other-file)
      (error "Can't find the corresponding file %s" other-file))
    (when display-file
      (find-file-other-window other-file)
      (goto-line line-num))
    other-file))




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

* Re: The source linke in the help buffer
  2008-09-24 16:46       ` Stefan Monnier
@ 2008-09-25  9:11         ` martin rudalics
  0 siblings, 0 replies; 19+ messages in thread
From: martin rudalics @ 2008-09-25  9:11 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lennart Borgman (gmail), Emacs Devel

 >>> I think it's a bad change.  We should only print the file name relative
 >>> to the load-path.
 >
 >> And the absolute name when the file is not in the load-path?
 >
 > Yes.

Meanwhile I implemented Chong's suggestion.  If you think it's still bad
please tell me.

martin





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

* Re: The source linke in the help buffer
  2008-09-24 21:48                 ` Lennart Borgman (gmail)
@ 2008-09-25  9:11                   ` martin rudalics
  2008-09-25  9:59                     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 19+ messages in thread
From: martin rudalics @ 2008-09-25  9:11 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

 > But I think this version would live a more pleasant and longer life there:
 >
 > (defun find-emacs-other-file (display-file)
 > [...]

I see.  But this is no more related to `help' or `find-function'.

martin





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

* Re: The source linke in the help buffer
  2008-09-25  9:11                   ` martin rudalics
@ 2008-09-25  9:59                     ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 19+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-25  9:59 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

martin rudalics wrote:
>> But I think this version would live a more pleasant and longer life
> there:
>>
>> (defun find-emacs-other-file (display-file)
>> [...]
> 
> I see.  But this is no more related to `help' or `find-function'.


Yes, I should propably has avoid mixing those things.

But find-emacs-other-file is very much related to the use of
find-function. Typically a user/developer would first use find-function
(or the link in the help buffer) and then find-emacs-other-file.

Thanks for working on fixing the problem with the help buffer link.




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

end of thread, other threads:[~2008-09-25  9:59 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24 10:16 The source linke in the help buffer Lennart Borgman (gmail)
2008-09-24 12:18 ` martin rudalics
2008-09-24 12:53   ` Lennart Borgman
2008-09-24 13:20     ` martin rudalics
2008-09-24 13:51       ` Lennart Borgman
2008-09-24 13:53         ` martin rudalics
2008-09-24 14:05           ` Lennart Borgman
2008-09-24 14:12             ` martin rudalics
2008-09-24 16:05               ` Lennart Borgman (gmail)
2008-09-24 21:48                 ` Lennart Borgman (gmail)
2008-09-25  9:11                   ` martin rudalics
2008-09-25  9:59                     ` Lennart Borgman (gmail)
2008-09-24 14:31   ` Stefan Monnier
2008-09-24 14:57     ` martin rudalics
2008-09-24 15:42       ` Chong Yidong
2008-09-24 16:15         ` martin rudalics
2008-09-24 16:51           ` Chong Yidong
2008-09-24 16:46       ` Stefan Monnier
2008-09-25  9:11         ` martin rudalics

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