Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: (ement-room-image-show) pass frame parameters #225

Closed

Conversation

progfolio
Copy link
Contributor

No description provided.

Prevents frame from being resized when display-buffer-alist has been customized
for image buffer.
See: alphapapa#223
@progfolio progfolio closed this Sep 26, 2023
@progfolio progfolio reopened this Sep 26, 2023
@progfolio progfolio changed the title wip: add ement-room-compose-send-functions fix: (ement-room-image-show) pass frame parameters Sep 26, 2023
@progfolio
Copy link
Contributor Author

Come to think of it, why not just skip the ACTION argument and let the user decide?:

(defun ement-room-image-show (pos)
  "Show image at POS in a new buffer."
  (interactive "d")
  (pcase-let* ((ement-event (ewoc-data (ewoc-locate ement-ewoc pos)))
               ((cl-struct ement-event id) ement-event)
               (buffer-name (format "*Ement image: %s*" id)))
    (unless (get-buffer buffer-name)
      (let ((image (copy-sequence (get-text-property pos 'display))))
        (when (fboundp 'imagemagick-types)
          ;; Only do this when ImageMagick is supported.
          ;; FIXME: When requiring Emacs 27+, remove this (I guess?).
          (setf (image-property image :type) 'imagemagick))
        (setf (image-property image :scale) 1.0
              (image-property image :max-width) nil
              (image-property image :max-height) nil)
        (with-current-buffer (get-buffer-create buffer-name)
          (erase-buffer)
          (insert-image image)
          (image-mode))))
    (pop-to-buffer buffer-name)))

@progfolio progfolio marked this pull request as draft September 26, 2023 03:51
@alphapapa
Copy link
Owner

alphapapa commented Oct 3, 2023

I think the current frame parameters should be the default, because I think most users will want that (to be able to see as much of a large image as possible), and no one will want to have to edit display-buffer-alist to achieve it.

So I still think this.

If you can get this ready before Friday, it can be part of v0.13, otherwise I'll retarget it for v0.14. Thanks.

@alphapapa alphapapa added the enhancement New feature or request label Oct 3, 2023
@alphapapa alphapapa added this to the 0.13 milestone Oct 3, 2023
@alphapapa alphapapa self-assigned this Oct 3, 2023
@progfolio
Copy link
Contributor Author

Won't have time to rework the patch in foreseeable future. Feel free to modify or discard.

@progfolio progfolio closed this Oct 3, 2023
alphapapa added a commit that referenced this pull request Oct 3, 2023
Fixes #223.  Closes #225.

Reported-by: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
@alphapapa
Copy link
Owner

Merged as-is. It's an improvement anyway. Thanks.

@progfolio progfolio deleted the fix/ement-room-image-show branch October 3, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants