all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: joakim@verona.se
To: 68486@debbugs.gnu.org
Cc: manuel@ledu-giraud.fr
Subject: bug#68486: 29.1; Confusing window layout changes in image-dired
Date: Tue, 16 Jan 2024 12:51:42 +0100	[thread overview]
Message-ID: <874jfdh4xd.fsf@tanaka.verona.se> (raw)
In-Reply-To: <87zfx5vc3x.fsf@ledu-giraud.fr> (Manuel Giraud via's message of "Tue, 16 Jan 2024 10:52:50 +0100")

Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> Hi,
>
> Could you try this patch?

After some failures trying the patch in my running emacs session, I
tried with emacs -q, and now it worked, big improvement!



> -- 
> Manuel Giraud
>
> From b979865cf8cf2fa8ec73ac8bc6cfee32f6de68fc Mon Sep 17 00:00:00 2001
> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Date: Tue, 16 Jan 2024 10:47:45 +0100
> Subject: [PATCH] Refill 'image-dired-display-image-buffer'
>
> Bug#68486
>
> * lisp/image/image-dired.el (image-dired-display-image): Refill
> 'image-dired-display-image-buffer' instead of killing it, open a new
> file and then renaming it.
> ---
>  lisp/image/image-dired.el | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
> index 9eb68e240fe..b08aa129b98 100644
> --- a/lisp/image/image-dired.el
> +++ b/lisp/image/image-dired.el
> @@ -1260,18 +1260,18 @@ image-dired-display-image
>    (setq file (expand-file-name file))
>    (when (not (file-exists-p file))
>      (error "No such file: %s" file))
> -  (let ((buf (get-buffer image-dired-display-image-buffer))
> +  (let ((buf (get-buffer-create image-dired-display-image-buffer))
>          (cur-win (selected-window)))
> -    (when buf
> -      (kill-buffer buf))
> -    (when-let ((buf (find-file-noselect file nil t)))
> -      (pop-to-buffer buf)
> -      (rename-buffer image-dired-display-image-buffer)
> -      (if (string-match (image-file-name-regexp) file)
> -          (image-dired-image-mode)
> -        ;; Support visiting PDF files.
> -        (normal-mode))
> -      (select-window cur-win))))
> +    (with-current-buffer buf
> +      (let ((inhibit-read-only t))
> +        (erase-buffer)
> +        (insert-file-contents file)
> +        (if (string-match (image-file-name-regexp) file)
> +            (image-dired-image-mode)
> +          ;; Support visiting PDF files.
> +          (normal-mode))))
> +    (when buf (pop-to-buffer buf))
> +    (select-window cur-win)))
>  
>  (defun image-dired-display-this (&optional arg)
>    "Display current thumbnail's original image in display buffer.
-- 
Joakim Verona
joakim@verona.se





  reply	other threads:[~2024-01-16 11:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 20:16 bug#68486: 29.1; Confusing window layout changes in image-dired joakim
2024-01-16  9:08 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-16  9:52   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-16 11:51     ` joakim [this message]
2024-01-16 14:36       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-16 14:46         ` Eli Zaretskii
2024-01-16 15:32           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-16  9:53   ` joakim

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

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

  git send-email \
    --in-reply-to=874jfdh4xd.fsf@tanaka.verona.se \
    --to=joakim@verona.se \
    --cc=68486@debbugs.gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.