From 1ab359646569ee5752e8eff0645f6239b4e75780 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 20 Oct 2023 09:24:27 +0200 Subject: [PATCH] Move coding related packages to their own section --- configuration.org | 225 +++++++++++++++++++++++----------------------- 1 file changed, 111 insertions(+), 114 deletions(-) diff --git a/configuration.org b/configuration.org index ca06bc4..a721dfd 100644 --- a/configuration.org +++ b/configuration.org @@ -2538,6 +2538,117 @@ Now that’s out of the way, let’s configure mu4e itself. (org-msg-signature "\n\nBest,\n\n,#+begin_signature\n-- *Gergely Polonkai* \\\\\n,#+end_signature")) #+end_src +* External packages to boost coding productivity + +** ~electric-operator~ to automatically add spaces around operators + +#+begin_src emacs-lisp +(use-package electric-operator + :config + ;; Apply electric-operator-mode to vala-mode, too + (apply #'electric-operator-add-rules-for-mode 'vala-mode + (electric-operator-get-rules-for-mode 'prog-mode)) + :hook + (c-mode-common . electric-operator-mode) + (python-mode . electric-operator-mode)) +#+end_src + +** ~rainbow-delimiters~ + +#+begin_src emacs-lisp +(use-package rainbow-delimiters + :hook + (prog-mode . rainbow-delimiters-mode)) +#+end_src + +** ~rainbow-identifiers~ + +#+begin_src emacs-lisp +(use-package rainbow-identifiers) +#+end_src + +** ~auto-highlight-symbol~ to hightlight current symbol + +Great help during refactoring. + +#+begin_src emacs-lisp +(use-package auto-highlight-symbol + :config + (global-auto-highlight-symbol-mode t)) +#+end_src + +** ~glasses~, to make ReallyLongCamelCaseWords more readable + +#+begin_src emacs-lisp +(use-package glasses + :delight " 👓" + :hook + (prog-mode . glasses-mode)) +#+end_src + +** ~hl-todo~ to highlight TODO comments + +#+begin_src emacs-lisp +(use-package hl-todo) +#+end_src + +** ~bug-reference~ to turn bug/patch references to links + +#+begin_src emacs-lisp +(defvar gpolonkai/bug-reference-url-bug-string "issues" + "String to insert in a `bug-reference-url-format' for bug references.") + +(put 'gpolonkai/bug-reference-url-bug-string 'safe-local-variable 'stringp) + +(defvar gpolonkai/bug-reference-url-patch-string "merge_requests" + "String to insert in a `bug-reference-url-format' for patch references.") + +(defvar-local bug-reference-host "gitlab.com" + "The hostname to use in `bug-reference-url-format'.") + +(defvar-local bug-reference-group "gamesystems" + "The group name or username to use in `bug-reference-url-format'.") + +(defvar-local bug-reference-repository "game-app" + "The repository name to use in `bug-reference-url-format'.") + +(put 'gpolonkai/bug-reference-url-patch-string 'safe-local-variable 'stringp) + +(defun gpolonkai/bug-reference-url () + "Return a GitLab issue or Merge Request URL. +Intended as a value for `bug-referecne-url-format'." + (format "https://%s/%s/%s/%s/%s" + bug-reference-host + bug-reference-group + bug-reference-repository + (if (string-suffix-p "!" (match-string-no-properties 1)) + gpolonkai/bug-reference-url-patch-string + gpolonkai/bug-reference-url-bug-string) + (match-string-no-properties 2))) + +(use-package bug-reference + :custom + (bug-reference-bug-regexp (rx (group word-boundary + (: (| (: (in ?B ?b) "ug" (? " ") (? ?#)) + (: (in ?P ?p) "atch" (? " ") ?#) + (: "RFE" (? " ") ?#) + (: "PR " (+ (any "a-z+-")) "/") + (: "MR" (? " ") (? "!")))) + (group (+ (any "0-9")) (opt (: ?# (+ (any "0-9")))))))) + (bug-reference-url-format #'my-gitlab-url) + :hook + (text-mode . bug-reference-mode) + (prog-mode . bug-reference-prog-mode)) +#+end_src + +** ~highlight-indentation~ to highlight indentation levels + +#+begin_src emacs-lisp +(use-package highlight-indentation + :hook + (python-mode . highlight-indentation-mode)) +#+end_src + * Custom commands and functions ** Frame manipulation @@ -2646,120 +2757,6 @@ I don’t always use the package menu, but when i do, i want to do it in style ("xena" "https://xena.greedo.xeserv.us/files/xena.txt")))) #+end_src -* Make programming a bit easier - -** Electric operator - -Automatically add spaces around operators. - -#+BEGIN_SRC emacs-lisp -(use-package electric-operator - :config - ;; Apply electric-operator-mode to vala-mode, too - (apply #'electric-operator-add-rules-for-mode 'vala-mode - (electric-operator-get-rules-for-mode 'prog-mode)) - :hook - (c-mode-common . electric-operator-mode) - (python-mode . electric-operator-mode)) -#+END_SRC - -** Colourful delimiters - -#+BEGIN_SRC emacs-lisp -(use-package rainbow-delimiters - :hook - (prog-mode . rainbow-delimiters-mode)) -#+END_SRC - -** Colourful identifiers - -#+begin_src emacs-lisp -(use-package rainbow-identifiers) -#+end_src - -** Highlight current symbol - -A big help during refactoring. - -#+BEGIN_SRC emacs-lisp -(use-package auto-highlight-symbol - :config - (global-auto-highlight-symbol-mode t)) -#+END_SRC - -** Make ReallyLongCamelCaseWords more readable - -#+BEGIN_SRC emacs-lisp -(use-package glasses - :delight " 👓" - :hook - (prog-mode . glasses-mode)) -#+END_SRC - -** Highlight TODO, FIXME, and XXX - -#+BEGIN_SRC emacs-lisp -(use-package hl-todo) -#+END_SRC - -** Bug and patch links - -#+BEGIN_SRC emacs-lisp -(defvar gpolonkai/bug-reference-url-bug-string "issues" - "String to insert in a `bug-reference-url-format' for bug references.") - -(put 'gpolonkai/bug-reference-url-bug-string 'safe-local-variable 'stringp) - -(defvar gpolonkai/bug-reference-url-patch-string "merge_requests" - "String to insert in a `bug-reference-url-format' for patch references.") - -(defvar-local bug-reference-host "gitlab.com" - "The hostname to use in `bug-reference-url-format'.") - -(defvar-local bug-reference-group "gamesystems" - "The group name or username to use in `bug-reference-url-format'.") - -(defvar-local bug-reference-repository "game-app" - "The repository name to use in `bug-reference-url-format'.") - -(put 'gpolonkai/bug-reference-url-patch-string 'safe-local-variable 'stringp) - -(defun gpolonkai/bug-reference-url () - "Return a GitLab issue or Merge Request URL. -Intended as a value for `bug-referecne-url-format'." - (format "https://%s/%s/%s/%s/%s" - bug-reference-host - bug-reference-group - bug-reference-repository - (if (string-suffix-p "!" (match-string-no-properties 1)) - gpolonkai/bug-reference-url-patch-string - gpolonkai/bug-reference-url-bug-string) - (match-string-no-properties 2)) - ) - -(use-package bug-reference - :custom - (bug-reference-bug-regexp (rx (group word-boundary - (: (| (: (in ?B ?b) "ug" (? " ") (? ?#)) - (: (in ?P ?p) "atch" (? " ") ?#) - (: "RFE" (? " ") ?#) - (: "PR " (+ (any "a-z+-")) "/") - (: "MR" (? " ") (? "!")))) - (group (+ (any "0-9")) (opt (: ?# (+ (any "0-9")))))))) - (bug-reference-url-format #'my-gitlab-url) - :hook - (text-mode . bug-reference-mode) - (prog-mode . bug-reference-prog-mode)) -#+END_SRC - -** Highlight indentation - -#+begin_src emacs-lisp -(use-package highlight-indentation - :hook - (python-mode . highlight-indentation-mode)) -#+end_src - * Python related setup and ~use-package~ calls Because, well, that’s my job now. Of course it gets a dedicated section.