简体   繁体   中英

How to fill entire frame with an image?

I am creating an Emacs frame with (make-frame) and loading an image into it. When I start Emacs with -q option and run my script, Emacs creates a frame and fills the entire frame with the image.

However when I run this from my ordinary Emacs session ( emacsclient ), then Emacs inserts 1 to the left of the image and creates a column over entire height of the frame to the left of the image:

Screenshot

Below is my code to create a frame and insert an image:

(defvar bckgimg "~/a.jpg" "Image used for desktop background")
(progn
    (setq backgr-frame
          (make-frame
           `((name . "background-frame")
             (width . ,(display-pixel-width))
             (height . ,(display-pixel-height))
             (undecorated . t)
             (fringe . nil)
             (below . t)
             (left-fringe . 0)
             (right-fringe . 0)
             (tool-bar-lines . 0)
             (menu-bar-lines . 0)
             (unsplittable . t)
             (mode-line . nil)
             (buffer-predicate . (lambda (x) nil))
             (internal-border-width . 0)
             (z-group . below)
             (visibility . nil)
             (skip-taskbar . t)
             (minibuffer . nil)
             (top . 0)
             (left . 0))))

    (with-selected-frame backgr-frame
            (toggle-frame-maximized)
            (lower-frame backgr-frame)
            (make-frame-visible backgr-frame)
            (with-output-to-temp-buffer "backgr"
                    (switch-to-buffer "backgr")
                    (setq mode-line-format nil)
                    (if (fboundp 'display-line-numbers-mode)
                                    (display-line-numbers-mode -1))
                    (if (fboundp 'linnum-mode)
                                    (linnum-mode -1))
                    (insert-image (create-image bckgimg
                                                'jpeg nil
                                                :width 3840)))))

I have being looking into docs and searching around but I can't seem to find how to fix this. What would be the code to display the image without that extra column to the left (green in screenshot)?

Ok I have solved it with help from someone on Reddit. The issue was with line numbers. I had global-display-line-numbers-mode on. Adding

(display-line-numbers-mode -1)

solves the issue. I have edited code above for correct solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM