Move the activation of global modes to emacs-startup

This commit is contained in:
Sameer Rahmani 2024-04-10 14:48:47 +01:00
parent fce6134cac
commit 04ae06edcb
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
4 changed files with 60 additions and 52 deletions

View File

@ -44,8 +44,8 @@
:config :config
(setq-default company-backends (setq-default company-backends
'((company-capf :with company-yasnippet) :separate '((company-capf :with company-yasnippet :separate)
(company-keywords company-dabbrev company-ispell) :separate (company-keywords company-dabbrev company-ispell :separate)
company-files)) company-files))
(bind-key [remap completion-at-point] #'company-complete company-mode-map)) (bind-key [remap completion-at-point] #'company-complete company-mode-map))

View File

@ -36,10 +36,11 @@
(require 'fg42/wm) (require 'fg42/wm)
(require 'fg42/org) (require 'fg42/org)
(require 'fg42/minibuffer) (require 'fg42/minibuffer)
(require 'fg42/graphics)) (require 'fg42/graphics)
(require 'fg42/modeline))
(require 'server) (require 'server)
(require 'fg42/modeline)
(defvar fg42/font '("Fira Mono" 12) (defvar fg42/font '("Fira Mono" 12)
@ -158,26 +159,26 @@ contextual information."
"This cube controls the different aspect of buffer navigation" "This cube controls the different aspect of buffer navigation"
:bind ("C-<tab>" . ace-window)) :bind ("C-<tab>" . ace-window))
(when-not-wm (when-not-wm
(use! flyspell (use! flyspell
"Spell checking on the fly" "Spell checking on the fly"
:commands (flyspell-mode flyspell-prog-mode) :commands (flyspell-mode flyspell-prog-mode)
:init :init
(setq-default ispell-program-name "aspell") (setq-default ispell-program-name "aspell")
(setq-default ispell-extra-args '("--sug-mode=ultra" (setq-default ispell-extra-args '("--sug-mode=ultra"
"--lang=en_US" "--lang=en_US"
"--camel-case"))) "--camel-case")))
(use! savehist (use! savehist
"Persist history over Emacs restarts. Vertico sorts by history position." "Persist history over Emacs restarts. Vertico sorts by history position."
:init :init
(savehist-mode)) (savehist-mode))
(use! display-line-numbers (use! display-line-numbers
"The builtin replacement of linum. It's is pretty fast." "The builtin replacement of linum. It's is pretty fast."
:config :config
(global-display-line-numbers-mode 1))) (global-display-line-numbers-mode 1)))
(use! yasnippet (use! yasnippet
@ -240,12 +241,9 @@ shipped with Emacs."
(setq tooltip-use-echo-area t) (setq tooltip-use-echo-area t)
(setq x-gtk-use-system-tooltips nil) (setq x-gtk-use-system-tooltips nil)
;; Switch from `dabbrev-expand' to `hippie-expand'
(global-set-key [remap dabbrev-expand] 'hippie-expand)
;; Global configurations ;; Global configurations
(tool-bar-mode -1) (tool-bar-mode -1)
(tooltip-mode nil) (tooltip-mode nil)
(menu-bar-mode -1) (menu-bar-mode -1)
(when (display-graphic-p) (when (display-graphic-p)
@ -253,25 +251,32 @@ shipped with Emacs."
(pixel-scroll-precision-mode) (pixel-scroll-precision-mode)
(scroll-bar-mode -1)) (scroll-bar-mode -1))
(column-number-mode t)
(show-paren-mode t)
(electric-pair-mode 1)
(global-company-mode)
;; git changes in the fringe
(global-diff-hl-mode)
(noether-global-mode)
;; Rectangular select
(cua-selection-mode t)
;; Yank the region on type
(delete-selection-mode 1)
(defalias 'yes-or-no-p 'y-or-n-p) (defalias 'yes-or-no-p 'y-or-n-p)
;; Hooks --- ;; Hooks ---
(add-hook
'emacs-startup-hook
(lambda ()
;; Switch from `dabbrev-expand' to `hippie-expand'
(global-set-key [remap dabbrev-expand] 'hippie-expand)
(column-number-mode t)
(show-paren-mode t)
(electric-pair-mode 1)
(global-company-mode)
;; git changes in the fringe
(global-diff-hl-mode)
;; Modeline replacement
(noether-global-mode)
;; Rectangular select
(cua-selection-mode t)
;; Yank the region on type
(delete-selection-mode 1)))
;; Deletel extra trailing white spaces on save ;; Deletel extra trailing white spaces on save
(add-hook 'before-save-hook 'delete-trailing-whitespace) (add-hook 'before-save-hook 'delete-trailing-whitespace)

View File

@ -54,9 +54,8 @@
"Smart mode line is a pretty simple yet fantastic alternative "Smart mode line is a pretty simple yet fantastic alternative
to Emacs modeline." to Emacs modeline."
:if (display-graphic-p) :if (display-graphic-p)
:after projectile ;;:after projectile
:commands noether-global-mode :commands noether-global-mode
:config :config
(require 'noether-views) (require 'noether-views)

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
{ lib, stdenv, elispPkgs, srcDir, emacsPackagesFor, ourPackages, direnv { lib, stdenv, elispPkgs, srcDir, emacsPackagesFor, ourPackages, direnv
, makeDesktopItem, nix , makeFontsConf, nix
, nil, # nix lsp server , nil, # nix lsp server
@ -74,18 +74,19 @@ let
pathsStr = lib.strings.concatStrings (lib.strings.intersperse ":" paths); pathsStr = lib.strings.concatStrings (lib.strings.intersperse ":" paths);
mimes = import ./mimes.nix; mimes = import ./mimes.nix;
fontsConf = makeFontsConf {
fontDirectories = [
vazir-fonts
fira-code
nerdfonts
fira-mono
noto-fonts
];
};
in stdenv.mkDerivation (final: rec { in stdenv.mkDerivation (final: rec {
inherit version; inherit version;
pname = "fg42"; pname = "fg42";
desktop = makeDesktopItem {
name = "FG42";
desktopName = "FG42";
exec = "${placeholder "out"}/bin/fg42 %F";
comment = "Emacs Editor for advance users";
};
src = srcDir; src = srcDir;
outputs = [ "out" ]; outputs = [ "out" ];
@ -98,6 +99,8 @@ in stdenv.mkDerivation (final: rec {
cp -rv ${src}/lisp/ $LISPDIR cp -rv ${src}/lisp/ $LISPDIR
cp -rv ${src}/share $out/ cp -rv ${src}/share $out/
cp -rv ${src}/snippets $LISPDIR/snippets cp -rv ${src}/snippets $LISPDIR/snippets
cp "${fontsConf}" $LISPDIR/fonts.conf
export FONTCONFIG_FILE="$LISPDIR/fonts.conf"
cat >> $out/share/applications/FG42.desktop << EOF cat >> $out/share/applications/FG42.desktop << EOF
[Desktop Entry] [Desktop Entry]
@ -128,6 +131,7 @@ in stdenv.mkDerivation (final: rec {
export FG42_EMACSD=~/.fg42/v4/emacs.d export FG42_EMACSD=~/.fg42/v4/emacs.d
export FG42_USE_NIX=true; export FG42_USE_NIX=true;
export PATH=${pathsStr}:$PATH export PATH=${pathsStr}:$PATH
export FONTCONFIG_FILE="$LISPDIR/fonts.conf"
LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \ LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \
FG42_WM=fales ${emacsBundle}/bin/emacs \ FG42_WM=fales ${emacsBundle}/bin/emacs \
@ -145,6 +149,7 @@ in stdenv.mkDerivation (final: rec {
export FG42_EMACSD=~/.fg42/v4/emacs.d export FG42_EMACSD=~/.fg42/v4/emacs.d
export FG42_USE_NIX=true; export FG42_USE_NIX=true;
export PATH=${pathsStr}:\$PATH export PATH=${pathsStr}:\$PATH
export FONTCONFIG_FILE="$LISPDIR/fonts.conf"
# Disable access control for the current user. # Disable access control for the current user.
${xorg.xhost}/bin/xhost +SI:localuser:\$USER ${xorg.xhost}/bin/xhost +SI:localuser:\$USER
@ -179,7 +184,6 @@ in stdenv.mkDerivation (final: rec {
${nerdfonts} ${nerdfonts}
${noto-fonts} ${noto-fonts}
${lib.strings.concatLines paths} ${lib.strings.concatLines paths}
${desktop}/share/applications/FG42.desktop
EOF EOF
runHook postBuild runHook postBuild