unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore
@ 2016-07-20 13:58 Kaushal Modi
  2016-07-21 21:02 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Kaushal Modi @ 2016-07-20 13:58 UTC (permalink / raw)
  To: 24036, lekktu, monnier

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

Hi,

This bug report is more like a minor enhancement in the process of file
restoration during desktop-restore.

@Juanma, Stefan: I am copying you guys to review this as this section of
desktop.el has commits made by you the most. (PS: vc-region-history is
awesome!)

I use the *Messages* buffer at startup as a check that everything's good in
my config.

But as I use desktop save/restore in my workflow, I also get stuff like

Note: file is write protected [2 times]
<something else>
Note: file is write protected [19 times]
<something else>
Note: file is write protected
<something else>
Note: file is write protected [3 times]

Finally after much digging I had figured out that it is
`desktop-restore-file-buffer` that is causing this.

I understand that "file is write protected" and other warning are useful to
the user when they are doing find-file interactively. But in this scenario,
they just add clutter in the *Messages* buffer and provide no useful debug
info.

The patch that I am proposing in this report has been living in my emacs
config since Nov 2014! and I have not seen a single bad side-effect of
that. I hope this get merged into the master.

===== patch start
From e5fdf14a387248c282abd94effe7f97be51340b5 Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Wed, 20 Jul 2016 09:50:38 -0400
Subject: [PATCH] No find-file warnings during desktop-restore

* lisp/desktop.el (desktop-restore-file-buffer): Do not print warnings
  when files are being opened during desktop restore.
---
 lisp/desktop.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/desktop.el b/lisp/desktop.el
index 1f460b7..df4ff55 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1402,7 +1402,7 @@ desktop-restore-file-buffer
  (or coding-system-for-read
     (cdr (assq 'buffer-file-coding-system
        desktop-buffer-locals))))
-       (buf (find-file-noselect buffer-filename)))
+       (buf (find-file-noselect buffer-filename :nowarn)))
   (condition-case nil
       (switch-to-buffer buf)
     (error (pop-to-buffer buf)))
-- 
2.6.0.rc0.24.gec371ff
===== patch end


In GNU Emacs 25.0.95.11 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
 of 2016-06-29
Repository revision: 6192b6c3a4374b2cb6e02ca865e1899a04a7f7dc
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6
(Santiago)

Thanks!
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 4150 bytes --]

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

* bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore
  2016-07-20 13:58 bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore Kaushal Modi
@ 2016-07-21 21:02 ` Stefan Monnier
  2016-07-21 23:40   ` Kaushal Modi
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-07-21 21:02 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: lekktu, 24036

> -       (buf (find-file-noselect buffer-filename)))
> +       (buf (find-file-noselect buffer-filename :nowarn)))

Fine by me,


        Stefan





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

* bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore
  2016-07-21 21:02 ` Stefan Monnier
@ 2016-07-21 23:40   ` Kaushal Modi
  2016-07-22 18:49     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Kaushal Modi @ 2016-07-21 23:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: lekktu, 24036

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

Thanks!

Can you please commit it to master when you get a chance?

On Thu, Jul 21, 2016, 5:00 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > -       (buf (find-file-noselect buffer-filename)))
> > +       (buf (find-file-noselect buffer-filename :nowarn)))
>
> Fine by me,
>
>
>         Stefan
>
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 724 bytes --]

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

* bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore
  2016-07-21 23:40   ` Kaushal Modi
@ 2016-07-22 18:49     ` Stefan Monnier
  2016-07-22 19:57       ` Kaushal Modi
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-07-22 18:49 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: lekktu, 24036

> Can you please commit it to master when you get a chance?

Done,


        Stefan





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

* bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore
  2016-07-22 18:49     ` Stefan Monnier
@ 2016-07-22 19:57       ` Kaushal Modi
  0 siblings, 0 replies; 5+ messages in thread
From: Kaushal Modi @ 2016-07-22 19:57 UTC (permalink / raw)
  To: Stefan Monnier, 24036-done; +Cc: Juanma Barranquero

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

Thanks!

On Fri, Jul 22, 2016 at 2:49 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > Can you please commit it to master when you get a chance?
>
> Done,
>
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 550 bytes --]

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

end of thread, other threads:[~2016-07-22 19:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-20 13:58 bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore Kaushal Modi
2016-07-21 21:02 ` Stefan Monnier
2016-07-21 23:40   ` Kaushal Modi
2016-07-22 18:49     ` Stefan Monnier
2016-07-22 19:57       ` Kaushal Modi

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