From a002b15f52f6b2bf476b52a117f045d44c045f1d Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Thu, 14 Mar 2019 11:03:42 -0400 Subject: [PATCH] Use more idiomatic lisp Replace multiple calls to setq with a single call --- global.org | 108 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 46 deletions(-) diff --git a/global.org b/global.org index c38b154..9e91af1 100644 --- a/global.org +++ b/global.org @@ -108,10 +108,10 @@ ** Mouseless Disable mouse interaction with emacs #+BEGIN_SRC emacs-lisp - (setq mouse-autoselect-window nil) (mouse-wheel-mode -1) - (setq mouse-yank-at-point nil) - (setq focus-follows-mouse nil) + (setq mouse-autoselect-window nil + mouse-yank-at-point nil + focus-follows-mouse nil) #+END_SRC *** TODO Find out what of the above is necessary given the disable-mouse mode below Use the ~disable-mouse~ package by Steve Purcell available at @@ -147,11 +147,10 @@ ** Modeline #+BEGIN_SRC emacs-lisp - (setq-default mode-line-modified '(:eval (if (buffer-modified-p) "●" "·"))) ;still needs some improvements, - ;does not report Readonly state - (setq-default mode-line-remote '(:eval (let ((s (format-mode-line "%@"))) - (cond - ((equal s "-") "·") ((equal s "@") "@") (t s))))) + (setq-default mode-line-modified '(:eval (if (buffer-modified-p) "●" "·")) ;Still needs some improvements, does not report Readonly state + mode-line-remote '(:eval (let ((s (format-mode-line "%@"))) + (cond + ((equal s "-") "·") ((equal s "@") "@") (t s))))) (defvar wilder-buffer-vc-mode-line '("%b" (vc-mode (:propertize @@ -162,25 +161,42 @@ (status (cond ((equal s "-") "") ((equal s ":") "!") (t s)))) (concat "·" branch status))) face magit-branch-local)))) - (put 'wilder-buffer-vc-mode-line 'risky-local-variable t) (defvar wilder-position '("[%p·%I] " )) + (put 'wilder-buffer-vc-mode-line 'risky-local-variable t) (put 'wilder-position 'risky-local-variable t) - (setq-default mode-line-format - '("%e" - mode-line-front-space - mode-line-mule-info - mode-line-modified - mode-line-remote - mode-line-frame-identification - wilder-buffer-vc-mode-line " " - wilder-position " " - mode-line-modes - mode-line-misc-info - mode-line-end-spaces)) + (defvar wilder/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) + '("" mode-name) + '("" mode-line-process) + " " + '("" minor-mode-alist) + (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 construct for displaying major and minor modes.") + (put 'wilder/mode-line-modes 'risky-local-variable t) + + (setq-default mode-line-format + '("%e" + mode-line-front-space + mode-line-mule-info + mode-line-modified + mode-line-remote + mode-line-frame-identification + wilder-buffer-vc-mode-line " " + wilder-position + " " + wilder/mode-line-modes + mode-line-misc-info + mode-line-end-spaces)) #+END_SRC The following has been found in [[https://www.masteringemacs.org/article/hiding-replacing-modeline-strings][here]] to clean up the modeline #+BEGIN_SRC emacs-lisp @@ -323,8 +339,8 @@ Tabs are evil; get rid of them #+BEGIN_SRC emacs-lisp (setq c-basic-offset 4) - (setq-default tab-width 4) - (setq-default indent-tabs-mode nil) + (setq-default tab-width 4 + indent-tabs-mode nil) #+END_SRC *** TODO Have a look at ws-trim.el It is conf'ble to avoid removing whitespace from lines that were not @@ -450,14 +466,14 @@ #+END_SRC ** Calendar #+BEGIN_SRC emacs-lisp - (add-hook 'calendar-load-hook - (lambda () - (calendar-set-date-style 'european))) - ;; first day of the week is monday instead of sunday: - (setq calendar-week-start-day 1) - (setq calendar-location-name "Toronto, ON Canada") - (setq calendar-latitude 43.7) - (setq calendar-longitude -79.4) + (add-hook 'calendar-load-hook + (lambda () + (calendar-set-date-style 'european))) + ;; first day of the week is monday instead of sunday: + (setq calendar-week-start-day 1 + calendar-location-name "Toronto, ON Canada" + calendar-latitude 43.7 + calendar-longitude -79.4) #+END_SRC ** Use system proxy #+BEGIN_SRC emacs-lisp @@ -764,17 +780,17 @@ *** TODO split --- Setup ~reftex~ Unbind "C-c [" #+BEGIN_SRC emacs-lisp - (eval-after-load "reftex" - '(progn - (define-key reftex-mode-map (kbd "C-c [") nil) - (setq reftex-plug-into-AUCTeX (quote (t t nil t t))) - (setq reftex-insert-label-flags '(t t)) - (setq reftex-label-alist - '(("thm" ?t "thm:" "~\\ref{%s}" thm (regexp "theorems?")) - ("lem" ?l "lem:" "~\\ref{%s}" lem (regexp "lemma{ta}?")) - ("prop" ?p "prp:" "~\\ref{%s}" prp (regexp "propositions?")) - ("cor" ?c "cor:" "~\\ref{%s}" cor (regexp "corollary")) - ("def" ?d "def:" "~\\ref{%s}" cor (regexp "defintions?")))))) + (eval-after-load "reftex" + '(progn + (setq reftex-cite-format "~\\cite{%l}" + reftex-plug-into-AUCTeX (quote (t t nil t t)) + reftex-insert-label-flags '(t t) + reftex-label-alist + '(("thm" ?t "thm:" "~\\ref{%s}" thm (regexp "theorems?")) + ("lem" ?l "lem:" "~\\ref{%s}" lem (regexp "lemma{ta}?")) + ("prop" ?p "prp:" "~\\ref{%s}" prp (regexp "propositions?")) + ("cor" ?c "cor:" "~\\ref{%s}" cor (regexp "corollary")) + ("def" ?d "def:" "~\\ref{%s}" cor (regexp "defintions?")))))) #+END_SRC *** Setup ~latex-mode~ #+BEGIN_SRC emacs-lisp @@ -869,10 +885,10 @@ #+END_SRC *** Set default TeX options #+BEGIN_SRC emacs-lisp - (setq-default TeX-master nil) - (setq TeX-auto-save t - TeX-parse-self t - TeX-insert-braces nil) + (setq-default TeX-master nil) + (setq TeX-auto-save t + TeX-parse-self t + TeX-insert-braces nil) #+END_SRC *** Appearance No fontification for sub and superscripts