Skip to content

Latest commit

 

History

History
991 lines (738 loc) · 36 KB

starter-kit-misc.org

File metadata and controls

991 lines (738 loc) · 36 KB

Starter Kit Misc

This is part of the Emacs Starter Kit.

Starter Kit Misc

Things that don’t fit anywhere else.

Rainbow-mode

(use-package rainbow-mode
  :ensure
  :commands rainbow-mode
  :init
  (add-hook 'prog-mode-hook         #'rainbow-mode)
  (add-hook 'html-mode-hook         #'rainbow-mode)
  (add-hook 'css-mode-hook          #'rainbow-mode)
  (add-hook 'org-mode-hook          #'rainbow-mode)
  (add-hook 'latex-mode-hook        #'rainbow-mode)
  (add-hook 'R-mode-hook            #'rainbow-mode)
  (add-hook 'inferior-ess-mode-hook #'rainbow-mode)
  (add-hook 'python-mode-hook       #'rainbow-mode)
  :config
  (setq rainbow-ansi-colors nil)
  (setq rainbow-x-colors nil))

Rainbow delimiters

Colors parentheses and other delimiters depending on their depth, useful for any language using them, especially lisp.

Note, however, that Sacha Chua doesn’t automatically turn this on because she thinks it slows things down a little. So she has (use-package rainbow-delimiters :disabled t). So keep an eye on it.

(use-package rainbow-delimiters
  :hook (prog-mode . rainbow-delimiters-mode))

Note that the :hook bit is taken from DW. Previously I had:

;; :init
;; (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)

Kurecolor

(use-package kurecolor
  :defer t)

Font-face setup (PragmataPro)

Read:

https://emacs.stackexchange.com/questions/1030/how-can-i-set-different-font-sizes-for-buffers-and-for-the-mode-line

;; (font-family-list) for having all installed fonts

(defun font-existsp (font)
  "Check to see if the named FONT is available."
  (if (null (x-list-fonts font))
      nil t))

;; To change the default font for the current and future frames
;; Affects the height of the mode-line (originally at 156)
(set-face-attribute 'default nil :family "Pragmata Pro Mono" :height 180)
(set-face-attribute 'fixed-pitch nil :family "Pragmata Pro Mono" :height 180)
(set-face-attribute 'variable-pitch nil :family "Pragmata Pro" :height 180)

;; Mode-line (This is what shrinks the mode line)
(set-face-attribute 'mode-line nil :font "Pragmata Pro Mono-16")

;; my function to reduce the mode-line on the flycheck

(defun dgm/shrink-modeline ()
  "Shrinks font size in the modeline"
  (interactive)
  (set-face-attribute 'mode-line nil :font "Pragmata Pro Mono-16"))

;; I believe it is not needed.
;; (setq default-frame-alist '((font . "Pragmata Pro Mono-18")))

Line-spacing tweak

Set this to a different number depending on taste and the font selected. The value can be a integer or decimal number.

If integer
it means pixels, added below each line.
If float
(e.g 0.02): a scaling factor relative to current window’s default line height.

if nil: add no extra spacing.

Tuned for Pragmata Pro at 0.09. 0.06 originally

(setq-default line-spacing 0.10)
;; no sé por qué me da error ahora
;; (add-to-list 'default-frame-alist '(line-spacing . 0.06))

Customize minibuffer’s height

My change relates to height: changed from 2 to 10 in an attempt to raise the minibuffer and be able to see more… but it doesn’t work!! It’d be useful for `pass’, for example.

(setq minibuffer-frame-alist
      '((width . 80) (height . 10)))

Minions

  • Bundle all minor modes under a [+] symbol
  • Not compatible with spaceline out of the box
  • Customizations I don’t use now that I use doom’s mode line
  • How to make it compatible with spaceline.
(setq display-time-24hr-format t)
(setq display-time-default-load-average t)
(setq display-time-mail-string "") ;; no mail alert
(display-time-mode 1)

My original, working config

  (use-package minions
;;    :after (circadian)
    :config
    (setq minions-mode-line-lighter "[+]")
    (minions-mode 1))

(global-set-key [S-down-mouse-3] 'minions-minor-modes-menu)

DW’s config for the doom-modeline

(use-package minions
  :hook (doom-modeline-mode . minions-mode)
  :custom
  (minions-mode-line-lighter "[+]"))

My mode line

https://emacs.stackexchange.com/questions/10033/change-mode-line-buffer-id-face-for-inactive-windows/22682#22682

It’s working. Turn off when using DW’s Doom setup

;;;; Comment out when Polybar takes care of this.
(setq display-time-day-and-date t)
(setq display-time-24hr-format t)
(display-time-mode 1)

(defvar ml-selected-window nil)

(defun ml-record-selected-window ()
  (setq ml-selected-window (selected-window)))

(defun ml-update-all ()
  (force-mode-line-update t))

(add-hook 'post-command-hook 'ml-record-selected-window)

(add-hook 'buffer-list-update-hook 'ml-update-all)

(defface ml-active-window-face
  '((t (:foreground "#b58900")))
  "Face for active buffer identification.")

(defface ml-inactive-window-face
  '((t (:foreground "#696969")))
  "Face for inactive buffer identification.")

(defun ml-propertized-buffer-identification (fmt)
  "Return a list suitable for `mode-line-buffer-identification'.
FMT is a format specifier such as \"%12b\".  This function adds
text properties for face, help-echo, and local-map to it."
  (list (propertize fmt
                    'face
                    (if (eq ml-selected-window (selected-window))
                        'ml-active-window-face
                      'ml-inactive-window-face)
                    'help-echo
                    (purecopy "Buffer name
mouse-1: Previous buffer\nmouse-3: Next buffer")
                    'mouse-face 'mode-line-highlight
                    'local-map mode-line-buffer-identification-keymap)))

(setq-default mode-line-buffer-identification
              '(:eval (ml-propertized-buffer-identification "%12b")))

;; (defun dgm/send-polybar-hook (module-name hook-index)
;;   (start-process-shell-command "polybar-msg" nil (format "polybar-msg hook %s %s" module-name hook-index)))

;; (defun dgm/send-polybar-exwm-workspace () 
;;   (dgm/send-polybar-hook "exwm-workspace" 1))

DW’s modeline config with doom-modeline

doom-modeline is a very attractive and rich (yet still minimal) mode line configuration for Emacs. The default configuration is quite good but you can check out the configuration options for more things you can enable or disable.

NOTE: The first time you load your configuration on a new machine, you’ll need to run `M-x all-the-icons-install-fonts` so that mode line icons display correctly.

(use-package doom-modeline
  :init (doom-modeline-mode 1)
  :custom ((doom-modeline-height 15)))

More sophisticated config: (disabled in 15 May 2021)

(use-package doom-modeline
  :after eshell     ;; Make sure it gets hooked after eshell
  :hook (after-init . doom-modeline-init)
  :custom-face
  (mode-line ((t (:height 0.95)))) ;; 1
  (mode-line-inactive ((t (:height 0.75))))
  (mode-line-buffer-modified ((t :foreground "orange")))
  :custom
  (doom-modeline-height 8)     ;; 15, luego 10
  (doom-modeline-bar-width 6)   ;; 6
  (doom-modeline-lsp t)
  (doom-modeline-github nil)
  (doom-modeline-mu4e nil)
  (doom-modeline-irc nil)
  (doom-modeline-minor-modes t)
  (doom-modeline-persp-name nil)
  (doom-modeline-buffer-file-name-style 'truncate-except-project)
  (doom-modeline-major-mode-icon t)
  :config
  (setq doom-modeline-icon t)
  (column-number-mode t))
 
(defun doom-modeline-conditional-buffer-encoding ()
  "We expect the encoding to be LF UTF-8, so only show the modeline when this is not the case"
  (setq-local doom-modeline-buffer-encoding
              (unless (and (memq (plist-get (coding-system-plist buffer-file-coding-system) :category)
                                 '(coding-category-undecided coding-category-utf-8))
                           (not (memq (coding-system-eol-type buffer-file-coding-system) '(1 2))))
                t)))

(add-hook 'after-change-major-mode-hook #'doom-modeline-conditional-buffer-encoding)

Color Themes

Emacs 24 introduces a streamlined theming system that replaces an older, messier one. The Starter Kit comes with Ethan Schoonover’s Solarized color theme and the Zenburn theme, in versions maintained by Bozhidar Batsov. Load it with M-x load-theme solarized-dark or M-x load-theme solarized-light. You can also try loading the zenburn and anti-zenburn themes.

Theme customization

Add (setq custom-safe-themes t) to your init file before you load your theme. This will treat all themes as safe, which could be a risk in theory, but if you are only installing themes from trusted sources, I don’t see any issue https://emacs.stackexchange.com/questions/18932/stop-emacs-asking-if-a-theme-is-safe

If you don’t set this up, then load-theme does not work.

(add-to-list 'custom-theme-load-path "~/.emacs.d/elpa")
(setq custom-safe-themes t)

Solarized Theme

New, simplified customization. I leave (load-theme 'solarized-light t) as I guess the theme is chosen according to the time.

(use-package solarized-theme
  :init
  ;; these settings need to be set before load-theme is invoked for Solarized.
  (setq solarized-distinct-fringe-background t) ;; make the fringe stand out from the background 
  (setq solarized-use-variable-pitch nil)       ;; Don't change the font for some headings and titles
  (setq solarized-high-contrast-mode-line t)  ;; make the modeline high contrast (change to t if you want it)
  ;;  (setq solarized-use-less-bold t)          ;; Use less bolding
  ;;  (setq solarized-use-more-italic t)        ;; Use more italics
  (setq solarized-emphasize-indicators nil)     ;; Use less colors for indicators such as git: gutter, flycheck and similar
  (setq solarized-scale-org-headlines nil)      ;; Don't change size of org-mode headlines (but keep other size-changes)
  ;; Avoid all font-size changes
  (setq solarized-height-minus-1 1.0)
  (setq solarized-height-plus-1 1.0)
  (setq solarized-height-plus-2 1.0)
  (setq solarized-height-plus-3 1.0)
  (setq solarized-height-plus-4 1.0)
  (setq x-underline-at-descent-line t)
  ;; Use less bolding
  (setq solarized-use-less-bold t)
  ;; Put the underline below the font bottomline instead of the baseline.
  (setq x-underline-at-descent-line t))

Tweaking solarized theme

Examples taken from https://github.com/bbatsov/solarized-emacs

$base03: #002b36; $base02: #073642; $base01: #586e75; $base00: #657b83; $base0: #839496; $base1: #93a1a1; $base2: #eee8d5; $base3: #fdf6e3; $yellow: #b58900; $orange: #cb4b16; $red: #dc322f; $magenta: #d33682; $violet: #6c71c4; $blue: #268bd2; $cyan: #2aa198; $green: #859900;

  • #e9e2cb is the creamy-white color from solarized,
  • and #2075c7 is the blue colour.

;; Solarized accented colors (yellow “#b58900”) (orange “#cb4b16”) (red “#dc322f”) (magenta “#d33682”) (violet “#6c71c4”) (blue “#268bd2”) (cyan “#2aa198”) (green “#859900”)

The Solarized Face settings consist of a palette of colors with eight accents in addition to the darkest and brightest colors. Recent changes allow you to freely create theme files using different palettes instead of the Solarized color palette. It consists of two steps: creating a theme file and loading a theme. Creating/Loading Theme Files

Select the darkest and lightest colors and the eight accents to pass to the function. This creates a theme file in .emacs.d/themes/. If you need to make minor modifications, you can override Face individually by specifying a free Sexp as the fourth argument.

Once you have a theme file, you can load it with load-theme, like solarized.

DGM customization of solarized dark

;; dgm's solarized color-theme: A less vibrant palette
(solarized-create-theme-file-with-palette 'dark 'solarized-dgm
  '("#002b36" "#fdf6e3"  
     "#6c71c4" "SteelBlue"  "#8b4500" "#eee8d5" "#6c71c4" "#268bd2" "#2aa198" "#859900"))            
              "#cb4b16" ; #8b3a3a
;;  "#b58900"     "#8b5a00" "#8b36s26" "#93115C" "#6c71c4" "#268bd2" "#2aa198" "#546E00"))            
;; "#8b795e" "#8b8378" "#4f94cd"  "#2075c7" "#4682b4" "#268bd2" "#2aa198" "#546E00")) 
;; "#839496"
;; #93a1a1
;;    "#8b8b00" "#8b5a00" "#8b3626" "#93115C" "#6c71c4" "#268bd2" "#2aa198" "#546E00"))          
;;
;;   #b58900   #cb4b16   #dc322f   #8b008b             #2075c7             #859900       
;;                         #8B2C02                                         #B4C342
;;                         #8b3626
;;                         #990A1B
;;                         #8b3626
;; "#8b795e"
;; "#Cdb38b" "#839496" SteelBlue

;; (load-theme 'solarized-dgm)

;; inspired vim's jellybeans color-theme
(solarized-create-theme-file-with-palette 'light 'solarized-jellybeans-light
  '("#202020" "#ffffff"
    "#ffb964" "#8fbfdc" "#a04040" "#b05080" "#805090" "#fad08a" "#99ad6a" "#8fbfdc"))

;; (load-theme 'solarized-jellybeans-light t)


;; inspired emacs's mesa color-theme
(solarized-create-theme-file-with-palette 'light 'solarized-mesa-light
  '("#000000" "#faf5ee"
    "#3388dd" "#ac3d1a" "#dd2222" "#8b008b" "#00b7f0" "#1388a2" "#104e8b" "#00688b"))

;; (load-theme 'solarized-mesa-light t)


;; inspired emacs's solarized color-theme
(solarized-create-theme-file-with-palette 'light 'solarized-solarized-light
  '("#002b36" "#fdf6e3"
    "#b58900" "#cb4b16" "#dc322f" "#d33682" "#6c71c4" "#268bd2" "#2aa198" "#859900"))

;; (load-theme 'solarized-solarized-light t)


;; wombat color-theme with misc face definition
(solarized-create-theme-file-with-palette 'dark 'solarized-wombat-dark
  '("#2a2a29" "#f6f3e8"
    "#e5c06d" "#ddaa6f" "#ffb4ac" "#e5786d" "#834c98" "#a4b5e6" "#7ec98f" "#8ac6f2")
  '((custom-theme-set-faces
     theme-name
     `(default ((,class (:foreground ,(solarized-color-blend base03 base3 0.15 2) :background ,base03))))
     `(highlight ((,class (:background ,violet))))
     `(font-lock-builtin-face ((,class (:foreground ,magenta))))
     `(font-lock-constant-face ((,class (:foreground ,blue))))
     `(font-lock-comment-face ((,class (:foreground ,base00))))
     `(mode-line
       ((,class (:foreground ,base2 :background ,(solarized-color-blend base03 base3 0.85 2)))))
     `(mode-line-inactive
       ((,class (:foreground ,base00 :background ,(solarized-color-blend base03 "black" 0.85 2)))))
     `(mode-line-buffer-id ((,class (:foreground ,base3 :weight bold))))
     `(minibuffer-prompt ((,class (:foreground ,base1))))
     `(vertical-border ((,class (:foreground ,base03)))))))

;; (load-theme 'solarized-wombat-dark t)

Other themes

Notes on Labburn: Labburn is a port of the Zenburn for Emacs theme, which in turn is is a direct port of the popular Zenburn theme for vim, developed by Jani Nurminen.

The main change is the movement of color defintions to the Lab Color Space, which allows better manipulation and comparative equality in perception of the lightness of different colors. Colors were converted from the zenburn theme and slightly adjusted in lightness.

All/most bold attributes were removed as well, as these change the lightness perception.

;;  (use-package poet-theme)
(use-package tao-theme)
(use-package nord-theme)
(use-package dream-theme) ;; se descarga pero no se puede cargar, no sé por qué. Dark alternative
;; to zenburn by dbjc!

(use-package labburn-theme)     ;; the best low-contrast, zenburn-alike theme for the
;; HDPI screen
(use-package doneburn-theme)     ;; light alternative by Manuel Uberti
(use-package anti-zenburn-theme) ;; light, greyish alternative to zenburn that might
;; even work at night
(use-package twilight-anti-bright-theme) ;; check this light-on-dark theme
(use-package twilight-theme)             ;; check it

More Color Themes with Doom

doom-themes is a great set of themes with a lot of variety and support for many different Emacs modes. Taking a look at the screenshots might help you decide which one you like best. You can also run M-x counsel-load-theme to choose between them easily.

(use-package doom-themes
  :commands counsel-load-theme)

Protesilaos Stavrou’s Modus Themes

Message from Prot in Youtube:

You are welcome! There is no need to use the defconst inside your config (it is discouraged to change something that is declared as a constant). Instead, you can check the value of that defconst to get a sense of all the key-value pairs that you can override. The overrides are handled by the variables ‘modus-themes-operandi-color-overrides’ and ‘modus-themes-vivendi-color-overrides’. Here is a sample that changes quite a few basic colours in modus-vivendi (the main foreground you want to change is called ‘fg-main’, others you might also want to affect as ‘fg-alt’, ‘fg-active’…).

(setq modus-themes-vivendi-color-overrides
      '((bg-main . "#100b17")
        (bg-dim . "#161129")
        (bg-alt . "#181732")
        (bg-hl-line . "#191628")
        (bg-active . "#282e46")
        (bg-inactive . "#1a1e39")
        (bg-region . "#393a53")
        (bg-header . "#202037")
        (bg-tab-bar . "#262b41")
        (bg-tab-active . "#120f18")
        (bg-tab-inactive . "#3a3a5a")
        (fg-unfocused . "#9a9aab")
        (fg-main . "#eee8d5")))
(use-package modus-themes
  :ensure                               ; omit this to use the built-in themes
  :init
  ;; Add all your customizations prior to loading the themes
  (setq modus-themes-slanted-constructs t
        modus-themes-bold-constructs t ; nil
        modus-themes-region 'no-extend
        modus-themes-no-mixed-fonts nil  ; default
        modus-themes-subtle-line-numbers t ; nil (line numbers blend with the
                                 ; buffer)
        modus-themes-success-deuteranopia nil ; t to use blue-ish colors instead
                                        ; of greenish to denote "success",
                                        ; "done, etc
        modus-themes-fringes 'subtle ; {nil, 'subtle, 'intense}
        modus-themes-mode-line '3d   ; nil
        modus-themes-syntax 'faint ; nil, try  'faint to get same colors but more
                                        ; desaturated (less vibrant, more muted colors)
        modus-themes-hl-line 'underline-neutral ; nil is the default
        modus-themes-prompts 'subtle-gray ; ni is the default
        modus-themes-completions 'moderate ; {nil, 'moderate, 'opinionated}
        modus-themes-region 'no-extend ; {nil, 'bg-only-no-extend}
        modus-themes-diffs nil ; {'desaturated}
        modus-themes-org-blocks nil ; {'gray-background 'tinted-background}
        modus-themes-org-habit nil
        modus-themes-scale-headings t ; nil 
        )

  ;; Load the theme files before enabling a theme (else you get an error).
  (modus-themes-load-themes)
  ;; My costumization
  (setq modus-themes-operandi-color-overrides
        '((bg-main . "#eee8d5")))

  (defvar my-modus-themes-operandi-extra-colors-overrides
    '((bg-main . "#eee8d5"))
    "My bespoke colors for `modus-vivendi'.")

  (setq modus-themes-vivendi-color-overrides
        '((bg-main . "#002b36")             ; #100b17
          (bg-dim . " #93a1a1")             ; #161129
          (bg-alt . "#073642")              ; #181732
          (bg-hl-line . "#93a1a1")          ; #191628
          (bg-active . "#282e46")
          (bg-inactive . "#1a1e39") 
          (bg-region . "#393a53")
          (bg-header . "#202037")
          (bg-tab-bar . "#262b41")
          (bg-tab-active . "#120f18")
          (bg-tab-inactive . "#3a3a5a")
          (fg-unfocused . "#9a9aab")
          (fg-main . "#93a1a1")))       ;;  #e9e2cb #eee8d5

  (defvar my-modus-themes-vivendi-extra-color-overrides
    '((bg-main . "#002b36")             ; #100b17
      (bg-dim . " #93a1a1")             ; #161129
      (bg-alt . "#073642")              ; #181732
      (bg-hl-line . "#93a1a1")          ; #191628
      (bg-active . "#282e46")
      (bg-inactive . "#1a1e39") 
      (bg-region . "#393a53")
      (bg-header . "#202037")
      (bg-tab-bar . "#262b41")
      (bg-tab-active . "#120f18")
      (bg-tab-inactive . "#3a3a5a")
      (fg-unfocused . "#9a9aab")
      (fg-main . "#93a1a1"))
    "My bespoke colors for `modus-operandi'.")

  (defun my-modus-themes-saturate (percent)
    "Saturate current Modus theme palette overrides by PERCENT.
Preserve the color values stored in
`my-modus-themes-operandi-extra-color-overrides',
`my-modus-themes-vivendi-extra-color-overrides'."
    (interactive
     (list (read-number "Saturation by percent: ")))
    (let* ((theme (modus-themes--current-theme))
           (palette (pcase theme
                      ('modus-operandi modus-themes-operandi-colors)
                      ('modus-vivendi modus-themes-vivendi-colors)
                      (_ (error "No Modus theme is active"))))
           (overrides (pcase theme
                        ('modus-operandi 'modus-themes-operandi-color-overrides)
                        ('modus-vivendi 'modus-themes-vivendi-color-overrides)
                        (_ (error "No Modus theme is active"))))
           (extra-overrides (pcase theme
                              ('modus-operandi my-modus-themes-operandi-extra-color-overrides)
                              ('modus-vivendi my-modus-themes-vivendi-extra-color-overrides)
                              (_ (error "No Modus theme is active")))))
      (let (name cons colors)
        (dolist (cons palette)
          (setq name (color-saturate-name (cdr cons) percent))
          (setq name (format "%s" name))
          (setq cons `(,(car cons) . ,name))
          (push cons colors))
        (set overrides (append extra-overrides colors)))
      (pcase theme
        ('modus-operandi (modus-themes-load-operandi))
        ('modus-vivendi (modus-themes-load-vivendi))))))

;; To disable the effect

(defun my-modus-themes-revert-overrides ()
  "Reset palette overrides and reload active Modus theme."
  (interactive)
  (setq modus-themes-operandi-color-overrides nil
        modus-themes-vivendi-color-overrides nil)
  (pcase (modus-themes--current-theme)
    ('modus-operandi (modus-themes-load-operandi))
    ('modus-vivendi (modus-themes-load-vivendi))))

:config ;; Load the theme of your choice: ;; (modus-themes-load-operandi) ;; OR (modus-themes-load-vivendi) :bind (“<f5>” . modus-themes-toggle)

Circadian package: Same as my switching of themes based on time

Other dark themes I like:

  • solarized-zenburn
  • doom-nord
  • doom-solarized-dark

Prot in https://protesilaos.com/modus-themes/ claims that the solar package is built-in but it is not in my built!!

(use-package solar       ; built-in
  :config
  (setq calendar-latitude 40.4
        calendar-longitude -3.7))

(dgm/shrink-modeline)

Fuengirola:

  • latitude 36.6
  • longitude: -4.6

Madrid:

  • latitude: 40.4
  • longitude: -3.7
(use-package circadian
  :ensure
  :init (minions-mode 1)
  :config
  (setq calendar-latitude 40.4)
  (setq calendar-longitude -3.7)
  (setq circadian-themes '((:sunrise . solarized-light)
                           (:sunset  . labburn)))
  (circadian-setup))

Transparently open compressed files

(auto-compression-mode t)

Show Menu Bar in Window but not in tty

If launching Emacs as in windowing system, show the menu. If launching in a tty/terminal window, don’t display the menu.

Note by dgm on 16 sept 2018: I’m trying to use exwm so I am not going to use menu-bar-mode.

;;  (if window-system
;      (menu-bar-mode t)
;;      (menu-bar-mode -1)
;;      )

Save place last visited in buffer

The `saveplace` library saves the location of the point when you kill a buffer and returns to it next time you visit the associated file

;; Code by Kieran Healy:
;; saveplace remembers your location in a file when saving files
;;  (require 'saveplace)
;;  (setq-default save-place t) for Emacs below 24.4
;;  (toggle-save-place-globally 1) ;; in Emacs above 24.4

;; My code
;; (require 'saveplace)
;; I comment saveplace out because in the documentation it says: "For GNU Emacs 25.1 and newer versions
;; Note that saveplace is auto-loaded by save-place-mode. So you do not need to explicitly require it.

  (save-place-mode 1)

ido mode and flx-ido

Ido-mode is like magic pixie dust!

;;  (when (> emacs-major-version 21)
;;    (require 'flx-ido) 
;;    (ido-mode t)
;;    (ido-everywhere 1)
;;    (setq ido-enable-prefix nil
;;          ido-enable-flex-matching t
;;          ido-create-new-buffer 'always
;;          ido-use-filename-at-point nil
;;          ido-use-faces nil
;;          ido-max-prospects 10))                    

New setup from https://github.com/danielmai/.emacs.d/blob/master/config.org But I disable it as of 12 nov 2019 because it seems that you have to choose either helm or ido! See emacs-helm/helm#2085 and https://github.com/emacs-helm/helm/wiki/FAQ#helm-mode-conflict-with-ido-everywhere and emacs-helm/helm#1527 and, finally, https://github.com/emacs-helm/helm/wiki where it says

Customize helm-mode

To customize the completion interface or disable completion for specific commands in helm-mode, edit helm-completing-read-handlers-alist. See C-h v helm-completing-read-handlers-alist for details.

Use helm-mode and ido-mode

To use Ido for some commands and Helm for others, do not enable ido-mode. Instead, customize helm-completing-read-handlers-alist to specify which command uses Ido.

For example, suppose we want find-file-read-only to use Ido and find-file to use Helm. Then:

In your init file, turn on helm-mode. In the helm-mode customize group, add a key to helm-completing-read-handlers-alist for find-file-read-only with value ido, i.e.

(find-file-read-only . ido)

With helm-mode active, to use Emacs default completion instead of either Helm or Ido, use nil for the key value:

(find-alternate-file . nil)

;;(use-package ido
;;  :ensure t
;;  :init
;;  (setq ido-enable-prefix nil
;;        ido-enable-flex-matching t
;;        ido-create-new-buffer 'always
;;        ido-use-filename-at-point 'guess ;; changed from nil. If intrusive, revert to nil
;;        ido-use-faces nil             
;;        ido-max-prospects 10
;;        ido-everywhere nil ;; t conflicts with helm sometimes. See https://github.com/emacs-helm/helm/issues/2085
;;        ido-mode t)
;;  (use-package flx-ido
;;    :ensure t) 

(use-package ido-vertical-mode
    :init (ido-vertical-mode 1)
    (setq ido-vertical-define-keys 'C-n-and-C-p-only)
    (setq ido-vertical-show-count t))

(set-face-attribute 'ido-vertical-first-match-face nil
                    :background nil
                    :foreground "#b58900")
(set-face-attribute 'ido-vertical-only-match-face nil
                    :background nil
                    :foreground nil)
(set-face-attribute 'ido-vertical-match-face nil
                    :foreground nil)

Other, tabs, imenu and a coding hook

  (set-default 'indent-tabs-mode nil)
  (set-default 'indicate-empty-lines t)
  (set-default 'imenu-auto-rescan t)
  
  (add-hook 'text-mode-hook 'turn-on-auto-fill)

;; dgm, 1 july 2017: turn flyspell off
;;  (add-hook 'text-mode-hook 'turn-on-flyspell)
;;  (add-hook 'LaTeX-mode-hook 'turn-on-flyspell)
;;  (add-hook 'markdown-mode-hook 'turn-on-flyspell)
;;  (add-hook 'org-mode-hook 'turn-on-flyspell)
  
  (defvar starter-kit-coding-hook nil
    "Hook that gets run on activation of any programming mode.")
  
  (defalias 'yes-or-no-p 'y-or-n-p)
  ;; Seed the random-number generator
  (random t)

;; Istan Zahn uses this instea: (https://github.com/izahn/dotemacs)
;; Use y/n instead of yes/no
;; (fset 'yes-or-no-p 'y-or-n-p)

functions for prettier source code

(defun starter-kit-pretty-lambdas ()
  (font-lock-add-keywords
   nil `(("(\\(lambda\\>\\)"
          (0 (progn (compose-region (match-beginning 1) (match-end 1)
                                    ,(make-char 'greek-iso8859-7 107))
                    nil))))))

Hippie expand: at times perhaps too hip

(delete 'try-expand-line hippie-expand-try-functions-list)
(delete 'try-expand-list hippie-expand-try-functions-list)

Don’t clutter up directories with files~

(setq backup-directory-alist `(("." . ,(expand-file-name
                                        (concat dotfiles-dir "backups")))))

Associate modes with file extensions

(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . diff-mode))
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
;; (require 'yaml-mode) ;; dgm comments out as I don't know what it is for
;; (add-to-list 'auto-mode-alist '("\\.ya?ml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))

Default to unified diffs

From documentation: A string or list of strings specifying switches to be passed to diff. -u, -U NUM, --unified[=NUM] is an option for: “output NUM (default 3) lines of unified context” (man pages for diff).

(setq diff-switches "-u")

Set light and dark themes

(defun set-light-theme ()
  "Set the light theme with some customization if needed."
  (interactive)
  (load-theme 'solarized-light t)  ;; {modus-operandi, doneburn by Manuel Uberti, anti-zenburn (greyish, nice even for night work) }
  (dgm/shrink-modeline))

(defun set-dark-theme ()
  "Set the dark theme with some customization if needed."
  (interactive)
  (load-theme 'labburn t)    ;; comparándole con zenburn, con labburn veo mejor los colores vibrantes en un high dpi monitor; also `modus-vivendi'
  (dgm/shrink-modeline))
;; solarized-dark originally

;;(let ((current-hour (string-to-number (format-time-string "%H"))))
;;    (if (or (< current-hour 10) (> current-hour 19)) (set-dark-theme) (set-light-theme)))

Provide

(provide 'starter-kit-misc)

Final Message

(message "Starter Kit Misc loaded.")