[PATCH] emacs: tweak error buffer handling

2012-12-28 Thread Mark Walters

Austin Clements  writes:

> Quoth Mark Walters on Dec 26 at 10:27 pm:
>> 
>> On Tue, 25 Dec 2012, Tomi Ollila  wrote:
>> > On Sat, Dec 22 2012, Mark Walters  wrote:
>> >
>> >> view-mode-enter changed between emacs 23 and emacs 24: the current
>> >> code makes the error buffer disappear in emacs 24 on quitting it (ie
>> >> pressing q) but this just kills the buffer without closing the split
>> >> window in emacs 23.
>> >>
>> >> This patch makes the error buffer window disappear in emacs 23
>> >> too. Since the view-mode-enter function changed we have to test for
>> >> version and do the correct thing in each case.
>> >> ---
>> >>
>> >> This seems to work but I have only tested on 23.4 and 24.2
>> >
>> > I run emacs 23.1.1 to get the documentation of view-mode-enter
>> > there. So, this patch instructs to delete WINDOW when exiting
>> > view mode...
>> >
>> > Documentation of pop-to-buffer says:
>> >
>> > "Select buffer BUFFER-OR-NAME in some window, preferably a different one."
>> >
>> > What if pop-up-windows's value is nil -- the content of current window
>> > is replaced with this view stuff -- and when exiting view mode, the
>> > window will be deleted ? What happens with emacs 24 in this case ?
>> 
>> Hi 
>> 
>> You are quite right there are problems here under emacs 23: if you
>> already have a split window when the error occurs in one part the error
>> is displayed in the other window and then on exit that (previously
>> existing) window is closed.
>> 
>> What do people think should happen on an error? I, personally, don't
>> like taking over an existing window, and Jamie liked some of the errors
>> (eg non-fatal `locked database' tagging errors) to be shown in the
>> mini-buffer.
>> 
>> I also think it is going to be difficult to get this right: emacs 23 and
>> 24 are different and there are also some user configuration variable
>> that affect what happens.
>
> How about showing all errors in the minibuffer (which could simply
> mean calling (error ...) and letting the Emacs top-level show it in
> the mini-buffer)?  We could log the verbose error details (like
> stdout) to some other buffer that we don't automatically show, but
> instead simply reference from the minibuffer message.  This would be
> more in line with how Emacs typically handles errors, and would make
> the details available to the user without flooding them with the
> details.

Hi 

That sounds great. In an ideal world we could behave slightly
differently for fatal errors but the common errors are likely to be
transient (locked database errors) so getting these right (which this
would do) seems the important step.

My view is that we should push a fix like the above for 0.15. What do
other people think?


Best wishes

Mark



[PATCH] emacs: tweak error buffer handling

2012-12-28 Thread David Bremner
Mark Walters  writes:

> Austin Clements  writes:

>> How about showing all errors in the minibuffer (which could simply
>> mean calling (error ...) and letting the Emacs top-level show it in
>> the mini-buffer)?  We could log the verbose error details (like
>> stdout) to some other buffer that we don't automatically show, but
>> instead simply reference from the minibuffer message
>
> That sounds great. In an ideal world we could behave slightly
> differently for fatal errors but the common errors are likely to be
> transient (locked database errors) so getting these right (which this
> would do) seems the important step.
>
> My view is that we should push a fix like the above for 0.15. What do
> other people think?

Sounds reasonable. I have to admit the new reporting is a bit annoying
for transient messages.

d


Re: [PATCH] emacs: tweak error buffer handling

2012-12-28 Thread David Bremner
Mark Walters markwalters1...@gmail.com writes:

 Austin Clements amdra...@mit.edu writes:

 How about showing all errors in the minibuffer (which could simply
 mean calling (error ...) and letting the Emacs top-level show it in
 the mini-buffer)?  We could log the verbose error details (like
 stdout) to some other buffer that we don't automatically show, but
 instead simply reference from the minibuffer message

 That sounds great. In an ideal world we could behave slightly
 differently for fatal errors but the common errors are likely to be
 transient (locked database errors) so getting these right (which this
 would do) seems the important step.

 My view is that we should push a fix like the above for 0.15. What do
 other people think?

Sounds reasonable. I have to admit the new reporting is a bit annoying
for transient messages.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: tweak error buffer handling

2012-12-27 Thread Austin Clements
Quoth Mark Walters on Dec 26 at 10:27 pm:
> 
> On Tue, 25 Dec 2012, Tomi Ollila  wrote:
> > On Sat, Dec 22 2012, Mark Walters  wrote:
> >
> >> view-mode-enter changed between emacs 23 and emacs 24: the current
> >> code makes the error buffer disappear in emacs 24 on quitting it (ie
> >> pressing q) but this just kills the buffer without closing the split
> >> window in emacs 23.
> >>
> >> This patch makes the error buffer window disappear in emacs 23
> >> too. Since the view-mode-enter function changed we have to test for
> >> version and do the correct thing in each case.
> >> ---
> >>
> >> This seems to work but I have only tested on 23.4 and 24.2
> >
> > I run emacs 23.1.1 to get the documentation of view-mode-enter
> > there. So, this patch instructs to delete WINDOW when exiting
> > view mode...
> >
> > Documentation of pop-to-buffer says:
> >
> > "Select buffer BUFFER-OR-NAME in some window, preferably a different one."
> >
> > What if pop-up-windows's value is nil -- the content of current window
> > is replaced with this view stuff -- and when exiting view mode, the
> > window will be deleted ? What happens with emacs 24 in this case ?
> 
> Hi 
> 
> You are quite right there are problems here under emacs 23: if you
> already have a split window when the error occurs in one part the error
> is displayed in the other window and then on exit that (previously
> existing) window is closed.
> 
> What do people think should happen on an error? I, personally, don't
> like taking over an existing window, and Jamie liked some of the errors
> (eg non-fatal `locked database' tagging errors) to be shown in the
> mini-buffer.
> 
> I also think it is going to be difficult to get this right: emacs 23 and
> 24 are different and there are also some user configuration variable
> that affect what happens.

How about showing all errors in the minibuffer (which could simply
mean calling (error ...) and letting the Emacs top-level show it in
the mini-buffer)?  We could log the verbose error details (like
stdout) to some other buffer that we don't automatically show, but
instead simply reference from the minibuffer message.  This would be
more in line with how Emacs typically handles errors, and would make
the details available to the user without flooding them with the
details.


Re: [PATCH] emacs: tweak error buffer handling

2012-12-27 Thread Austin Clements
Quoth Mark Walters on Dec 26 at 10:27 pm:
 
 On Tue, 25 Dec 2012, Tomi Ollila tomi.oll...@iki.fi wrote:
  On Sat, Dec 22 2012, Mark Walters markwalters1...@gmail.com wrote:
 
  view-mode-enter changed between emacs 23 and emacs 24: the current
  code makes the error buffer disappear in emacs 24 on quitting it (ie
  pressing q) but this just kills the buffer without closing the split
  window in emacs 23.
 
  This patch makes the error buffer window disappear in emacs 23
  too. Since the view-mode-enter function changed we have to test for
  version and do the correct thing in each case.
  ---
 
  This seems to work but I have only tested on 23.4 and 24.2
 
  I run emacs 23.1.1 to get the documentation of view-mode-enter
  there. So, this patch instructs to delete WINDOW when exiting
  view mode...
 
  Documentation of pop-to-buffer says:
 
  Select buffer BUFFER-OR-NAME in some window, preferably a different one.
 
  What if pop-up-windows's value is nil -- the content of current window
  is replaced with this view stuff -- and when exiting view mode, the
  window will be deleted ? What happens with emacs 24 in this case ?
 
 Hi 
 
 You are quite right there are problems here under emacs 23: if you
 already have a split window when the error occurs in one part the error
 is displayed in the other window and then on exit that (previously
 existing) window is closed.
 
 What do people think should happen on an error? I, personally, don't
 like taking over an existing window, and Jamie liked some of the errors
 (eg non-fatal `locked database' tagging errors) to be shown in the
 mini-buffer.
 
 I also think it is going to be difficult to get this right: emacs 23 and
 24 are different and there are also some user configuration variable
 that affect what happens.

How about showing all errors in the minibuffer (which could simply
mean calling (error ...) and letting the Emacs top-level show it in
the mini-buffer)?  We could log the verbose error details (like
stdout) to some other buffer that we don't automatically show, but
instead simply reference from the minibuffer message.  This would be
more in line with how Emacs typically handles errors, and would make
the details available to the user without flooding them with the
details.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: tweak error buffer handling

2012-12-26 Thread Mark Walters

On Tue, 25 Dec 2012, Tomi Ollila  wrote:
> On Sat, Dec 22 2012, Mark Walters  wrote:
>
>> view-mode-enter changed between emacs 23 and emacs 24: the current
>> code makes the error buffer disappear in emacs 24 on quitting it (ie
>> pressing q) but this just kills the buffer without closing the split
>> window in emacs 23.
>>
>> This patch makes the error buffer window disappear in emacs 23
>> too. Since the view-mode-enter function changed we have to test for
>> version and do the correct thing in each case.
>> ---
>>
>> This seems to work but I have only tested on 23.4 and 24.2
>
> I run emacs 23.1.1 to get the documentation of view-mode-enter
> there. So, this patch instructs to delete WINDOW when exiting
> view mode...
>
> Documentation of pop-to-buffer says:
>
> "Select buffer BUFFER-OR-NAME in some window, preferably a different one."
>
> What if pop-up-windows's value is nil -- the content of current window
> is replaced with this view stuff -- and when exiting view mode, the
> window will be deleted ? What happens with emacs 24 in this case ?

Hi 

You are quite right there are problems here under emacs 23: if you
already have a split window when the error occurs in one part the error
is displayed in the other window and then on exit that (previously
existing) window is closed.

What do people think should happen on an error? I, personally, don't
like taking over an existing window, and Jamie liked some of the errors
(eg non-fatal `locked database' tagging errors) to be shown in the
mini-buffer.

I also think it is going to be difficult to get this right: emacs 23 and
24 are different and there are also some user configuration variable
that affect what happens.

Best wishes

Mark



>
> Tomi
>
>> Best wishes
>>
>> Mark
>>
>>
>>
>>  emacs/notmuch-lib.el |8 +---
>>  1 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
>> index 77a591d..0407f8a 100644
>> --- a/emacs/notmuch-lib.el
>> +++ b/emacs/notmuch-lib.el
>> @@ -324,15 +324,17 @@ the user dismisses it."
>>  
>>(let ((buf (get-buffer-create "*Notmuch errors*")))
>>  (with-current-buffer buf
>> -  (view-mode-enter nil #'kill-buffer)
>> +  (pop-to-buffer buf)
>> +  (view-mode-enter (when (< emacs-major-version 24)
>> +   (cons (selected-window) (cons nil t)))
>> +   #'kill-buffer)
>>(let ((inhibit-read-only t))
>>  (goto-char (point-max))
>>  (unless (bobp)
>>(insert "\n"))
>>  (insert msg)
>>  (unless (bolp)
>> -  (insert "\n"
>> -(pop-to-buffer buf)))
>> +  (insert "\n"))
>>  
>>  (defun notmuch-check-async-exit-status (proc msg)
>>"If PROC exited abnormally, pop up an error buffer and signal an error.
>> -- 
>> 1.7.9.1
>>
>> ___
>> notmuch mailing list
>> notmuch at notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: tweak error buffer handling

2012-12-26 Thread Mark Walters

On Tue, 25 Dec 2012, Tomi Ollila tomi.oll...@iki.fi wrote:
 On Sat, Dec 22 2012, Mark Walters markwalters1...@gmail.com wrote:

 view-mode-enter changed between emacs 23 and emacs 24: the current
 code makes the error buffer disappear in emacs 24 on quitting it (ie
 pressing q) but this just kills the buffer without closing the split
 window in emacs 23.

 This patch makes the error buffer window disappear in emacs 23
 too. Since the view-mode-enter function changed we have to test for
 version and do the correct thing in each case.
 ---

 This seems to work but I have only tested on 23.4 and 24.2

 I run emacs 23.1.1 to get the documentation of view-mode-enter
 there. So, this patch instructs to delete WINDOW when exiting
 view mode...

 Documentation of pop-to-buffer says:

 Select buffer BUFFER-OR-NAME in some window, preferably a different one.

 What if pop-up-windows's value is nil -- the content of current window
 is replaced with this view stuff -- and when exiting view mode, the
 window will be deleted ? What happens with emacs 24 in this case ?

Hi 

You are quite right there are problems here under emacs 23: if you
already have a split window when the error occurs in one part the error
is displayed in the other window and then on exit that (previously
existing) window is closed.

What do people think should happen on an error? I, personally, don't
like taking over an existing window, and Jamie liked some of the errors
(eg non-fatal `locked database' tagging errors) to be shown in the
mini-buffer.

I also think it is going to be difficult to get this right: emacs 23 and
24 are different and there are also some user configuration variable
that affect what happens.

Best wishes

Mark




 Tomi

 Best wishes

 Mark



  emacs/notmuch-lib.el |8 +---
  1 files changed, 5 insertions(+), 3 deletions(-)

 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
 index 77a591d..0407f8a 100644
 --- a/emacs/notmuch-lib.el
 +++ b/emacs/notmuch-lib.el
 @@ -324,15 +324,17 @@ the user dismisses it.
  
(let ((buf (get-buffer-create *Notmuch errors*)))
  (with-current-buffer buf
 -  (view-mode-enter nil #'kill-buffer)
 +  (pop-to-buffer buf)
 +  (view-mode-enter (when ( emacs-major-version 24)
 +   (cons (selected-window) (cons nil t)))
 +   #'kill-buffer)
(let ((inhibit-read-only t))
  (goto-char (point-max))
  (unless (bobp)
(insert \n))
  (insert msg)
  (unless (bolp)
 -  (insert \n
 -(pop-to-buffer buf)))
 +  (insert \n))
  
  (defun notmuch-check-async-exit-status (proc msg)
If PROC exited abnormally, pop up an error buffer and signal an error.
 -- 
 1.7.9.1

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: tweak error buffer handling

2012-12-25 Thread Tomi Ollila
On Sat, Dec 22 2012, Mark Walters  wrote:

> view-mode-enter changed between emacs 23 and emacs 24: the current
> code makes the error buffer disappear in emacs 24 on quitting it (ie
> pressing q) but this just kills the buffer without closing the split
> window in emacs 23.
>
> This patch makes the error buffer window disappear in emacs 23
> too. Since the view-mode-enter function changed we have to test for
> version and do the correct thing in each case.
> ---
>
> This seems to work but I have only tested on 23.4 and 24.2

I run emacs 23.1.1 to get the documentation of view-mode-enter
there. So, this patch instructs to delete WINDOW when exiting
view mode...

Documentation of pop-to-buffer says:

"Select buffer BUFFER-OR-NAME in some window, preferably a different one."

What if pop-up-windows's value is nil -- the content of current window
is replaced with this view stuff -- and when exiting view mode, the
window will be deleted ? What happens with emacs 24 in this case ?

Tomi

> Best wishes
>
> Mark
>
>
>
>  emacs/notmuch-lib.el |8 +---
>  1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 77a591d..0407f8a 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -324,15 +324,17 @@ the user dismisses it."
>  
>(let ((buf (get-buffer-create "*Notmuch errors*")))
>  (with-current-buffer buf
> -  (view-mode-enter nil #'kill-buffer)
> +  (pop-to-buffer buf)
> +  (view-mode-enter (when (< emacs-major-version 24)
> +(cons (selected-window) (cons nil t)))
> +#'kill-buffer)
>(let ((inhibit-read-only t))
>   (goto-char (point-max))
>   (unless (bobp)
> (insert "\n"))
>   (insert msg)
>   (unless (bolp)
> -   (insert "\n"
> -(pop-to-buffer buf)))
> +   (insert "\n"))
>  
>  (defun notmuch-check-async-exit-status (proc msg)
>"If PROC exited abnormally, pop up an error buffer and signal an error.
> -- 
> 1.7.9.1
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: tweak error buffer handling

2012-12-25 Thread Tomi Ollila
On Sat, Dec 22 2012, Mark Walters markwalters1...@gmail.com wrote:

 view-mode-enter changed between emacs 23 and emacs 24: the current
 code makes the error buffer disappear in emacs 24 on quitting it (ie
 pressing q) but this just kills the buffer without closing the split
 window in emacs 23.

 This patch makes the error buffer window disappear in emacs 23
 too. Since the view-mode-enter function changed we have to test for
 version and do the correct thing in each case.
 ---

 This seems to work but I have only tested on 23.4 and 24.2

I run emacs 23.1.1 to get the documentation of view-mode-enter
there. So, this patch instructs to delete WINDOW when exiting
view mode...

Documentation of pop-to-buffer says:

Select buffer BUFFER-OR-NAME in some window, preferably a different one.

What if pop-up-windows's value is nil -- the content of current window
is replaced with this view stuff -- and when exiting view mode, the
window will be deleted ? What happens with emacs 24 in this case ?

Tomi

 Best wishes

 Mark



  emacs/notmuch-lib.el |8 +---
  1 files changed, 5 insertions(+), 3 deletions(-)

 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
 index 77a591d..0407f8a 100644
 --- a/emacs/notmuch-lib.el
 +++ b/emacs/notmuch-lib.el
 @@ -324,15 +324,17 @@ the user dismisses it.
  
(let ((buf (get-buffer-create *Notmuch errors*)))
  (with-current-buffer buf
 -  (view-mode-enter nil #'kill-buffer)
 +  (pop-to-buffer buf)
 +  (view-mode-enter (when ( emacs-major-version 24)
 +(cons (selected-window) (cons nil t)))
 +#'kill-buffer)
(let ((inhibit-read-only t))
   (goto-char (point-max))
   (unless (bobp)
 (insert \n))
   (insert msg)
   (unless (bolp)
 -   (insert \n
 -(pop-to-buffer buf)))
 +   (insert \n))
  
  (defun notmuch-check-async-exit-status (proc msg)
If PROC exited abnormally, pop up an error buffer and signal an error.
 -- 
 1.7.9.1

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: tweak error buffer handling

2012-12-22 Thread Mark Walters
view-mode-enter changed between emacs 23 and emacs 24: the current
code makes the error buffer disappear in emacs 24 on quitting it (ie
pressing q) but this just kills the buffer without closing the split
window in emacs 23.

This patch makes the error buffer window disappear in emacs 23
too. Since the view-mode-enter function changed we have to test for
version and do the correct thing in each case.
---

This seems to work but I have only tested on 23.4 and 24.2

Best wishes

Mark



 emacs/notmuch-lib.el |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 77a591d..0407f8a 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -324,15 +324,17 @@ the user dismisses it."

   (let ((buf (get-buffer-create "*Notmuch errors*")))
 (with-current-buffer buf
-  (view-mode-enter nil #'kill-buffer)
+  (pop-to-buffer buf)
+  (view-mode-enter (when (< emacs-major-version 24)
+  (cons (selected-window) (cons nil t)))
+  #'kill-buffer)
   (let ((inhibit-read-only t))
(goto-char (point-max))
(unless (bobp)
  (insert "\n"))
(insert msg)
(unless (bolp)
- (insert "\n"
-(pop-to-buffer buf)))
+ (insert "\n"))

 (defun notmuch-check-async-exit-status (proc msg)
   "If PROC exited abnormally, pop up an error buffer and signal an error.
-- 
1.7.9.1



[PATCH] emacs: tweak error buffer handling

2012-12-22 Thread Mark Walters
view-mode-enter changed between emacs 23 and emacs 24: the current
code makes the error buffer disappear in emacs 24 on quitting it (ie
pressing q) but this just kills the buffer without closing the split
window in emacs 23.

This patch makes the error buffer window disappear in emacs 23
too. Since the view-mode-enter function changed we have to test for
version and do the correct thing in each case.
---

This seems to work but I have only tested on 23.4 and 24.2

Best wishes

Mark



 emacs/notmuch-lib.el |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 77a591d..0407f8a 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -324,15 +324,17 @@ the user dismisses it.
 
   (let ((buf (get-buffer-create *Notmuch errors*)))
 (with-current-buffer buf
-  (view-mode-enter nil #'kill-buffer)
+  (pop-to-buffer buf)
+  (view-mode-enter (when ( emacs-major-version 24)
+  (cons (selected-window) (cons nil t)))
+  #'kill-buffer)
   (let ((inhibit-read-only t))
(goto-char (point-max))
(unless (bobp)
  (insert \n))
(insert msg)
(unless (bolp)
- (insert \n
-(pop-to-buffer buf)))
+ (insert \n))
 
 (defun notmuch-check-async-exit-status (proc msg)
   If PROC exited abnormally, pop up an error buffer and signal an error.
-- 
1.7.9.1

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch