简体   繁体   English

如何用图像填充整个框架?

[英]How to fill entire frame with an image?

I am creating an Emacs frame with (make-frame) and loading an image into it.我正在使用(make-frame)创建一个 Emacs 框架并将图像加载到其中。 When I start Emacs with -q option and run my script, Emacs creates a frame and fills the entire frame with the image.当我使用-q选项启动 Emacs 并运行我的脚本时,Emacs 创建一个框架并用图像填充整个框架。

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:但是,当我从普通的 Emacs 会话 ( emacsclient ) 运行它时,Emacs 会在图像左侧插入1并在图像左侧的整个框架高度上创建一列:

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.好的,我已经在 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.我已经编辑了上面的代码以获得正确的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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