all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ramon Diaz-Uriarte <r.diaz@uam.es>
To: Rahguzar <rahguzar@zohomail.eu>
Cc: Ramon Diaz-Uriarte <rdiaz02@gmail.com>,
	Eli Zaretskii <eliz@gnu.org>,
	70038@debbugs.gnu.org
Subject: bug#70038: 29.3.50; Shift up/down in buffer with images on M-x other-window with some fonts
Date: Sun, 31 Mar 2024 20:43:48 +0200	[thread overview]
Message-ID: <871q7qckd7.fsf@uam.es> (raw)
In-Reply-To: <87sf0a2kyh.fsf@zohomail.eu> (rahguzar@zohomail.eu's message of "Thu, 28 Mar 2024 20:50:49 +0100")


For me, this setting fixes the problem when there is no dependence on fonts:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq read-minibuffer-restore-windows nil)
(progn
  (defun pin-vscroll-down (win)
    (set-window-vscroll win 200 t))
   (let* ((height (/ (* 2 (frame-pixel-height)) 5))
         (image1 (create-image "/tmp/image1.png" nil nil :height height))
         (image2 (create-image "/tmp/image2.png" nil nil :height height))
         (image3 (create-image "/tmp/image3.png" nil nil :height height)))
    (with-current-buffer (get-buffer-create "*image-scroll-test*")
      (insert " \n \n \n \n \n \n")
      (put-image image1 1)
      (put-image image2 5)
      (put-image image3 9)
      ;; With larger image sizes (goto-char 3)
      ;; also consistently triggers the problem.
      (goto-char 11)
      (add-hook 'pre-redisplay-functions #'pin-vscroll-down nil t))
    (split-window-right)
    (other-window 1)
    (switch-to-buffer "*image-scroll-test*")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


However, it does not solve the problem when I change fonts:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq read-minibuffer-restore-windows nil)
(progn
  (defun pin-vscroll-down (win)
    (set-window-vscroll win 200 t))
  ;; Any of the following leads to the bug
  (set-frame-font "JuliaMono" nil t)
  ;; (set-frame-font "DM Mono" nil t)
  ;; (set-frame-font "Intel One Mono" nil t)
  (let* ((height (/ (* 2 (frame-pixel-height)) 15))
         (image1 (create-image "/tmp/image1.png" nil nil :height height))
         (image2 (create-image "/tmp/image2.png" nil nil :height height))
         (image3 (create-image "/tmp/image3.png" nil nil :height height)))
    (with-current-buffer (get-buffer-create "*image-scroll-test*")
      (insert " \n \n \n \n \n \n")
      (put-image image1 1)
      (put-image image2 5)
      (put-image image3 9)
      ;; With larger image sizes (goto-char 3)
      ;; also triggers the problem.
      (goto-char 11)
      (add-hook 'pre-redisplay-functions #'pin-vscroll-down nil t))
    (split-window-right)
    (other-window 1)
    (switch-to-buffer "*image-scroll-test*")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


As mentioned initially, this issue was found when trying to solve a similar problem with pdf-tools: https://github.com/vedang/pdf-tools/pull/224#issuecomment-2014151358

Setting

(setq read-minibuffer-restore-windows nil)

solves the pdf-tools continuous scrolling issue when there is no change in font but not when we change font (https://github.com/vedang/pdf-tools/pull/224#issuecomment-2026142343 )


Best,

R.




On Thu, 28-March-2024, at 21:50:49, Rahguzar <rahguzar@zohomail.eu> wrote:
> On further testing,
>
> (setq read-minibuffer-restore-windows nil)
>
> makes the problem go away.
>
> Rahguzar <rahguzar@zohomail.eu> writes:
>
>> Hi Ramon,
>>
>> Ramon Diaz-Uriarte <rdiaz02@gmail.com> writes:
>>
>>> Actually, maybe I can claim those bonus points: this does not depend on fonts, though I am triggering it using the package vertico (so maybe this example is vertico's fault):
>>>
>>>
>>> Steps:
>>>
>>> 1. emacs -Q
>>> 2. eval this code
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>> (package-initialize)
>>> (vertico-mode 1)
>>>
>>> (progn
>>>   (defun pin-vscroll-down (win)
>>>     (set-window-vscroll win 200 t))
>>>    (let* ((height (/ (* 2 (frame-pixel-height)) 15))
>>>          (image1 (create-image "/tmp/image1.png" nil nil :height height))
>>>          (image2 (create-image "/tmp/image2.png" nil nil :height height))
>>>          (image3 (create-image "/tmp/image3.png" nil nil :height height)))
>>>     (with-current-buffer (get-buffer-create "*image-scroll-test*")
>>>       (insert " \n \n \n \n \n \n")
>>>       (put-image image1 1)
>>>       (put-image image2 5)
>>>       (put-image image3 9)
>>>       ;; With larger image sizes (goto-char 3)
>>>       ;; also consistently triggers the problem.
>>>       (goto-char 11)
>>>       (add-hook 'pre-redisplay-functions #'pin-vscroll-down nil t))
>>>     (split-window-right)
>>>     (other-window 1)
>>>     (switch-to-buffer "*image-scroll-test*")))
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>
>>> 3. Do `M-x` (or C-x b). No need to execute anything or switch buffers, just have the minibuffer show options.
>>>
>>> 4. `C-x o`  a few times. You'll see the images move up and down.
>>>
>>> I am seeing this in Lucid and GTK builds.
>>
>> I can also reproduce this now! And vertico mode can be replaced with the
>> builtin icomplete-vertical-mode. So, the following recipe starting with
>> emacs -Q works for me:
>>
>> 1) Paste
>> (let ((height (/ (* 2 (frame-pixel-height)) 15)))
>>   (icomplete-vertical-mode)
>>   (defun pin-vscroll-down (win)
>>     (set-window-vscroll win (/ height 2) t))
>>   (let ((image1 (create-image "~/Downloads/image1.png" nil nil :height height))
>>         (image2 (create-image "~/Downloads/image2.png" nil nil :height height))
>>         (image3 (create-image "~/Downloads/image3.png" nil nil :height height)))
>>     (with-current-buffer (get-buffer-create "*image-scroll-test*")
>>       (insert " \n \n \n \n \n \n")
>>       (put-image image1 1)
>>       (put-image image2 5)
>>       (put-image image3 9)
>>       ;; With larger image sizes (goto-char 3)
>>       ;; also consistently triggers the problem.
>>       (goto-char 11)
>>       (add-hook 'pre-redisplay-functions #'pin-vscroll-down nil t))
>>     (split-window-right)
>>     (other-window 1)
>>     (switch-to-buffer "*image-scroll-test*")))
>>
>> into scratch buffer.
>>
>> 2) Evaluate the form above using `C-M-x`.
>>
>> 3) Type M-x t
>>
>> 4) Wait till minibuffer expands to show completions, then type `C-g` to
>> quit minibuffer.
>>
>> 5) Typing `C-x 0` results in the window with images losing vscroll.
>>
>>> Best,
>>>
>>> R.
>>
>> Rahguzar

-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-31
Facultad de Medicina 
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid
Spain


  reply	other threads:[~2024-03-31 18:43 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 20:25 bug#70038: 29.3.50; Shift up/down in buffer with images on M-x other-window with some fonts Ramon Diaz-Uriarte
2024-03-28  5:58 ` Eli Zaretskii
2024-03-28  7:52   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28  8:36     ` Eli Zaretskii
2024-03-28 16:12   ` Ramon Diaz-Uriarte
2024-03-28 16:59     ` Ramon Diaz-Uriarte
2024-03-28 17:24       ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28 19:50         ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-31 18:43           ` Ramon Diaz-Uriarte [this message]
2024-04-06 12:33         ` Eli Zaretskii
2024-04-06 14:08           ` Eli Zaretskii
2024-04-06 14:20             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-07  8:24             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-07  9:13               ` Eli Zaretskii
2024-04-07 10:12                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-07 11:28                   ` Eli Zaretskii
2024-04-08  9:07                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13 10:10                       ` Eli Zaretskii
2024-04-14  8:31                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-14  9:28                           ` Eli Zaretskii
2024-04-15  9:23                             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-15 13:54                               ` Eli Zaretskii
2024-04-17  8:02                                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17 12:58                                   ` Eli Zaretskii
2024-04-28  8:51                                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-28  9:15                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29  9:47                                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29 12:51                                       ` Eli Zaretskii
2024-04-11 13:56           ` Ramon Diaz-Uriarte
2024-04-11 15:36             ` Eli Zaretskii
2024-04-12 16:43               ` Ramon Diaz-Uriarte

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=871q7qckd7.fsf@uam.es \
    --to=r.diaz@uam.es \
    --cc=70038@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rahguzar@zohomail.eu \
    --cc=rdiaz02@gmail.com \
    /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.