aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaúl Benencia <id@rbenencia.name>2023-07-27 07:55:41 -0700
committerRaúl Benencia <id@rbenencia.name>2023-07-27 07:55:41 -0700
commit1dbdde9d5c392bf2042ee36abe37b9ec6cd86b2d (patch)
tree7967afc6f40c9b3583ad3609941141356f10fbde
parent4ee690114a3fc68c7f58897a9ba1b44ef902a3e5 (diff)
emacs: rul-write and rul-completion
-rw-r--r--.emacs.d/init.el16
-rw-r--r--.emacs.d/rul-init.d/staging.el35
-rw-r--r--.emacs.d/rul-lisp/packages/rul-completion.el38
-rw-r--r--.emacs.d/rul-lisp/packages/rul-write.el38
4 files changed, 89 insertions, 38 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 76d33ed..743df0a 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -142,13 +142,23 @@
;; Set this to t if you don't understand what it means
(setq vc-follow-symlinks nil)
+;; dired
+(add-hook 'dired-mode-hook #'dired-hide-details-mode)
+
+(setq dired-guess-shell-alist-user
+ '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
+ ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
+ (".*" "xdg-open")))
+
(dolist (path '("~/.emacs.d/rul-lisp/config" "~/.emacs.d/rul-lisp/packages"))
(add-to-list 'load-path path))
+(require 'rul-completion)
+(require 'rul-dart)
+(require 'rul-elfeed)
(require 'rul-org)
(require 'rul-org-roam)
-(require 'rul-elfeed)
-(require 'rul-dart)
+(require 'rul-write)
(load-file "~/.emacs.d/rul-init.d/fonts.el")
(load-file "~/.emacs.d/rul-init.d/themes.el")
@@ -177,7 +187,7 @@
(load-file "~/.emacs.d/rul-init.d/staging.el")
-(when-let* ((file (locate-user-emacs-file "rul-pre-init.el"))
+(when-let* ((file (locate-user-emacs-file "rul-post-init.el"))
((file-exists-p file)))
(load-file file))
diff --git a/.emacs.d/rul-init.d/staging.el b/.emacs.d/rul-init.d/staging.el
index 7134fc3..01fd079 100644
--- a/.emacs.d/rul-init.d/staging.el
+++ b/.emacs.d/rul-init.d/staging.el
@@ -1,6 +1,5 @@
;; Debian packages: elpa-consult elpa-orderless elpa-vertico elpa-marginalia
-;; Example configuration for Consult
(use-package consult
;; Replace bindings. Lazily loaded due by `use-package'.
:bind (;; C-c bindings in `mode-specific-map'
@@ -119,40 +118,6 @@
;; (setq consult-project-function nil)
)
-;; Enable vertico
-(use-package vertico
- :init
- (vertico-mode)
-
- ;; Different scroll margin
- ;; (setq vertico-scroll-margin 0)
-
- ;; Show more candidates
- ;; (setq vertico-count 20)
-
- ;; Grow and shrink the Vertico minibuffer
- ;; (setq vertico-resize t)
-
- ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
- ;; (setq vertico-cycle t)
- )
-
-;; Enable rich annotations using the Marginalia package
-(use-package marginalia
- ;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding
- ;; available in the *Completions* buffer, add it to the
- ;; `completion-list-mode-map'.
- :bind (:map minibuffer-local-map
- ("M-A" . marginalia-cycle))
-
- ;; The :init section is always executed.
- :init
-
- ;; Marginalia must be actived in the :init section of use-package such that
- ;; the mode gets enabled right away. Note that this forces loading the
- ;; package.
- (marginalia-mode))
-
(setq completion-styles '(flex basic)
completion-category-defaults nil
completion-category-overrides nil)
diff --git a/.emacs.d/rul-lisp/packages/rul-completion.el b/.emacs.d/rul-lisp/packages/rul-completion.el
new file mode 100644
index 0000000..d1bb8a6
--- /dev/null
+++ b/.emacs.d/rul-lisp/packages/rul-completion.el
@@ -0,0 +1,38 @@
+;; Enable vertico
+(use-package vertico
+ :init
+ (vertico-mode)
+
+ :config
+ (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)
+
+ ;; Different scroll margin
+ ;; (setq vertico-scroll-margin 0)
+
+ ;; Show more candidates
+ ;; (setq vertico-count 20)
+
+ ;; Grow and shrink the Vertico minibuffer
+ ;; (setq vertico-resize t)
+
+ ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
+ ;; (setq vertico-cycle t)
+ )
+
+;; Enable rich annotations using the Marginalia package
+(use-package marginalia
+ ;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding
+ ;; available in the *Completions* buffer, add it to the
+ ;; `completion-list-mode-map'.
+ :bind (:map minibuffer-local-map
+ ("M-A" . marginalia-cycle))
+
+ ;; The :init section is always executed.
+ :init
+
+ ;; Marginalia must be actived in the :init section of use-package such that
+ ;; the mode gets enabled right away. Note that this forces loading the
+ ;; package.
+ (marginalia-mode))
+
+(provide 'rul-completion)
diff --git a/.emacs.d/rul-lisp/packages/rul-write.el b/.emacs.d/rul-lisp/packages/rul-write.el
new file mode 100644
index 0000000..933473d
--- /dev/null
+++ b/.emacs.d/rul-lisp/packages/rul-write.el
@@ -0,0 +1,38 @@
+(use-package denote
+ :ensure t
+ :config
+ (setq denote-infer-keywords t)
+ (setq denote-sort-keywords t)
+ (setq denote-file-type 'text)
+ (setq denote-excluded-directories-regexp nil)
+ (setq denote-allow-multi-word-keywords nil)
+ (setq denote-link-fontify-backlinks t)
+
+ (add-hook 'find-file-hook #'denote-link-buttonize-buffer)
+ (add-hook 'dired-mode-hook #'denote-dired-mode-in-directories)
+
+ (let ((map global-map))
+ (define-key map (kbd "C-c n j") #'rul/denote-journal)
+ (define-key map (kbd "C-c n n") #'denote))
+)
+
+(defun rul/denote-journal ()
+ "Create an entry tagged 'journal' with the date as its title.
+If a journal for the current day exists, visit it. If multiple
+entries exist, prompt with completion for a choice between them.
+Else create a new file."
+ (interactive)
+ (let* ((today (format-time-string "%A %e %B %Y"))
+ (string (denote-sluggify today))
+ (files (denote-directory-files-matching-regexp string)))
+ (cond
+ ((> (length files) 1)
+ (find-file (completing-read "Select file: " files nil :require-match)))
+ (files
+ (find-file (car files)))
+ (t
+ (denote
+ today
+ '("journal"))))))
+
+(provide 'rul-write)
nihil fit ex nihilo