unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Source file not shown in help next to symbol
@ 2015-07-14 15:12 Ivan Kanis
  2015-07-15 21:26 ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Ivan Kanis @ 2015-07-14 15:12 UTC (permalink / raw)
  To: Emacs Development List

Hi,

I have noticed this problem 2 years ago. When I C-h f on one of my
compiled function I do not get a link to the source code anymore.

My emacs compiled file are not on the same directory as my source file.
I do this so that I can run different version of emacs.

find-lisp-object-file-name is now returning nil. In the function the
variable file-name is correct.

The last condition is looking in the compiled file for the source file.
I haven't seen anything in the byte compiler that generates the string
";;; from file" that it uses to indicate the source. It seems like dead
code to me.

I just removed the last bit so that it works for me.

Let me know if you want me to commit this to master.

Ivan

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 1c7a68a..c1bcab6 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -275,19 +275,7 @@ suitable file is found, return nil."
                    lib-name)
                file-name))
             ;; The next three forms are from `find-source-lisp-file'.
-            (elc-file (locate-file
-                       (concat file-name
-                               (if (string-match "\\.el\\'" file-name)
-                                   "c"
-                                 ".elc"))
-                       load-path nil 'readable))
-            (str (when elc-file
-                   (with-temp-buffer
-                     (insert-file-contents-literally elc-file nil 0 256)
-                     (buffer-string))))
-            (src-file (and str
-                           (string-match ";;; from file \\(.*\\.el\\)" str)
-                           (match-string 1 str))))
+            (src-file (locate-library file-name load-path nil 'readable)))
        (and src-file (file-readable-p src-file) src-file))))))
 
 (defun help-fns--key-bindings (function)



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

* Re: Source file not shown in help next to symbol
  2015-07-14 15:12 Source file not shown in help next to symbol Ivan Kanis
@ 2015-07-15 21:26 ` Stefan Monnier
  2015-07-16 12:09   ` Ivan Kanis
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-07-15 21:26 UTC (permalink / raw)
  To: Ivan Kanis; +Cc: Emacs Development List

> -            (elc-file (locate-file
> -                       (concat file-name
> -                               (if (string-match "\\.el\\'" file-name)
> -                                   "c"
> -                                 ".elc"))
> -                       load-path nil 'readable))
> -            (str (when elc-file
> -                   (with-temp-buffer
> -                     (insert-file-contents-literally elc-file nil 0 256)
> -                     (buffer-string))))
> -            (src-file (and str
> -                           (string-match ";;; from file \\(.*\\.el\\)" str)
> -                           (match-string 1 str))))

This code indeed looks weird.  Apparently it comes from elsewhere, so it
might need fixing elsewhere as well.

> +            (src-file (locate-library file-name load-path nil 'readable)))

Hmm... I don't understand why you pass `load-path' as the
`nosuffix' argument.


        Stefan



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

* Re: Source file not shown in help next to symbol
  2015-07-15 21:26 ` Stefan Monnier
@ 2015-07-16 12:09   ` Ivan Kanis
  2015-08-06 22:40     ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Ivan Kanis @ 2015-07-16 12:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Development List

Hi Stefan,

July, 15 at 17:26 Stefan wrote:

>> -            (elc-file (locate-file
>> -                       (concat file-name
>> -                               (if (string-match "\\.el\\'" file-name)
>> -                                   "c"
>> -                                 ".elc"))
>> -                       load-path nil 'readable))
>> -            (str (when elc-file
>> -                   (with-temp-buffer
>> -                     (insert-file-contents-literally elc-file nil 0 256)
>> -                     (buffer-string))))
>> -            (src-file (and str
>> -                           (string-match ";;; from file \\(.*\\.el\\)" str)
>> -                           (match-string 1 str))))
>
> This code indeed looks weird.  Apparently it comes from elsewhere, so it
> might need fixing elsewhere as well.

I confirm it's dead code.

The information it needs used to be in byte-compile-insert-header. Glenn
removed it with good reasons I think.

commit a6d63d97cd7f213a87630ab86119b469a89caeeb
Author: Glenn Morris <rgm@gnu.org>
Date:   Sat Apr 20 12:48:04 2013 -0700

    No longer include timestamp in header of .elc files
    
    This removes needless differences between files compiled at different
    times or by different people, or from sources in different locations.
    Ref: http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00187.html
    
    * lisp/emacs-lisp/bytecomp.el (byte-compile-insert-header):
    No longer include timestamp etc information.
    
    * etc/NEWS: Mention this.

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 5db1793..755d5f7 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1997,11 +1997,7 @@ Call from the source buffer."
       ;; >4    byte            x               version %d
       (insert
        ";ELC" 23 "\000\000\000\n"
-       ";;; Compiled by "
-       (or (and (boundp 'user-mail-address) user-mail-address)
-          (concat (user-login-name) "@" (system-name)))
-       " on " (current-time-string) "\n"
-       ";;; from file " filename "\n"
+       ";;; Compiled\n"
        ";;; in Emacs version " emacs-version "\n"
        ";;; with"
        (cond

>
>> +            (src-file (locate-library file-name load-path nil 'readable)))
>
> Hmm... I don't understand why you pass `load-path' as the
> `nosuffix' argument.

I got the bug by copying the form that computed the elc-file in the
original code. I put t instead and it works fine.

Ivan

-- 
It is easier to act yourself into a better way of feeling than to
feel yourself into a better way of action.
    -- O.H. Mowrer



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

* Re: Source file not shown in help next to symbol
  2015-07-16 12:09   ` Ivan Kanis
@ 2015-08-06 22:40     ` Stefan Monnier
  2015-08-08  9:27       ` Ivan Kanis
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-08-06 22:40 UTC (permalink / raw)
  To: Ivan Kanis; +Cc: Emacs Development List

> I got the bug by copying the form that computed the elc-file in the
> original code. I put t instead and it works fine.

Sorry, got side tracked by vacation and am a bit lost.  Can you send the
final patch you think should be applied?


        Stefan



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

* Re: Source file not shown in help next to symbol
  2015-08-06 22:40     ` Stefan Monnier
@ 2015-08-08  9:27       ` Ivan Kanis
  2015-08-08 20:54         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Ivan Kanis @ 2015-08-08  9:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Development List

August, 06 at 18:40 Stefan wrote:

>> I got the bug by copying the form that computed the elc-file in the
>> original code. I put t instead and it works fine.
>
> Sorry, got side tracked by vacation and am a bit lost.  Can you send the
> final patch you think should be applied?

Hi Stefan,

I have this patch running for a while and it seems fine. I made the
commit message today. I can push it if you think it's OK.

commit 3a4acdc5d99843ac883831e40cb1d8020df53d69
Author: Ivan Kanis <ivan@kanis.fr>
Date:   Tue Jul 14 17:04:11 2015 +0200

    fix link to source code in help window
    
    * lisp/help-fns.el (find-lisp-object-file-name): remove code that
    will never work due to Glenn Morris change a6d63d9 on Apr 20 2013
    'No longer include timestamp in header of .elc files'. Add code
    that will return .el source file in load-path.

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 1c7a68a..0836c7f 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -275,19 +275,7 @@ suitable file is found, return nil."
 		    lib-name)
 		file-name))
 	     ;; The next three forms are from `find-source-lisp-file'.
-	     (elc-file (locate-file
-			(concat file-name
-				(if (string-match "\\.el\\'" file-name)
-				    "c"
-				  ".elc"))
-			load-path nil 'readable))
-	     (str (when elc-file
-		    (with-temp-buffer
-		      (insert-file-contents-literally elc-file nil 0 256)
-		      (buffer-string))))
-	     (src-file (and str
-			    (string-match ";;; from file \\(.*\\.el\\)" str)
-			    (match-string 1 str))))
+	     (src-file (locate-library file-name t nil 'readable)))
 	(and src-file (file-readable-p src-file) src-file))))))
 
 (defun help-fns--key-bindings (function)

-- 
Our whole economy is base on planned obsolescence.
    -- Brooks Stevens



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

* Re: Source file not shown in help next to symbol
  2015-08-08  9:27       ` Ivan Kanis
@ 2015-08-08 20:54         ` Stefan Monnier
  2015-08-09  9:37           ` Ivan Kanis
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-08-08 20:54 UTC (permalink / raw)
  To: Ivan Kanis; +Cc: Emacs Development List

> I have this patch running for a while and it seems fine. I made the
> commit message today. I can push it if you think it's OK.

Yes, please push it, I think it's OK, thank you.


        Stefan



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

* Re: Source file not shown in help next to symbol
  2015-08-08 20:54         ` Stefan Monnier
@ 2015-08-09  9:37           ` Ivan Kanis
  2015-08-09 15:07             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Ivan Kanis @ 2015-08-09  9:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Development List

August, 08 at 16:54 Stefan wrote:

>> I have this patch running for a while and it seems fine. I made the
>> commit message today. I can push it if you think it's OK.
>
> Yes, please push it, I think it's OK, thank you.

OK it's done.



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

* Re: Source file not shown in help next to symbol
  2015-08-09  9:37           ` Ivan Kanis
@ 2015-08-09 15:07             ` Eli Zaretskii
  2015-08-10 12:50               ` Ivan Kanis
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2015-08-09 15:07 UTC (permalink / raw)
  To: Ivan Kanis; +Cc: emacs-devel

> From: Ivan Kanis <ivan@kanis.fr>
> Date: Sun, 09 Aug 2015 11:37:29 +0200
> Cc: Emacs Development List <emacs-devel@gnu.org>
> 
> August, 08 at 16:54 Stefan wrote:
> 
> >> I have this patch running for a while and it seems fine. I made the
> >> commit message today. I can push it if you think it's OK.
> >
> > Yes, please push it, I think it's OK, thank you.
> 
> OK it's done.

Thanks.  Please allow me a couple of minor comments about your log
entry:

    fix link to source code in help window
    ^^^
This should start with a capital F, as any English sentence.

    * lisp/help-fns.el (find-lisp-object-file-name): remove code that
                                                     ^^^^^^
Likewise.

    'No longer include timestamp in header of .elc files'. Add code
                                                         ^^
Two spaces between sentences, per US English conventions we use.



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

* Re: Source file not shown in help next to symbol
  2015-08-09 15:07             ` Eli Zaretskii
@ 2015-08-10 12:50               ` Ivan Kanis
  0 siblings, 0 replies; 9+ messages in thread
From: Ivan Kanis @ 2015-08-10 12:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

August, 09 at 18:07 Eli wrote:

> Thanks.  Please allow me a couple of minor comments about your log
> entry:
>
>     fix link to source code in help window
>     ^^^
> This should start with a capital F, as any English sentence.
>
>     * lisp/help-fns.el (find-lisp-object-file-name): remove code that
>                                                      ^^^^^^
> Likewise.
>
>     'No longer include timestamp in header of .elc files'. Add code
>                                                          ^^
> Two spaces between sentences, per US English conventions we use.
>

Thank you, I'll keep it in mind next time.

-- 
Knot in cables caused data stream to become twisted and kinked.
    -- BOFH excuse #61



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

end of thread, other threads:[~2015-08-10 12:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14 15:12 Source file not shown in help next to symbol Ivan Kanis
2015-07-15 21:26 ` Stefan Monnier
2015-07-16 12:09   ` Ivan Kanis
2015-08-06 22:40     ` Stefan Monnier
2015-08-08  9:27       ` Ivan Kanis
2015-08-08 20:54         ` Stefan Monnier
2015-08-09  9:37           ` Ivan Kanis
2015-08-09 15:07             ` Eli Zaretskii
2015-08-10 12:50               ` Ivan Kanis

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