punassuming / ranger.el

Bringing the goodness of ranger to dired!
699 stars 52 forks source link

Ranger conflicts with web-mode and js2-mode hooks #170

Open ztlevi opened 6 years ago

ztlevi commented 6 years ago

I'm trying to add hooks to web-mode and js2-mode to set the header-line. It works for prog-mode and text-mode but not for web-mode and js2-mode since they are derived from fundamental-mode.

More tricky thing is it works when I open the html or js files with dired or treemacs but not for ranger or deer. I get so confused and I already tried ranger-mode-load-hook but still not working.

I'm using ranger-20170817.857 and emacs 25.3.

(which-function-mode)
;; when editing js file, this feature is very useful
;; (setq-default header-line-format
;;               '((which-func-mode ("" which-func-format " "))))

(defun zt/set-header-line ()
  (message "NOOOOOOOOOOOO!")
  (setq header-line-format
        '((which-func-mode ("" which-func-format " ")))))
(add-hook 'prog-mode-hook 'zt/set-header-line)
(add-hook 'text-mode-hook 'zt/set-header-line)
(add-hook 'js2-mode-hook 'zt/set-header-line)
(add-hook 'web-mode-hook 'zt/set-header-line)

Here is the header-line-format value opened with dired and ranger.

Dired:

Ranger:

I tried adding hooks to ranger-mode-load-hook and set ranger-modify-header to nil. Not working.

Need some help here~ Thanks.