14 changed files with 1432 additions and 7 deletions
@ -0,0 +1,7 @@
|
||||
# Testing blogging from emacs |
||||
Ping? |
||||
|
||||
|
||||
# Heading |
||||
|
||||
This post was written and published from within emacs |
@ -0,0 +1,85 @@
|
||||
# Emacs, Lovely |
||||
For the last few months I've been tinkering with Emacs at a deeper |
||||
level. I got started with it at my first job as an intern 15 years ago |
||||
and have not looked back ever since. To be completely honest, I don't |
||||
remember how I learned. All my colleagues used it and I got started with |
||||
some basic modes thanks to them. I suppose I had better memory 15 years |
||||
ago! |
||||
|
||||
For those who don't know, Emacs is a text editor created by Richard |
||||
Stallman, David Moon, and Guy Steele in 1976. It's available for nearly |
||||
every platform known to man and can be customized to infinity. A friend |
||||
jokes about how if Emacs was an operating system, that's the one I'd |
||||
run. |
||||
|
||||
Reality is, to be able to get around Emacs you just need to learn a few |
||||
things, such as dired commands, open, close buffer, save, search, |
||||
etc. But it can go so much further! Did you know that you can find out |
||||
the lunar phases with `M-x lunar-phases'? |
||||
|
||||
|
||||
# How Emacs works for me |
||||
|
||||
Alright, fair enough, the lunar phases tip is not strong of a reason |
||||
to switch to Emacs (or to even try it). But this editor, to me, has |
||||
been the perfect fit for several purposes. Here's a few: |
||||
* Thanks to `org-mode', I write a journal, take notes, have my TO-DO |
||||
list, write technical documentation, and manage JIRA tickets. |
||||
* `go-mode' is an excellent Go IDE that I use every day. |
||||
* `shell-mode' to use the shell while you're writing code. |
||||
* `twittering-mode' :blush: |
||||
|
||||
I code all my software and do all my writing using Emacs. It works |
||||
well for me. I wish multi-language support was more straight forward |
||||
and, while I have figured it out for the most part and feel |
||||
comfortable with it, setting it up wasn't trivial. |
||||
|
||||
|
||||
# Where it falls short for me |
||||
|
||||
Emacs, however, is not for everyone. First of all, I tend to recommend |
||||
`vim' to newbies thanks to its wide support. But that's not the |
||||
point. Emacs hasn't been perfect for me (so far) for a few things: |
||||
* Raltime Communications. I use [Telegram] and [Slack] on a daily |
||||
basis; while there are modes for both on Emacs, they are not great |
||||
or as convenient as the native alternatives or other command line |
||||
options. |
||||
* Email. I have tried and made it work. I've used `gnus',=mu4e=, and |
||||
`notmuch'. While `notmuch' worked the best for me, handling 3 |
||||
accounts and a somewhat large index made Emacs sluggish and |
||||
unresponsive. I'll stick to [Thunderbird] for now. |
||||
|
||||
Again, these didn't work for me, but your mileage may vary. |
||||
|
||||
|
||||
=> https://telegram.org/ Telegram |
||||
=> https://slack.com/ Slack |
||||
=> https://www.thunderbird.net Thunderbird |
||||
|
||||
|
||||
# Best resources |
||||
|
||||
The beauty of this community is how responsive and supportive it |
||||
is. Here are some of the best resources I've found for all things |
||||
Emacs: |
||||
* [Stackoverflow]. Duh! |
||||
* [/r/emacs] to learn how other people are using the editor. |
||||
* The original [Emacs Manual] by Mr. Stallman himself. Consider |
||||
purchasing the [printed version] and support the FSF. |
||||
* The [org-mode manual] for all things `org-mode'. |
||||
* [Mastering Emacs] is an amazing resource. Similar to the Emacs |
||||
Manual but easy to read and more practical. Worth every penny. |
||||
|
||||
|
||||
=> https://stackoverflow.com/ Stackoverflow |
||||
=> https://www.reddit.com/r/emacs/ /r/emacs |
||||
=> https://www.gnu.org/software/emacs/manual/pdf/emacs.pdf Emacs Manual |
||||
=> https://shop.fsf.org/books/gnu-emacs-manual-18th-edition-v-261 printed version |
||||
=> https://orgmode.org/manual org-mode manual |
||||
=> https://www.masteringemacs.org/ Mastering Emacs |
||||
|
||||
|
||||
# Where to go from here |
||||
|
||||
My plan is to publish my `.emacs' file and explain it part by part, so |
||||
stay tuned for more Emacs goodness. |
@ -0,0 +1,225 @@
|
||||
# Emacs Go Mode |
||||
You will notice how much I use "me" and "I" on this post. This because |
||||
your emacs configuration is extremely personal. You are creating a |
||||
"dream editor", and the options that I pick might not be of your |
||||
preference. Feel free to make it your own! |
||||
|
||||
Back on topic. I started writing Go in late 2015. At first, I used |
||||
[Sublime Text], which I like a lot, but I was a little jealous of those |
||||
using [vim-go] and I figured there would be a way to make myself at home |
||||
writing Go in Emacs. This is how the adventure began. |
||||
|
||||
|
||||
=> https://www.sublimetext.com/ Sublime Text |
||||
=> https://github.com/fatih/vim-go vim-go |
||||
|
||||
|
||||
# Find a Mode! |
||||
|
||||
The first thing I had to do was find a major mode for Go on emacs. It |
||||
didn't take me long to find [go-mode]. Installation is not hard, as |
||||
it's available as a package in the MELPA repository. A simple `M-x |
||||
package-install go-mode' sufficed. Configuring it was a bit harder. |
||||
|
||||
|
||||
=> https://github.com/dominikh/go-mode.el go-mode |
||||
|
||||
|
||||
# Configuration |
||||
|
||||
This is my `.emacs' configuration for Go. |
||||
|
||||
``` |
||||
;;Load Go-specific language syntax |
||||
;;For gocode use https://github.com/mdempsky/gocode |
||||
(defun go-mode-setup () |
||||
(go-eldoc-setup)) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
|
||||
;;Format before saving |
||||
(defun go-mode-setup () |
||||
(go-eldoc-setup) |
||||
(add-hook 'before-save-hook 'gofmt-before-save)) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
|
||||
;;Goimports |
||||
(defun go-mode-setup () |
||||
(go-eldoc-setup) |
||||
(setq gofmt-command "goimports") |
||||
(add-hook 'before-save-hook 'gofmt-before-save)) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
|
||||
;;Godef, shows function definition when calling godef-jump |
||||
(defun go-mode-setup () |
||||
(go-eldoc-setup) |
||||
(local-set-key (kbd "M-.") 'godef-jump)) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
|
||||
;;Custom Compile Command |
||||
(defun go-mode-setup () |
||||
;; (setq compile-command "go build -v && go test -v && go vet && golint && errcheck") |
||||
(linum-mode 1) |
||||
(setq compile-command "echo Building... && go build -v && echo Testing... && go test -v && echo Linter... && golint") |
||||
(setq compilation-read-command nil) |
||||
;; (define-key (current-local-map) "\C-c\C-c" 'compile) |
||||
(local-set-key (kbd "M-,") 'compile) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
|
||||
;;Load auto-complete |
||||
(ac-config-default) |
||||
(require 'auto-complete-config) |
||||
(require 'go-autocomplete) |
||||
|
||||
;;Go rename |
||||
|
||||
(require 'go-rename) |
||||
|
||||
;;Configure golint |
||||
(add-to-list 'load-path (concat (getenv "GOPATH") "/src/github.com/golang/lint/misc/emacs")) |
||||
(require 'golint) |
||||
|
||||
;;Smaller compilation buffer |
||||
(setq compilation-window-height 14) |
||||
(defun my-compilation-hook () |
||||
(when (not (get-buffer-window "*compilation*")) |
||||
(save-selected-window |
||||
(save-excursion |
||||
(let* ((w (split-window-vertically)) |
||||
(h (window-height w))) |
||||
(select-window w) |
||||
(switch-to-buffer "*compilation*") |
||||
(shrink-window (- h compilation-window-height))))))) |
||||
(add-hook 'compilation-mode-hook 'my-compilation-hook) |
||||
|
||||
;;Other Key bindings |
||||
(global-set-key (kbd "C-c C-c") 'comment-or-uncomment-region) |
||||
|
||||
;;Compilation autoscroll |
||||
(setq compilation-scroll-output t) |
||||
``` |
||||
|
||||
|
||||
# The Basics |
||||
|
||||
That's a lot! Yeah, I know, but before you freak out, I'll give you a |
||||
run down of what each block is for (although the comments should help |
||||
a lot). |
||||
|
||||
``` |
||||
;;Load Go-specific language syntax |
||||
;;For gocode use https://github.com/mdempsky/gocode |
||||
(defun go-mode-setup () |
||||
(go-eldoc-setup)) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
|
||||
;;Format before saving |
||||
(defun go-mode-setup () |
||||
(go-eldoc-setup) |
||||
(add-hook 'before-save-hook 'gofmt-before-save)) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
|
||||
;;Goimports |
||||
(defun go-mode-setup () |
||||
(go-eldoc-setup) |
||||
(setq gofmt-command "goimports") |
||||
(add-hook 'before-save-hook 'gofmt-before-save)) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
``` |
||||
|
||||
This block enables `go-mode' and makes sure it runs `gofmt' before |
||||
saving. `gofmt' allows our code to be nice and tidy and to let |
||||
`go-mode' take care of importing the required packages. Nifty, huh? |
||||
Makes coding nicer. |
||||
|
||||
|
||||
# Making life even easier |
||||
|
||||
Some extra elements to make our lives easier. Not necessary, but nice |
||||
to have. |
||||
|
||||
``` |
||||
;;Custom Compile Command |
||||
(defun go-mode-setup () |
||||
;; (setq compile-command "go build -v && go test -v && go vet && golint && errcheck") |
||||
(linum-mode 1) |
||||
(setq compile-command "echo Building... && go build -v && echo Testing... && go test -v && echo Linter... && golint") |
||||
(setq compilation-read-command nil) |
||||
;; (define-key (current-local-map) "\C-c\C-c" 'compile) |
||||
(local-set-key (kbd "M-,") 'compile) |
||||
(add-hook 'go-mode-hook 'go-mode-setup) |
||||
``` |
||||
|
||||
This is a good one. Here I'm configuring `M-,' (Escape key + comma) to |
||||
run `go build', `go test', and `golint'. Extremely simple way make |
||||
sure our code compiles. |
||||
|
||||
|
||||
# Autocomplete and Linting |
||||
|
||||
``` |
||||
;;Load auto-complete |
||||
(ac-config-default) |
||||
(require 'auto-complete-config) |
||||
(require 'go-autocomplete) |
||||
|
||||
;;Go rename |
||||
|
||||
(require 'go-rename) |
||||
|
||||
;;Configure golint |
||||
(add-to-list 'load-path (concat (getenv "GOPATH") "/src/github.com/golang/lint/misc/emacs")) |
||||
(require 'golint) |
||||
``` |
||||
|
||||
Sets up `go-autocomplete' and `go-rename'. `go-rename' only is used if |
||||
you want to do project-level renames. Just between us, I barely use |
||||
it. |
||||
|
||||
The last block configures the path of the linter. Remember, Emacs is |
||||
smart, but not /that/ smart. |
||||
|
||||
|
||||
# Beautify our editor |
||||
|
||||
``` |
||||
;;Smaller compilation buffer |
||||
(setq compilation-window-height 14) |
||||
(defun my-compilation-hook () |
||||
(when (not (get-buffer-window "*compilation*")) |
||||
(save-selected-window |
||||
(save-excursion |
||||
(let* ((w (split-window-vertically)) |
||||
(h (window-height w))) |
||||
(select-window w) |
||||
(switch-to-buffer "*compilation*") |
||||
(shrink-window (- h compilation-window-height))))))) |
||||
(add-hook 'compilation-mode-hook 'my-compilation-hook) |
||||
``` |
||||
|
||||
All of this to make the compilation buffer smaller than a default |
||||
buffer. |
||||
|
||||
``` |
||||
;;Other Key bindings |
||||
(global-set-key (kbd "C-c C-c") 'comment-or-uncomment-region) |
||||
``` |
||||
|
||||
How about a simple command to comment out big blocks of code? `C-c |
||||
C-c'. Also, `compilation-scroll-output' simply scrolls the compilation |
||||
buffer all the way to the end. |
||||
|
||||
|
||||
# What's left? |
||||
|
||||
This is my current set up. It works really well for my needs, but it |
||||
might not be yours. Something I'll work on is to integrate `delve' |
||||
(golang debugger) into the editor, but I suppose I'm quite old school. |
||||
|
||||
I also have [Magit] integrated into my workflow, but that's a topic |
||||
for a different episode. To be honest, I don't miss anything from |
||||
Sublime (or Atom or MS Code), plus it already makes use of my favorite |
||||
editor. A simple `.emacs' file gives me all the customization that I |
||||
need and I know I always have MY set up everywhere. |
||||
|
||||
|
||||
=> https://magit.vc/ Magit |
@ -0,0 +1,97 @@
|
||||
# Emacs Locale Management and Input Methods |
||||
I was born in Spain, and have lived there most of my life. In fact, I |
||||
just moved to the US 6 years ago. This means that a lot of my spoken and |
||||
written communication is still in Spanish, mostly overseas with family |
||||
and friends. Working with special characters non existent in the English |
||||
language (think ñ, á, etc) is not as straight forward as it is on MacOS |
||||
for instance, where `Alt + e + a' will result in á. |
||||
|
||||
|
||||
# Temporarily enable an input method |
||||
|
||||
By default, Emacs doesn't have an [input method]. Which means that |
||||
special characters will not be very convenient to insert. To be able |
||||
to switch languages, you will need to set an input method. In my case, |
||||
`latin-1-prefix' will be the chosen locale. To do this, run `M-x |
||||
set-input-method' and then choose the locale. This will most likely |
||||
affect your editing mode when special characters are no longer needed, |
||||
therefore to disable the input method, just issue `M-x |
||||
toggle-input-method' or just `C-\'. |
||||
|
||||
|
||||
=> https://www.emacswiki.org/emacs/InputMethods input method |
||||
|
||||
|
||||
# Permanently enable an input method |
||||
|
||||
This all works well when you want to write using a different locale |
||||
temporarily, but it doesn't work well when you want to have an input |
||||
method enabled every time you're in a mode. For instance, if I want to |
||||
type text in Spanish every time I'm in `org-mode', I would need to |
||||
issue the `M-x set-input-method' command every time I open this |
||||
mode. This is obviously an inconvenience, and the Emacs life is all |
||||
about making the editor just the way you want it. |
||||
|
||||
To permanently set an input method for a mode, we will need to add |
||||
something like this to our init file. |
||||
|
||||
``` |
||||
;; Set latin-1-prefix as default locale |
||||
|
||||
(setq default-input-method "latin-1-prefix") |
||||
(defun activate-default-input-method () |
||||
(interactive) |
||||
(activate-input-method default-input-method)) |
||||
(add-hook 'org-mode-hook 'activate-default-input-method) |
||||
``` |
||||
|
||||
Here we are indicating that `latin-1-prefix' will be our new |
||||
`default-input-method' and the function will enable this method for |
||||
`org-mode'. This way, every time we open `org-mode', I will be ready |
||||
to type in Spanish. This is a white-listing approach, where we select |
||||
the modes that will have an input method applied, but we can also take |
||||
the opposite approach. A blacklist method approach will enable an |
||||
input method for ALL modes except for the ones indicated. This was the |
||||
first approach I took, but soon realized that I have too many key |
||||
bindings that would be disabled by the special character keys. Here's |
||||
an example of the blacklist approach. |
||||
|
||||
``` |
||||
;; Set latin-1-prefix as default locale |
||||
|
||||
(setq default-input-method "latin-1-prefix") |
||||
(defvar use-default-input-method t) |
||||
(make-variable-buffer-local 'use-default-input-method) |
||||
(defun activate-default-input-method () |
||||
(interactive) |
||||
(if use-default-input-method |
||||
(activate-input-method default-input-method) |
||||
(inactivate-input-method))) |
||||
(add-hook 'after-change-major-mode-hook 'activate-default-input-method) |
||||
(add-hook 'minibuffer-setup-hook 'activate-default-input-method) |
||||
(defun inactivate-default-input-method () |
||||
(setq use-default-input-method nil)) |
||||
;; Blacklisted modes |
||||
(add-hook 'c-mode-hook 'inactivate-default-input-method) |
||||
(add-hook 'go-mode-hook 'inactivate-default-input-method) |
||||
(add-hook 'markdown-mode-hook 'inactivate-default-input-method) |
||||
(add-hook 'sh-mode-hook 'inactivate-default-input-method) |
||||
``` |
||||
|
||||
This way, we are enabling `latin-1-prefix' as the default input method |
||||
for everything except for `c-mode', `go-mode', `markdown-mode', and |
||||
`sh-mode'. While these cover many of the options that I use on a |
||||
regular basis, `dired' and other modes that I use very frequently |
||||
would still be screwed up and the blacklist would grow too |
||||
large. Whitelisting `org-mode' is enough for now. I might consider |
||||
`message-mode' for writing emails in Spanish, which I do like 10% of |
||||
the time, or `text-mode' (that I don't use that often). |
||||
|
||||
|
||||
# Summary |
||||
|
||||
Overall I feel very happy with this set up, but still needs some minor |
||||
tweaking. As always, Emacs' flexibility makes customization extremely |
||||
powerful. Easily overwhelming. Just like everything we're doing, try |
||||
settings out, keep your `.emacs' in source control and make changes |
||||
without fear. Tweak as needed. Repeat. |
@ -0,0 +1,281 @@
|
||||
# Emacs Org-mode |
||||
It's hard to introduce [org-mode]. Most emacs users are familiar with it |
||||
or have, at least, used it at some point or another. I personally have |
||||
only been using it for about six months, but it has taken a pivotal role |
||||
in my daily workflows. I will describe how I use it and how I have |
||||
configured it. As always, feel free to tweak it to fit your needs. |
||||
|
||||
|
||||
=> https://orgmode.org org-mode |
||||
|
||||
|
||||
# My use cases |
||||
|
||||
## Logbook/TODO-list |
||||
|
||||
This is a little bit special. I use `org-mode' as a project |
||||
tracker. Yes, we use JIRA and I actually integrate it [with Emacs], |
||||
but pure org-mode for my personal notes and logbook is a better fit |
||||
for me. |
||||
|
||||
[Image-placeholder] |
||||
|
||||
As you can see, I keep track of my tasks using `org-mode', but also |
||||
add notes to the tasks if necessary. For development purposes, I also |
||||
keep a log of problems that I have encountered and resolutions for |
||||
these problems. That way I can go back to these notes in the future if |
||||
needed. I keep this data saved as `todo.gpg' that gets encrypted and |
||||
decrypted when opening and saving. |
||||
|
||||
|
||||
=> https://www.emacswiki.org/emacs/OrgJiraMode with Emacs |
||||
|
||||
|
||||
## Agenda |
||||
|
||||
`org-mode' also works well when you want to combine your to-do list |
||||
with your calendar. If, like me, you have your calendar on Google |
||||
Calendar, you should check out [org-gcal]. For the most part, I always |
||||
have a terminal tab with the agenda up and refresh it periodically to |
||||
have the latest appointments and task schedules and deadlines. |
||||
|
||||
|
||||
=> https://github.com/myuhe/org-gcal.el org-gcal |
||||
|
||||
|
||||
## Journal |
||||
|
||||
Great practice and excellent substitute for therapy. Store thoughts, |
||||
experiences and ideas. Highly recommended. I use the wonderful |
||||
[org-journal] package for this. |
||||
|
||||
|
||||
=> https://github.com/bastibe/org-journal org-journal |
||||
|
||||
|
||||
## Blogging |
||||
|
||||
I write this blog using `org-mode' :) (thanks [org2blog]). I can't |
||||
imagine writing it in any other way. |
||||
|
||||
|
||||
=> https://github.com/org2blog/org2blog org2blog |
||||
|
||||
|
||||
## RSS List |
||||
|
||||
I just replaced my RSS reader of choice with [elfeed]. It's a simple |
||||
emacs-based RSS reader. Fast, no frills and straightforward. To keep a |
||||
list of my RSS feeds, I imported an OPML into [elfeed-org] and now |
||||
keep all my RSS feeds in one beautiful org-file that I can easily |
||||
manage and sync. |
||||
|
||||
|
||||
There's plenty of reasons to use `org-mode'. I have used it for email, |
||||
but honestly, I have been unable to find a suitable workflow for |
||||
it. Longform writing is something I would like to spend more time |
||||
doing, and `org-mode' seems like a great platform to get started with |
||||
to do it. |
||||
|
||||
|
||||
=> https://github.com/skeeto/elfeed elfeed |
||||
=> https://github.com/remyhonig/elfeed-org elfeed-org |
||||
|
||||
|
||||
# My configuration |
||||
|
||||
``` |
||||
(setenv "GPG_AGENT_INFO" nil) |
||||
(setq epg-gpg-program "/usr/local/bin/gpg2") |
||||
(require 'epa-file) |
||||
|
||||
(require 'password-cache) |
||||
|
||||
(setq password-cache-expiry (* 15 60)) |
||||
(setq epa-file-cache-passphrase-for-symmetric-encryption t) |
||||
``` |
||||
|
||||
First of all, I load GPG for encryption/decryption of gpg files. I set |
||||
a generous expiration because this is my work desktop and I always |
||||
keep it locked. |
||||
|
||||
``` |
||||
(require 'org-install) |
||||
(package-initialize) |
||||
(global-set-key "\C-cl" 'org-store-link) |
||||
(global-set-key "\C-cc" 'org-capture) |
||||
(global-set-key "\C-ca" 'org-agenda) |
||||
(global-set-key "\C-cr" 'org-gcal-sync) |
||||
``` |
||||
|
||||
I load `org-mode' and set the shortcuts to store links (it's easier |
||||
this way for me 😊), capture (for agenda, work TODO, etc) and pull up |
||||
the agenda. |
||||
|
||||
``` |
||||
(setq org-directory "~/Documents/org/") |
||||
(setq org-default-notes-file "~/Documents/org/scrapbook.gpg") |
||||
(setq org-agenda-files (list "~/Documents/org/todo.gpg" "~/Documents/org/work_cal.org" "~/Documents/org/personal_cal.org")) |
||||
``` |
||||
|
||||
Here I'm setting the directory structure. `org-directory' sets the |
||||
default `org-mode' directory for file storage. Notes are created with |
||||
`org-default-notes-file', and `org-agenda-files' lists all the files |
||||
loaded by default in the Agenda. |
||||
|
||||
``` |
||||
(add-hook 'org-mode-hook #'(lambda () |
||||
(visual-line-mode) |
||||
(org-indent-mode))) |
||||
(add-hook 'org-mode-hook #'toggle-word-wrap) |
||||
|
||||
(defun my/org-mode-hook () |
||||
"My `org-mode' hook" |
||||
(set-face-attribute 'org-document-info-keyword nil :foreground "yellow") |
||||
(set-face-attribute 'org-document-info nil :foreground "cornflower blue") |
||||
(set-face-attribute 'org-document-title nil :foreground "cornflower blue")) |
||||
(add-hook 'org-mode-hook 'my/org-mode-hook) |
||||
``` |
||||
|
||||
Some color tweaks and line-wrapping. `org-mode' doesn't wrap lines by |
||||
default, but that has an easy fix. |
||||
|
||||
``` |
||||
(setq org-todo-keywords |
||||
'((sequence "TODO(t)" "PENDING(p!)" "WAIT(w@)" "VERIFY(v)" "|" "DONE(d!)" "CANCELED(c@)") |
||||
(sequence "REPORT(r@)" "BUG(b@)" "KNOWNCAUSE(k@)" "|" "FIXED(f!)"))) |
||||
|
||||
(global-set-key (kbd "C-c s") |
||||
(lambda () (interactive) (find-file "~/Documents/org/scrapbook.gpg"))) |
||||
(global-set-key (kbd "C-c w") |
||||
(lambda () (interactive) (find-file "~/Documents/org/todo.gpg"))) |
||||
|
||||
(setq org-log-done 'time) |
||||
(setq org-list-allow-alphabetical t) |
||||
``` |
||||
|
||||
Define files for notes and for the to-do list. Here we also define the |
||||
to-do sequences and indicate whether I want them timestamped (!) or |
||||
timestamped and with a comment (@). |
||||
|
||||
``` |
||||
(setq org-capture-templates |
||||
'(("n" "Personal Note" entry (file "~/Documents/org/scrapbook.gpg") |
||||
"* PERSONAL NOTE %?\n%U\n" :empty-lines 1) |
||||
("w" "Work Note" entry (file "~/Documents/org/scrapbook.gpg") |
||||
"* WORK NOTE %?\n%U\n" :empty-lines 1) |
||||
("j" "Journal" entry |
||||
(file+datetree "~/Documents/org/journal.gpg") |
||||
"**** %U%?\n%a" :tree-type week)) |
||||
) |
||||
``` |
||||
|
||||
Define the capture modes. I only have personal and work notes and |
||||
journal capture. |
||||
|
||||
``` |
||||
(eval-after-load "org" |
||||
'(require 'ox-md nil t)) |
||||
``` |
||||
|
||||
Markdown export. We use markdown at work a lot. It makes my life |
||||
easier if I have direct conversion to markdown. |
||||
|
||||
``` |
||||
(setq org-agenda-span 4) |
||||
``` |
||||
|
||||
`org-agenda' will only load the next 4 days. I don't need any more |
||||
than that. |
||||
|
||||
``` |
||||
(require 'org2blog-autoloads) |
||||
(require 'netrc) |
||||
|
||||
(require 'auth-source) |
||||
(let (credentials) |
||||
(add-to-list 'auth-sources "~/.authinfo") |
||||
(setq credentials (auth-source-user-and-password "arenzana.org")) |
||||
(setq org2blog/wp-blog-alist |
||||
`(("arenzanaorg" |
||||
:url "https://arenzana.org/xmlrpc.php" |
||||
:username ,(car credentials) |
||||
:password ,(cadr credentials) |
||||
:default-title "Hello World" |
||||
:default-categories ("emacs") |
||||
:tags-as-categories nil)))) |
||||
|
||||
(setq org2blog/wp-use-sourcecode-shortcode nil) |
||||
;; removed light="true" |
||||
(setq org2blog/wp-sourcecode-default-params nil) |
||||
;; target language needs to be in here |
||||
(setq org2blog/wp-sourcecode-langs |
||||
'("actionscript3" "bash" "coldfusion" "cpp" "csharp" "css" "delphi" |
||||
"erlang" "fsharp" "diff" "groovy" "javascript" "java" "javafx" "matlab" |
||||
"objc" "perl" "php" "text" "powershell" "python" "ruby" "scala" "sql" |
||||
"vb" "xml" "go" "sh" "emacs-lisp" "lisp" "lua")) |
||||
|
||||
;; this will use emacs syntax higlighting in your #+BEGIN_SRC |
||||
;; <language> <your-code> #+END_SRC code blocks. |
||||
(setq org-src-fontify-natively t) |
||||
``` |
||||
|
||||
For `org-2blog' We begin by loading it and `.netrc'. In my case, I'm |
||||
using `.authinfo' that I keep encrypted as well. It stores my blog |
||||
credentials. Since I only have one blog, I just add it as |
||||
`arenzanaorg' to the wordpress blog list, set some defaults, and then |
||||
set some source code defaults. I got most of this configuration from |
||||
[here]. Great resource! |
||||
|
||||
``` |
||||
(require 'org-gcal) |
||||
(load-library "~/.gcal.el.gpg") |
||||
(setq org-gcal-file-alist '(("iarenzana@gmail.com" . "~/Documents/org/personal_cal.org") |
||||
("iarenzana@indigital.net" . "~/Documents/org/work_cal.org"))) |
||||
``` |
||||
|
||||
[Image Placeholder] |
||||
|
||||
`org-gcal' is the package I use to pull [Google Calendar] data into |
||||
Emacs and, ultimately, `org-agenda'. Earlier in the set up I created a |
||||
shortcut for `org-gcal-sync' to update the calendars on demand. After |
||||
that, I just press `r' in `org-agenda' to refresh the buffer and the |
||||
new events show up . In order to not publish API keys to any |
||||
repository, I keep this information in a `.gcal.el.gpg' file stored in |
||||
my home directory. This is what the structure of that file looks like: |
||||
|
||||
``` |
||||
;; -*- epa-file-encrypt-to: ("user@example.com") -*- |
||||
|
||||
(setq org-gcal-client-id "clientid" |
||||
org-gcal-client-secret "secretkey") |
||||
``` |
||||
|
||||
Make sure you substitute the email address with your PGP key's email |
||||
and both `clientid' and `secretid' with the ones generated at [Google |
||||
Cloud] for your calendar. To do this, create a new oauth key pair. |
||||
|
||||
|
||||
=> http://blog.binchen.org/posts/how-to-use-org2blog-effectively-as-a-programmer.html here |
||||
=> https://calendar.google.com Google Calendar |
||||
=> https://cloud.google.com/ Google Cloud |
||||
|
||||
|
||||
# Caveats |
||||
|
||||
There's a few things that still bother me that I want to tackle. First |
||||
of them is the `yellow' output of my blog's HTML code source. I'm |
||||
disabling colors by not specifying `emacs-lisp' as the language, but |
||||
this is a bad work around. I have been unable to correctly format the |
||||
HTML template for this, so I will need to keep researching. |
||||
|
||||
Also, every time I open emacs I'm prompted for `.gcal.el.gpg''s |
||||
password. I'd like to delay this until I call `org-gcal'. |
||||
|
||||
|
||||
# Summary |
||||
|
||||
I know I've flown over my `org-mode' set up, but going in depth would |
||||
take a lot more posts (which I may write). For now this is a short |
||||
introduction to how I use the package and some of the possibilities |
||||
that might bring ideas on how to improve your workflows. |
@ -0,0 +1,111 @@
|
||||
# Blogging with org-mode |
||||
|
||||
|
||||
|
||||
# Wait, what? |
||||
|
||||
My coworker makes infinite fun of me because I do everything in |
||||
Emacs. He's a proficient Vim user and uses it as a text editor like a |
||||
master. Emacs, however, is almost a full operating system for me. Even |
||||
though I haven't figured out how to do video editing in Emacs (😂), |
||||
blogging is a task that's possible to do with it. |
||||
|
||||
I run a self-hosted [Wordpress] instance on [Scaleway]. This is an |
||||
affordable set up that gives me extreme flexibility. |
||||
|
||||
|
||||
=> https://wordpress.org/ Wordpress |
||||
=> https://www.scaleway.com/en/ Scaleway |
||||
|
||||
|
||||
# The setup |
||||
|
||||
As I described on my [previous post], I use [org2blog] as the blogging |
||||
package to post to Wordpress. I have the following block on my |
||||
`.emacs' file. |
||||
|
||||
``` |
||||
(require 'org2blog-autoloads) |
||||
(require 'netrc) |
||||
|
||||
(require 'auth-source) |
||||
(let (credentials) |
||||
(add-to-list 'auth-sources "~/.authinfo") |
||||
(setq credentials (auth-source-user-and-password "arenzana.org")) |
||||
(setq org2blog/wp-blog-alist |
||||
`(("arenzanaorg" |
||||
:url "https://arenzana.org/xmlrpc.php" |
||||
:username ,(car credentials) |
||||
:password ,(cadr credentials) |
||||
:default-title "Hello World" |
||||
:default-categories ("emacs") |
||||
:tags-as-categories nil)))) |
||||
|
||||
(setq org2blog/wp-use-sourcecode-shortcode nil) |
||||
;; removed light="true" |
||||
(setq org2blog/wp-sourcecode-default-params nil) |
||||
;; target language needs to be in here |
||||
(setq org2blog/wp-sourcecode-langs |
||||
'("actionscript3" "bash" "coldfusion" "cpp" "csharp" "css" "delphi" |
||||
"erlang" "fsharp" "diff" "groovy" "javascript" "java" "javafx" "matlab" |
||||
"objc" "perl" "php" "text" "powershell" "python" "ruby" "scala" "sql" |
||||
"vb" "xml" "go" "sh" "emacs-lisp" "lisp" "lua")) |
||||
|
||||
;; this will use emacs syntax higlighting in your #+BEGIN_SRC |
||||
;; <language> <your-code> #+END_SRC code blocks. |
||||
(setq org-src-fontify-natively t) |
||||
``` |
||||
|
||||
Naturally, I don't post my credentials as part of my `.emacs' since I |
||||
keep it under version control. Instead, I store it under |
||||
`${HOME}/.authinfo.gpg' like this: |
||||
|
||||
``` |
||||
machine arenzana.org |
||||
login admin |
||||
password "mypassword" |
||||
``` |
||||
|
||||
These credentials are called when loading the `netrc' package and |
||||
`auth-source'. |
||||
|
||||
The Lisp block creates a new blog instance called `arenzanaorg' (in |
||||
case you want to have more than one blog). Include the XML RPC |
||||
endpoint, credentials, and some defaults. In addition to this, I |
||||
enable code highlighting. This is actually not working very well for |
||||
me, because the CSS uses a very bright yellow color to represent |
||||
strings for the `emacs-lisp' language (as you can see on previous |
||||
posts). Instead, I'm just using the `#+BEGING_SRC #+END_SRC' blocks |
||||
(without specifying the language) to post code blocks. This gives grey |
||||
blocks, but at least they're readable. I've tried different options, |
||||
without success. I'm not a front end developer, so to be honest, I've |
||||
struggled working with all the CSS options for the HTML export option |
||||
of org2blog. |
||||
|
||||
|
||||
=> https://arenzana.org/2019/04/emacs-org-mode/ previous post |
||||
=> https://github.com/org2blog/org2blog org2blog |
||||
|
||||
|
||||
# The Workflow |
||||
|
||||
The workflow is fairly simple for what I do. `M-x |
||||
org2blog/wp-new-entry'. The first time you call this, it will prompt |
||||
you to log in. Make sure you do so. Then it will open an `Org' buffer |
||||
where you can edit the defaults and type away. |
||||
|
||||
Once I'm done, I issue `M-x org2blog/wp-post-buffer'. This will upload |
||||
the draft and give me the option to display the preview, where I can |
||||
see what things will look like prior to publishing. After I'm happy |
||||
with the final edits, I issue `M-x |
||||
org2blog/wp-post-bufffer-and-publish'. This will post directly to |
||||
Wordpress. |
||||
|
||||
|
||||
# Caveats |
||||
|
||||
* As I described above, syntax highlighting for emacs-lisp is not |
||||
great and it doesn't support Go (my language of choice). |
||||
* Attaching images to a blog post is something I do after the fact, |
||||
once the draft is up. I haven't figured out a good way to upload and |
||||
link images to a post straight from org2blog. |
@ -0,0 +1,89 @@
|
||||
# Artisanal Web Hosting |
||||
|
||||
|
||||
|
||||
# Summary |
||||
|
||||
I have an operations background. My first company taught me most of |
||||
what I know about how to run software and server |
||||
operations. Fast-forward 15 years and we are now all about the cloud, |
||||
VPSs, and Kubernetes. I love [the cloud]. Up until a few weeks ago, my |
||||
blog has been hosted at [Scaleway], which has worked great for |
||||
me. Today I run it on my own server where (for better or for worse) |
||||
everything is managed by me. |
||||
|
||||
|
||||
=> https://arenzana.org/2019/04/blogging-with-org-mode/ the cloud |
||||
=> http://scaleway.com/ Scaleway |
||||
|
||||
|
||||
# Why |
||||
|
||||
One thing I was not happy about was Google Analytics. To keep my |
||||
uptime I want to know the number of page loads and system load in |
||||
order to optimize and scale. I know, I should probably be using a CDN |
||||
to mitigate some of these issues, but I don't feel I'm there just |
||||
yet. Google Analytics is one of those services that is not known to be |
||||
privacy friendly, and if you are here, I respect you and your time. I |
||||
don't include ads and I try to keep the tracking as limited as |
||||
possible disabling social crap, etc. For my purposes, I don't need |
||||
Google analytics. A web server logs all of the information I need for |
||||
scaling purposes. All I needed was to access those logs (which I |
||||
already had access to) and store the data in a database, create a |
||||
dashboard, and kiss Google Analytics goodbye. |
||||
|
||||
I know, I could've used AWS or Google Cloud to do this; but the cost |
||||
over time would have been prohibitive. Self-hosting seems like the |
||||
right answer at the moment. |
||||
|
||||
The game plan: |
||||
|
||||
* With the help of my company, I got a new server and some data |
||||
center space (power, networking, and a rack). I know, this is the |
||||
most tricky part as not everyone works for a telco that can provide |
||||
these things. The point of this post is not to justify the |
||||
financial advantage of self-hosting vs the cloud, but to point out |
||||
the elements we overlook by leaving it up to the cloud to do some |
||||
of the heavy lifting. |
||||
|
||||
* I installed ESXi on the server to run all my infrastructure. I have |
||||
done this before, so I felt fairly comfortable reproducing this. |
||||
|
||||
* I used VyOS for all the networking and firewall needs. This was the |
||||
trickiest part. I hate networking. I still do and the networking |
||||
concepts, to be honest, just beat me. Somehow though, with basic |
||||
subnetting and routing skills, you can actually get surprisingly |
||||
far. |
||||
|
||||
* I used [Terraform] to define all my (CentOS 7) infrastructure and |
||||
[Ansible] to automate/standarize the configuration of every element |
||||
in my little cloud. |
||||
|
||||
* NGINX to host my site (quite straight forward). |
||||
|
||||
* Run an Elastic stack (really, just [Beats], [Elasticsearch], and |
||||
[Kibana]) for data processing. From system auditing, to security, |
||||
log parsing, and metrics. This stack is the central unit that gives |
||||
me visibility into what's happening inside my system. This includes |
||||
NGINX log analysis. |
||||
|
||||
|
||||
=> https://www.terraform.io/ Terraform |
||||
=> https://www.ansible.com/ Ansible |
||||
=> https://www.elastic.co/products/beats Beats |
||||
=> https://www.elastic.co/products/elasticsearch Elasticsearch |
||||
=> https://www.elastic.co/products/kibana Kibana |
||||
|
||||
|
||||
# tl;dr |
||||
|
||||
Over the next few weeks I'll be writing about my experience _moving |
||||
away from the cloud_. The work it involved, where I believe it's |
||||
better than the cloud, and where I believe the cloud is superior. I |
||||
will talk about what's left in my set up and how I'm planning on |
||||
tackling it. |
||||
|
||||
They say the journey is as important as the destination itself and, in |
||||
this case, I must agree. I have learned a lot through the |
||||
process. Perhaps someone will learn something from my experience. That |
||||
will make it all worth it! |
@ -0,0 +1,236 @@
|
||||
# Emacs Go Mode - Revisited |
||||
A few months ago [I went over] how to set up Emacs for Go |
||||
development. Since then, I have honestly not changed a single thing |
||||
about it. Until this week. |
||||
|
||||
|
||||
=> https://arenzana.org/2019/01/emacs-go-mode/ I went over |
||||
|
||||
|
||||
# Background |
||||
|
||||
Here's the thing. Something I have changed too much over the last few |
||||
months has been the vendoring mechanism I use for my Go projects. From |
||||
[Glide], I moved to [go dep], and a couple of months ago, I started |
||||
the migration to the [Go Modules], Golang's potential long-term |
||||
solution to the package management mess the community has been living |
||||
with since the inception of the language 10 years ago ([Happy Birthday |
||||
Go!]). |
||||
|
||||
Go Modules changes a lot of things about the taxonomy of your |
||||
projects: vendor management, GOPATH, `go get `, etc. Just like me and |
||||
my vendor management journey, `gomode ` has also gone through several |
||||
iterations from [here], to [here], and [here]. |
||||
|
||||
It was time to start looking at something else with more long term |
||||
support. |
||||
|
||||
|
||||
=> https://github.com/Masterminds/glide Glide |
||||
=> https://github.com/golang/dep go dep |
||||
=> https://github.com/golang/go/wiki/Modules Go Modules |
||||
=> https://blog.golang.org/10years Happy Birthday Go! |
||||
=> https://github.com/nsf/gocode here |
||||
=> https://github.com/mdempsky/gocode here |
||||
=> https://github.com/stamblerre/gocode here |
||||
|
||||
|
||||
# LSP time |
||||
|
||||
LSP (Language Server Provider) promises to do away with all these |
||||
issues by implementing a "driver" with a common editor interface and |
||||
adapting to the languages as they evolve. [Rebecca Stambler's "Go, |
||||
please stop breaking my editor"] is a must-watch if you're interested |
||||
in the topic. |
||||
|
||||
To work on Go using emacs, the most logical recipe would be |
||||
[lsp-mode], [gopls], and [go-mode]. `gopls ` is the LSP-compatible |
||||
language server, `lsp-mode ` is the Emacs interface for LSP servers, |
||||
and `go-mode ` is, well, the major mode for Go (discussed [in my |
||||
previous article]). |
||||
|
||||
|
||||
=> https://www.youtube.com/watch?v=5Re6BHEOT_k Rebecca Stambler's "Go, please stop breaking my editor" |
||||
=> https://github.com/emacs-lsp/lsp-mode lsp-mode |
||||
=> https://github.com/golang/tools/blob/master/gopls/README.md gopls |
||||
=> https://github.com/dominikh/go-mode.el go-mode |
||||
=> https://arenzana.org/2019/01/emacs-go-mode/ in my previous article |
||||
|
||||
|
||||
# Go, please |
||||
|
||||
In the video (May 2019), Rebecca points out that `gopls ` is still in |
||||
alpha and warns us to proceed with caution. Currently, (December 2019) |
||||
it feels more like a beta, so not too bad, but still not |
||||
perfect. `gopls ` is, however, the future for Emacs to become a solid |
||||
Golang editor. This is because it's the only language tool (beside's |
||||
Rebecca's `gocode ` that's in maintenance mode) that fully supports Go |
||||
modules that is in active development. |
||||
|
||||
All I had to do to install it was this: |
||||
``` |
||||
go get golang.org/x/tools/gopls@latest |
||||
``` |
||||
|
||||
It's important to check out the latest version since the tool is |
||||
evolving quite quickly right now. |
||||
|
||||
What happens in the editor is that Emacs spawns an instance of the |
||||
server when `go-mode ` is enabled on a buffer. After this, `lsp-mode ` |
||||
will attempt to connect to it. The advantage of using a server rather |
||||
than a command is that it's much quicker to respond and interface with |
||||
Emacs (it does feel snappier once the server comes up, which is also |
||||
fairly quick). The disadvantages are the security concerns of running |
||||
a server on a laptop; but to be fair, this is not supposed to be a |
||||
long-running/permanent process. |
||||
|
||||
On my Emacs config, I just added the following lines: |
||||
|
||||
``` |
||||
(setq lsp-gopls-staticcheck t) |
||||
(setq lsp-eldoc-render-all t) |
||||
(setq lsp-gopls-complete-unimported t) |
||||
``` |
||||
|
||||
I just wanted those elements to be active, but feel free to edit to |
||||
taste. |
||||
|
||||
|
||||
# lsp-mode |
||||
|
||||
`lsp-mode ` will need to be added to our Emacs set up. I copied most |
||||
of this from the `gopls ` + `lsp-mode ` set up guides adjusting it to |
||||
my needs and adding a couple of things. |
||||
|
||||
``` |
||||
|
||||
(use-package lsp-mode |
||||
:ensure t |
||||
:commands (lsp lsp-deferred) |
||||
:hook (go-mode . lsp-deferred)) |
||||
|
||||
;;Set up before-save hooks to format buffer and add/delete imports. |
||||
;;Make sure you don't have other gofmt/goimports hooks enabled. |
||||
|
||||
(defun lsp-go-install-save-hooks () |
||||
(add-hook 'before-save-hook #'lsp-format-buffer t t) |
||||
(add-hook 'before-save-hook #'lsp-organize-imports t t)) |
||||
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks) |
||||
|
||||
;;Optional - provides fancier overlays. |
||||
|
||||
(use-package lsp-ui |
||||
:ensure t |
||||
:commands lsp-ui-mode |
||||
:init |
||||
) |
||||
|
||||
;;Company mode is a standard completion package that works well with lsp-mode. |
||||
;;company-lsp integrates company mode completion with lsp-mode. |
||||
;;completion-at-point also works out of the box but doesn't support snippets. |
||||
|
||||
(use-package company |
||||
:ensure t |
||||
:config |
||||
(setq company-idle-delay 0) |
||||
(setq company-minimum-prefix-length 1)) |
||||
|
||||
(use-package company-lsp |
||||
:ensure t |
||||
:commands company-lsp) |
||||
|
||||
;;Optional - provides snippet support. |
||||
|
||||
(use-package yasnippet |
||||
:ensure t |
||||
:commands yas-minor-mode |
||||
:hook (go-mode . yas-minor-mode)) |
||||
|
||||
;;lsp-ui-doc-enable is false because I don't like the popover that shows up on the right |
||||
;;I'll change it if I want it back |
||||
|
||||
|
||||
(setq lsp-ui-doc-enable nil |
||||
lsp-ui-peek-enable t |
||||
lsp-ui-sideline-enable t |
||||
lsp-ui-imenu-enable t |
||||
lsp-ui-flycheck-enable t) |
||||
|
||||
``` |
||||
|
||||
Here, I: |
||||
* Enable `lsp-mode `. |
||||
* Add hooks for package imports and buffer formatting on save. |
||||
* Enable `lsp-ui ` (to display `go-eldoc ` info, etc). |
||||
* Company for overlays. |
||||
* `yasnippet ` for snippet support. |
||||
* Some options for `lsp-ui `. |
||||
|
||||
In the options I disabled `lsp-ui-doc-enable ` because it displayed |
||||
docs on both the mini buffer and on an overlay located to the right of |
||||
the buffer. I found it too distracting and decided to disable the |
||||
overlay and leave the mini buffer help. |
||||
|
||||
|
||||
# Old Go Mode |
||||
|
||||
So what's left of my original Go mode configuration? Well, the custom |
||||
compilation stuff, line numbers, etc are still there: |
||||
|
||||
``` |
||||
(defun custom-go-mode () |
||||
(display-line-numbers-mode 1)) |
||||
|
||||
(use-package go-mode |
||||
:defer t |
||||
:ensure t |
||||
:mode ("\\.go\\'" . go-mode) |
||||
:init |
||||
(setq compile-command "echo Building... && go build -v && echo Testing... && go test -v && echo Linter... && golint") |
||||
(setq compilation-read-command nil) |
||||
(add-hook 'go-mode-hook 'custom-go-mode) |
||||
:bind (("M-," . compile) |
||||
("M-." . godef-jump))) |
||||
|
||||
(setq compilation-window-height 14) |
||||
(defun my-compilation-hook () |
||||
(when (not (get-buffer-window "*compilation*")) |
||||
(save-selected-window |
||||
(save-excursion |
||||
(let* ((w (split-window-vertically)) |
||||
(h (window-height w))) |
||||
(select-window w) |
||||
(switch-to-buffer "*compilation*") |
||||
(shrink-window (- h compilation-window-height))))))) |
||||
(add-hook 'compilation-mode-hook 'my-compilation-hook) |
||||
|
||||
(global-set-key (kbd "C-c C-c") 'comment-or-uncomment-region) |
||||
(setq compilation-scroll-output t) |
||||
``` |
||||
|
||||
I'm not calling any of the goimports, gocode, etc as I used to, since |
||||
`gopls ` takes care of it all. |
||||
|
||||
|
||||
# Summary |
||||
|
||||
Besides speed, there's not a whole lot of difference between my |
||||
previous and my current setups, really. The real advantage I see is |
||||
that I'm future-proofing my setup by adopting officially-supported |
||||
procedures. Just like going to Go Modules: my workflow is not |
||||
improved, but this seems to be the direction the community is going |
||||
and it will be easier for me to adopt it now than in the future. |
||||
|
||||
|
||||
# Caveats |
||||
|
||||
The first time you open a `.go ` file, you will be prompted for the |
||||
root of the project. It will find `go.mod ` and suggest that directory |
||||
as the root. It's an extra step, but not a big deal. The interface |
||||
makes it simple enough. |
||||
|
||||
This root path might have been the issue I initially hit where Emacs |
||||
would color everything red on save. I couldn't figure out what the |
||||
problem was (I assumed it was a problem with my GOPATH and Modules), |
||||
but removing my `.emacs.d ` directory and having it recreated fixed it |
||||
on my Mac. I never had the problem on my Fedora laptop. |
@ -0,0 +1,79 @@
|
||||
# Emacs Server - Why and why not? |
||||
|
||||
|
||||
|
||||
# What |
||||
|
||||
Unknown to many of us, under the hood emacs was designed as a |
||||
client/server architecture; which means, Emacs core runs as a daemon |
||||
and you attach clients to it. Normally, we run both when we type |
||||
`emacs', but the execution of both the client and the server is |
||||
transparent to the user. Before you attempt to do something fancy, |
||||
this architecture is somewhat limited to localhost (1), which means |
||||
that you can't quite "remote into" an emacs running on a different |
||||
host. In a world where we have [tmux], [mosh], and other multiplexers |
||||
and mobile connectivity technologies, there may not seem like there's |
||||
much room for running emacs as a server, but we will see some |
||||
advantages to this approach. |
||||
|
||||
|
||||
=> https://github.com/tmux/tmux/wiki tmux |
||||
=> https://mosh.org/ mosh |
||||
|
||||
|
||||
# Why and How |
||||
|
||||
I tend to use `tmux' as my multiplexer and I run a session on my |
||||
laptop as soon as I start working. This session will only die when the |
||||
machine goes down for a reboot or when shutting it down. The advantage |
||||
of running tmux is (besides being able to upgrade iTerm without losing |
||||
all my sessions) is that it keeps my brain trained to work on a remote |
||||
box (I used to work in operations, being a sysadmin truly does |
||||
something to your brain). Inside this tmux session, I run Emacs by |
||||
typing `e', which is an alias on my `~/.zshrc' as follows: |
||||
|
||||
``` |
||||
alias e="emacsclient -a '' -t" |
||||
``` |
||||
|
||||
You will notice that this alias uses a different command, |
||||
`emacsclient'. Running this command will not run a full instance of |
||||
Emacs, but will attempt to attach to a currently running session on |
||||
localhost. If a server is not running, one will be started. You can |
||||
also start Emacs as a daemon by running `emacs --daemon'. No client |
||||
will be attached to it if you run it this way. |
||||
|
||||
If you have been following this blog, you will know how much I enjoy |
||||
customizing Emacs. This passion for customization has driven my Emacs |
||||
to take almost 3 seconds to start from cold (2). And even though I've |
||||
done my best to improve the performance of this operation (remove |
||||
unnecessary customization, use of `use-package', some performance |
||||
tuning, etc), there's too much overhead at start time. |
||||
|
||||
By running a server first, my configuration gets loaded once, and when |
||||
I attach the client, the configuration is loaded in memory. The |
||||
operation of starting a client (what I actually interface with) is a |
||||
matter of milliseconds. In addition to this when I close the client |
||||
and reattach it, my Emacs still contains the same open buffers, |
||||
running processes, etc. This means that, if you want to actually close |
||||
Emacs and all of its open buffers, you need to make sure you close all |
||||
of them `C-x C-B' and then `d' on every entry to close. |
||||
|
||||
|
||||
# Conclusion |
||||
|
||||
The value I drive from this workflow resides in performance |
||||
improvements. It saves me time and, why not, frustrations. It can be |
||||
argued that value can be found from an Emacs-as-a-server architecture |
||||
even if your `~/.emacs' is not too complex, but in my opinion, if |
||||
that's your situation, there's no need to add any extra "complexity" |
||||
associated to separating the client and server operations. |
||||
|
||||
Special thanks to the always great Irreal for [[\][this article]] that |
||||
served as a good starting guide. |
||||
|
||||
(1) While it's technically possible to connect to a TCP socket, this |
||||
is not meant to be a remote connectivity tool. |
||||
|
||||
(2) Listen, email loading, RSS, Twitter, journals, and development |
||||
environments don't come without a cost. |
@ -0,0 +1,34 @@
|
||||
# Emacs 27.1 Installation |
||||
This is for you as much as this is for me, since I want to remember some |
||||
stuff I do and the blog sometimes serves as a public knowledge base. |
||||
|
||||
Regarding 27.1, there's plenty of great resources [here] and [here], so |
||||
I won't go over them. |
||||
|
||||
Simple installation considering you have Development Tools and TLS |
||||
libraries installed for your distro: |
||||
``` |
||||
wget http://ftp.gnu.org/gnu/emacs/emacs-27.1.tar.gz |
||||
./configure --with-json |
||||
make |
||||
make install |
||||
``` |
||||
|
||||
I'm only adding native JSON support since it's the number one (or |
||||
[number two] after language servers) feature in Emacs 27. Since the |
||||
loading order in 27 changes, I'm adding support for previous versions |
||||
with the following in my `.emacs.org ` file: |
||||
``` |
||||
(when (< emacs-major-version 27) |
||||
(package-initialize)) |
||||
``` |
||||
|
||||
Additionally, I had to run `go get golang.org/x/tools/gopls@latest ` in |
||||
order for gopls to not crash. Other than that, it seems like this |
||||
version hasn't broken any other elements of my set up; but it might |
||||
still be a little bit too early to tell! |
||||
|
||||
|
||||
=> https://www.masteringemacs.org/article/whats-new-in-emacs-27-1 here |
||||
=> https://emacsredux.com/blog/2020/08/13/emacs-27-1/ here |
||||
=> https://arenzana.org/2019/12/emacs-go-mode-revisited/ number two |
@ -0,0 +1,144 @@
|
||||
# Hasta Pronto, WhatsApp / Farewell, WhatsApp (English & Español) |
||||
*tl;dr* Ponte en contacto conmigo a través de Signal / You can contact |
||||
me on Signal |
||||
|
||||
|
||||
## Hasta Pronto, WhatsApp (Español) |
||||
|
||||
Es probable que te encuentres aquí porque has visto un link a esta |
||||
página en mi estado de [Whatsapp]. De hecho, esta es la única ocasión |
||||
desde que uso el servicio (hace alrededor de 11 años), que cambio de |
||||
estado. |
||||
|
||||
> "Hey there! I'm NOT using WhatsApp" |
||||
|
||||
No es necesario hablar de todas las noticias que plagan los medios |
||||
últimamente sobre los [problemas de] [los términos de privacidad] [de |
||||
WhatsApp] que, salvo porque [Facebook ha recogido cable], el grupo |
||||
pensaba obligar a sus usuarios a aceptar para seguir utilizando el |
||||
servicio. O sobre los problemas éticos de la [censura ejercida por |
||||
estas empresas]. |
||||
|
||||
La realidad es que ninguna de estas compañías (no solo Facebook, sino |
||||
Google, Twitter, etc) tiene motivación para ajustar su servicio para |
||||
el bien de los usuarios porque, citando a Richard Serra, _nosotros |
||||
somos el producto_ al no pagar por él. |
||||
|
||||
Por estos motivos estoy buscando medios sociales y de comunicación más |
||||
sostenibles de cara al futuro para los que yo no sea el |
||||
producto. Existen, en serio; pero no son tan conocidos como "los |
||||
clásicos". |
||||
|
||||
¿Y ahora qué? |
||||
|
||||
Abandono WhatsApp, pero no de la noche a la mañana. Empezando en |
||||
marzo, eliminaré las notificaciones y todos los permisos que la |
||||
aplicación requiere (localización, fotos, etc) para operar |
||||
correctamente. A día de hoy me resultará posible avisar a mis |
||||
contactos más comunes de mis intenciones, una vez llegue marzo, las |
||||
personas con las que apenas hablo tendrán que esperar a que vuelva a |
||||
abrir la aplicación para que vea el mensaje. Este será el caso durante |
||||
6 meses. En ese momento, eliminaré la aplicación de mi móvil y |
||||
ordenadores. |
||||
|
||||
Pero seguiré aquí, en internet. WhatsApp no es internet, Instagram no |
||||
es internet. Forman parte de internet, pero La Red es más profunda que |
||||
todas estas empresas. A partir de ahora, la mejor forma de ponerse en |
||||
contacto conmigo será a través de [Signal]. A diferencia de WhatsApp o |
||||
Telegram, Signal es una organización sin ánimo de lucro (no tiene |
||||
accionistas a los que rendir cuentas) que se sostiene a través de |
||||
donaciones. Si eres usuario de Signal y lo utilizas regularmente, te |
||||
animo a que [dones al proyecto]. |
||||
|
||||
Si realmente prefieres no utilizar algo nuevo y tienes un dispositivo |
||||
Apple, sigo disponible en iMessage y si eres usuario de Telegram, |
||||
[mantendré mi cuenta de Telegram]. Al menos a corto plazo. Finalmente, |
||||
para los más aventureros, sigo la evolución del protocolo |
||||
decentralizado [Matrix], que realmente creo que es el futuro de las |
||||
comunicaciones. Puedes encontrarme como `@arenzana:matrix.org `. |
||||
|
||||
Igualmente, mi uso de Twitter se verá reducido con los |
||||
meses. [Mastodon] es sin duda la mejor alternativa y puedes seguirme |
||||
[aquí]. |
||||
|
||||
|
||||
=> https://www.whatsapp.com Whatsapp |
||||
=> https://elpais.com/tecnologia/2019/03/06/actualidad/1551903283_498432.html problemas de |
||||
=> https://www.bloomberg.com/news/articles/2021-01-11/why-whatsapp-s-privacy-rules-sparked-moves-to-rivals-quicktake los términos de privacidad |
||||
=> https://www.schneier.com/blog/archives/2021/01/changes-in-whatsapps-privacy-policy.html de WhatsApp |
||||
=> https://elpais.com/tecnologia/2021-01-15/whatsapp-retrasa-su-decision-de-compartir-con-facebook-los-datos-de-usuarios.html Facebook ha recogido cable |
||||
=> https://theintercept.com/2020/10/15/facebook-and-twitter-cross-a-line-far-more-dangerous-than-what-they-censor censura ejercida por estas empresas |
||||
=> https://signal.org Signal |
||||
=> https://signal.org/donate/ dones al proyecto |
||||
=> https://t.me/Arenzana mantendré mi cuenta de Telegram |
||||
=> https://matrix.org Matrix |
||||
=> https://joinmastodon.org/ Mastodon |
||||
=> https://social.mrcol.es/@isma aquí |
||||
|
||||
|
||||
## Farewell, WhatsApp (English) |
||||
|
||||
It's very likely that you're here because you've seen this on my |
||||
[WhatsApp] status. In fact, this is the first time ever since I |
||||
registered around 11 years ago that I have changed my status. |
||||
|
||||
> "Hey there! I'm NOT using WhatsApp" |
||||
|
||||
There's no need to talk about the news about [WhatsApp's terms] [of |
||||
service] that, if it wasn't because [Facebook has delayed], we would |
||||
be forced to accept in order to keep using the service. There's no |
||||
need to talk about the ethical problems of the systematic [censorship |
||||
exercised by these companies] either. Reality is, none of these |
||||
companies (not just Facebook, but Google or Twitter for that matter) |
||||
are enticed to adjust their service for their users well-being |
||||
because, citing Richard Serra, _we are the product_ since we're not |
||||
paying for it. |
||||
|
||||
For these reasons, I'm looking for more sustainable social media |
||||
platforms and means of communication looking into the future. They |
||||
exist, seriously; but they are not as wide-spread as "the classics". |
||||
|
||||
So now what? |
||||
|
||||
I'm out of WhatsApp, but not immediately. Starting in March, I will |
||||
eliminate notifications and permissions given to the application |
||||
(location, pictures, etc). Today, I will start letting my contacts |
||||
know where to find me. After March, people I talk to less regularly |
||||
will have to wait until I open the app again (days or weeks later) for |
||||
me to see the message. This will be the case for about 6 months. After |
||||
that, I will eliminate the app from my phone and computers. |
||||
|
||||
But I will remain on the internet. WhatsApp is not the internet, |
||||
Instagram is not the internet. They belong to it, but the Internet is |
||||
deeper than those applications. |
||||
|
||||
The best way to get in contact with me, will be through |
||||
[Signal]. Unlike WhatsApp or Telegram, Signal is a 501c-3 (non profit |
||||
organization) that has no shareholders to please. This also means that |
||||
if you're a user that enjoys the service, I encourage you to [donate |
||||
to the project]. |
||||
|
||||
If you really don't want to use a new service and have an Apple |
||||
device, I will still be available on iMessage and, if you're a |
||||
Telegram user, [I will keep my Telegram account]. At least in the |
||||
short term. Finally, for the adventurous ones, I'm keeping an eye on |
||||
the evolution of the decentralized [Matrix] protocol, I truly believe |
||||
it is the future of communications. You can find me as |
||||
`@arenzana:matrix.org `. |
||||
|
||||
My use of Twitter will be reduced as well, potentially following the |
||||
fate of WhatsApp. [Mastodon] is certainly the best alternative, and |
||||
you can follow me [here]. |
||||
|
||||
|
||||
=> https://whatsapp.com WhatsApp |
||||
=> https://elpais.com/tecnologia/2019/03/06/actualidad/1551903283_498432.html WhatsApp's terms |
||||
=> https://www.schneier.com/blog/archives/2021/01/changes-in-whatsapps-privacy-policy.html of service |
||||
=> https://elpais.com/tecnologia/2021-01-15/whatsapp-retrasa-su-decision-de-compartir-con-facebook-los-datos-de-usuarios.html Facebook has delayed |
||||
=> https://theintercept.com/2020/10/15/facebook-and-twitter-cross-a-line-far-more-dangerous-than-what-they-censor censorship exercised by these companies |
||||
=> https://signal.org Signal |
||||
=> https://signal.org/donate/ donate to the project |
||||
=> https://t.me/Arenzana I will keep my Telegram account |
||||
=> https://matrix.org Matrix |
||||
=> https://joinmastodon.org/ Mastodon |
||||
=> https://social.mrcol.es/@isma here |
@ -0,0 +1,41 @@
|
||||
# Arenzana |
||||
|
||||
## About me |
||||
|
||||
Hey there, I’m Isma. |
||||
|
||||
Interested in everything: from art to technology, faith to travel. |
||||
Spanish by birth, American by adoption. |
||||
|
||||
I’m also a co-host at El Mentidero, a podcast in Spanish about what it is like to live abroad. You can find it here: |
||||
|
||||
=> https://elmentidero.net El Mentidero |
||||
|
||||
## Contact |
||||
|
||||
=> mailto://isma@arenzana.org Email |
||||
=> https://arenzana.org HTTPS |
||||
=> https://t.me/Arenzana Telegram |
||||
|
||||
PGP Fingerprint: |
||||
``` |
||||
B2AD 040F 88EC 812F 6ABB 8392 E855 12E7 12CC D0C6 |
||||
``` |
||||
|
||||
=> https://gist.githubusercontent.com/arenzana/51d4107bcbbbe12aa47db1df6e23f4a7/raw/cca5ab2f742459f8a8ef92969cc384d6118eea60/eddsa_public_key.txt PGP Public Key |
||||
|
||||
## Articles |
||||
|
||||
=> 20210201-farewall-whatsapp.gmi |
||||
=> 20200819-emacs-27-1-install.gmi |
||||
=> 20200624-emacs-server-mode.gmi |
||||
=> 20191202-emacs-go-mode-revisited.gmi |
||||
=> 20190628-artisanal-hosting.gmi |
||||
=> 20190424-blogging-with-org-mode.gmi |
||||
=> 20190309-emacs-org-mode.gmi |
||||
=> 20190125-emacs-locale.gmi |
||||
=> 20190121-emacs-go-mode.gmi |
||||
=> 20190120-emacs-lovely.gmi |
||||
=> 20181120-hello-world.gmi |
||||
|
||||
© 2021 arenzana.org. All Rights Reserved |
Loading…
Reference in new issue