# Normal assignment doesn't work.
lines=$(printf "abc\n123\n\n"); echo -n "$lines" | wc -l
# 1 -- WRONG
empty=$(printf ""); echo -n "$empty" | wc -l
# 0 -- WRONG
# Problem is that variable assignment strips all newlines when assigning the
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- lexical-binding: t -*- | |
(defun org-roam-search () | |
"Search for backlinks for a given article in a new buffer." | |
(interactive) | |
(let* ((source-org-roam-directory org-roam-directory) | |
(completions (org-roam--get-title-path-completions)) | |
(title (completing-read "File: " completions)) | |
(file-path (cdr (assoc title completions))) | |
(buf-name (format "*org-roam-search-%s*" title)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar org-roam-directories nil | |
"Paths to org-roam files. List where CAR is name and CDR is path.") | |
;; Example: | |
;; (setq org-roam-directories '(("Home roam" . "~/Documents/home-roam") | |
;; ("Work roam" . "~/Documents/work-roam"))) | |
;; Set first directory | |
(setq org-roam-directory (cdar org-roam-directories)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Non-macro macro helper | |
(defun run-and-act-on-new-window (cmd props timeout function) | |
"Run a command, setup a handler to apply a function to the new window once it's open." | |
(let* (focus-window-handler | |
timeout-handler | |
(timer (run-with-timer timeout nil | |
#'(lambda () | |
;; Remove hooks after period of time should something go wrong. | |
(when focus-window-handler | |
(remove-hook *focus-window-hook* focus-window-handler)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
stderr() { cat <<< "$@" 1>&2; } | |
toggle_xinput_device() | |
{ | |
declare -r -a device_filters=("$@") | |
if [[ ${#device_filters[*]} -eq 0 ]]; then | |
stderr "No filters provided." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- mode: dotspacemacs -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration." | |
(setq-default | |
;; List of additional paths where to look for configuration layers. | |
;; Paths must have a trailing slash (ie. `~/.mycontribs/') | |
dotspacemacs-configuration-layer-path '("/home/herbert/spacemacs/my-layers/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading /home/herbert/.emacs.d/contrib/git/config.el (source)...done | |
Loading /home/herbert/.emacs.d/spacemacs/packages.el (source)...done | |
Loading /home/herbert/spacemacs/my-layers/hfj-c++/packages.el (source)...done | |
Loading /home/herbert/spacemacs/my-layers/hfj-pastebins/packages.el (source)...done | |
Loading /home/herbert/.emacs.d/contrib/ace-window/packages.el (source)...done | |
Loading /home/herbert/.emacs.d/contrib/git/packages.el (source)...done | |
Loading /home/herbert/.emacs.d/contrib/perspectives/packages.el (source)...done | |
Loading /home/herbert/.emacs.d/spacemacs/extensions.el (source)...done | |
Loading /home/herbert/spacemacs/my-layers/hfj-c++/extensions.el (source)...done | |
Loading /home/herbert/spacemacs/my-layers/hfj-pastebins/extensions.el (source)...done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Place this in layer directory and create a "snippets" directory | |
;; in the same layer directory as this file to have a personal | |
;; layer snippets repository | |
;; My snippets directory | |
(setq hfj-snippets/snippet-dir | |
(concat (file-name-directory load-file-name) "snippets")) | |
(setq yas-snippet-dirs | |
(list hfj-snippets/snippet-dir)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Stolen from http://xahlee.blogspot.com/2013/05/emacs-open-file-path-under-cursor-fast.html | |
(defun hfj/open-file-at-cursor () | |
"Open the file path under cursor. | |
If there is text selection, uses the text selection for path. | |
If the path is starts with “http://”, open the URL in browser. | |
Input path can be {relative, full path, URL}. | |
This command is similar to `find-file-at-point' but without prompting for confirmation. | |
" | |
(interactive) | |
(let ( (path (thing-at-point 'filename))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(evil-leader/set-key | |
"jn" 'spacemacs/navagation-micro-state) | |
(defun spacemacs//navagation-mode-ms-full-doc () | |
"Full documentation for helm navigation micro-state." | |
" | |
[?] display this help | |
[)] [0] forwards sentence | |
[)] [9] backwards sentence | |
[}] [{] forwards/backwards paragraph |
NewerOlder