GNU bug report logs - #24472
25.1; Emacs crashes when clicking on OSX menu bar when opening file with tramp

Previous Next

Package: emacs;

Reported by: Souvik Banerjee <souvik1997 <at> gmail.com>

Date: Mon, 19 Sep 2016 19:48:01 UTC

Severity: normal

Tags: confirmed

Merged with 37299, 37557

Found in versions 25.1, 26.3, 27.0.50

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


Message #47 received at 24472 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Marc Herbert <marc.herbert <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 24472 <at> debbugs.gnu.org
Subject: Re: bug#24472 - a workaround/fix for the menubar crashes on macOS
Date: Sat, 02 May 2020 14:15:19 +0200
Marc Herbert <marc.herbert <at> gmail.com> writes:

Hi Marc,

> I leveraged the milder symptoms in 26.1 to debug the issue and found a
> workaround/fix. I then upgraded to 26.3 and ta-da: the crashes are
> gone!
>
> The root cause is in menu-bar.el which defines the revert-buffer item like this:
>
>       '(menu-item "Revert Buffer" revert-buffer
>                   :enable (or (blah) (blah)
>                               (and buffer-file-number
>                                    (or (buffer-modified-p)
>                                        (not (verify-visited-file-modtime
>                                              (current-buffer))))))
>
> This greys out the "Revert Buffer" menu item when (among others) no
> one modified the file outside Emacs.
>
> verify-visited-file-modtime calls
> tramp-sh-handle-verify-visited-file-modtime that temporarily hardcodes
> remote-file-name-inhibit-cache to 't that causes the network accesses
> that cause the delays and/or crashes.

Excellent analysis!

> After a few other attempts, my final workaround is dead simple: remove
> the "Revert Buffer" item from the menu by adding this one line to your
> .emacs file:
>
>      (define-key global-map [menu-bar file revert-buffer] nil)
>
> Enjoy. I think it's better than a "workaround" actually, it's almost a
> "feature" that I'm going to keep that in my .emacs file permanently
> because trying to use the network every time you click the menubar is
> just... silly?

Isn't this too heavy? Wouldn't it be sufficient to avoid the
`verify-visited-file-modtime' call in case the buffer is visiting a
remote file? Something like

                              (and buffer-file-number
                                   (or (buffer-modified-p)
                                       (file-remote-p default-directory)
                                       (not (verify-visited-file-modtime
                                             (current-buffer))))))

> I also tried to hack menu-bar.el directly but any change I made to it
> was completely ignored. Anyone knows why?

Hmm. Have you recompiled the whole Emacs after your change? Maybe menu-bar.elc
is dumped into Emacs?

Best regards, Michael.




This bug report was last modified 4 years and 51 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.