Преглед на файлове

Started the video conversion section

Plus moved the blog writing to its own section. It's going to grow a bit
I think. Better move the subtree while it's small.
Eiyeron Fulmincendii преди 6 години
родител
ревизия
3b29987fbc
променени са 1 файла, в които са добавени 81 реда и са изтрити 34 реда
  1. 81 34
      config.org

+ 81 - 34
config.org

@@ -4,7 +4,8 @@
 This is another attempt at making a decent Emacs configuration for the chicken I
 am. Having multiple files with a poor consistence or a directed goal always bit
 me in the back relatively quickly. So this time, I'll try to write something
-documenting my process to warn my future me about my current configuration mishaps.
+documenting my process to warn my future me about my current configuration
+mishaps.
 * The first steps in the look&feel
 ** The colors
 Lately, I have been partial towards Gruvbox, for multiple reasons, the first
@@ -50,20 +51,26 @@ border color if needed.
 ;; (set-face-attribute 'vertical-border nil :foreground "red")
 #+end_src
 
-* Functions
-** Blog helpers
-Org mode is awesome, that's a fact. I tried to look into making org my blog
-framework/builder but I couldn't. I switched to Hugo and reconverted my blog
-files into Markdown.
-*** Draft jump list
+* Blog writing
+I have a [[https://retroactive.me][blog]]. I want to use emacs as my platform to type bits and bobs on it.
+
+Org mode is awesome, that's a fact. Minus the fact that I have to deal with a
+few weirds things around the UI, I love each instant I handle notes or todos
+with that mode. I tried to look into making org my blog framework/builder but I
+couldn't do the jump for many reasons, the most important ones were about having
+to do the templates for org, another one being having to convert Markdown blog
+posts. I switched to Hugo and extracted my blog files from the v3's database
+into markdown files.
+
+Now I'll just enjoy the blog writing from a [[https://gohugo.io][Hugo]]-powered blog git repo. The v4
+is out for a few weeks now and I feel content with the workflow I'm having with
+it right now. But /we can do better/.
+** Draft jump list
 Hugo has a few utilities, notably listing draft posts. I wrote a while ago a
 function to list drafts and feed them to helm. Doom Emacs seems to use ivy as
-file browser, so I have to adapt it to feed Ivy. I currently have a version that
-works pretty well on the blog's project. I have an error risen by Hugo that
-blocks Ivy from doing its completion when Hugo can't find the blog config.
-
-Here's how it works. First we have a function that calls Hugo's draft listing
-based on the project's directory.
+file browser, so I had to rewrite one to feed Ivy with my draft list. Here's how
+it works. First we have a function that calls Hugo's draft listing based on the
+project's directory.
 
 #+begin_src emacs-lisp
 (defun chicken/list-hugo-drafts ()
@@ -106,6 +113,42 @@ if the current project is the root of a Hugo-powered site."
                 :caller 'chicken/hugo-goto-draft)
     (message "The current project doesn't have a config.toml in the root directory.")))
 #+end_src
+** TODO Convert GIF to videos
+I like GIFs, that's a fact. But neither your bandwidth nor your CPU will
+appreciate them. It's soon 2020 and GIFs are one of the most known ways to share
+a small video but it is one of the heaviest way one could do on the internet.
+Why keep continuing using it, except for pixel perfect (256) colors when most of
+the time a little encoding will lose little details but a lot of filesize?
+
+I have a recipe to convert GIFs (and anything video related) into webm or mp4
+with the help of FFMPEG, here it is.
+#+begin_src bash :tangle no
+# base
+ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
+# This worked not so bad on voxathrone gif
+# ---
+# auto-alt-ref is needed because the webm format will throw a tantrum due to
+# transparency in the gif.
+ffmpeg -i .\collision_benchmark.gif -c:v libvpx -crf 10 -auto-alt-ref 0 -b:v 1M -an .\collision_benchmark.webm
+#+end_src
+
+It might be nice to have some functions in emacs to convert a picture when
+working on a post. I'm still randomly trying to figure what I need, but here
+what I have for now:
+- Codec selection (vpx, mp4)
+- /Sane/ quality presets
+- Customizable variables (crf quality for MP4, crf quality and video bandwidth
+  for webm)
+- Detect when working on a post to automatically filter the compatible pictures
+  - I'm usually working with an "images" folder. That could be a thing to detect.
+  - I don't know how it works, but I could detect the `{{< video >}}` template
+    so I can extract the link to the file and locate the file.
+- GPU codec selection?
+
+Of course, an automatic script could help too, but I think this is kind of
+situation where I prefer handling myself the conversion as I might still need
+GIFs in some situations.
+* Unsorted Functions
 ** Search Everything with Everything
 [[https://www.voidtools.com/][Everything]] is a very useful tool for Windows that indexes all the available in
 the system and provides a insanely fast search popup to directly find the file
@@ -118,45 +161,49 @@ function based on Ivy to let me jump on any file with the command line version.
 First, the function that will feed ~ivy-read~. It assumes ~es.exe~ is in your
 ~PATH~.
 #+begin_src emacs-lisp
+;;;###autoload
 (defun chicken/counsel-es-function (str)
   (or
    (ivy-more-chars)
    (progn
      (counsel--async-command
-      (format "es %s" str))
+      (format "es.exe %s" str))
      '("" "working..."))))
 #+end_src
 
-Then the search function. It doesn't do any guards on the presence or not of the
-~es.exe~ executable in your ~PATH~ environment variable. The function is largely
-inspired by Ivy's own examples.
+Then the search function. It is defined when the executable ~es.exe~ can be
+found in your ~PATH~ environment variable. The function is largely inspired by
+Ivy's own examples.
 #+begin_src emacs-lisp
 ;;;###autoload
-(defun chicken/search-everything ()
-  "Call the \"es\" shell command.
+(when (and
+       (executable-find "es.exe")
+       (featurep! :completion ivy))
+  (defun chicken/search-everything ()
+    "Call the \"es\" shell command.
 INITIAL-INPUT can be given as the initial minibuffer input."
-  (interactive)
-  (ivy-read "Everything: " #'chicken/counsel-es-function
-            :dynamic-collection t
-            :require-match t
-            :history 'chicken/search-everything-history
-            :action (lambda (file)
-                      (with-ivy-window
-                        (when file
-                          (find-file file))))
-            :unwind #'counsel-delete-process
-            :caller 'chicken/search-everything ))
+    (interactive)
+    (ivy-read "Everything: " #'chicken/counsel-es-function
+              :dynamic-collection t
+              :require-match t
+              :history 'chicken/search-everything-history
+              :action (lambda (file)
+                        (with-ivy-window
+                          (when file
+                            (find-file file))))
+              :unwind #'counsel-delete-process
+              :caller 'chicken/search-everything )))
+
 #+end_src
 
 Finally, let's set up a shortcut to directly search a file globally with that
 tool. I'm going to map it on ~[LEADER]-s-E~, as I hope it won't be used in the
 near future by Doom Emacs' default configuration. The mapping makes sure that
-you have the executable available before enabling the mapping.
+you have the executable available by checking if the function to be called is
+available.
 #+begin_src emacs-lisp
 (map! (:when
-        (and
-         (executable-find "es")
-         (featurep! :completion ivy)))
+        (functionp 'chicken/search-everything))
       :leader
       :desc "Everything" "sE" #'chicken/search-everything)
 #+end_src