commit 0bb59f956c3892c9fd1b462cd6ba971f40ca5aad
parent ca719cab5273f2f28b89e7866a4e202054827f29
Author: Cem Keylan <cem@ckyln.com>
Date: Tue, 21 Apr 2020 19:16:59 +0300
move filetype configuration to the 'Packages' header. Add functions
This adds the functions:
* Paste Service -- This integrates with termbin and my personal server
* Notmuch function
Diffstat:
M | init.org | | | 153 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------ |
1 file changed, 107 insertions(+), 46 deletions(-)
diff --git a/init.org b/init.org
@@ -28,12 +28,11 @@
- [[Treemacs][Treemacs]]
- [[emacs-dashboard][emacs-dashboard]]
- [[Extras][Extras]]
+ - [[Filetype Configurations][Filetype Configurations]]
- [[Themes and Icons][Themes and Icons]]
-- [[Filetype Configurations][Filetype Configurations]]
- - [[Default Formatting][Default Formatting]]
- - [[Markdown][Markdown]]
- - [[Shell][Shell]]
- - [[Python][Python]]
+- [[Functions][Functions]]
+ - [[Paste Services][Paste Services]]
+ - [[Notmuch][Notmuch]]
- [[Other Settings][Other Settings]]
- [[Dired -- ls dired][Dired -- ls dired]]
- [[Coding System for Terminal][Coding System for Terminal]]
@@ -569,47 +568,12 @@ flavoured MarkDown and publishes to the website.
:after org
)
#+END_SRC
-* Themes and Icons
-I used to make use of my Xresources themes, but I sometimes sadly
-need windows, and I actually do want some eye candy from time to
-time.
-
-*** Doom themes
-I want to use the default doom-theme (perhaps I can switch to
-Dracula someday as well).
-
-The 'if' statement makes sure we have
-
-#+BEGIN_SRC emacs-lisp
- (use-package doom-themes
- :after all-the-icons
- :straight t
- :functions doom-themes-org-config doom-themes-treemacs-config
- :custom
- (doom-themes-enable-bold t)
- (doom-themes-enable-italic t)
- (doom-themes-treemacs-theme "doom-colors")
- :config
- (load-theme 'doom-vibrant t)
- (doom-themes-treemacs-config)
- (doom-themes-org-config))
-#+END_SRC
-
-*** All the icons
-
-All the icons is an icon-pack. I mean it probably isn't hard to
-guess. Pretty straightforward.
-
-#+BEGIN_SRC emacs-lisp
- (use-package all-the-icons
- :straight t)
-#+END_SRC
-* Filetype Configurations
+** Filetype Configurations
I would like to have some different configurations for filetypes. Those
are for indents and spaces, mostly.
-** Default Formatting
+*** Default Formatting
Here is the default formatting for most files. I don't like tabs as indents
so I avoid them wherever I can.
@@ -620,7 +584,7 @@ so I avoid them wherever I can.
fill-column 80)
#+END_SRC
-** Markdown
+*** Markdown
For markdown, I want to have 4 spaces as an indentation.
@@ -632,7 +596,7 @@ For markdown, I want to have 4 spaces as an indentation.
(md-tab-width 4))
#+END_SRC
-** Shell
+*** Shell
For shell, I want to have 4 spaces as an indentation.
@@ -643,11 +607,11 @@ For shell, I want to have 4 spaces as an indentation.
)
#+END_SRC
-** Python
+*** Python
I use the django framework quite frequently at work. So I want a few packages
for that as well.
-*** Company jedi
+**** Company jedi
Company jedi is for better completion while I am editing python files. Here
is the use-package
@@ -658,6 +622,103 @@ is the use-package
:init
(add-to-list 'company-backends 'company-jedi))
#+END_SRC
+*** C/C++
+*** Go
+For Go, we are installing
+- gomode :: A rewrite of Go mode for Emacs
+- company-go :: Company-mode go backend
+#+BEGIN_SRC emacs-lisp
+ (use-package go-mode :straight t)
+ (use-package company-go
+ :straight t
+ :after company
+ )
+#+END_SRC
+* Themes and Icons
+I used to make use of my Xresources themes, but I sometimes sadly
+need windows, and I actually do want some eye candy from time to
+time.
+
+*** Doom themes
+I want to use the default doom-theme (perhaps I can switch to
+Dracula someday as well).
+
+The 'if' statement makes sure we have
+
+#+BEGIN_SRC emacs-lisp
+ (use-package doom-themes
+ :after all-the-icons
+ :straight t
+ :functions doom-themes-org-config doom-themes-treemacs-config
+ :custom
+ (doom-themes-enable-bold t)
+ (doom-themes-enable-italic t)
+ (doom-themes-treemacs-theme "doom-colors")
+ :config
+ (load-theme 'doom-vibrant t)
+ (doom-themes-treemacs-config)
+ (doom-themes-org-config))
+#+END_SRC
+
+*** All the icons
+
+All the icons is an icon-pack. I mean it probably isn't hard to
+guess. Pretty straightforward.
+
+#+BEGIN_SRC emacs-lisp
+ (use-package all-the-icons
+ :straight t)
+#+END_SRC
+* Functions
+** Paste Services
+Here are two paste-thingies that I use. I got the first code from
+[[https://github.com/a-schaefers/dotfiles/blob/2.0/.emacs.d/lisp.d/termbin.el][@a-schaefer's termbin.el]].
+#+BEGIN_SRC emacs-lisp
+ ;; termbin.el
+ (defun region-to-termbin (start end)
+ "push the marked region to termbin.com via shell command"
+ (interactive "r")
+ (message "pushing region to termbin.com...")
+ (shell-command-on-region start end "nc termbin.com 9999"))
+
+ (defun buffer-to-termbin ()
+ "push the buffer to termbin.com via shell command"
+ (interactive)
+ (message "pushing buffer to termbin.com...")
+ (shell-command-on-region (point-min) (point-max) "nc termbin.com 9999"))
+
+ ;; pastesrv.el
+ (defun region-to-srv (start end)
+ "push the marked region to server via shell command"
+ (interactive "r")
+ (message "pushing region to server...")
+ (shell-command-on-region start end (concat "pastesrv " (read-string "Enter file name (optional): "))))
+
+ (defun buffer-to-srv ()
+ "push the buffer to server via shell command"
+ (interactive)
+ (message "pushing buffer to server...")
+ (shell-command-on-region (point-min) (point-max) (concat "pastesrv " (read-string "Enter file name (optional): "))))
+#+END_SRC
+*** Pastesrv
+This is the simple shell script I use to paste to my server. It
+is taken from [[https://codemadness.org/paste-service.html][Hiltjo's blog post]]. I use it as a script rather than
+a shell function so that I can use it with Emacs.
+#+BEGIN_SRC sh :tangle no
+ #!/bin/sh
+
+ # This substitutes a random 4-character string if no file
+ # name is given.
+ file="${1:-$(tr -dc "A-Z-a-z-0-9" < /dev/urandom | dd ibs=1 obs=1 count=4 2>/dev/null)}"
+
+ # shellcheck disable=2029
+ ssh user@ckyln.com "cat > /home/www/ckyln.com/files/$file"
+ printf '%s\n' "https://ckyln.com/files/$file"
+#+END_SRC
+** Notmuch
+#+BEGIN_SRC emacs-lisp
+ (autoload 'notmuch "notmuch" "notmuch mail" t)
+#+END_SRC
* Other Settings
Those are small settings for emacs that I cannot categorize but have importance