Made emacs more stable, disabled some plugins

This commit is contained in:
Aleksandr Lebedev 2025-02-01 14:32:16 +01:00
parent dff0de6a63
commit b5e21b2faa
3 changed files with 53 additions and 108 deletions

View file

@ -6,21 +6,19 @@
* Table of contents :toc:
- [[#important-programs-to-load-first][IMPORTANT PROGRAMS TO LOAD FIRST]]
- [[#recent-files][Recent Files]]
- [[#keybindings][Keybindings]]
- [[#support-functions][Support functions]]
- [[#emacs-function-launcher][Emacs function launcher]]
- [[#copy-to-clipboard][Copy to clipboard]]
- [[#app-launcher][App Launcher]]
- [[#standalone-run][Standalone run]]
- [[#backup-files-tilda-files][Backup files (tilda files)]]
- [[#company][Company]]
- [[#dashboard][Dashboard]]
- [[#diminish][Diminish]]
- [[#dired-file-manager][DIRED (File manager)]]
- [[#ediff][EDIFF]]
- [[#emoji][Emoji]]
- [[#copy-to-clipboard-1][Copy to clipboard]]
- [[#standalone-emoji-picker][Standalone emoji picker]]
- [[#flycheck][FLYCHECK]]
- [[#fonts][Fonts]]
- [[#sane-defaults][Sane defaults]]
- [[#battery-info][Battery info]]
@ -28,7 +26,6 @@
- [[#magit][MAGIT]]
- [[#minibuffer-escape][Minibuffer escape]]
- [[#modeline][Modeline]]
- [[#projectile][PROJECTILE]]
- [[#pdf-tools][PDF Tools]]
- [[#rainbow-delimiters][RAINBOW DELIMITERS]]
- [[#org-mode][ORG MODE]]
@ -53,9 +50,9 @@
- [[#nerd-icons][Nerd Icons]]
- [[#nerd-icons-completion][Nerd Icons Completion]]
- [[#buffer-move][Buffer Move]]
- [[#vertico][Vertico]]
- [[#consult][Consult]]
- [[#embark][Embark]]
- [[#completions][Completions]]
- [[#vertico][Vertico]]
- [[#fido-mode][Fido-mode]]
- [[#descriptions][Descriptions]]
- [[#theme][Theme]]
- [[#theme-loading][Theme loading]]
@ -68,7 +65,10 @@
#+begin_src emacs-lisp
(recentf-mode t)
#+end_src
** Keybindings
#+begin_src emacs-lisp
(global-set-key [remap list-buffers] 'ibuffer)
#+end_src
* Support functions
** Emacs function launcher
Launches emacs function as a window
@ -279,30 +279,9 @@ To use it, create a global keyboard shortcut with the following code
(emacs-run-launcher 'app-launcher-run-app))
#+end_src
* Backup files (tilda files)
By default, Emacs creates automatic backups of files in their original directories, such “file.el” and the backup “file.el~”. This leads to a lot of clutter, so lets tell Emacs to put all backups that it creates in the ~TRASH~ directory.
By default, Emacs creates automatic backups of files in their original directories, such “file.el” and the backup “file.el~”. This leads to a lot of clutter, so lets tell Emacs to put all backups that it creates in the ~.emacs.d~ directory.
#+begin_src emacs-lisp
(setq backup-directory-alist '((".*" . "~/.local/share/Trash/files")))
#+end_src
* Company
[[https://company-mode.github.io/][Company]] is a text completion framework for Emacs. The name stands for “complete anything”. Completion will start automatically after you type a few letters. Use M-n and M-p to select, <return> to complete or <tab> to complete the common part.
#+begin_src emacs-lisp
(use-package company
:ensure t
:defer 2
:diminish
:custom
(company-begin-commands '(self-insert-command))
(company-idle-delay .1)
(company-minimum-prefix-length 2)
(company-show-numbers t)
(company-tooltip-align-annotations 't)
(global-company-mode t))
(use-package company-box
:ensure t
:after company
:diminish
:hook (company-mode . company-box-mode))
(setq backup-directory-alist '((".*" . "~/.emacs.d/tildafiles")))
#+end_src
* Dashboard
Emacs Dashboard is an extensible startup screen showing you recent files, bookmarks, agenda items and an Emacs banner.
@ -349,19 +328,6 @@ This package implements hiding or abbreviation of the modeline displays (lighter
:after dired
)
#+end_src
* EDIFF
ediff is a diff program that is built into Emacs. By default, ediff splits files vertically and places the help frame in its own window. I have changed this so the two files are split horizontally and the help frame appears as a lower split within the existing window. Also, I create my own dt-ediff-hook where I add j/k for moving to next/prev diffs. By default, this is set to n/p.
#+begin_src emacs-lisp
(setq ediff-split-window-function 'split-window-horizontally
ediff-window-setup-function 'ediff-setup-windows-plain)
(defun dt-ediff-hook ()
(ediff-setup-keymap)
(define-key ediff-mode-map "j" 'ediff-next-difference)
(define-key ediff-mode-map "k" 'ediff-previous-difference))
(add-hook 'ediff-mode-hook 'dt-ediff-hook)
#+end_src
* Emoji
** Copy to clipboard
#+begin_src emacs-lisp
@ -389,15 +355,6 @@ To use it, create a global keyboard shortcut with the following code
(run-at-time "60 sec" nil (lambda (frame) (delete-frame frame)) launcher-frame))))
#+end_src
* FLYCHECK
Install luacheck from your Linux distros repositories for flycheck to work correctly with lua files. Install python-pylint for flycheck to work with python files. Haskell works with flycheck as long as haskell-ghc or haskell-stack-ghc is installed. For more information on language support for flycheck, [[https://www.flycheck.org/en/latest/languages.html][read this]].
#+begin_src emacs-lisp
(use-package flycheck
:ensure t
:defer t
:diminish
:init (global-flycheck-mode))
#+end_src
* Fonts
Defining the various fonts that Emacs will use.
#+begin_src emacs-lisp
@ -435,7 +392,6 @@ Defining the various fonts that Emacs will use.
* Sane defaults
The following settings are simple modes that are enabled (or disabled) so that Emacs functions more like you would expect a proper editor/IDE to function.
#+begin_src emacs-lisp
(delete-selection-mode 1) ;; You can select text and delete it by typing.
(electric-indent-mode -1) ;; Turn off the weird indenting that Emacs does by default.
(electric-pair-mode 1) ;; Turns on automatic parens pairing
;; The following prevents <> from auto-pairing when electric-pair-mode is on.
@ -447,14 +403,6 @@ The following settings are simple modes that are enabled (or disabled) so that E
(global-auto-revert-mode t) ;; Automatically show changes if the file has changed
(global-display-line-numbers-mode 1) ;; Display line numbers
(global-visual-line-mode t) ;; Enable truncated lines
(menu-bar-mode 1) ;; Disable the menu bar
(scroll-bar-mode -1) ;; Disable the scroll bar
(tool-bar-mode 1) ;; Disable the tool bar
(setq org-edit-src-content-indentation 0) ;; Set src block automatic indent to 0 instead of 2.
(setq use-file-dialog nil) ;; No file dialog
(setq use-dialog-box nil) ;; No dialog box
(setq pop-up-windows nil) ;; No popup windows
(setq save-interprogram-paste-before-kill t)
#+end_src
** Battery info
#+begin_src emacs-lisp
@ -481,7 +429,7 @@ By default, Emacs requires you to hit ESC three times to escape quit the minibuf
#+end_src
* Modeline
The modeline is the bottom status bar that appears in Emacs windows. While you can create your own custom modeline, why go to the trouble when Doom Emacs already has a nice modeline package available. For more information on what is available to configure in the Doom modeline, check out: [[https://github.com/seagle0128/doom-modeline][Doom Modeline]]
#+begin_src emacs-lisp
#+begin_src emacs-lispp
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1)
@ -492,14 +440,6 @@ The modeline is the bottom status bar that appears in Emacs windows. While you
doom-modeline-time t ;; shows time
doom-modeline-persp-icon t)) ;; adds folder icon next to persp name
#+end_src
* PROJECTILE
[[https://github.com/bbatsov/projectile][Projectile]] is a project interaction library for Emacs. It should be noted that many projectile commands do not work if you have set “fish” as the “shell-file-name” for Emacs.
#+begin_src emacs-lisp
(use-package projectile
:ensure t
:config
(projectile-mode 1))
#+end_src
* PDF Tools
[[https://github.com/vedang/pdf-tools][pdf-tools]] is a replacement of DocView for viewing PDF files inside Emacs. It uses the poppler library, which also means that pdf-tools can by used to modify PDFs. I use to disable display-line-numbers-mode in pdf-view-mode because line numbers crash it.
#+begin_src emacs-lisp
@ -508,11 +448,11 @@ The modeline is the bottom status bar that appears in Emacs windows. While you
:defer t
:commands (pdf-loader-install)
:mode "\\.pdf\\'"
:bind (:map pdf-view-mode-map
("j" . pdf-view-next-line-or-next-page)
("k" . pdf-view-previous-line-or-previous-page)
("C-=" . pdf-view-enlarge)
("C--" . pdf-view-shrink))
;:bind (:map pdf-view-mode-map
; ("j" . pdf-view-next-line-or-next-page)
; ("k" . pdf-view-previous-line-or-previous-page)
; ("C-=" . pdf-view-enlarge)
; ("C--" . pdf-view-shrink))
:init (pdf-loader-install)
:config (add-to-list 'revert-without-query ".pdf"))
@ -635,7 +575,6 @@ Org-tempo is not a separate package but a module within org that can be enabled.
#+end_src
** Inbox
#+begin_src emacs-lisp
(defun kylekrein/org-roam-capture-inbox ()
(interactive)
(org-roam-capture- :node (org-roam-node-create)
@ -724,7 +663,6 @@ Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets t
(window-height . 0.3))))
#+end_src
* SUDO EDIT
[[https://github.com/nflath/sudo-edit][sudo-edit]] gives us the ability to open files with sudo privileges or switch over to editing with sudo privileges if we initially opened the file without such privileges.
@ -843,7 +781,8 @@ one, an error is signaled."
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
#+end_src
* Vertico
* Completions
** Vertico
[[https://github.com/minad/vertico][Vertico]] provides a performant and minimalistic vertical completion UI based on the default completion system.
#+begin_src emacs-lisp
;; Enable vertico
@ -894,7 +833,10 @@ one, an error is signaled."
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))
#+end_src
** Orderless
Better searching
#+begin_src emacs-lisp
;; Optionally use the `orderless' completion style.
(use-package orderless
:ensure t
@ -905,14 +847,13 @@ one, an error is signaled."
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
#+end_src
** Fido-mode
Enables fido completion in emacs.
#+begin_src emacs-lispp
(fido-mode t)
(fido-vertical-mode t)
#+end_src
** Consult
A collection of commands (like Counsel for Ivy), which provide additional completions.
#+begin_src emacs-lisp
#+end_src
** Embark
Provides actions for the current selection in Vertico completion list (ex. Remove/Rename file in ~find-file~)
** Descriptions
*** Marginalia
[[https://github.com/minad/marginalia/]]
@ -938,7 +879,7 @@ Descriptions for completions
* Theme
[[https://emacsfodder.github.io/emacs-theme-editor/][Emacs Theme Editor]]
** Theme loading
#+begin_src emacs-lisp
#+begin_src emacs-lispp
(use-package doom-themes
:ensure t
:config

24
flake.lock generated
View file

@ -6,11 +6,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1737998189,
"narHash": "sha256-Np3e0z3S9nSbnbqaj+i0KyCR5S+KS+bdqHyser+KJuU=",
"lastModified": 1738401115,
"narHash": "sha256-fPlNjx90JW7gMr19XlY2zEVJTFnV1nmhaJBdSmZ0efY=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "2251b6ce66de3f27aaf26779f2dc8c7b99402014",
"rev": "2c113c718a7cbe167e6e5ac7f9228f02c815c8e5",
"type": "github"
},
"original": {
@ -36,11 +36,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1737885589,
"narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
"lastModified": 1738142207,
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
"type": "github"
},
"original": {
@ -52,11 +52,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1737885640,
"narHash": "sha256-GFzPxJzTd1rPIVD4IW+GwJlyGwBDV1Tj5FLYwDQQ9sM=",
"lastModified": 1738277201,
"narHash": "sha256-6L+WXKCw5mqnUIExvqkD99pJQ41xgyCk6z/H9snClwk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4e96537f163fad24ed9eb317798a79afc85b51b7",
"rev": "666e1b3f09c267afd66addebe80fb05a5ef2b554",
"type": "github"
},
"original": {
@ -68,11 +68,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1737885589,
"narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
"lastModified": 1738142207,
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
"type": "github"
},
"original": {

View file

@ -3,6 +3,9 @@
x11 ? false,
...
}: let
configFile = pkgs.tangleOrgBabelFile "default.el" ./config.org {
languages = ["emacs-lisp"];
};
emacs = pkgs.emacsWithPackagesFromUsePackage {
# Your Emacs config file. Org mode babel files are also
# supported.
@ -10,7 +13,7 @@
# they're being parsed in nix, which lacks unicode
# support.
# config = ./emacs.org;
config = ./config.org;
config = configFile;
# Whether to include your config as a default init file.
# If being bool, the value of config is used.
@ -21,14 +24,12 @@
# src = ./emacs.el;
# inherit (config.xdg) configHome dataHome;
# };
defaultInitFile = pkgs.tangleOrgBabelFile "default.el" ./config.org {
languages = ["emacs-lisp"];
};
defaultInitFile = true;
# Package is optional, defaults to pkgs.emacs
package =
if x11
then pkgs.emacs-unstable
else pkgs.emacs-pgtk;
else pkgs.emacs-unstable-pgtk;
# By default emacsWithPackagesFromUsePackage will only pull in
# packages with `:ensure`, `:ensure t` or `:ensure <package name>`.
@ -46,7 +47,7 @@
# Note that this is NOT recommended unless you have something like
# `#+PROPERTY: header-args:emacs-lisp :tangle yes` in your config,
# which defaults `:tangle` to `yes`.
alwaysTangle = true;
alwaysTangle = false;
# Optionally provide extra packages not in the configuration file.
# This can also include extra executables to be run by Emacs (linters,
@ -55,7 +56,11 @@
with pkgs; [
#nerd-fonts.jetbrains-mono
#jetbrains-mono
unzip
unzip
librsvg
imagemagick
fontconfig
freetype
];
# Optionally override derivations.
@ -69,7 +74,6 @@
fontDirectories = with pkgs; [
jetbrains-mono
ubuntu-classic
nerd-fonts.jetbrains-mono
nerd-fonts.symbols-only
];
};