From d7974bc08c0f2264f142e120b570967e17c20455 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 16:48:04 +0100 Subject: Emacs: Move Modeline settings under Style --- tag-emacs/emacs.d/init.org | 241 +++++++++++++++++++++++---------------------- 1 file changed, 121 insertions(+), 120 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 63a09a78..53b8f0cb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -185,6 +185,127 @@ By default, Emacs displays page breaks as ^L. Lines look much nicer. :defer 5 :config (global-page-break-lines-mode)) #+END_SRC +** Modeline + +I modified the mode-line format to show me less information. Instead, +I put some of it in the frame-line at the top. + +#+BEGIN_SRC emacs-lisp + (column-number-mode t) + (size-indication-mode t) + + (defun fill-line-format (line-format) + (max 0 + (- (window-width) + (length (format-mode-line line-format))))) + + (defvar mode-line-size + `((size-indication-mode + ((-3 ,(propertize + "%p" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + ;; XXX needs better description + 'help-echo "Size indication mode\n\ + mouse-1: Display Line and Column Mode Menu")) + " " + (-4 "%I"))))) + + (setq-default + mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) + (list (propertize "%[" 'help-echo recursive-edit-help-echo) + `(:propertize ("" mode-name) + help-echo "Major mode\n\ + mouse-1: Display major mode menu\n\ + mouse-2: Show help for major mode\n\ + mouse-3: Toggle minor modes" + mouse-face mode-line-highlight + local-map ,mode-line-major-mode-keymap) + '("" mode-line-process) + `(:propertize ("" minor-mode-alist) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ + mouse-1: Display minor mode menu\n\ + mouse-2: Show help for minor mode\n\ + mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" + 'mouse-face 'mode-line-highlight + 'local-map (make-mode-line-mouse-map + 'mouse-2 #'mode-line-widen)) + (propertize "%]" 'help-echo recursive-edit-help-echo) + " ")) + mode-line-buffer-identification (list (propertize "%b" + 'face 'mode-line-buffer-id)) + + mode-line-position `((line-number-mode + ((column-number-mode + ,(propertize + "%l:%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line number and Column number\n\ + mouse-1: Display Line and Column Mode Menu") + (6 ,(propertize + "L%l" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line Number\n\ + mouse-1: Display Line and Column Mode Menu")))) + ((column-number-mode + (5 ,(propertize + "C%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Column number\n\ + mouse-1: Display Line and Column Mode Menu")))))) + mode-line-format `("%e" + " " + mode-line-modes + mode-line-misc-info + (vc-mode vc-mode) + mode-line-end-spaces) + header-line-format `("%e" + mode-line-front-space + mode-line-mule-info + mode-line-client + mode-line-modified + mode-line-auto-compile + mode-line-remote " " + mode-line-position " " + mode-line-size + " ⎸ " + mode-line-buffer-identification + )) + + (setq frame-title-format + '("%f" (dired-directory dired-directory))) +#+END_SRC + +** Renaming major modes + +Diminishing major modes does not happen in the same manner as minor +modes. + +#+BEGIN_SRC emacs-lisp + (use-package cyphejor + :defer 2 + :config (progn + (setq cyphejor-rules `(("emacs" "ε") + ("diff" "Δ") + ("js2" "js") + ("magit-status" ,(char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + ("inferior" "i" :prefix) + ("interaction" "i" :prefix) + ("interactive" "i" :prefix) + ("menu" "▤" :postfix) + ("ledger" "Ledger") + ("mode" "") + ("shell" "sh" :postfix))) + (cyphejor-mode 1))) +#+END_SRC + + * Projects #+BEGIN_SRC emacs-lisp @@ -1307,126 +1428,6 @@ don’t use it directly. "smex-items")))) #+END_SRC -* Modeline - -I modified the mode-line format to show me less information. Instead, -I put some of it in the frame-line at the top. - -#+BEGIN_SRC emacs-lisp - (column-number-mode t) - (size-indication-mode t) - - (defun fill-line-format (line-format) - (max 0 - (- (window-width) - (length (format-mode-line line-format))))) - - (defvar mode-line-size - `((size-indication-mode - ((-3 ,(propertize - "%p" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - ;; XXX needs better description - 'help-echo "Size indication mode\n\ - mouse-1: Display Line and Column Mode Menu")) - " " - (-4 "%I"))))) - - (setq-default - mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) - (list (propertize "%[" 'help-echo recursive-edit-help-echo) - `(:propertize ("" mode-name) - help-echo "Major mode\n\ - mouse-1: Display major mode menu\n\ - mouse-2: Show help for major mode\n\ - mouse-3: Toggle minor modes" - mouse-face mode-line-highlight - local-map ,mode-line-major-mode-keymap) - '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "Minor mode\n\ - mouse-1: Display minor mode menu\n\ - mouse-2: Show help for minor mode\n\ - mouse-3: Toggle minor modes" - local-map ,mode-line-minor-mode-keymap) - (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" - 'mouse-face 'mode-line-highlight - 'local-map (make-mode-line-mouse-map - 'mouse-2 #'mode-line-widen)) - (propertize "%]" 'help-echo recursive-edit-help-echo) - " ")) - mode-line-buffer-identification (list (propertize "%b" - 'face 'mode-line-buffer-id)) - - mode-line-position `((line-number-mode - ((column-number-mode - ,(propertize - "%l:%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line number and Column number\n\ - mouse-1: Display Line and Column Mode Menu") - (6 ,(propertize - "L%l" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line Number\n\ - mouse-1: Display Line and Column Mode Menu")))) - ((column-number-mode - (5 ,(propertize - "C%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Column number\n\ - mouse-1: Display Line and Column Mode Menu")))))) - mode-line-format `("%e" - " " - mode-line-modes - mode-line-misc-info - (vc-mode vc-mode) - mode-line-end-spaces) - header-line-format `("%e" - mode-line-front-space - mode-line-mule-info - mode-line-client - mode-line-modified - mode-line-auto-compile - mode-line-remote " " - mode-line-position " " - mode-line-size - " ⎸ " - mode-line-buffer-identification - )) - - (setq frame-title-format - '("%f" (dired-directory dired-directory))) -#+END_SRC - -** Renaming major modes - -Diminishing major modes does not happen in the same manner as minor -modes. - -#+BEGIN_SRC emacs-lisp - (use-package cyphejor - :defer 2 - :config (progn - (setq cyphejor-rules `(("emacs" "ε") - ("diff" "Δ") - ("js2" "js") - ("magit-status" ,(char-to-string (-find #'char-displayable-p '(11942 5848 177)))) - ("inferior" "i" :prefix) - ("interaction" "i" :prefix) - ("interactive" "i" :prefix) - ("menu" "▤" :postfix) - ("ledger" "Ledger") - ("mode" "") - ("shell" "sh" :postfix))) - (cyphejor-mode 1))) -#+END_SRC - * Modes Setup some modes for systemd files -- cgit 1.4.1