GNU bug report logs - #45999
28.0.50; repeat does not work when saving files modified outside emacs

Previous Next

Package: emacs;

Reported by: Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>

Date: Wed, 20 Jan 2021 00:46:02 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45999 in the body.
You can then email your comments to 45999 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#45999; Package emacs. (Wed, 20 Jan 2021 00:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 20 Jan 2021 00:46:02 GMT) Full text and rfc822 format available.

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

From: Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; repeat does not work when saving files modified outside emacs
Date: Tue, 19 Jan 2021 21:45:10 -0300
1) Normal case:
1.1) Run 'emacs -q'
1.2) Open a file with 'C-x C-f'
1.3) Make some modification without saving the buffer
1.4) Save the buffer with 'C-x C-s'
1.5) Repeat last last command with 'C-x z'. You will see the message '(no
changes need to be saved)' indicating that the 'save-buffer' command was
repeated.

2) Problematic case:
2.1) Run 'emacs -q'
2.2) Open a file with 'C-x C-f'
2.3) Make some modification without saving the buffer
2.4) Edit the same file outside emacs (with another text editor or with
shell command 'touch')
2.5) Save the buffer with 'C-x C-s'. You will see the message
'<filename> has changed since visited or saved. Save anyway ?'. Type
'yes'
2.6)  Repeat last last command with 'C-x z'. You will see the message
'Repeating (find-file <path> t)' indicating that the last command before
'save-buffer' was repeated, which in this case was 'find-file' command
with 'C-x C-f'. It's possible to test with some other command before saving
the buffer to see what happens with the '(repeat)' command.

In GNU Emacs 28.0.50 (build 39, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0)
 of 2021-01-16 built on precision5540
Repository revision: 25e1b732947bcba51e457a7168eba6608fb666c0
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Ubuntu 20.10

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_CTYPE: pt_BR.UTF-8
  value of $LC_MONETARY: pt_BR.UTF-8
  value of $LC_NUMERIC: pt_BR.UTF-8
  value of $LC_TIME: pt_BR.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Browse Server

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort emacsbug gnus-ml disp-table mail-extr cursor-sensor nndraft
nnmh utf-7 gnutls network-stream nsm nnnil gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg nntp gnus-cache smtpmail
sendmail misearch multi-isearch rx org-element avl-tree generator ol-eww
eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-search eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015
mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-parse url-vars mailcap gnus-group gnus-undo
gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo parse-time gnus-spec gnus-int gnus-range message rmc puny
rfc822 mml mml-sec epa derived epg epg-config mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win
gnus nnheader gnus-util rmail rmail-loaddefs auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map rfc2047
rfc2045 ietf-drums text-property-search mail-utils mm-util mail-prsvr
wid-edit ol-docview doc-view image-mode exif dired dired-loaddefs
ol-bibtex bibtex iso8601 ol-bbdb ol-w3m org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete
pcomplete comint ansi-color ring org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob-core ob-eval org-table ol
org-keys org-compat advice org-macs org-loaddefs format-spec find-func
cal-menu calendar cal-loaddefs mule-util jka-compr info time-date subr-x
cl-extra seq byte-opt gv bytecomp byte-compile cconv cl-print thingatpt
help-fns radix-tree help-mode vc-git diff-mode easymenu easy-mmode
cl-loaddefs cl-lib conf-mode iso-transl tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 295807 45058)
 (symbols 48 23424 1)
 (strings 32 114515 4556)
 (string-bytes 1 3691174)
 (vectors 16 37971)
 (vector-slots 8 463088 27462)
 (floats 8 266 124)
 (intervals 56 70122 0)
 (buffers 984 24))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45999; Package emacs. (Tue, 07 Jun 2022 14:31:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>
Cc: 45999 <at> debbugs.gnu.org
Subject: Re: bug#45999: 28.0.50; repeat does not work when saving files
 modified outside emacs
Date: Tue, 07 Jun 2022 16:29:52 +0200
Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com> writes:

> 2) Problematic case:
> 2.1) Run 'emacs -q'
> 2.2) Open a file with 'C-x C-f'
> 2.3) Make some modification without saving the buffer
> 2.4) Edit the same file outside emacs (with another text editor or with
> shell command 'touch')
> 2.5) Save the buffer with 'C-x C-s'. You will see the message
> '<filename> has changed since visited or saved. Save anyway ?'. Type
> 'yes'
> 2.6)  Repeat last last command with 'C-x z'. You will see the message
> 'Repeating (find-file <path> t)' indicating that the last command before
> 'save-buffer' was repeated, which in this case was 'find-file' command
> with 'C-x C-f'. It's possible to test with some other command before saving
> the buffer to see what happens with the '(repeat)' command.

I can't reproduce this exactly -- in Emacs 29, `C-x z' executes
`exit-minibuffer', since that's the value of `last-repeatable-command'
after typing "yes".  (Most likely due to yes-or-no-p being reimplemented
as non-modal.)

I'm not at all familiar with how `last-repeatable-command' is supposed
to work -- it's just set from command_loop_1, and there's no blocklist
of commands or anything, so it seems like any commands that prompts with
yes-or-no-p/completing-read/etc aren't repeatable (now).

(defun foo ()
  (interactive)
  (yes-or-no-p "Foo")
  (message "%s" last-repeatable-command))

and examine 

last-repeatable-command

I guess a way to fix this would be to introduce a blocklist (containing
minibuffer-exit/self-insert-command/etc/etc), but I'm not sure how much
etc this would be.  Or perhaps there's a different way around this.

Any opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 07 Jun 2022 14:31:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45999; Package emacs. (Mon, 11 Jul 2022 12:56:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com>
Cc: 45999 <at> debbugs.gnu.org
Subject: Re: bug#45999: 28.0.50; repeat does not work when saving files
 modified outside emacs
Date: Mon, 11 Jul 2022 14:55:47 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I guess a way to fix this would be to introduce a blocklist (containing
> minibuffer-exit/self-insert-command/etc/etc), but I'm not sure how much
> etc this would be.  Or perhaps there's a different way around this.

I tried various approaches, but none seemed to work in a satisfactory
way -- adding a variable to inhibit recording last-repeatable-command
didn't work well, because of how it's set from command_loop_1, and a
blocklist just seemed odd.

But the main problem here is that yes-or-no-p now overwrites
last-repeatable-command with exit-minibuffer, and that's a regression at
least, so I've fixed this specific problem.  But I'm still not sure
whether it should be fixed in a more general way, and perhaps a
blocklist is the way to go, anyway...  but the reason I didn't do that
is because self-insert-command would have to be on that list for
yes-or-no-p to not override `repeat', and that's a behavioural change.

So I went with the easy fix.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 45999 <at> debbugs.gnu.org and Gabriel do Nascimento Ribeiro <gabriel376 <at> hotmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 11 Jul 2022 12:57:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 09 Aug 2022 11:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 272 days ago.

Previous Next


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