unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45999: 28.0.50; repeat does not work when saving files modified outside emacs
@ 2021-01-20  0:45 Gabriel do Nascimento Ribeiro
  2022-06-07 14:29 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel do Nascimento Ribeiro @ 2021-01-20  0:45 UTC (permalink / raw)
  To: 45999

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





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

* bug#45999: 28.0.50; repeat does not work when saving files modified outside emacs
  2021-01-20  0:45 bug#45999: 28.0.50; repeat does not work when saving files modified outside emacs Gabriel do Nascimento Ribeiro
@ 2022-06-07 14:29 ` Lars Ingebrigtsen
  2022-07-11 12:55   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-07 14:29 UTC (permalink / raw)
  To: Gabriel do Nascimento Ribeiro; +Cc: 45999

Gabriel do Nascimento Ribeiro <gabriel376@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





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

* bug#45999: 28.0.50; repeat does not work when saving files modified outside emacs
  2022-06-07 14:29 ` Lars Ingebrigtsen
@ 2022-07-11 12:55   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-11 12:55 UTC (permalink / raw)
  To: Gabriel do Nascimento Ribeiro; +Cc: 45999

Lars Ingebrigtsen <larsi@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





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

end of thread, other threads:[~2022-07-11 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20  0:45 bug#45999: 28.0.50; repeat does not work when saving files modified outside emacs Gabriel do Nascimento Ribeiro
2022-06-07 14:29 ` Lars Ingebrigtsen
2022-07-11 12:55   ` Lars Ingebrigtsen

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