jojojames / dired-sidebar

Sidebar for Emacs leveraging Dired
GNU General Public License v3.0
513 stars 22 forks source link

truncate long lines (filenames) #63

Closed henningninneh closed 2 years ago

henningninneh commented 2 years ago

I tried to get dired-sidebar to truncate rather than wrap long filenames. In dired this works with (setq truncate-lines t), but I had no success with dired-sidebar.

Here is my config:

 (use-package dired-sidebar
    :bind (([f8] . dired-sidebar-toggle-sidebar))
    :ensure t
    :commands (dired-sidebar-toggle-sidebar)
    :init
    (add-hook 'dired-sidebar-mode-hook
              (lambda ()
                (unless (file-remote-p default-directory)
                  (auto-revert-mode))))
    ;; don't wrap long filenames. `truncate-lines' is 
    ;; buffer-local, so this should not affect dired-buffers. 
    ;; Doesn' t work, though.
    (add-hook 'dired-sidebar-mode-hook
              (lambda () 
                (setq truncate-lines t)))
    :config
    (push 'toggle-window-split dired-sidebar-toggle-hidden-commands)
    (push 'rotate-windows dired-sidebar-toggle-hidden-commands)
    (setq dired-sidebar-use-term-integration t)
    (setq dired-sidebar-use-custom-font t))

Replacing dired-sidebar-mode-hook with dired-mode-hook doesn't help either.

If I enter M-x eval-expression and (setq truncate-lines t) while in the sidebar, the lines are truncated as intended.

I'm sorry to bother you with something that is probably my own mistake. Any hints are appreciated, as is your work.

DivineDominion commented 2 years ago

Do you have global-visual-line-mode enabled? In my hook, I added (visual-line-mode -1) and it works fine, if this is what you expect:

image

jojojames commented 2 years ago

Please update if you are still having problems, thanks.