2024-11-13 06:46:05 +00:00
|
|
|
;;;; Tabs, indentation, and the TAB key
|
|
|
|
(use-package emacs
|
|
|
|
:ensure nil
|
|
|
|
:demand t
|
|
|
|
:config
|
|
|
|
(setq tab-always-indent 'complete)
|
|
|
|
(setq tab-first-completion 'word-or-paren-or-punct) ; Emacs 27
|
|
|
|
(setq-default tab-width 4
|
|
|
|
indent-tabs-mode nil))
|
|
|
|
|
|
|
|
;;;; Parentheses (show-paren-mode)
|
|
|
|
(use-package paren
|
|
|
|
:ensure nil
|
|
|
|
:hook (prog-mode . show-paren-local-mode)
|
|
|
|
:config
|
|
|
|
(setq show-paren-style 'mixed)
|
|
|
|
(setq show-paren-when-point-in-periphery nil)
|
|
|
|
(setq show-paren-when-point-inside-paren nil)
|
|
|
|
(setq show-paren-context-when-offscreen 'overlay)) ; Emacs 29
|
|
|
|
|
|
|
|
;;;; Eldoc (Emacs live documentation feedback)
|
|
|
|
(use-package eldoc
|
|
|
|
:ensure nil
|
|
|
|
:hook (prog-mode . eldoc-mode)
|
|
|
|
:config
|
|
|
|
(setq eldoc-message-function #'message)) ; don't use mode line for M-x eval-expression, etc.
|
|
|
|
|
|
|
|
;;;; Eglot (built-in client for the language server protocol)
|
|
|
|
(use-package eglot
|
|
|
|
:ensure nil
|
|
|
|
:functions (eglot-ensure)
|
|
|
|
:commands (eglot)
|
|
|
|
:config
|
|
|
|
(setq eglot-sync-connect nil)
|
|
|
|
(setq eglot-autoshutdown t))
|
|
|
|
|
|
|
|
;;; Markdown (markdown-mode)
|
|
|
|
(use-package markdown-mode
|
|
|
|
:ensure t
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(setq markdown-fontify-code-blocks-natively t))
|
|
|
|
|
|
|
|
;;; csv-mode
|
|
|
|
(use-package csv-mode
|
|
|
|
:ensure t
|
|
|
|
:commands (csv-align-mode))
|
|
|
|
|
|
|
|
;;; Flyspell
|
|
|
|
(use-package flyspell
|
|
|
|
:ensure nil
|
|
|
|
:bind
|
|
|
|
( :map flyspell-mode-map
|
|
|
|
("C-;" . nil)
|
|
|
|
:map flyspell-mouse-map
|
|
|
|
("<mouse-3>" . flyspell-correct-word))
|
|
|
|
:config
|
|
|
|
(setq flyspell-issue-message-flag nil)
|
|
|
|
(setq flyspell-issue-welcome-flag nil)
|
|
|
|
(setq ispell-program-name "aspell")
|
|
|
|
(setq ispell-dictionary "en_GB"))
|
|
|
|
|
|
|
|
;;; Flymake
|
|
|
|
(use-package flymake
|
|
|
|
:ensure nil
|
|
|
|
:bind
|
|
|
|
(:map flymake-mode-map
|
|
|
|
("C-c ! s" . flymake-start)
|
|
|
|
("C-c ! l" . flymake-show-buffer-diagnostics) ; Emacs28
|
|
|
|
("C-c ! L" . flymake-show-project-diagnostics) ; Emacs28
|
|
|
|
("C-c ! n" . flymake-goto-next-error)
|
|
|
|
("C-c ! p" . flymake-goto-prev-error))
|
|
|
|
:config
|
|
|
|
(setq flymake-fringe-indicator-position 'left-fringe)
|
|
|
|
(setq flymake-suppress-zero-counters t)
|
|
|
|
(setq flymake-no-changes-timeout nil)
|
|
|
|
(setq flymake-start-on-flymake-mode t)
|
|
|
|
(setq flymake-start-on-save-buffer t)
|
|
|
|
(setq flymake-proc-compilation-prevents-syntax-check t)
|
|
|
|
(setq flymake-wrap-around nil)
|
|
|
|
(setq flymake-mode-line-format
|
|
|
|
'("" flymake-mode-line-exception flymake-mode-line-counters))
|
|
|
|
;; NOTE 2023-07-03: `prot-modeline.el' actually defines the counters
|
|
|
|
;; itself and ignores this.
|
|
|
|
(setq flymake-mode-line-counter-format
|
|
|
|
'("" flymake-mode-line-error-counter
|
|
|
|
flymake-mode-line-warning-counter
|
|
|
|
flymake-mode-line-note-counter ""))
|
|
|
|
(setq flymake-show-diagnostics-at-end-of-line nil)) ; Emacs 30
|
|
|
|
|
|
|
|
;;; Elisp packaging requirements
|
|
|
|
(use-package package-lint-flymake
|
|
|
|
:ensure t
|
|
|
|
:after flymake
|
|
|
|
:config
|
|
|
|
(add-hook 'flymake-diagnostic-functions #'package-lint-flymake))
|
|
|
|
|
|
|
|
;;; General configurations for prose/writing
|
|
|
|
|
|
|
|
;;;; `outline' (`outline-mode' and `outline-minor-mode')
|
|
|
|
(use-package outline
|
|
|
|
:ensure nil
|
|
|
|
:bind
|
|
|
|
("<f10>" . outline-minor-mode)
|
|
|
|
:config
|
|
|
|
(setq outline-minor-mode-highlight nil) ; emacs28
|
|
|
|
(setq outline-minor-mode-cycle t) ; emacs28
|
|
|
|
(setq outline-minor-mode-use-buttons nil) ; emacs29---bless you for the nil option!
|
|
|
|
(setq outline-minor-mode-use-margins nil)) ; as above
|
|
|
|
|
|
|
|
;;;; `dictionary'
|
|
|
|
(use-package dictionary
|
|
|
|
:ensure nil
|
|
|
|
:config
|
|
|
|
(setq dictionary-server "dict.org"
|
|
|
|
dictionary-default-popup-strategy "lev" ; read doc string
|
|
|
|
dictionary-create-buttons nil
|
|
|
|
dictionary-use-single-buffer t))
|
|
|
|
|
2024-11-14 16:38:27 +00:00
|
|
|
;;; Denote (simple note-taking and file-naming)
|
|
|
|
|
|
|
|
;; Read the manual: <https://protesilaos.com/emacs/denote>. This does
|
|
|
|
;; not include all the useful features of Denote. I have a separate
|
|
|
|
;; private setup for those, as I need to test everything is in order.
|
|
|
|
(use-package denote
|
|
|
|
:ensure t
|
|
|
|
:hook
|
|
|
|
;; If you use Markdown or plain text files you want to fontify links
|
|
|
|
;; upon visiting the file (Org renders links as buttons right away).
|
|
|
|
((text-mode . denote-fontify-links-mode-maybe)
|
|
|
|
|
|
|
|
;; Highlight Denote file names in Dired buffers. Below is the
|
|
|
|
;; generic approach, which is great if you rename files Denote-style
|
|
|
|
;; in lots of places as I do.
|
|
|
|
;;
|
|
|
|
;; If you only want the `denote-dired-mode' in select directories,
|
|
|
|
;; then modify the variable `denote-dired-directories' and use the
|
|
|
|
;; following instead:
|
|
|
|
;;
|
|
|
|
;; (dired-mode . denote-dired-mode-in-directories)
|
|
|
|
(dired-mode . denote-dired-mode))
|
|
|
|
:bind
|
|
|
|
;; Denote DOES NOT define any key bindings. This is for the user to
|
|
|
|
;; decide. Here I only have a subset of what Denote offers.
|
|
|
|
( :map global-map
|
|
|
|
("C-c n n" . denote)
|
|
|
|
("C-c n N" . denote-type)
|
|
|
|
("C-c n o" . denote-sort-dired) ; "order" mnemonic
|
|
|
|
;; Note that `denote-rename-file' can work from any context, not
|
|
|
|
;; just Dired buffers. That is why we bind it here to the
|
|
|
|
;; `global-map'.
|
|
|
|
;;
|
|
|
|
;; Also see `denote-rename-file-using-front-matter' further below.
|
|
|
|
("C-c n r" . denote-rename-file)
|
|
|
|
;; If you intend to use Denote with a variety of file types, it is
|
|
|
|
;; easier to bind the link-related commands to the `global-map', as
|
|
|
|
;; shown here. Otherwise follow the same pattern for
|
|
|
|
;; `org-mode-map', `markdown-mode-map', and/or `text-mode-map'.
|
|
|
|
:map text-mode-map
|
|
|
|
("C-c n i" . denote-link) ; "insert" mnemonic
|
|
|
|
("C-c n I" . denote-add-links)
|
|
|
|
("C-c n b" . denote-backlinks)
|
|
|
|
;; Also see `denote-rename-file' further above.
|
|
|
|
("C-c n R" . denote-rename-file-using-front-matter)
|
|
|
|
:map org-mode-map
|
|
|
|
("C-c n d l" . denote-org-extras-dblock-insert-links)
|
|
|
|
("C-c n d b" . denote-org-extras-dblock-insert-backlinks)
|
|
|
|
;; Key bindings specifically for Dired.
|
|
|
|
:map dired-mode-map
|
|
|
|
("C-c C-d C-i" . denote-dired-link-marked-notes)
|
|
|
|
("C-c C-d C-r" . denote-dired-rename-marked-files)
|
|
|
|
("C-c C-d C-k" . denote-dired-rename-marked-files-with-keywords)
|
|
|
|
("C-c C-d C-f" . denote-dired-rename-marked-files-using-front-matter))
|
|
|
|
:config
|
|
|
|
;; Remember to check the doc strings of those variables.
|
|
|
|
(setq denote-directory (expand-file-name "~/Documents/notes/"))
|
|
|
|
(setq denote-file-type 'text) ; Org is the default file type
|
|
|
|
|
|
|
|
;; If you want to have a "controlled vocabulary" of keywords,
|
|
|
|
;; meaning that you only use a predefined set of them, then you want
|
|
|
|
;; `denote-infer-keywords' to be nil and `denote-known-keywords' to
|
|
|
|
;; have the keywords you need.
|
|
|
|
(setq denote-known-keywords '("emacs" "philosophy" "politics" "economics"))
|
|
|
|
(setq denote-infer-keywords t)
|
|
|
|
(setq denote-sort-keywords t)
|
|
|
|
|
|
|
|
(setq denote-excluded-directories-regexp nil)
|
|
|
|
(setq denote-date-format nil) ; read its doc string
|
|
|
|
(setq denote-rename-confirmations nil) ; CAREFUL with this if you are not familiar with Denote!
|
|
|
|
|
|
|
|
(setq denote-backlinks-show-context nil)
|
|
|
|
|
|
|
|
(setq denote-rename-buffer-format "[D] %t%b")
|
|
|
|
(setq denote-buffer-has-backlinks-string " (<--->)")
|
|
|
|
|
|
|
|
;; Automatically rename Denote buffers when opening them so that
|
|
|
|
;; instead of their long file name they have a literal "[D]"
|
|
|
|
;; followed by the file's title. Read the doc string of
|
|
|
|
;; `denote-rename-buffer-format' for how to modify this.
|
|
|
|
(denote-rename-buffer-mode 1)
|
|
|
|
|
|
|
|
;; ----- PERSONAL TWEAKS FOR EXPERIMENTS -----
|
|
|
|
(setq denote-text-front-matter "title: %s\n\n")
|
|
|
|
|
|
|
|
(defun prot/denote-add-text-front-matter-separator ()
|
|
|
|
"Add separator equal to the length of the title.
|
|
|
|
Do this when the `denote-file-type' is `text'."
|
|
|
|
(when (and (eq denote-file-type 'text)
|
|
|
|
;; Not `string=' because there may be a .gpg extension as well.
|
|
|
|
(string-match-p (file-name-extension buffer-file-name) "txt"))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(when (re-search-forward "title:" nil t)
|
|
|
|
(let ((text (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
|
|
|
|
(if (re-search-forward "^$" nil t)
|
|
|
|
(insert (make-string (length text) ?-))
|
|
|
|
(error "Could not find an empty line after the front matter")))))))
|
|
|
|
|
|
|
|
(add-hook 'denote-after-new-note-hook #'prot/denote-add-text-front-matter-separator))
|
|
|
|
|
|
|
|
(use-package consult-denote
|
|
|
|
:ensure t
|
|
|
|
:bind
|
|
|
|
(("C-c n f" . consult-denote-find)
|
|
|
|
("C-c n g" . consult-denote-grep))
|
|
|
|
:config
|
|
|
|
(consult-denote-mode 1))
|
|
|
|
|
2024-11-13 06:46:05 +00:00
|
|
|
(provide 'unravel-langs)
|