Convert setq calls of customisable variables to customize-set-variable calls

Well, most of them. Some are a bit harder to do so i leave them for later.
This commit is contained in:
Gergely Polonkai 2018-11-21 13:59:29 +01:00
parent 8ab669205c
commit 32759d1544

View File

@ -32,6 +32,16 @@
(use-package bind-key)
#+END_SRC
** Set up the really basic things
#+BEGIN_SRC emacs-lisp
(use-package emacs
:ensure nil
:custom
(user-full-name "Gergely Polonkai")
(user-mail-address "gergely@polonkai.eu"))
#+END_SRC
** Set up my personal keymap
I set it up early so I can use it in ~use-package~ calls immediately.
@ -59,15 +69,6 @@ Just to make sure, although most Linux DE does this for me.
(set-default-coding-systems 'utf-8)
#+END_SRC
* Set personal information
** Who am I?
#+BEGIN_SRC emacs-lisp
(setq user-full-name "Gergely Polonkai"
user-mail-address "gergely@polonkai.eu")
#+END_SRC
* Add some directories to ~load-path~
** My own (version controlled) ~lisp~ directory
@ -1185,10 +1186,10 @@ Because Im a sysadmin, too.
#+BEGIN_SRC emacs-lisp
(use-package nxml-mode
:ensure nil
:config
(setq nxml-attribute-indent 4
nxml-child-indent 2
nxml-outline-child-indent 4))
:custom
(nxml-attribute-indent 4)
(nxml-child-indent 4)
(nxml-outline-child-indent 4))
#+END_SRC
** ~recentf~
@ -1206,8 +1207,8 @@ Because Im a sysadmin, too.
#+BEGIN_SRC emacs-lisp
(use-package files
:ensure nil
:config
(setq make-backup-file-name-function 'xah/backup-file-name))
:custom
(make-backup-file-name-function 'xah/backup-file-name))
#+END_SRC
** ~whitespace~
@ -1226,7 +1227,8 @@ Because Im a sysadmin, too.
:config
(add-function :before-while whitespace-enable-predicate 'prevent-whitespace-mode-for-some)
(global-whitespace-mode 1)
(setq whitespace-line-column 100)
:custom
(whitespace-line-column 100)
:bind
(([f10] . whitespace-mode)
([(shift f10)] . global-whitespace-mode)
@ -1276,10 +1278,9 @@ Now set up eshell.
;; Save place
(use-package saveplace
:config'
(if (version< emacs-version "25.0")
(setq-default save-place t)
(save-place-mode 1))
(setq save-place-file (expand-file-name ".places" user-emacs-directory)))
(save-place-mode 1)
:custom
(save-place-file (expand-file-name ".places" user-emacs-directory)))
#+END_SRC
** ID manager
@ -1299,10 +1300,10 @@ Manage credentials, AKA password manager.
#+BEGIN_SRC emacs-lisp
(use-package ediff
:init
(setq-default ediff-merge-split-window-function 'split-window-horizontally
ediff-split-window-function 'split-window-vertically
ediff-window-setup-function 'ediff-setup-windows-plain))
:custom
(ediff-merge-split-window-function 'split-window-horizontally)
(ediff-split-window-function 'split-window-vertically)
(ediff-window-setup-function 'ediff-setup-windows-plain))
#+END_SRC
** Automatically revert changed files
@ -1321,8 +1322,8 @@ For in-Emacs browsing needs.
#+BEGIN_SRC emacs-lisp
(use-package eww
:config
(setq eww-search-prefix "https://www.google.com/?q="))
:custom
(eww-search-prefix "https://duckduckgo.com/html/?q="))
#+END_SRC
** Electric indent mode
@ -1375,8 +1376,8 @@ The cookies are from the Hungarian version an ancient MS-DOS based program calle
#+BEGIN_SRC emacs-lisp
(use-package cookie1
:demand t
:config
(setq cookie-file (expand-file-name "fortune-cookies.txt" user-emacs-directory))
:custom
(cookie-file (expand-file-name "fortune-cookies.txt" user-emacs-directory))
:bind
(:map gpolonkai/pers-map
("k" . cookie)))
@ -1403,10 +1404,10 @@ The cookies are from the Hungarian version an ancient MS-DOS based program calle
#+BEGIN_SRC emacs-lisp
(use-package dired
:ensure nil
:config
(customize-set-variable 'dired-dwim-target t)
(customize-set-variable 'wdired-create-parent-directories t)
(customize-set-variable 'wdired-allow-to-change-permissions t)
:custom
(dired-dwim-target t)
(wdired-create-parent-directories t)
(wdired-allow-to-change-permissions t)
:bind
(:map dired-mode-map
("RET" . dired-find-alternate-file)
@ -1461,9 +1462,9 @@ I dont usually like to see them, but there are occasions when they can be use
#+BEGIN_SRC emacs-lisp
(use-package ispell
:config
(customize-set-variable 'ispell-dictionary "en_GB")
(customize-set-variable 'ispell-program-name "/usr/bin/aspell")
:custom
(ispell-dictionary "en_GB")
(ispell-program-name "/usr/bin/aspell")
:hook
(mail-send . ispell-message)
(message-send . ispell-message))
@ -1475,9 +1476,9 @@ I dont usually like to see them, but there are occasions when they can be use
#+BEGIN_SRC emacs-lisp
(use-package auto-package-update
:config
(setq auto-package-update-interval 7
auto-package-update-delete-old-versions t)
:custom
(auto-package-update-interval 7)
(auto-package-update-delete-old-versions t)
;; Lets do this in after-init-hook, as use-package invocations may modify
;; the list of installed packages
:hook
@ -1490,12 +1491,12 @@ I dont usually like to see them, but there are occasions when they can be use
#+BEGIN_SRC emacs-lisp
(use-package nyan-mode
:init
(setq-default nyan-animate-nyancat t
nyan-wavy-trail t)
:config
(customize-set-variable 'nyan-bar-length 20)
(nyan-mode t))
(nyan-mode t)
:custom
(nyan-bar-length 20)
(nyan-animate-nyancat t)
(nyan-wavy-trail t))
#+END_SRC
*** Nyan prompt in EShell
@ -1514,8 +1515,9 @@ Unfortunately, this works only in a graphical mode.
:after
zone
:config
(setq-default zone-nyan-hide-progress t)
(setq zone-programs (vconcat zone-programs [zone-nyan])))
(setq zone-programs (vconcat zone-programs [zone-nyan]))
:custom
(zone-nyan-hide-progress t))
#+END_SRC
** De-light some minor modes
@ -1533,9 +1535,10 @@ Unfortunately, this works only in a graphical mode.
:config
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode)
(customize-set-variable 'moody-mode-line-height 18)
(set-face-attribute 'mode-line nil :box nil :foreground "#7e7486")
(set-face-attribute 'mode-line-inactive nil :box nil))
(set-face-attribute 'mode-line-inactive nil :box nil)
:custom
(moody-mode-line-height 18))
#+END_SRC
*** Minions
@ -1581,10 +1584,11 @@ Highlight point. Sometimes its not easy to see.
:config
(with-eval-after-load "esh-opt"
(autoload 'epe-theme-lambda "eshell-prompt-extras")
(setq eshell-highlight-prompt nil
eshell-prompt-function 'epe-theme-lambda)
(when (featurep 'nyan-prompt)
(nyan-prompt-enable))))
(nyan-prompt-enable)))
:custom
(eshell-highlight-prompt nil)
(eshell-prompt-function 'epe-theme-lambda))
#+END_SRC
*** Show form feeds as a horizontal line
@ -1624,10 +1628,10 @@ Because one is never enough.
#+BEGIN_SRC emacs-lisp
(defun gpolonkai/no-blink-matching-paren ()
(setq blink-matching-paren nil))
(customize-set-variable 'blink-matching-paren nil))
(defun gpolonkai/blink-matching-paren ()
(setq blink-matching-paren t))
(customize-set-variable 'blink-matching-paren t))
(use-package multiple-cursors
:init
@ -1684,10 +1688,9 @@ Because one is never enough.
#+BEGIN_SRC emacs-lisp
(use-package magit
:init
(setq magit-auto-revert-mode nil
magit-last-seen-setup-instructions "1.4.0"
magit-push-always-verify nil)
:custom
(magit-auto-revert-mode nil)
(magit-last-seen-setup-instructions "1.4.0")
:bind
(:map ctl-x-map
("g" . magit-status))
@ -1806,9 +1809,10 @@ window.
#+BEGIN_SRC emacs-lisp
(use-package ace-window
:custom
(aw-background nil)
(aw-dispatch-always t)
:config
(setq aw-background nil
aw-dispatch-always t)
(add-to-list 'aw-dispatch-alist
'(?s gpolonkai/scroll-window-up " Scroll window up")
t)
@ -2155,8 +2159,8 @@ This will be replaced with something self-hosted, eventually.
#+BEGIN_SRC emacs-lisp
(use-package wakatime-mode
:init
(setq-default wakatime-cli-path (executable-find "wakatime"))
:custom
(wakatime-cli-path (executable-find "wakatime"))
:config
(global-wakatime-mode t))
#+END_SRC
@ -2175,13 +2179,9 @@ This will be replaced with something self-hosted, eventually.
#+BEGIN_SRC emacs-lisp
(use-package keyfreq
:demand
:init
(setq keyfreq-file (expand-file-name
"keyfreq"
user-emacs-directory))
(setq keyfreq-file-lock (expand-file-name
"keyfreq.lock"
user-emacs-directory))
:custom
(keyfreq-file (expand-file-name "keyfreq" user-emacs-directory))
(keyfreq-file-lock (expand-file-name "keyfreq.lock" user-emacs-directory))
:config
(keyfreq-mode 1)
(keyfreq-autosave-mode 1)
@ -2508,8 +2508,8 @@ Because its great.
(use-package pipenv
:hook
(python-mode . pipenv-mode)
:init
(setq pipenv-projectile-after-switch-function #'pipenv-projectile-after-switch-extended))
:custom
(pipenv-projectile-after-switch-function #'pipenv-projectile-after-switch-extended))
#+END_SRC
** Automatically insert Sphinx-style docstrings
@ -2560,8 +2560,8 @@ Because thats still my favourite language.
(lambda ()
(local-set-key (kbd "C-c o") 'ff-find-other-file)
(c-set-style "PERSONAL")
(setq tab-width 4
indent-tabs-mode nil)
(customize-set-variable 'tab-width 4)
(customize-set-variable 'indent-tabs-mode nil)
(c-toggle-auto-newline 1)))
(add-hook 'c-initialization-hook
(lambda ()
@ -2582,17 +2582,17 @@ Because thats still my favourite language.
#+BEGIN_SRC emacs-lisp
(use-package web-mode
:mode "\\.html?\\'"
:config
(setq web-mode-enable-auto-indentation nil)
(setq web-mode-enable-engine-detection t))
:custom
(web-mode-enable-auto-indentation nil)
(web-mode-enable-engine-detection t))
#+END_SRC
** Emmet mode
#+BEGIN_SRC emacs-lisp
(use-package emmet-mode
:config
(setq emmet-self-closing-tag-style "")
:custom
(emmet-self-closing-tag-style "")
:hook
(web-mode . emmet-mode)
(css-mode . emmet-mode))
@ -2778,21 +2778,21 @@ This is a big one; I use a lot of customisation here.
(use-package org-ref
:after
org
:config
(setq org-ref-bibliography-notes (expand-file-name "bibliography-notes" org-directory)
org-ref-default-bibliography '((expadn-file-name "references.bib" org-directory))
org-ref-pdf-directory (expand-file-name "bibtex-pdfs" org-directory)))
:custom
(org-ref-bibliography-notes (expand-file-name "bibliography-notes" org-directory))
(org-ref-default-bibliography (expand-file-name "references.bib" org-directory))
(org-ref-pdf-directory (expand-file-name "bibtex-pdfs" org-directory)))
#+END_SRC
And set up a function to open PDF files with the system pdf viewer, using ~xdg-open~.
An alternative could be
#+BEGIN_EXAMPLE
(setq bibtex-completion-pdf-open-function 'org-open-file))
(customize-set-variable 'bibtex-completion-pdf-open-function 'org-open-file))
#+END_EXAMPLE
#+BEGIN_SRC emacs-lisp
(setq bibtex-completion-pdf-open-function
(customize-set-variable 'bibtex-completion-pdf-open-function
(lambda (fpath)
(start-process "xdg-open" "*open*" "open" fpath)))
#+END_SRC
@ -2823,26 +2823,21 @@ An alternative could be
#+BEGIN_SRC emacs-lisp
(use-package org-msg
:config
(customize-set-variable 'org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil")
(customize-set-variable 'org-msg-startup "hidestars indent inlineimages")
(customize-set-variable 'org-msg-greeting-fmt "\nHello,\n\n")
(customize-set-variable 'org-msg-greeting-fmt-mailto nil)
(customize-set-variable 'org-msg-signature "
Best,
,#+begin_signature
-- *Gergely Polonkai* \\\\
,#+end_signature")
(org-msg-mode))
(org-msg-mode)
:custom
(org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil")
(org-msg-startup "hidestars indent inlineimages")
(org-msg-greeting-fmt "\nHello,\n\n")
(org-msg-greeting-fmt-mailto nil)
(org-msg-signature "\n\nBest,\n\n,#+begin_signature\n-- *Gergely Polonkai* \\\\\n,#+end_signature"))
#+END_SRC
** Sticky headers so i always know where i am
#+BEGIN_SRC emacs-lisp
(use-package org-sticky-header
:config
(customize-set-variable 'org-sticky-header-full-path 'full)
:custom
(org-sticky-header-full-path 'full)
:hook
(org-mode . org-sticky-header-mode))
#+END_SRC
@ -2897,11 +2892,12 @@ See previous versions of the current file.
#+BEGIN_SRC emacs-lisp
(use-package company
:delight " 🏢"
:custom
(company-idle-delay nil)
(company-dabbrev-downcase nil)
:config
(setq company-idle-delay nil
company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend)
company-dabbrev-downcase nil)
(setq company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend))
(put 'company-clang-arguments 'safe-local-variable #'nil-or-list-of-strings-p)
(global-company-mode))
#+END_SRC
@ -2962,9 +2958,10 @@ See previous versions of the current file.
(use-package helm
:init
(require 'helm-config)
(setq helm-M-x-fuzzy-match t
helm-buffers-fuzzy-matching t
helm-recentf-fuzzy-match t)
:custom
(helm-M-x-fuzzy-match t)
(helm-buffers-fuzzy-matching t)
(helm-recentf-fuzzy-match t)
:config
(helm-mode t)
:bind
@ -2991,10 +2988,10 @@ See previous versions of the current file.
(helm-gtags-mode t))
(use-package helm-gtags
:init
(setq-default helm-gtags-auto-update t
helm-gtags-ignore-case t
helm-gtags-path-style 'relative)
:custom
(helm-gtags-auto-update t)
(helm-gtags-ignore-case t)
(helm-gtags-path-style 'relative)
:hook
(c-mode . gpolonkai/enable-helm-gtags-mode)
:bind
@ -3035,8 +3032,8 @@ See previous versions of the current file.
#+BEGIN_SRC emacs-lisp
(use-package helm-projectile
:init
(setq projectile-completion-system 'helm)
:custom
(projectile-completion-system 'helm)
:config
(helm-projectile-on))
#+END_SRC
@ -3061,8 +3058,8 @@ See previous versions of the current file.
#+BEGIN_SRC emacs-lisp
(use-package helm-github-stars
:init
(setq-default helm-github-stars-username "gergelypolonkai"))
:custom
(helm-github-stars-username "gergelypolonkai"))
#+END_SRC
** Smex with Helm
@ -3096,8 +3093,8 @@ See previous versions of the current file.
#+BEGIN_SRC emacs-lisp
(use-package helm-c-yasnippet
:demand t
:config
(setq helm-yas-space-match-any-greedy t)
:custom
(helm-yas-space-match-any-greedy t)
:bind
(("C-c y" . helm-yas-complete)))
#+END_SRC
@ -3120,13 +3117,14 @@ See previous versions of the current file.
(use-package helm-bibtex
:after
org
:custom
(bibtex-completion-bibliography (expand-file-name "references.bib" org-directory))
(bibtex-completion-library-path (expand-file-name "bibtex-pdfs" org-directory))
(bibtex-completion-pdf-open-function 'org-open-file)
:config
(setq bibtex-completion-bibliography (expand-file-name "references.bib" org-directory)
bibtex-completion-library-path (expand-file-name "bibtex-pdfs" org-directory)
bibtex-completion-notes-path (expand-file-name
(setq bibtex-completion-notes-path (expand-file-name
(convert-standard-filename "bibliography/helm-bibtex-notes")
org-directory)
bibtex-completion-pdf-open-function 'org-open-file))
org-directory)))
#+END_SRC
* Mode specific ~use-package~ calls