unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: 24036@debbugs.gnu.org, lekktu@gmail.com, monnier@iro.umontreal.ca
Subject: bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore
Date: Wed, 20 Jul 2016 13:58:15 +0000	[thread overview]
Message-ID: <CAFyQvY18_tRGTWyCBNTWz17_GTmB8KEbERRTkHPysZ+MYuk-_w@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2016-07-20 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 13:58 Kaushal Modi [this message]
2016-07-21 21:02 ` bug#24036: 25.0.95; Prevent warnings when opening files during desktop restore Stefan Monnier
2016-07-21 23:40   ` Kaushal Modi
2016-07-22 18:49     ` Stefan Monnier
2016-07-22 19:57       ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFyQvY18_tRGTWyCBNTWz17_GTmB8KEbERRTkHPysZ+MYuk-_w@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=24036@debbugs.gnu.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).