From dc655490b630b2f3e53c566645d1d66e2d9a8086 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Thu, 2 Apr 2020 22:39:25 +0100 Subject: [PATCH] Add exwm integration within FG42 Signed-off-by: Sameer Rahmani --- .gitignore | 3 ++- Makefile | 9 ++++++++- lib/extensions/editor/init.el | 4 ++-- lib/extensions/serene/init.el | 2 +- lib/fg42/extension.el | 15 +++++++++++++++ share/applications/fg42.desktop | 4 ++-- 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 41255ae..3a93feb 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ lib/**/*.elc *.elc tmp/ test-runner/ -.fpkg/ \ No newline at end of file +.fpkg/ +/fg42-wm \ No newline at end of file diff --git a/Makefile b/Makefile index e538a7d..b955d79 100644 --- a/Makefile +++ b/Makefile @@ -25,14 +25,21 @@ install: @cp ./config/fg42.user.el ${HOME}/.fg42.el @echo "Creating the link..." @echo "#! /bin/sh" > ./fg42 + @cp ./scripts/fg42-wm ./fg42-wm @echo "export FG42_HOME=$(shell pwd)" >> ./fg42 - @echo 'emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42 + @echo "export FG42_HOME=$(shell pwd)" >> ./fg42-wm + @echo 'FG42_WM=false emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42 + @echo 'FG42_WM=true emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42-wm @chmod +x ./fg42 + @chmod +x ./fg42-wm @sudo rm -f /usr/local/bin/fg42 + @sudo rm -f /usr/local/bin/fg42-wm @sudo ln -s `pwd`/fg42 /usr/local/bin/fg42 + @sudo ln -s `pwd`/fg42-wm /usr/local/bin/fg42-wm @echo "Copying share files..." @sudo mkdir -p /usr/share/fg42/ @sudo cp -r ./share/* /usr/share/fg42/ + @sudo cp -r ./share/xsessions/fg42.desktop /usr/share/xsessions/ @echo " " @echo "------------------------------------------------------------------------------------" @echo "Make sure to install external dependencies of FG42. For more info checkout README.md" diff --git a/lib/extensions/editor/init.el b/lib/extensions/editor/init.el index fef0dfc..6f84e26 100644 --- a/lib/extensions/editor/init.el +++ b/lib/extensions/editor/init.el @@ -72,7 +72,7 @@ (ability which-key () (when (is-evil?) - (which-key-mode t))) + (which-key-mode t))) ;; enhance evil mode with space leader keybindings (ability space-keys (which-key) @@ -130,7 +130,7 @@ (ability highligh-current-line () "Highlights the current line." (global-hl-line-mode t)) - (ability flycheck () + (ability flycheck () "Check syntax on the fly using flycheck." (require 'flycheck) diff --git a/lib/extensions/serene/init.el b/lib/extensions/serene/init.el index 5bf68fc..8d84eae 100644 --- a/lib/extensions/serene/init.el +++ b/lib/extensions/serene/init.el @@ -4,7 +4,7 @@ ;;;###autoload (defun extensions/serene-initialize () - "Initialize the common Lisp extension." + "Initialize the Serene extension." (require 'extensions/serene/serene-simple-mode) (add-hook 'serene-simple-mode-hook #'paredit-mode) diff --git a/lib/fg42/extension.el b/lib/fg42/extension.el index 9aaa5b4..cfa00d5 100644 --- a/lib/fg42/extension.el +++ b/lib/fg42/extension.el @@ -56,6 +56,21 @@ to them. ,@body))) +(defmacro defability (name deps &optional docs &rest body) + "Define an ability with the given NAME, DEPS, DOCS and BODY. + +*deps* should be a list of abilities with the defined ability dependens +to them. + +*body* is a block of code which will run as the ability initializer code." + (declare (doc-string 3) (indent 2)) + ;; TODO: there's no point of using `if' in the quoted code. evaluate + ;; the `if' in compile time and return nil or evalute the body. + `(if (active-ability? (intern ,(symbol-name name))) + (when (null (delq t (mapcar 'active-ability? (quote ,deps)))) + ,@body))) + + (defmacro extension (name &rest args) "A simple DSL to define new fg42 extension by given NAME and ARGS." ;(declare (doc-string 1) (indent 1)) diff --git a/share/applications/fg42.desktop b/share/applications/fg42.desktop index 24c8dea..5619721 100644 --- a/share/applications/fg42.desktop +++ b/share/applications/fg42.desktop @@ -2,12 +2,12 @@ Encoding=UTF-8 Name=FG42 GenericName=FG42 -Comment=An Emacs base IDE for emacs lovers. +Comment=An Emacs base editor for true believers MimeType=text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-java;application/x-shellscript;text/x-c;text/x-c++;text/x-ruby;text/x-python;text/x-clojure;text/css;text/html;text/x-javascript; Type=Application Terminal=false Categories=Development;TextEditor; StartupWMClass=FG42 Exec=/usr/local/bin/fg42 %F -Icon=kuso +Icon=fg42 Version=2.67 \ No newline at end of file