Compare commits
6
Commits
91da886a69
...
1c277c96da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c277c96da | ||
|
|
6e4565cd90 | ||
|
|
6bc67c0c82 | ||
|
|
a1fea5bc99 | ||
|
|
a9265c931d | ||
|
|
d54d16f98f |
+83
-36
@@ -251,25 +251,35 @@
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Org
|
* Org
|
||||||
I use a couple non-standard bits and pieces, but not a whole
|
** Code and Quote block shortcuts
|
||||||
bunch. I really like the =<s= to insert a source block thing (which
|
I am a big fan of using =<s= for source blocks and =<q= for quotes;
|
||||||
was deprecated); =org-tempo= brings that back.
|
these are enabled by the =org-tempo= module, which is included in
|
||||||
|
=org= but not loaded by default.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package org
|
(use-package org :config (require 'org-tempo))
|
||||||
:config
|
#+end_src
|
||||||
(require 'org-tempo))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
A keybinding to add a new heading is super useful
|
However, I have recently discovered, much to my despair, that these
|
||||||
|
shortcuts do not work if there are tabs in the line ahead of them!
|
||||||
|
Quite ridiculous. Easily worked around, however; I am going to
|
||||||
|
ensure that spaces are used for indentation when in org mode by
|
||||||
|
setting [[help:indent-tabs-mode][indent-tabs-mode]] to nil in a hook:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-hook 'org-mode-hook
|
(add-hook 'org-mode-hook (lambda () (setq indent-tabs-mode nil)))
|
||||||
(lambda ()
|
#+end_src
|
||||||
(define-key org-mode-map
|
|
||||||
(kbd "<C-M-return>")
|
** Keybindings
|
||||||
'org-insert-heading-after-current)))
|
A keybinding to add a new heading is super useful
|
||||||
#+end_src
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(add-hook 'org-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(define-key org-mode-map
|
||||||
|
(kbd "<C-M-return>")
|
||||||
|
'org-insert-heading-after-current)))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Journal Files
|
** Journal Files
|
||||||
Sometimes I like to make a todo list for a day if I've a lot to do,
|
Sometimes I like to make a todo list for a day if I've a lot to do,
|
||||||
@@ -690,7 +700,7 @@
|
|||||||
There's a lot of boilerplate in C, so I want YASnippet enabled.
|
There's a lot of boilerplate in C, so I want YASnippet enabled.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-hook 'c-mode-hook (lambda () (yas-minor-mode)))
|
(add-hook 'c-mode-hook (lambda () (yas-minor-mode)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** C++
|
** C++
|
||||||
@@ -1187,7 +1197,7 @@
|
|||||||
I want to indent with tabs (set to 4 characters wide):
|
I want to indent with tabs (set to 4 characters wide):
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq lua-indent-level 4)
|
(setq lua-indent-level 4)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
I also want to be able to run =lua-format= on files with =C-c f=
|
I also want to be able to run =lua-format= on files with =C-c f=
|
||||||
@@ -1196,51 +1206,77 @@
|
|||||||
[[help:call-process-region][call-process-region]].
|
[[help:call-process-region][call-process-region]].
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defvar lua-format-binary "lua-format")
|
(defvar lua-format-binary "lua-format")
|
||||||
|
|
||||||
(defun lua-format ()
|
(defun lua-format ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (executable-find lua-format-binary)
|
(if (executable-find lua-format-binary)
|
||||||
(let ((start (if (region-active-p) (region-beginning) (point-min)))
|
(let ((start (if (region-active-p) (region-beginning) (point-min)))
|
||||||
(end (if (region-active-p) (region-end) (point-max))))
|
(end (if (region-active-p) (region-end) (point-max))))
|
||||||
(call-process-region start end lua-format-binary t '(t nil)))
|
(call-process-region start end lua-format-binary t '(t nil)))
|
||||||
(error "%s" (concat lua-format-binary " not found."))))
|
(error "%s" (concat lua-format-binary " not found."))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
This then needs to be assigned to the keybinding:
|
This then needs to be assigned to the keybinding:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-hook
|
(add-hook
|
||||||
'lua-mode-hook
|
'lua-mode-hook
|
||||||
(lambda () (define-key lua-mode-map (kbd "C-c f") 'lua-format)))
|
(lambda () (define-key lua-mode-map (kbd "C-c f") 'lua-format)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** BASIC
|
** BASIC
|
||||||
=basic-mode= provides syntax highlighting and a few nice features:
|
=basic-mode= provides syntax highlighting and a few nice features:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package basic-mode)
|
(use-package basic-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
As well as =.bas= files, I want to open all =.bbc= files in
|
As well as =.bas= files, I want to open all =.bbc= files in
|
||||||
=basic-mode=:
|
=basic-mode=:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-to-list 'auto-mode-alist '("\\.bbc\\'" . basic-mode))
|
(add-to-list 'auto-mode-alist '("\\.bbc\\'" . basic-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Nix
|
** Nix
|
||||||
Basic editing support comes from =nix-mode=:
|
Basic editing support comes from =nix-mode=:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package nix-mode)
|
(use-package nix-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
And =nix-update= provides a convenient way to update ~fetch~
|
And =nix-update= provides a convenient way to update ~fetch~
|
||||||
blocks:
|
blocks:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package nix-update)
|
(use-package nix-update)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** SCAD
|
||||||
|
There is a language server for OpenSCAD, but I think I'll just
|
||||||
|
stick to the basic mode:
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package scad-mode)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Go
|
||||||
|
First of all, of course, install =go-mode=:
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package go-mode)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
This package provides a convenient lil function to use gofmt to
|
||||||
|
format a buffer; I want to run this whenever I save a go source
|
||||||
|
file. This is pretty easily done by adding a =before-save-hook= in
|
||||||
|
a =go-mode-hook= (hey, I heard you like hooks...)
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(add-hook 'go-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(add-hook 'before-save-hook 'gofmt-before-save)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Tool Integrations
|
* Tool Integrations
|
||||||
@@ -1357,7 +1393,7 @@
|
|||||||
ChatGPT.
|
ChatGPT.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package chatgpt-shell)
|
(use-package chatgpt-shell)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
[[help:chatgpt-shell-openai-key][chatgpt-shell-openai-key]] must also be set to a function that
|
[[help:chatgpt-shell-openai-key][chatgpt-shell-openai-key]] must also be set to a function that
|
||||||
@@ -1380,6 +1416,17 @@
|
|||||||
(use-package graphviz-dot-mode)
|
(use-package graphviz-dot-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** Man pages
|
||||||
|
Man page support is built in to Emacs but it's one of those
|
||||||
|
annoying things where it will open in the "other" window instead of
|
||||||
|
where you ran =M-x man= from. Thankfully, this behaviour can be
|
||||||
|
changed by setting [[help:Man-notify-method][Man-notify-method]]. The value ~'pushy~ makes the
|
||||||
|
man page open in the current window.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq Man-notify-method 'pushy)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Backup and Autosave
|
* Backup and Autosave
|
||||||
** Keep $PWD Tidy
|
** Keep $PWD Tidy
|
||||||
Emacs' default behaviour of dumping temporary files in the current
|
Emacs' default behaviour of dumping temporary files in the current
|
||||||
@@ -1645,6 +1692,6 @@
|
|||||||
memory usage getting too high.
|
memory usage getting too high.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq gc-cons-threshold 1000000)
|
(setq gc-cons-threshold 1000000)
|
||||||
(setq gc-cons-percentage 0.2)
|
(setq gc-cons-percentage 0.2)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: header-guard
|
# name: header-guard
|
||||||
# binding: C-c C-k C-l
|
# binding: C-c C-k C-h
|
||||||
# key: hdr
|
# key: hdr
|
||||||
# --
|
# --
|
||||||
#ifndef ${1:`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H}
|
#ifndef ${1:`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# key: spdx
|
# key: spdx
|
||||||
# --
|
# --
|
||||||
/*
|
/*
|
||||||
* SPDX-License-Identifier: $1
|
|
||||||
* Copyright (c) Camden Dixie O'Brien
|
* Copyright (c) Camden Dixie O'Brien
|
||||||
|
* SPDX-License-Identifier: $1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$0
|
$0
|
||||||
|
|||||||
Reference in New Issue
Block a user