Skip to content

Instantly share code, notes, and snippets.

@arnested
Last active July 5, 2022 13:30
Show Gist options
  • Select an option

  • Save arnested/afd421c89a68b874e1c0 to your computer and use it in GitHub Desktop.

Select an option

Save arnested/afd421c89a68b874e1c0 to your computer and use it in GitHub Desktop.

Revisions

  1. arnested revised this gist May 20, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions mode-line-awesome.el
    Original file line number Diff line number Diff line change
    @@ -24,4 +24,9 @@
    ;; Use the tags icon for `gtags-mode'.
    (add-hook 'gtags-mode-hook '(lambda ()
    (diminish 'gtags-mode (concat " " [#xF02C]))))

    ;; Use the Druplicon icon for `drupal-mode' (and color it Drupal
    ;; blue :-).
    (add-hook 'drupal-mode-hook '(lambda ()
    (diminish 'drupal-mode (propertize (concat " " [#xF1A9]) 'face '(:foreground "#0077C0")))))
    )
  2. arnested revised this gist May 20, 2014. 1 changed file with 25 additions and 23 deletions.
    48 changes: 25 additions & 23 deletions mode-line-awesome.el
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,27 @@
    ;; Use align-left icon for `auto-fill-mode'.
    (eval-after-load 'diminish-autoloads
    '(eval-after-load 'simple
    '(diminish 'auto-fill-function (concat " " [#xF036]))))
    (when (display-graphic-p)
    ;; Use align-left icon for `auto-fill-mode'.
    (eval-after-load 'diminish-autoloads
    '(eval-after-load 'simple
    '(diminish 'auto-fill-function (concat " " [#xF036]))))

    ;; Use thumbs-up / thumbs-down for flymake status.
    ;; We need to reimplement `flymake-report-status' to make this happen.
    (eval-after-load 'flymake
    '(defun flymake-report-status (e-w &optional status)
    "Show status in mode line."
    (when e-w
    (setq flymake-mode-line-e-w e-w))
    (when status
    (setq flymake-mode-line-status status))
    (let* ((mode-line " "))
    (if (> (length flymake-mode-line-e-w) 0)
    (setq mode-line (concat mode-line [#xF165] flymake-mode-line-e-w))
    (setq mode-line (concat mode-line [#xF164])))
    (setq mode-line (concat mode-line flymake-mode-line-status))
    (setq flymake-mode-line mode-line)
    (force-mode-line-update))))
    ;; Use thumbs-up / thumbs-down for flymake status.
    ;; We need to reimplement `flymake-report-status' to make this happen.
    (eval-after-load 'flymake
    '(defun flymake-report-status (e-w &optional status)
    "Show status in mode line."
    (when e-w
    (setq flymake-mode-line-e-w e-w))
    (when status
    (setq flymake-mode-line-status status))
    (let* ((mode-line " "))
    (if (> (length flymake-mode-line-e-w) 0)
    (setq mode-line (concat mode-line [#xF165] flymake-mode-line-e-w))
    (setq mode-line (concat mode-line [#xF164])))
    (setq mode-line (concat mode-line flymake-mode-line-status))
    (setq flymake-mode-line mode-line)
    (force-mode-line-update))))

    ;; Use the tags icon for `gtags-mode'.
    (add-hook 'gtags-mode-hook '(lambda ()
    (diminish 'gtags-mode (concat " " [#xF02C]))))
    ;; Use the tags icon for `gtags-mode'.
    (add-hook 'gtags-mode-hook '(lambda ()
    (diminish 'gtags-mode (concat " " [#xF02C]))))
    )
  3. arnested revised this gist May 14, 2014. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions mode-line-awesome.el
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ;; Use align-left icon for `auto-fill-mode'.
    (eval-after-load 'diminish-autoloads
    '(eval-after-load 'simple
    '(diminish 'auto-fill-function (concat " " (char-to-string #xF036)))))
    '(diminish 'auto-fill-function (concat " " [#xF036]))))

    ;; Use thumbs-up / thumbs-down for flymake status.
    ;; We need to reimplement `flymake-report-status' to make this happen.
    @@ -14,12 +14,12 @@
    (setq flymake-mode-line-status status))
    (let* ((mode-line " "))
    (if (> (length flymake-mode-line-e-w) 0)
    (setq mode-line (concat mode-line (char-to-string #xF165) flymake-mode-line-e-w))
    (setq mode-line (concat mode-line (char-to-string #xF164))))
    (setq mode-line (concat mode-line [#xF165] flymake-mode-line-e-w))
    (setq mode-line (concat mode-line [#xF164])))
    (setq mode-line (concat mode-line flymake-mode-line-status))
    (setq flymake-mode-line mode-line)
    (force-mode-line-update))))

    ;; Use the tags icon for `gtags-mode'.
    (add-hook 'gtags-mode-hook '(lambda ()
    (diminish 'gtags-mode (concat " " (char-to-string #xF02C)))))
    (diminish 'gtags-mode (concat " " [#xF02C]))))
  4. arnested created this gist May 14, 2014.
    14 changes: 14 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    ![Font Awesome icons in Emacs mode-line](https://lh6.googleusercontent.com/-5aRULA-qy1U/U3MfIIRkrzI/AAAAAAAASVw/Tgo3MIALOO0/w506-h82-no/Sk%25C3%25A6rmbillede+2014-05-14+kl.+09.07.02.png)

    I installed [Font Awesome](http://fontawesome.io/) and uses it to make my Emacs mode line look cool:

    * Use the _align-left_ icon for `auto-fill-mode`.
    * Use the _thumbs-up_ and _thumbs-down_ icons for flymake status (we need to reimplement `flymake-report-status` to make this happen).
    * Use the _tags_ icon for `gtags-mode`.

    Requirements: [diminish.el](http://www.eskimo.com/~seldon/diminish.el) - I installed it from [MELPA](http://melpa.milkbox.net/#/diminish).

    Since I don't specify the font anywhere this probably only works
    because Font Awesome is the only font providing those Unicode slots.

    Is there away to specify font for individual characters in the mode line?
    25 changes: 25 additions & 0 deletions mode-line-awesome.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    ;; Use align-left icon for `auto-fill-mode'.
    (eval-after-load 'diminish-autoloads
    '(eval-after-load 'simple
    '(diminish 'auto-fill-function (concat " " (char-to-string #xF036)))))

    ;; Use thumbs-up / thumbs-down for flymake status.
    ;; We need to reimplement `flymake-report-status' to make this happen.
    (eval-after-load 'flymake
    '(defun flymake-report-status (e-w &optional status)
    "Show status in mode line."
    (when e-w
    (setq flymake-mode-line-e-w e-w))
    (when status
    (setq flymake-mode-line-status status))
    (let* ((mode-line " "))
    (if (> (length flymake-mode-line-e-w) 0)
    (setq mode-line (concat mode-line (char-to-string #xF165) flymake-mode-line-e-w))
    (setq mode-line (concat mode-line (char-to-string #xF164))))
    (setq mode-line (concat mode-line flymake-mode-line-status))
    (setq flymake-mode-line mode-line)
    (force-mode-line-update))))

    ;; Use the tags icon for `gtags-mode'.
    (add-hook 'gtags-mode-hook '(lambda ()
    (diminish 'gtags-mode (concat " " (char-to-string #xF02C)))))