all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#690: 23.0.60; Function origin file misremembered
@ 2008-08-11  0:43 Markus Triska
  2008-08-11  1:15 ` OFFICE ZERO
  2008-08-11  8:27 ` martin rudalics
  0 siblings, 2 replies; 10+ messages in thread
From: Markus Triska @ 2008-08-11  0:43 UTC (permalink / raw)
  To: emacs-pretest-bug


Let ~/prolog.el consist of the forms:

   (defun prolog-mode ()
     (interactive)
     (message "hi"))

   (provide 'prolog)

When I do "$ emacs -Q" and evaluate:

   (progn
     (add-to-list 'load-path "~/")
     (autoload 'prolog-mode "prolog" "Prolog mode" t)
     (prolog-mode))

the message "hi" is displayed, like every further time I evaluate
(prolog-mode). "C-h f prolog-mode RET" shows:

   prolog-mode is a Lisp function in `prolog.el'.

When I follow the link (`prolog.el'), it leads me to the wrong file,
namely ~/emacs/lisp/progmodes/prolog.el, i.e., part of Emacs source.


In GNU Emacs 23.0.60.1 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
 of 2008-08-08 on pnsgw1-client079.demo.tuwien.ac.at
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t







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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11  0:43 bug#690: 23.0.60; Function origin file misremembered Markus Triska
@ 2008-08-11  1:15 ` OFFICE ZERO
  2008-08-11  8:27 ` martin rudalics
  1 sibling, 0 replies; 10+ messages in thread
From: OFFICE ZERO @ 2008-08-11  1:15 UTC (permalink / raw)
  To: Markus Triska, 690

Do not send me any mail !
No thank you !!




----- Original Message ----- 
From: "Markus Triska" <markus.triska@gmx.at>
To: <emacs-pretest-bug@gnu.org>
Sent: Monday, August 11, 2008 9:43 AM
Subject: bug#690: 23.0.60; Function origin file misremembered


>
> Let ~/prolog.el consist of the forms:
>
>   (defun prolog-mode ()
>     (interactive)
>     (message "hi"))
>
>   (provide 'prolog)
>
> When I do "$ emacs -Q" and evaluate:
>
>   (progn
>     (add-to-list 'load-path "~/")
>     (autoload 'prolog-mode "prolog" "Prolog mode" t)
>     (prolog-mode))
>
> the message "hi" is displayed, like every further time I evaluate
> (prolog-mode). "C-h f prolog-mode RET" shows:
>
>   prolog-mode is a Lisp function in `prolog.el'.
>
> When I follow the link (`prolog.el'), it leads me to the wrong file,
> namely ~/emacs/lisp/progmodes/prolog.el, i.e., part of Emacs source.
>
>
> In GNU Emacs 23.0.60.1 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
> of 2008-08-08 on pnsgw1-client079.demo.tuwien.ac.at
> Windowing system distributor `The XFree86 Project, Inc', version 
> 11.0.40400000
> Important settings:
>  value of $LC_ALL: nil
>  value of $LC_COLLATE: nil
>  value of $LC_CTYPE: nil
>  value of $LC_MESSAGES: nil
>  value of $LC_MONETARY: nil
>  value of $LC_NUMERIC: nil
>  value of $LC_TIME: nil
>  value of $LANG: en.UTF-8
>  value of $XMODIFIERS: nil
>  locale-coding-system: nil
>  default-enable-multibyte-characters: t
>
>
>
>
> 







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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11  0:43 bug#690: 23.0.60; Function origin file misremembered Markus Triska
  2008-08-11  1:15 ` OFFICE ZERO
@ 2008-08-11  8:27 ` martin rudalics
  2008-08-11  8:46   ` Markus Triska
  1 sibling, 1 reply; 10+ messages in thread
From: martin rudalics @ 2008-08-11  8:27 UTC (permalink / raw)
  To: Markus Triska; +Cc: 690

 > "C-h f prolog-mode RET" shows:
 >
 >    prolog-mode is a Lisp function in `prolog.el'.
 >
 > When I follow the link (`prolog.el'), it leads me to the wrong file,
 > namely ~/emacs/lisp/progmodes/prolog.el, i.e., part of Emacs source.

Could you please try to instrument the function `find-source-lisp-file'
(in help-fns.el) for debugging before you do C-h f and tell me what it
finds?

martin







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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11  8:27 ` martin rudalics
@ 2008-08-11  8:46   ` Markus Triska
  2008-08-11  9:42     ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Triska @ 2008-08-11  8:46 UTC (permalink / raw)
  To: martin rudalics; +Cc: 690

martin rudalics <rudalics@gmx.at> writes:

> Could you please try to instrument the function `find-source-lisp-file'
> (in help-fns.el) for debugging before you do C-h f and tell me what it
> finds?

`describe-simplify-lib-file-name' already converts "/Users/mt/prolog.el"
to "prolog.el", which I think it should not do to preserve the origin.
`find-source-lisp-file' then expands it to the Emacs source file.






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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11  8:46   ` Markus Triska
@ 2008-08-11  9:42     ` martin rudalics
  2008-08-11 10:23       ` Lennart Borgman (gmail)
  2008-08-11 11:08       ` Markus Triska
  0 siblings, 2 replies; 10+ messages in thread
From: martin rudalics @ 2008-08-11  9:42 UTC (permalink / raw)
  To: Markus Triska; +Cc: 690

 >> Could you please try to instrument the function `find-source-lisp-file'
 >> (in help-fns.el) for debugging before you do C-h f and tell me what it
 >> finds?
 >
 > `describe-simplify-lib-file-name' already converts "/Users/mt/prolog.el"
 > to "prolog.el", which I think it should not do to preserve the origin.
 > `find-source-lisp-file' then expands it to the Emacs source file.

Maybe.  Any ideas how to do that without breaking the rest of the code?

IIUC the problem is with `find-source-lisp-file' which searches for an
`elc-file' that does not exist for _your_ prolog.el, finds the compiled,
built-in one instead, ...

martin







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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11  9:42     ` martin rudalics
@ 2008-08-11 10:23       ` Lennart Borgman (gmail)
  2008-08-11 12:08         ` martin rudalics
  2008-08-11 11:08       ` Markus Triska
  1 sibling, 1 reply; 10+ messages in thread
From: Lennart Borgman (gmail) @ 2008-08-11 10:23 UTC (permalink / raw)
  To: martin rudalics, 690; +Cc: Markus Triska

martin rudalics wrote:
>  >> Could you please try to instrument the function `find-source-lisp-file'
>  >> (in help-fns.el) for debugging before you do C-h f and tell me what it
>  >> finds?
>  >
>  > `describe-simplify-lib-file-name' already converts "/Users/mt/prolog.el"
>  > to "prolog.el", which I think it should not do to preserve the origin.
>  > `find-source-lisp-file' then expands it to the Emacs source file.
> 
> Maybe.  Any ideas how to do that without breaking the rest of the code?
> 
> IIUC the problem is with `find-source-lisp-file' which searches for an
> `elc-file' that does not exist for _your_ prolog.el, finds the compiled,
> built-in one instead, ...

How about checking file mod time?






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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11  9:42     ` martin rudalics
  2008-08-11 10:23       ` Lennart Borgman (gmail)
@ 2008-08-11 11:08       ` Markus Triska
  2008-08-11 12:09         ` martin rudalics
  2008-08-11 15:56         ` martin rudalics
  1 sibling, 2 replies; 10+ messages in thread
From: Markus Triska @ 2008-08-11 11:08 UTC (permalink / raw)
  To: martin rudalics; +Cc: 690

martin rudalics <rudalics@gmx.at> writes:

>> `describe-simplify-lib-file-name' already converts "/Users/mt/prolog.el"
>> to "prolog.el", which I think it should not do to preserve the origin.
>> `find-source-lisp-file' then expands it to the Emacs source file.

>  Any ideas how to do that without breaking the rest of the code?

I do not see much value in abbreviating the file name at all; unless
that is important for other features to work, I find that the original
file name should be preserved in case of doubt. (symbol-file
'prolog-mode) correctly evaluates to "/Users/mt/prolog.el", so this is
what should be shown. Otherwise, even future changes to load-path could
lead to distorted file origins of functions that are already loaded.






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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11 10:23       ` Lennart Borgman (gmail)
@ 2008-08-11 12:08         ` martin rudalics
  0 siblings, 0 replies; 10+ messages in thread
From: martin rudalics @ 2008-08-11 12:08 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: 690, Markus Triska

The mod time of Markus' prolog.el might more "accurately" reflect that
of the built-in prolog.elc than that of the built-in prolog.el for
whatever definition of "accurately" you provide :-(

martin







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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11 11:08       ` Markus Triska
@ 2008-08-11 12:09         ` martin rudalics
  2008-08-11 15:56         ` martin rudalics
  1 sibling, 0 replies; 10+ messages in thread
From: martin rudalics @ 2008-08-11 12:09 UTC (permalink / raw)
  To: Markus Triska; +Cc: 690

 > I do not see much value in abbreviating the file name at all; unless
 > that is important for other features to work, I find that the original
 > file name should be preserved in case of doubt. (symbol-file
 > 'prolog-mode) correctly evaluates to "/Users/mt/prolog.el", so this is
 > what should be shown. Otherwise, even future changes to load-path could
 > lead to distorted file origins of functions that are already loaded.

`load-path' is fragile.  Consider the case where you have duplicates of
files foo.el and bar.el in two different directories that are both in
`load-path'.  You can't insist on finding foo.el in one and bar.el in
the other directory.  As I proposed in another thread we could try to
_always_ find the definition from `symbol-file' and use that from the
build directory iff the former fails.  This should handle your case as
well.

martin







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

* bug#690: 23.0.60; Function origin file misremembered
  2008-08-11 11:08       ` Markus Triska
  2008-08-11 12:09         ` martin rudalics
@ 2008-08-11 15:56         ` martin rudalics
  1 sibling, 0 replies; 10+ messages in thread
From: martin rudalics @ 2008-08-11 15:56 UTC (permalink / raw)
  To: Markus Triska; +Cc: 690

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

 > I do not see much value in abbreviating the file name at all; unless
 > that is important for other features to work, I find that the original
 > file name should be preserved in case of doubt. (symbol-file
 > 'prolog-mode) correctly evaluates to "/Users/mt/prolog.el", so this is
 > what should be shown. Otherwise, even future changes to load-path could
 > lead to distorted file origins of functions that are already loaded.

Do people see problems if we do not simplify the filename when the
libname is not a compiled file?

martin

[-- Attachment #2: 690.diff --]
[-- Type: text/plain, Size: 908 bytes --]

*** help-fns.el.~1.123.~	2008-07-28 15:19:09.000000000 +0200
--- help-fns.el	2008-08-11 17:49:09.375000000 +0200
***************
*** 225,234 ****
        (let ((libname (file-name-nondirectory file)))
  	;; Now convert that back to a file name and see if we get
  	;; the original one.  If so, they are equivalent.
! 	(if (equal file (locate-file libname load-path '("")))
! 	    (if (string-match "[.]elc\\'" libname)
! 		(substring libname 0 -1)
! 	      libname)
  	  file))))
  
  (defun find-source-lisp-file (file-name)
--- 225,233 ----
        (let ((libname (file-name-nondirectory file)))
  	;; Now convert that back to a file name and see if we get
  	;; the original one.  If so, they are equivalent.
! 	(if (and (equal file (locate-file libname load-path '("")))
! 		 (string-match "[.]elc\\'" libname))
! 	    (substring libname 0 -1)
  	  file))))
  
  (defun find-source-lisp-file (file-name)

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

end of thread, other threads:[~2008-08-11 15:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-11  0:43 bug#690: 23.0.60; Function origin file misremembered Markus Triska
2008-08-11  1:15 ` OFFICE ZERO
2008-08-11  8:27 ` martin rudalics
2008-08-11  8:46   ` Markus Triska
2008-08-11  9:42     ` martin rudalics
2008-08-11 10:23       ` Lennart Borgman (gmail)
2008-08-11 12:08         ` martin rudalics
2008-08-11 11:08       ` Markus Triska
2008-08-11 12:09         ` martin rudalics
2008-08-11 15:56         ` martin rudalics

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.