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