domtronn / all-the-icons.el

A utility package to collect various Icon Fonts and propertize them within Emacs.
MIT License
1.48k stars 177 forks source link

Mode Line patches set it to blank due to an error. #97

Open asadoll opened 6 years ago

asadoll commented 6 years ago

I copy-pasted the code snippets provided in the wiki for icon-tweaking the mode line to my empty ~/local.el (although some of the snippets had unbalanced parenthesis which I fixed and the corresponding errors) and the mode-line gone blank. I evaluated the final concated version of the patches in scratch and it returned with error: `(invalid-function "%e") ("%e" (:eval (let ((active (powerline-selected-window-active)) (face0 (if active (quote powerline-active0) (quote powerline-inactive0))) (lhs (list (powerline-raw (concat "GNU Emacs " ... "." ...) face0 (quote l)))) (rhs (list (if (buffer-modified-p) (powerline-raw "Modified" face0 ...)) (powerline-fill face0 0))) (center (list (powerline-raw "%b" face0)))) (concat (powerline-render lhs) (powerline-fill-center face0 (/ (powerline-width center) 2.0)) (powerline-render center) (powerline-fill face0 (powerline-width rhs)) (powerline-render rhs))))) eval(("%e" (:eval (let ((active (powerline-selected-window-active)) (face0 (if active (quote powerline-active0) (quote powerline-inactive0))) (lhs (list (powerline-raw (concat "GNU Emacs " ... "." ...) face0 (quote l)))) (rhs (list (if (buffer-modified-p) (powerline-raw "Modified" face0 ...)) (powerline-fill face0 0))) (center (list (powerline-raw "%b" face0)))) (concat (powerline-render lhs) (powerline-fill-center face0 (/ (powerline-width center) 2.0)) (powerline-render center) (powerline-fill face0 (powerline-width rhs)) (powerline-render rhs))))) nil) elisp--eval-last-sexp(nil)

[257 "\204`

I checked the mode-line-format variable and it was: ("%e" (:eval (let* ((active (powerline-selected-window-active)) (face0 (if active 'powerline-active0 'powerline-inactive0)) (lhs (list (powerline-raw (concat "GNU Emacs " (number-to-string emacs-major-version) "." (number-to-string emacs-minor-version)) face0 'l))) (rhs (list (if (buffer-modified-p) (powerline-raw "Modified" face0 'r)) (powerline-fill face0 0))) (center (list (powerline-raw "%b" face0)))) (concat (powerline-render lhs) (powerline-fill-center face0 (/ (powerline-width center) 2.0)) (powerline-render center) (powerline-fill face0 (powerline-width rhs)) (powerline-render rhs)))))

any idea how to get the iconized mode line up and running?

ghost commented 6 years ago

This might be a naive question, but is the function quoted? Ie. (setq mode-line-format ("%e" .... ) becomes (setq mode-line-format '("%e" ...) difference being the quote

wyuenho commented 5 years ago

I don't know exactly what you are trying to iconize, but here's a working example to turn the major mode into an icon:

(add-hook 'after-change-major-mode-hook
            (lambda ()
              (let* ((icon (all-the-icons-icon-for-mode major-mode))
                     (face-prop (and (stringp icon) (get-text-property 0 'face icon))))
                (when (and (stringp icon) (not (string= major-mode icon)) face-prop)
                  (setq mode-name (propertize icon 'display '(:ascent center)))))))