1

I am following System Crafters series on Emacs from Scratch on YouTube. With my configuration as I have set it up, Ivy doesn't appear in nice left-justified easy-to-read columns. I am trying to figure out a setting to do this. To be clear, here is what appears in my minibuffer.

emacs with badly justified mini buffer columns

A slightly shortened version of my init.el file is as follows:

(setq inhibit-startup-message t)
(setq initial-frame-alist
      (append initial-frame-alist
              '((width  . 100)
        (height . 45))))


(load-theme 'wombat)

(scroll-bar-mode -1)        ; Disable visible scrollbar
(tool-bar-mode -1)          ; Disable the toolbar
(tooltip-mode -1)           ; Disable tooltips
(set-fringe-mode 10)        ; Give some breathing room

(menu-bar-mode -1)            ; Disable the menu bar

(column-number-mode)
(global-display-line-numbers-mode t)


;; Disable line numbers for some modes
(dolist (mode '(org-mode-hook
                term-mode-hook
                shell-mode-hook
                treemacs-mode-hook
                eshell-mode-hook))
  (add-hook mode (lambda () (display-line-numbers-mode 0))))


(set-face-attribute 'default nil
                    :family "DejaVu Sans Mono"
                    :height 150)

;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)

;; Initialize package sources
(require 'package)

(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("org" . "https://orgmode.org/elpa/")
                         ("elpa" . "https://elpa.gnu.org/packages/")))

(package-initialize)
(unless package-archive-contents
 (package-refresh-contents))

;; Initialize use-package on non-Linux platforms
(unless (package-installed-p 'use-package)
   (package-install 'use-package)) 

(require 'use-package)
(setq use-package-always-ensure t)


(use-package doom-modeline
  :ensure t
  :init (doom-modeline-mode 1)
  :custom ((doom-modeline-height 10)))


(use-package ivy
  :diminish
  :bind (("C-s" . swiper)
         :map ivy-minibuffer-map
         ("TAB" . ivy-alt-done) 
         ("C-l" . ivy-alt-done)
         ("C-j" . ivy-next-line)
         ("C-k" . ivy-previous-line)
         :map ivy-switch-buffer-map
         ("C-k" . ivy-previous-line)
         ("C-l" . ivy-done)
         ("C-d" . ivy-switch-buffer-kill)
         :map ivy-reverse-i-search-map
         ("C-k" . ivy-previous-line)
         ("C-d" . ivy-reverse-i-search-kill))
  :config
  (ivy-mode 1))

(use-package ivy-rich
  :init
  (ivy-rich-mode 1))

(use-package counsel
  :bind (("M-x" . counsel-M-x)
         ("C-x b" . counsel-ibuffer)
         ("C-x C-f" . counsel-find-file)
         :map minibuffer-local-map
         ("C-r" . 'counsel-minibuffer-history)))

(use-package swiper :ensure t)

(use-package counsel
  :bind (("C-M-j" . 'counsel-switch-buffer)
         :map minibuffer-local-map
         ("C-r" . 'counsel-minibuffer-history))

  :config
  (counsel-mode 1))
5
  • Do you see the same problem if you start Emacs using emacs -Q (no init file)? If not then bisect your init file to find the culprit. If you still have a question at that point, either post it separately or edit this question to ask it (removing all code that's irrelevant to reproducing the problem with emacs -Q).
    – Drew
    Nov 27, 2021 at 20:49
  • I may be missing something but I don't understand how I can do that here since ivy behaviour is defined by my init.el. Without my init.el ivy will simply not do anything, right?
    – Lindsay
    Nov 27, 2021 at 21:37
  • 1
    Provide an explicit recipe that starts with emacs -Q. You can use M-: or M-x eval-region or load a file whose contents you show, to provide all necessary settings and other code you really need to repro it. The point is to narrow the question/problem down to just what's relevant.
    – Drew
    Nov 28, 2021 at 1:25
  • Thank you @Drew. I did as you suggest, and narrowed the problem. It turned out that the problem was caused by the font choice. When I removed the following the problem disappeared: (set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 150)
    – Lindsay
    Dec 1, 2021 at 9:09
  • Great. You can accept your own answer. Questions with accepted answers tend to help others more.
    – Drew
    Dec 1, 2021 at 15:56

1 Answer 1

1

By a process of elimination, I realised the problem was the font I was using, which puzzles me because I thought any monospace font would do OK. When I removed the following, the formatting in the minibuffer was fine.

(set-face-attribute 'default nil
                :family "DejaVu Sans Mono"
                :height 150)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.