* Error report on startup
@ 2007-03-01 13:48 Herbert Euler
2007-03-01 14:30 ` Juanma Barranquero
2007-03-02 3:28 ` Richard Stallman
0 siblings, 2 replies; 10+ messages in thread
From: Herbert Euler @ 2007-03-01 13:48 UTC (permalink / raw)
To: emacs-devel; +Cc: herberteuler
Error report on startup could be confusing. Consider the following in
~/.emacs:
(with-current-buffer (find-file-noselect "some-file.el")
(read (current-buffer)))
If ``some-file'' does not contain valid Lisp expression, the user will
see an error saying ``End of file during parsing:
/home/somebody/.emacs''. However, the ~/.emacs file is valid; what is
not valid is the file some-file.el.
I had this problem when using Emacs on Windows. I turned on
type-break mode. For some reason I do not know until now, the file
~/.type-break was not written correctly for many times, so that the
functions `type-break-get-previous-time' and
`type-break-get-previous-count' failed on the invoking to `read'.
Then I saw the above message, this vague message took me so long to
find out the problem.
Is it possible to improve the error report? An approach might be
setting `load-file-name' temporarily, but there seem to be many
adjustments.
Regards,
Guanpeng Xu
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-01 13:48 Error report on startup Herbert Euler
@ 2007-03-01 14:30 ` Juanma Barranquero
2007-03-01 15:04 ` Herbert Euler
2007-03-02 3:28 ` Richard Stallman
1 sibling, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2007-03-01 14:30 UTC (permalink / raw)
To: Herbert Euler; +Cc: emacs-devel
On 3/1/07, Herbert Euler <herberteuler@hotmail.com> wrote:
> Error report on startup could be confusing. Consider the following in
> ~/.emacs:
>
> (with-current-buffer (find-file-noselect "some-file.el")
> (read (current-buffer)))
>
> If ``some-file'' does not contain valid Lisp expression, the user will
> see an error saying ``End of file during parsing:
> /home/somebody/.emacs''. However, the ~/.emacs file is valid; what is
> not valid is the file some-file.el.
I don't see anything confusing. You're manually loading some-file.el
and reading its content in the context of loading .emacs, so certainly
it is ~/.emacs which is not valid (or, which is doing something
invalid). That the error comes from processing an elisp module is
irrelevant. It's not different to loading a non-lispy data file in
.emacs and then doing some kind of processing with it that causes an
error.
If instead you used `load' or `require' to load some-file.el you'd get:
An error has occurred while loading `c:/home/.emacs':
End of file during parsing: c:/emacs/site-lisp/some-file.el
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
Juanma
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-01 14:30 ` Juanma Barranquero
@ 2007-03-01 15:04 ` Herbert Euler
2007-03-01 15:26 ` Juanma Barranquero
0 siblings, 1 reply; 10+ messages in thread
From: Herbert Euler @ 2007-03-01 15:04 UTC (permalink / raw)
To: lekktu; +Cc: emacs-devel
>I don't see anything confusing. You're manually loading some-file.el
>and reading its content in the context of loading .emacs, so certainly
>it is ~/.emacs which is not valid (or, which is doing something
>invalid). That the error comes from processing an elisp module is
>irrelevant. It's not different to loading a non-lispy data file in
>.emacs and then doing some kind of processing with it that causes an
>error.
>
>If instead you used `load' or `require' to load some-file.el you'd get:
>
> An error has occurred while loading `c:/home/.emacs':
>
> End of file during parsing: c:/emacs/site-lisp/some-file.el
>
> To ensure normal operation, you should investigate and remove the
> cause of the error in your initialization file. Start Emacs with
> the `--debug-init' option to view a complete error backtrace.
It is just an explain to the general case. If you are loading a library,
which you are not familiar with and it does this, how could you
know which file is invalid?
For me, the library is type-break mode, and the file is ~/.type-break.
If I did not read the source and did some digging work, I cannot
know it is the file ~/.type-break that causes the error.
Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-01 15:04 ` Herbert Euler
@ 2007-03-01 15:26 ` Juanma Barranquero
2007-03-02 1:23 ` Herbert Euler
0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2007-03-01 15:26 UTC (permalink / raw)
To: Herbert Euler; +Cc: emacs-devel
On 3/1/07, Herbert Euler <herberteuler@hotmail.com> wrote:
> For me, the library is type-break mode, and the file is ~/.type-break.
> If I did not read the source and did some digging work, I cannot
> know it is the file ~/.type-break that causes the error.
Why are you loading type-break in such a weird way? If you .emacs contains
(require 'type-break)
messages *will* be meaningful wrt the point of error.
Juanma
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-01 15:26 ` Juanma Barranquero
@ 2007-03-02 1:23 ` Herbert Euler
2007-03-02 1:57 ` Juanma Barranquero
0 siblings, 1 reply; 10+ messages in thread
From: Herbert Euler @ 2007-03-02 1:23 UTC (permalink / raw)
To: lekktu; +Cc: emacs-devel
>>For me, the library is type-break mode, and the file is ~/.type-break.
>>If I did not read the source and did some digging work, I cannot
>>know it is the file ~/.type-break that causes the error.
>
>Why are you loading type-break in such a weird way? If you .emacs contains
>
> (require 'type-break)
>
>messages *will* be meaningful wrt the point of error.
Well, I load type-break in normal way. Please take a look at the
functions `type-break-get-previous-time' and
`type-break-get-previous-count'.
They contain similar expressions like I provided. For example,
the functiion `type-break-get-previous-time':
(defun type-break-get-previous-time ()
"Get previous break time from `type-break-file-name'.
Returns nil if the file is missing or if the time breaks with the
`current-time' format."
(let ((file (type-break-choose-file)))
(if file
(timep ;; returns expected format, else nil
(with-current-buffer (find-file-noselect file 'nowarn)
(save-excursion
(goto-char (point-min))
(read (current-buffer))))))))
The file returned by `type-break-choose-file' is the actual
file of `some-file.el'. On my system for some reason it is
not written correctly, which causes Emacs report confusing
error.
Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-02 1:23 ` Herbert Euler
@ 2007-03-02 1:57 ` Juanma Barranquero
2007-03-02 8:26 ` Richard Stallman
0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2007-03-02 1:57 UTC (permalink / raw)
To: Herbert Euler; +Cc: emacs-devel
On 3/2/07, Herbert Euler <herberteuler@hotmail.com> wrote:
> (defun type-break-get-previous-time ()
> "Get previous break time from `type-break-file-name'.
> Returns nil if the file is missing or if the time breaks with the
> `current-time' format."
> (let ((file (type-break-choose-file)))
> (if file
> (timep ;; returns expected format, else nil
> (with-current-buffer (find-file-noselect file 'nowarn)
> (save-excursion
> (goto-char (point-min))
> (read (current-buffer))))))))
I stand by what I said. If type-break-get-previous-time loads elisp
code in such a way, it is to be *expected* that erroneous input (in
the file being read) will be reported as a problem of
type-break-get-previous-time. If the code's author would've wanted
normal loading semantics, s/he would've used (load file).
Juanma
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-02 1:57 ` Juanma Barranquero
@ 2007-03-02 8:26 ` Richard Stallman
2007-03-02 23:46 ` Richard Stallman
0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-03-02 8:26 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: herberteuler, emacs-devel
I stand by what I said. If type-break-get-previous-time loads elisp
code in such a way, it is to be *expected* that erroneous input (in
the file being read) will be reported as a problem of
type-break-get-previous-time. If the code's author would've wanted
normal loading semantics, s/he would've used (load file).
It is not possible to do this by calling `load'. `load' evaluates all
the sexps that it reads, and it throws the values away.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-02 8:26 ` Richard Stallman
@ 2007-03-02 23:46 ` Richard Stallman
2007-03-05 1:41 ` Herbert Euler
0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-03-02 23:46 UTC (permalink / raw)
To: lekktu, herberteuler, emacs-devel
Does this patch give acceptable results?
*** type-break.el 30 Jan 2007 18:46:39 -0500 1.44
--- type-break.el 02 Mar 2007 14:33:25 -0500
***************
*** 562,570 ****
(if file
(timep ;; returns expected format, else nil
(with-current-buffer (find-file-noselect file 'nowarn)
! (save-excursion
! (goto-char (point-min))
! (read (current-buffer))))))))
(defun type-break-get-previous-count ()
"Get previous keystroke count from `type-break-file-name'.
--- 562,573 ----
(if file
(timep ;; returns expected format, else nil
(with-current-buffer (find-file-noselect file 'nowarn)
! (condition-case nil
! (save-excursion
! (goto-char (point-min))
! (read (current-buffer)))
! (end-of-file
! (error "End of file in `%s'" file))))))))
(defun type-break-get-previous-count ()
"Get previous keystroke count from `type-break-file-name'.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-02 23:46 ` Richard Stallman
@ 2007-03-05 1:41 ` Herbert Euler
0 siblings, 0 replies; 10+ messages in thread
From: Herbert Euler @ 2007-03-05 1:41 UTC (permalink / raw)
To: rms, lekktu, emacs-devel
>Does this patch give acceptable results?
>
>*** type-break.el 30 Jan 2007 18:46:39 -0500 1.44
>--- type-break.el 02 Mar 2007 14:33:25 -0500
>***************
>*** 562,570 ****
> (if file
> (timep ;; returns expected format, else nil
> (with-current-buffer (find-file-noselect file 'nowarn)
>! (save-excursion
>! (goto-char (point-min))
>! (read (current-buffer))))))))
>
> (defun type-break-get-previous-count ()
> "Get previous keystroke count from `type-break-file-name'.
>--- 562,573 ----
> (if file
> (timep ;; returns expected format, else nil
> (with-current-buffer (find-file-noselect file 'nowarn)
>! (condition-case nil
>! (save-excursion
>! (goto-char (point-min))
>! (read (current-buffer)))
>! (end-of-file
>! (error "End of file in `%s'" file))))))))
>
> (defun type-break-get-previous-count ()
> "Get previous keystroke count from `type-break-file-name'.
Sorry for the delay. I could not use computer these days. Yes,
it gives acceptable results. However, there are actually two
`read's. So the patch should be
*** type-break.el.orignal Mon Mar 5 09:38:20 2007
--- type-break.el Mon Mar 5 09:21:33 2007
***************
*** 562,570 ****
(if file
(timep ;; returns expected format, else nil
(with-current-buffer (find-file-noselect file 'nowarn)
! (save-excursion
! (goto-char (point-min))
! (read (current-buffer))))))))
(defun type-break-get-previous-count ()
"Get previous keystroke count from `type-break-file-name'.
--- 562,573 ----
(if file
(timep ;; returns expected format, else nil
(with-current-buffer (find-file-noselect file 'nowarn)
! (condition-case nil
! (save-excursion
! (goto-char (point-min))
! (read (current-buffer)))
! (end-of-file
! (error "End of file in `%s'" file))))))))
(defun type-break-get-previous-count ()
"Get previous keystroke count from `type-break-file-name'.
***************
*** 576,585 ****
(setq file
(with-current-buffer
(find-file-noselect file 'nowarn)
! (save-excursion
! (goto-char (point-min))
! (forward-line 1)
! (read (current-buffer)))))))
file
0)))
--- 579,591 ----
(setq file
(with-current-buffer
(find-file-noselect file 'nowarn)
! (condition-case nil
! (save-excursion
! (goto-char (point-min))
! (forward-line 1)
! (read (current-buffer)))
! (end-of-file
! (error "End of file in `%s'" file)))))))
file
0)))
Thank you very much.
Best regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Error report on startup
2007-03-01 13:48 Error report on startup Herbert Euler
2007-03-01 14:30 ` Juanma Barranquero
@ 2007-03-02 3:28 ` Richard Stallman
1 sibling, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2007-03-02 3:28 UTC (permalink / raw)
To: Herbert Euler; +Cc: herberteuler, emacs-devel
If ``some-file'' does not contain valid Lisp expression, the user will
see an error saying ``End of file during parsing:
/home/somebody/.emacs''. However, the ~/.emacs file is valid; what is
not valid is the file some-file.el.
I see your point, but is there a way we can do it better?
Which code in type-break.el causes this problem?
Many things visit .type-break, but I don't see anything that
evaluates it.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-03-05 1:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-01 13:48 Error report on startup Herbert Euler
2007-03-01 14:30 ` Juanma Barranquero
2007-03-01 15:04 ` Herbert Euler
2007-03-01 15:26 ` Juanma Barranquero
2007-03-02 1:23 ` Herbert Euler
2007-03-02 1:57 ` Juanma Barranquero
2007-03-02 8:26 ` Richard Stallman
2007-03-02 23:46 ` Richard Stallman
2007-03-05 1:41 ` Herbert Euler
2007-03-02 3:28 ` Richard Stallman
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.