Compare commits
No commits in common. "master" and "ep1" have entirely different histories.
|
@ -1,4 +1,3 @@
|
|||
emacs.dmastodon.plstore
|
||||
kuso.config.el
|
||||
kuso.d/*
|
||||
.build/*
|
||||
|
@ -7,7 +6,7 @@ build.log
|
|||
.cask/*
|
||||
packages/
|
||||
lib/magic-buffer.el
|
||||
/assets/
|
||||
assets/
|
||||
./fg42^
|
||||
/fg42
|
||||
project-config/
|
||||
|
@ -31,13 +30,20 @@ smex-items
|
|||
elpa/
|
||||
bm-repository
|
||||
.fpkg-v3/
|
||||
website/__pycache__/
|
||||
website/*.pyc
|
||||
website/.sass-cache/
|
||||
website/theme/static/css/bulma.css
|
||||
website/output/
|
||||
website/public/
|
||||
website/*.old.jpg
|
||||
website/pelican-plugins/
|
||||
website/.*.swp
|
||||
website/*~
|
||||
#*#
|
||||
*.swp
|
||||
|
||||
emacs.d/
|
||||
/build/
|
||||
build/
|
||||
|
||||
docs/site/orgs/cubes/
|
||||
**/*/sitemap.inc
|
||||
result
|
||||
v4/
|
|
@ -0,0 +1,148 @@
|
|||
# Contribution Guidelines
|
||||
*FG42* is a free software and a community of Emacs developers who like to share
|
||||
their ideas and tools. We encourage you to join us. The community is what matters
|
||||
to us. Here is a brief overview of contribution guidelines, which we ask all
|
||||
contributors to follow.
|
||||
|
||||
## Asking for help
|
||||
If you want to ask an usage question, first make sure to read the `README.md` file
|
||||
and the documents of *FG42*. If you still need help feel free to join us via
|
||||
[out gitter channel](https://gitter.im/FG42/FG42).
|
||||
|
||||
## Reporting issues
|
||||
Issues have to be reported on our [issues tracker](https://gitlab.com/FG42/FG42/issues). Please:
|
||||
|
||||
- Check that the issue has not already been reported.
|
||||
- This can be achieved by searching keywords on the [issues tracker](https://gitlab.com/FG42/FG42/issues).
|
||||
- Try to use a clear title, and describe your problem with complete sentences.
|
||||
- Include your emacs version and `~/.fg42.el` file as well.
|
||||
- If possible, try to include details on how to reproduce it, like a step by
|
||||
step guide.
|
||||
|
||||
## Contributing code
|
||||
Code contributions are welcome. Please read the following sections carefully. In
|
||||
any case, feel free to join us on [out gitter channel](https://gitter.im/FG42/FG42) to ask questions about
|
||||
contributing!
|
||||
|
||||
### General contribution
|
||||
|
||||
#### License
|
||||
The license is *GPLv2* for all parts specific to *FG42*, this includes:
|
||||
- The initialization and core files
|
||||
- All the built-in extensions.
|
||||
|
||||
For files not belonging to FG42 like local packages and libraries, refer
|
||||
to the header file. Those files should not have an empty header, we may not
|
||||
accept code without a proper header file.
|
||||
|
||||
#### Conventions
|
||||
We follow these simple rules:
|
||||
|
||||
* Make elisp linter happy
|
||||
* Make byte compiler happy `make compile`
|
||||
* Follow functional patterns and avoid huge functions
|
||||
* Seperate each root level expression by two new lines (e.g function definitions)
|
||||
* Put `(comment ...)` expression after each macro/function to demonstrate the usage.
|
||||
* Write good docstrings
|
||||
* Choose meaningful names
|
||||
* Follow the indentation guides made in FG42
|
||||
* Prefix the functions with a prefix to differentiate them from other functions.
|
||||
for example `fg42-namespace/functoin-name`.
|
||||
* use `<prefix>/-<fn-name>` for private/internal function names
|
||||
* use `/` to categorize functions into namespaces (air quote)
|
||||
|
||||
#### Pull-Request
|
||||
Submit your contribution against the `master` branch. The `stable` branch
|
||||
is going to be our last stable version only.
|
||||
|
||||
Please make one PR per feature. Keep your PRs as small as possible so we can review them
|
||||
easily. Don't forget to make the byte compiler and the linter happy. There should not
|
||||
be any build error or warning on `make compile`. We like how [Linus Torvalds thinks
|
||||
about build warnings](https://linuxreviews.org/Linus_Torvalds#On_Build-Testing).
|
||||
|
||||
Write commit messages according to adapted [this article](https://chris.beams.io/posts/git-commit/):
|
||||
|
||||
- Include the extension or library name in the title inside square brackets
|
||||
- Use present tense and write in the imperative: “Fix bug”, not “fixed bug” or
|
||||
“fixes bug”.
|
||||
- Start with a capitalized, short (72 characters or less) summary, followed by a
|
||||
blank line.
|
||||
- If necessary, add one or more paragraphs with details, wrapped at 72
|
||||
characters.
|
||||
- Separate paragraphs by blank lines.
|
||||
|
||||
This is a model commit message:
|
||||
|
||||
```
|
||||
[FPKG] Capitalized, short (72 chars or less) summary
|
||||
|
||||
More detailed explanatory text, if necessary. Wrap it to about 72
|
||||
characters or so. In some contexts, the first line is treated as the
|
||||
subject of an email and the rest of the text as the body. The blank
|
||||
line separating the summary from the body is critical (unless you omit
|
||||
the body entirely); tools like rebase can get confused if you run the
|
||||
two together.
|
||||
|
||||
Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
|
||||
or "Fixes bug." This convention matches up with commit messages generated
|
||||
by commands like git merge and git revert.
|
||||
|
||||
Further paragraphs come after blank lines.
|
||||
|
||||
- Bullet points are okay, too
|
||||
|
||||
- Typically a hyphen or asterisk is used for the bullet, followed by a
|
||||
single space, with blank lines in between, but conventions vary here
|
||||
|
||||
- Use a hanging indent
|
||||
```
|
||||
|
||||
[[https://github.com/magit/magit/][Git Commit]] and [[https://github.com/magit/magit/][Magit]] provide Emacs mode
|
||||
for Git commit messages, which helps you to comply to these guidelines.
|
||||
|
||||
### Contributing an extension
|
||||
Technical aspects TBD
|
||||
|
||||
Each file should be GPL compliant and contain the following header:
|
||||
|
||||
```lisp
|
||||
;;; FILENAME --- SHORT DESCRIPTION
|
||||
;;
|
||||
;; Copyright (c) 2010-2020 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: YOUR FULL NAME <YOUR EMAIL>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: VERSION
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; THE COMMENTARY ON THE MOST IMPORTANT ASPECT OF THE EXTENSION
|
||||
;;
|
||||
;;; Code:
|
||||
```
|
||||
|
||||
You should replace `FILENAME` by the name of the file (e.g. `packages.el`).
|
||||
Don't forget to replace `YOUR FULL NAME` and `YOUR EMAIL` also.
|
||||
|
||||
#### Contribute to an existing extension
|
||||
If you are contributing to an already existing extension, you should not modify any
|
||||
header file.
|
||||
|
||||
* Credits
|
||||
|
||||
This `CONTRIBUTING` file is partially based on the [Rails Contribution
|
||||
guidelines](https://github.com/rails/rails/blob/master/CONTRIBUTING.md)
|
||||
and [Flycheck Contribution guidelines](https://github.com/flycheck/flycheck/blob/master/CONTRIBUTING.md)
|
||||
and [Spacemacs Contribution guidelines](https://raw.githubusercontent.com/syl20bnr/spacemacs/master/CONTRIBUTING.org).
|
|
@ -0,0 +1,65 @@
|
|||
# Fg42 - Emacs Editor for advance users
|
||||
#
|
||||
# Copyright (c) 2010-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
my_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
.PHONY: update
|
||||
update:
|
||||
@git pull origin master
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
/bin/sh $(my_dir)/scripts/install_files.sh runners
|
||||
@echo " "
|
||||
@echo "------------------------------------------------------------------------------------"
|
||||
@echo "Make sure to install external dependencies of FG42. For more info checkout README.md"
|
||||
@echo "Enjoy the bless of GNU/Emacs and FG42 :)"
|
||||
|
||||
.PHONY: install-fonts
|
||||
install-fonts:
|
||||
/bin/sh $(my_dir)/scripts/install_files.sh fonts
|
||||
|
||||
.PHONY: install-extras
|
||||
install-extras:
|
||||
/bin/sh $(my_dir)/scripts/install_files.sh extras
|
||||
|
||||
|
||||
.PHONY: doc-clean
|
||||
clean:
|
||||
@rm -rf $(shell find `pwd` -iname "*~")
|
||||
@rm -rf build
|
||||
|
||||
.PHONY: dev-docs
|
||||
dev-docs: clean
|
||||
./build.el docs
|
||||
|
||||
.PHONY: docs
|
||||
docs:
|
||||
FG42_PROD=true ./build.el docs
|
||||
|
||||
serve: build
|
||||
npx http-server ./build
|
||||
|
||||
.PHONY: deploy-docs
|
||||
deploy-docs: docs
|
||||
rsync -vlcr --delete-after ./build/* core.lxsameer.com:/home/www/public/fg42/
|
||||
|
||||
.PHONY: dummy-x
|
||||
dummy-x:
|
||||
Xephyr -br -ac -noreset -screen 800x600 :1
|
||||
.PHONY: test-wm
|
||||
test-wm:
|
||||
DISPLAY=:1 FG42_WM=true FG42_V3=true ./fg42-wm
|
120
README.org
120
README.org
|
@ -1,108 +1,82 @@
|
|||
* Future Gadgets 42
|
||||
*FG42* is an Emacs based editor that utilizes [[https://nixos.org/][Nix]], and shipped preconfigured. While it
|
||||
is the Emacs that you love :heart:, it breaks the tradition by not using any of Emace's
|
||||
package managers (More on that later). It provides a self-contained program and
|
||||
contains all the runtime dependencies including Emacs itself.
|
||||
*FG42* is a framework to create and editor and window manager based on *GNU/Emacs*. It has
|
||||
a pre-defined setup as well which can be installed out of the box. But the goal of this
|
||||
project is to provide the API necessary to create an integrated editor.
|
||||
|
||||
** Requirements
|
||||
The only requirement to install *FG42*, is [[https://nixos.org/][Nix]]. If you don't use Nix, try it today.
|
||||
It's amazing.
|
||||
So you need to know about Emacs in advance.
|
||||
|
||||
** Install from source
|
||||
In order to install *FG42*, issue the following commands:
|
||||
|
||||
** Installation
|
||||
If you're using Nix (and not NixOS), then you can install *FG42* like:
|
||||
#+BEGIN_SRC bash
|
||||
# Install emacs, make and texinfo
|
||||
$ nix profile install "git+https://devheroes.codes/FG42/FG42#"
|
||||
|
||||
# Or via nix build like:
|
||||
nix build "git+https://devheroes.codes/FG42/FG42#"
|
||||
# clonse the FG42 repository in ~/.fg42 directory
|
||||
$ git clone https://devheroes.codes/FG42/FG42.git ~/.fg42/
|
||||
# You can clone it where ever your want
|
||||
$ cd ~/.fg42/
|
||||
$ make install
|
||||
# Run fg42, It will download and build some lisp dependencies on the first execution.
|
||||
$ fg42
|
||||
#+END_SRC
|
||||
|
||||
If you're using NixOS or HomeManager you can use *FG42* as an input
|
||||
to your flake. If your not using flakes, I'm pretty sure you know
|
||||
what you are doing so I leave it to your experience.
|
||||
|
||||
#+BEGIN_SRC nix
|
||||
{
|
||||
description = "Exmaple flake";
|
||||
|
||||
inputs = {
|
||||
fg42.url = "git+https://devheroes.codes/FG42/FG42";
|
||||
};
|
||||
|
||||
outputs = { self, fg42, ... } @ inputs:
|
||||
let
|
||||
# I just use linux and currently only x86_64
|
||||
system = "x86_64-linux";
|
||||
|
||||
# Grab the default package of FG42
|
||||
fg42 = fg42.outputs.packages.${system}.default;
|
||||
in {
|
||||
# Now you can use the 'fg42' package in your package list
|
||||
....
|
||||
};
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
|
||||
Since the installer script uses =sudo=, during the installation process,
|
||||
you'll have to enter your password. Make sure that you're user account has
|
||||
a =sudo= access.
|
||||
|
||||
After installing *FG42* you should be able to start the default editor via =fg42= script.
|
||||
The very first time that you start =fg42= it will download all the necessary packages to
|
||||
operate, so it will take a while for all the packages to install. You can tell when it is
|
||||
finished by a message in the minibuffer and the fact that the look of emacs changes.
|
||||
Enjoy using **FG42** ;)
|
||||
|
||||
** Configuration
|
||||
FG42 comes pre-configured, but if you need to add your own configuration you can
|
||||
do it in =~/.fg42.el=.
|
||||
After installation there would be a file at =~/.fg42.el= which is the user specific
|
||||
configuration of *FG42*. You can configure your copy of *FG42* using this file.
|
||||
Also you can generally use this file to configure Emacs as well.
|
||||
|
||||
** Flags
|
||||
** Terms & Concepts
|
||||
FG42 introduced some new features to the Vanilla *Gnu/Emacs*. So you migh encounter several of these features during your
|
||||
journey. It's a good idea to at least know what you're dealing with.
|
||||
|
||||
*** Cubes
|
||||
*FG42*'s design is very similar to *Gentoo*. The abstraction unit of functionality in FG42
|
||||
is a **Cube**. Cubes are function like entities that you can call in order to activate them.
|
||||
They get activated just once and multiple calls don't have any effect on them.
|
||||
|
||||
*** Flags
|
||||
** Documentation
|
||||
TBD
|
||||
|
||||
** Debugging
|
||||
Debugging is *OFF* by default in *FG42*. You can turn it on by setting the ~FG42_DEBUG~
|
||||
environment variable to ~1~.
|
||||
If you ran into an issue and want to debug FG42, the best and easiest way is to turn on
|
||||
debugging by uncommenting =(setq debug-on-error t)= in your configuration (=~/.fg42.el=)
|
||||
and restarting FG42. After that you'll get a traceback for any exception in FG42.
|
||||
|
||||
|
||||
** FAQ
|
||||
|
||||
*** Why Nix? Have you tried Emacsian package manager?
|
||||
Yes we tried many of them. We started by a manual solution that the name ~fpkg~ remains
|
||||
as remembrance of that effort. We moved to [[https://github.com/dimitri/el-get][el-get]], then [[https://github.com/cask/cask][Cask]], [[https://github.com/emacs-eldev/eldev][ElDev]] and finally we
|
||||
landed on [[https://github.com/radian-software/straight.el][straight.el]] on ~V3~. But none of the provided the stability that we need.
|
||||
|
||||
But on ~V4~ (Current version), We've change the approach by disabling all the package managers
|
||||
(don't worry you can still use them if you want to) and used *Nix* to manage everything. Both
|
||||
elisp dependencies and system dependencies. This way we get reproducible builds that gives
|
||||
us stability and reliability. Also we get to pin every single dependency version even Emacs
|
||||
itself. So no more ":shrug: But it works on my computer".
|
||||
|
||||
*** what's with the name?
|
||||
** what's with the name?
|
||||
I'm a huge fan of [Steins Gate](https://en.wikipedia.org/wiki/Steins;Gate) anime and I follow its
|
||||
naming convensions on *Future Gadgets 42*.
|
||||
|
||||
*** Why we moved from Github ?
|
||||
** Why we moved from Github ?
|
||||
We're not happy with Microsoft buying Github and we don't trust a company like Microsoft because of their history and
|
||||
their strategies (For more information take a look at [[https://en.wikipedia.org/wiki/Halloween_documents][Halloween documents]].
|
||||
So we decided to move to Devheroes as an alternative and we are happy here so far.
|
||||
|
||||
* Contribute
|
||||
FG42 made possible by the effort of the community of [[docs/site/pages/contributors.org][Contributors]].
|
||||
|
||||
If you're interested in *FG42* and wants to contribute to the project please follow
|
||||
the [[docs/site/pages/how-to-contribute.org][How to Contribute Guitd]]. Also please read our [[docs/site/pages/code-of-conduct.org][Code of Conduct]] as well.
|
||||
|
||||
* License
|
||||
FG42 is free software; you can redistribute it and/or modify
|
||||
|
||||
FG42 is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
any later version.
|
||||
|
||||
FG42 is distributed in the hope that it will be useful,
|
||||
FG42 is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
All the documents of FG42 that locate in 'doc' directories release
|
||||
All the documents of FG42 that locate in 'doc' directories release
|
||||
under the term of GNU FDL.
|
||||
|
||||
Copyright (C) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||
Copyright (C) 2010-2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
:;exec `echo $EMACS` --no-site-file --no-site-lisp --batch -L ./ -l "$0" -f main "$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)" "$@"
|
||||
;;; Buid --- The builder for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with thnis program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(setq debug-on-error t)
|
||||
|
||||
(defconst fg42/CORE_DIR (concat (getenv "HOME") "/.fg42/core"))
|
||||
|
||||
(setq user-emacs-directory (concat (getenv "HOME") "/.fg42/emacs.d"))
|
||||
(add-to-list 'load-path fg42/CORE_DIR)
|
||||
|
||||
|
||||
(require 'fg42/build/core)
|
||||
|
||||
(defvar FG42-VERSION "3.0.0-snapshot"
|
||||
"The version number of the current build of FG42.")
|
||||
|
||||
(defconst build/usage "
|
||||
Usage:
|
||||
|
||||
build.el [PARAMS] COMMAND [...]
|
||||
|
||||
COMMANDS:
|
||||
clean [DIRS] - Clean up the given list of directories (default: \"code\" \"fbt\").
|
||||
docs - Build the documents and convert them to HTML
|
||||
|
||||
PARAMS:
|
||||
:d - Turns on the debug mode.
|
||||
:e expr - Run the given `expr' before any operation.
|
||||
")
|
||||
|
||||
|
||||
|
||||
(defun print-help (command)
|
||||
"Print out a usage instructions and print out the invalid msg for COMMAND."
|
||||
(when command
|
||||
(warn "I don't know about '%s' command.\n" command))
|
||||
(message build/usage))
|
||||
|
||||
|
||||
(defmacro do-command (&rest body)
|
||||
"Run the BODY after loading FG42."
|
||||
`(progn
|
||||
(require 'fg42)
|
||||
(fg42/before-initialize)
|
||||
,@body))
|
||||
|
||||
|
||||
(defun main ()
|
||||
"The entry point to the build script."
|
||||
(message (version))
|
||||
(message "\nFG42 Build tool v%s\n\n" FG42-VERSION)
|
||||
|
||||
;; UTF-8 as default encoding
|
||||
(prefer-coding-system 'utf-8)
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
|
||||
(setq project-root (car command-line-args-left))
|
||||
|
||||
(let* ((fg42-home (car command-line-args-left))
|
||||
(build-dir (from-root "/build/"))
|
||||
(parsed-args (read-args (cdr command-line-args-left)))
|
||||
(eval-string (car parsed-args))
|
||||
(command (caadr parsed-args))
|
||||
(args (cdadr parsed-args)))
|
||||
|
||||
;; Evaluate the expression provided by :e
|
||||
(when eval-string
|
||||
(eval (car (read-from-string eval-string))))
|
||||
|
||||
(cond
|
||||
((string= command "docs")
|
||||
(do-command
|
||||
(require 'fpkg)
|
||||
(fpkg/use dash)
|
||||
|
||||
(require 'fg42/build/docs)
|
||||
(fg42/build-docs build-dir)))
|
||||
|
||||
((string= command "compile")
|
||||
(do-command
|
||||
(native-compile-async fg42/CORE_DIR 'recursively)
|
||||
(native-compile-async "~/.fg42.v3.el")
|
||||
|
||||
(print "Compiling FG42 files ...")
|
||||
(while (or comp-files-queue
|
||||
(> (comp-async-runnings) 0))
|
||||
(print ".")
|
||||
(sleep-for 1))
|
||||
|
||||
(message "Done")))
|
||||
|
||||
(t (print-help command)))))
|
||||
|
||||
(provide 'build)
|
||||
;;; build.el ends here
|
|
@ -0,0 +1,219 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2020 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(setq debug-on-error t)
|
||||
|
||||
(require 'fg42/flags)
|
||||
(require 'cubes/editor)
|
||||
(require 'cubes/elisp)
|
||||
(require 'cubes/region-expansion)
|
||||
(require 'cubes/wm)
|
||||
(require 'cubes/autocompletion)
|
||||
(require 'cubes/golang)
|
||||
(require 'cubes/project)
|
||||
(require 'cubes/irc)
|
||||
(require 'cubes/terminal)
|
||||
(require 'cubes/java)
|
||||
(require 'cubes/python)
|
||||
(require 'cubes/snippets)
|
||||
(require 'cubes/org)
|
||||
(require 'cubes/git)
|
||||
(require 'cubes/bookmark)
|
||||
(require 'cubes/terraform)
|
||||
(require 'cubes/graph)
|
||||
|
||||
;; ============== MY STUFF ==============================
|
||||
|
||||
(setq max-specpdl-size 13000)
|
||||
(setq max-lisp-eval-depth 10000)
|
||||
|
||||
(custom-set-faces
|
||||
'(mini-modeline-mode-line
|
||||
((((background light))
|
||||
:background "#aa0000" :height 0.1 :box nil)
|
||||
(t
|
||||
:background "#bd93f9" :height 0.1 :box nil))))
|
||||
|
||||
(defvar global-font-size 11)
|
||||
|
||||
|
||||
(setq lsp-clients-clangd-executable "/home/lxsameer/usr/lib/llvm-13rc2/bin/clangd")
|
||||
(defconst LLVM_DIR "/home/lxsameer/src/serene/llvm-project")
|
||||
(defconst llvm-config-dir (concat LLVM_DIR "/llvm/utils/emacs/"))
|
||||
(defconst mlir-config-dir (concat LLVM_DIR "/mlir/utils/emacs/"))
|
||||
|
||||
|
||||
(add-hook 'c++-mode-hook (lambda ()
|
||||
(load (concat llvm-config-dir "emacs.el"))
|
||||
(load (concat llvm-config-dir "llvm-mode.el"))
|
||||
(load (concat llvm-config-dir "tablegen-mode.el"))))
|
||||
|
||||
(autoload 'mlir-mode (concat mlir-config-dir "mlir-mode") "Code highlighting for MLIR" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.mlir\\'" . mlir-mode))
|
||||
|
||||
|
||||
(autoload 'llvm-mode (concat llvm-config-dir "llvm-mode") "Code highlighting for LLVMIR" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.llvmir\\'" . llvm-mode))
|
||||
|
||||
(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode))
|
||||
|
||||
(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode))
|
||||
|
||||
(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t)
|
||||
(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode))
|
||||
|
||||
(load-file "/home/lxsameer/src/serene/serene/resources/emacs/serene-dev.el")
|
||||
|
||||
|
||||
|
||||
;; =========== FG42 stuff ===============================
|
||||
;; (use-flags wm font-icons cursor-type
|
||||
;; exec-path-from-shell golang
|
||||
;; rcirc pinentry vterm
|
||||
;; company lsp flycheck smart-mode-line wm fg42/region-expansion-cube
|
||||
;; selectrum window-navigation buffer-navigation font-icons)
|
||||
|
||||
(use-flags
|
||||
(fg42/merge-with-default-flags
|
||||
wm
|
||||
python
|
||||
golang
|
||||
rcirc
|
||||
vterm
|
||||
company
|
||||
lsp
|
||||
flycheck
|
||||
fg42/region-expansion-cube))
|
||||
|
||||
;; ================== my stuff mixed with FG42 stuff ===================
|
||||
(when-wm
|
||||
(setq global-font-size 8)
|
||||
(custom-set-faces
|
||||
'(mini-modeline-mode-line
|
||||
((((background light))
|
||||
:background "#aa0000" :height 0.1 :box nil)
|
||||
(t
|
||||
:background "#6272a4" :height 0.1 :box nil))))
|
||||
(fg42/wm-cube :number-of-workspaces 9)
|
||||
|
||||
(defvar monitors
|
||||
'(:hdmi-only
|
||||
("--output HDMI-1 --primary"
|
||||
"--output eDP-1 --off")
|
||||
:hdmi-main
|
||||
("--output HDMI-1 --primary"
|
||||
"--output eDP-1 --mode 1920x1080 --left-of HDMI-1")
|
||||
:edp-only
|
||||
("--output eDP-1 --mode 1920x1080"
|
||||
"--output HDMI-1 --off")))
|
||||
|
||||
(require 'seq)
|
||||
(defun monitor-profiles ()
|
||||
(mapcar
|
||||
#'car
|
||||
(seq-partition monitors 2)))
|
||||
|
||||
(defun monitor (mon)
|
||||
(interactive
|
||||
(list (completing-read
|
||||
"Monitor Profole: "
|
||||
(monitor-profiles))))
|
||||
|
||||
(let ((cmd (mapconcat (lambda (x) (format "xrandr %s" x))
|
||||
(plist-get monitors (intern (format "%s" mon)))
|
||||
" && ")))
|
||||
(message "Setting monitor profile: %s" cmd)
|
||||
(async-shell-command cmd "*xrandr*")))
|
||||
|
||||
(comment
|
||||
;; how to run it via elisp
|
||||
(monitor :hdmi-only))
|
||||
|
||||
(use-flags
|
||||
(fg42/merge-with-default-flags
|
||||
wm
|
||||
-python
|
||||
-golang
|
||||
rcirc
|
||||
vterm
|
||||
-company
|
||||
-projectile
|
||||
-lsp
|
||||
-flycheck
|
||||
fg42/region-expansion-cube)))
|
||||
|
||||
;; =========== FG42 stuff ===============================
|
||||
|
||||
;; Both are part of the editor cube but we want to override
|
||||
;; their behavior
|
||||
|
||||
|
||||
(fg42/cursor-cube :type 'bar :color "#bd93f9")
|
||||
(fg42/font-cube :font-size global-font-size)
|
||||
(fg42/editor-cube)
|
||||
|
||||
;;(fg42/imenu-cube)
|
||||
(fg42/elisp-cube)
|
||||
(fg42/region-expansion-cube)
|
||||
(fg42/graphviz-cube)
|
||||
(fg42/company-cube)
|
||||
(fg42/lsp-cube)
|
||||
(fg42/c++-cube)
|
||||
(fg42/python-cube)
|
||||
(fg42/yaml-cube)
|
||||
(fg42/flycheck-cube)
|
||||
(fg42/org-cube)
|
||||
(fg42/golang-cube)
|
||||
(fg42/projectile-cube)
|
||||
(fg42/rcirc-cube :server '(("irc.libera.chat" :channels ("#fg42" "#5hit" "#serene-lang" "#technotux" "#emacs" "#c++") :nick "lxsameer")
|
||||
("irc.oftc.net" :channels ("#llvm") :nick "lxsameer")))
|
||||
|
||||
(fg42/vterm-cube)
|
||||
(fg42/git-cube)
|
||||
(fg42/alert-cube)
|
||||
(fg42/bookmark-cube)
|
||||
(fg42/terraform-cube :terraform-lsp-path "~/bin/terraform-lsp")
|
||||
(fg42/java-cube)
|
||||
(fg42/yasnippet-cube)
|
||||
;; Themes should be the last cube and anything that wants to manipulate a face
|
||||
;; has to use either `fg42/before-initializing-theme-hook' or
|
||||
;; `fg42/after-initializing-theme-hook' hooks.
|
||||
(fg42/dracula-theme-cube)
|
||||
|
||||
;;(global-set-key (kbd "C-t") 'forward-char)
|
||||
;;(g lobal-set-key (kbd "C-n") 'backward-char)
|
||||
;;(global-set-key (kbd "M-n") 'backward-word)
|
||||
;;(global-set-key (kbd "M-t") 'forward-word)
|
||||
;;(global-set-key (kbd "C-,") 'previous-line)
|
||||
;;(global-set-key (kbd "C-.") 'next-line)
|
||||
|
||||
(set-face-attribute 'region nil :background "#888")
|
||||
|
||||
|
||||
;; ============== MY STUFF ==============================
|
||||
(serene/setup-dev-env)
|
||||
|
||||
(provide 'fg42.user.v3)
|
||||
;;; fg42.user.v3.el ends here
|
|
@ -0,0 +1,45 @@
|
|||
;;; AllCubes --- An index to use import all the cubes at once -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(require 'fg42/flags)
|
||||
(require 'cubes/editor)
|
||||
(require 'cubes/elisp)
|
||||
(require 'cubes/region-expansion)
|
||||
(require 'cubes/wm)
|
||||
(require 'cubes/modeline)
|
||||
(require 'cubes/autocompletion)
|
||||
(require 'cubes/golang)
|
||||
(require 'cubes/project)
|
||||
(require 'cubes/irc)
|
||||
(require 'cubes/terminal)
|
||||
(require 'cubes/java)
|
||||
(require 'cubes/python)
|
||||
(require 'cubes/snippets)
|
||||
(require 'cubes/org)
|
||||
(require 'cubes/git)
|
||||
(require 'cubes/bookmark)
|
||||
(require 'cubes/terraform)
|
||||
|
||||
(provide 'cubes/all)
|
||||
;;; all.el ends here
|
|
@ -0,0 +1,116 @@
|
|||
;;; AutocompletionCubes --- The completion related cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
(defcube fg42/flycheck-cube
|
||||
"This cube adds the `flycheck' support to fg42."
|
||||
(:title "Flycheck cube"
|
||||
:flag flycheck)
|
||||
(fpkg/use flycheck
|
||||
:defer ()
|
||||
:init
|
||||
(global-flycheck-mode)))
|
||||
|
||||
|
||||
(defcube fg42/yaml-cube
|
||||
"Yaml Support"
|
||||
(:title "Yaml Support"
|
||||
:no-flag t)
|
||||
(fpkg/use yaml-mode))
|
||||
|
||||
|
||||
(defcube fg42/lsp-cube
|
||||
"LSP cube"
|
||||
(:title "LSP cube"
|
||||
:flag lsp)
|
||||
|
||||
(fpkg/use lsp-mode
|
||||
:commands lsp
|
||||
:init
|
||||
(setq lsp-headerline-breadcrumb-enable nil))
|
||||
|
||||
;; TODO: Create a flag for lsp-ui or move it
|
||||
;; to a new cube
|
||||
(fpkg/use lsp-ui
|
||||
:config
|
||||
(add-hook 'lsp-mode-hook 'lsp-ui-mode)))
|
||||
|
||||
(defcube fg42/cmake-cube
|
||||
"Cmake cube"
|
||||
(:title "CMake cube"
|
||||
:flag-default t
|
||||
:flag cmake)
|
||||
|
||||
(fpkg/use cmake-mode)
|
||||
(fpkg/use eldoc-cmake))
|
||||
|
||||
|
||||
(defcube fg42/c++-cube
|
||||
"C++ cube"
|
||||
(:title "C++ cube"
|
||||
:no-flag t)
|
||||
(fg42/cmake-cube)
|
||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
||||
(add-hook 'c++-mode-hook (lambda ()
|
||||
(lsp)
|
||||
(require 'company-capf)
|
||||
(require 'company-box)
|
||||
(setq company-backends
|
||||
'((company-capf
|
||||
company-keywords))))))
|
||||
|
||||
|
||||
(defcube fg42/company-cube
|
||||
"Auto complete using company mode"
|
||||
(:title "Company cube"
|
||||
:flag company)
|
||||
|
||||
(fpkg/use company
|
||||
:bind (:map company-active-map
|
||||
("M-n" . company-select-next)
|
||||
("M-p" . company-select-previous)
|
||||
("TAB" . company-complete-common-or-cycle)
|
||||
("M-d" . company-show-doc-buffer))
|
||||
:config
|
||||
(progn
|
||||
;; Use Company for completion
|
||||
(bind-key [remap completion-at-point] #'company-complete company-mode-map)
|
||||
(setq company-show-numbers t)
|
||||
(setq company-idle-delay 0)
|
||||
(setq company-tooltip-limit 20)
|
||||
(setq company-echo-delay 0)
|
||||
(setq company-tooltip-align-annotations t)
|
||||
(setq company-dabbrev-downcase nil)
|
||||
(global-company-mode)))
|
||||
|
||||
;; TODO: Move company box to a new cube
|
||||
(fpkg/use company-box
|
||||
:after company
|
||||
:config
|
||||
(add-hook 'company-mode-hook 'company-box-mode)))
|
||||
|
||||
|
||||
(provide 'cubes/autocompletion)
|
||||
;;; autocompletion.el ends here
|
|
@ -0,0 +1,100 @@
|
|||
;;; Bookmark --- Bookmarks within the code -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with thnis program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/bookmark-cube
|
||||
"bookmark cube"
|
||||
(:title "cubes/fg42/bookmark-cube.org"
|
||||
:flag bookmark
|
||||
:flag-default t)
|
||||
|
||||
(let* ((bnext (or (plist-get fg42/bookmark-cube-params :bm-next-key) "M-]"))
|
||||
(bprev (or (plist-get fg42/bookmark-cube-params :bm-previous-key) "M-["))
|
||||
(btoggle (or (plist-get fg42/bookmark-cube-params :bm-toggel-key) "M-p"))
|
||||
(keys `(list (,bnext . bm-next)
|
||||
(,bprev . bm-previous)
|
||||
(,btoggle . bm-toggle))))
|
||||
(eval
|
||||
`(fpkg/use bm
|
||||
:init
|
||||
;; restore on load (even before you require bm)
|
||||
(setq bm-restore-repository-on-load t)
|
||||
|
||||
|
||||
|
||||
:config
|
||||
;; Allow cross-buffer 'next'
|
||||
(setq bm-cycle-all-buffers t)
|
||||
|
||||
;; where to store persistant files
|
||||
(setq bm-repository-file (expand-file-name "bm-repository" user-emacs-directory))
|
||||
|
||||
;; save bookmarks
|
||||
(setq-default bm-buffer-persistence t)
|
||||
|
||||
;; Loading the repository from file when on start up.
|
||||
(add-hook 'after-init-hook 'bm-repository-load)
|
||||
|
||||
;; Saving bookmarks
|
||||
(add-hook 'kill-buffer-hook #'bm-buffer-save)
|
||||
|
||||
;; Saving the repository to file when on exit.
|
||||
;; kill-buffer-hook is not called when Emacs is killed, so we
|
||||
;; must save all bookmarks first.
|
||||
(add-hook 'kill-emacs-hook #'(lambda nil
|
||||
(bm-buffer-save-all)
|
||||
(bm-repository-save)))
|
||||
|
||||
;; The `after-save-hook' is not necessary to use to achieve persistence,
|
||||
;; but it makes the bookmark data in repository more in sync with the file
|
||||
;; state.
|
||||
(add-hook 'after-save-hook #'bm-buffer-save)
|
||||
|
||||
;; Restoring bookmarks
|
||||
(add-hook 'find-file-hooks #'bm-buffer-restore)
|
||||
(add-hook 'after-revert-hook #'bm-buffer-restore)
|
||||
|
||||
;; The `after-revert-hook' is not necessary to use to achieve persistence,
|
||||
;; but it makes the bookmark data in repository more in sync with the file
|
||||
;; state. This hook might cause trouble when using packages
|
||||
;; that automatically reverts the buffer (like vc after a check-in).
|
||||
;; This can easily be avoided if the package provides a hook that is
|
||||
;; called before the buffer is reverted (like `vc-before-checkin-hook').
|
||||
;; Then new bookmarks can be saved before the buffer is reverted.
|
||||
;; Make sure bookmarks is saved before check-in (and revert-buffer)
|
||||
(add-hook 'vc-before-checkin-hook #'bm-buffer-save)
|
||||
|
||||
|
||||
:bind ((,bnext . bm-next)
|
||||
(,bprev . bm-previous)
|
||||
(,btoggle . bm-toggle))))))
|
||||
|
||||
(provide 'cubes/bookmark)
|
||||
;;; bookmark.el ends here
|
|
@ -0,0 +1,264 @@
|
|||
;;; EditorCubes --- The common cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'server)
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
(require 'fg42/utils)
|
||||
(require 'fg42/modeline)
|
||||
(require 'cubes/modeline)
|
||||
|
||||
(defflag font-icons
|
||||
"Enable the support for font icones in FG42." t)
|
||||
|
||||
|
||||
(defflag server
|
||||
"Enable the support for server mode in FG42." t)
|
||||
|
||||
|
||||
(defcube fg42/pinentry-cube
|
||||
"Pinentry cube with setup the =pinentry= program to be used within FG42."
|
||||
(:title "Pinentry cube"
|
||||
:flag pinentry
|
||||
:flag-default t)
|
||||
(fpkg/use pinentry
|
||||
:init
|
||||
(progn
|
||||
(setq epa-pinentry-mode 'loopback)
|
||||
(pinentry-start))))
|
||||
|
||||
(defcube fg42/imenu-cube
|
||||
"Imenu support"
|
||||
(:title "Imenu cube"
|
||||
:flag imenu
|
||||
:flag-default t)
|
||||
(fpkg/use imenu-list
|
||||
:init
|
||||
(global-set-key (kbd "C-'") #'imenu-list-smart-toggle)))
|
||||
|
||||
(defcube fg42/alert-cube
|
||||
"alert support"
|
||||
(:title "Alert cube"
|
||||
:flag alert
|
||||
:flag-default t)
|
||||
(fpkg/use alert))
|
||||
|
||||
|
||||
(defcube fg42/exec-path-cube
|
||||
"This cube fixes the =exec-path-from-shell= issue on MacOS."
|
||||
(:title "Exec path cube"
|
||||
:flag exec-path-from-shell
|
||||
:flag-default t)
|
||||
(fpkg/use exec-path-from-shell
|
||||
:init
|
||||
(when (memq window-system '(mac ns x))
|
||||
(exec-path-from-shell-initialize))))
|
||||
|
||||
|
||||
(defcube fg42/hl-cube
|
||||
"This cube highlight the curret line."
|
||||
(:title "Current line highlight cube"
|
||||
:flag hl-line
|
||||
:flag-default t)
|
||||
(require 'hl-line)
|
||||
(global-hl-line-mode))
|
||||
|
||||
|
||||
(defcube fg42/cursor-cube
|
||||
"This cube controls the shape of the cursor."
|
||||
(:title "Cursor cube"
|
||||
:flag cursor-type
|
||||
:flag-default t)
|
||||
(let ((ctype (or (plist-get fg42/cursor-cube-params :type) 'box))
|
||||
(ccolor (or (plist-get fg42/cursor-cube-params :color) "#aa0000")))
|
||||
|
||||
(add-hook 'fg42/after-initializing-theme-hook
|
||||
(lambda ()
|
||||
(set-default 'cursor-type ctype)
|
||||
(set-cursor-color ccolor)))))
|
||||
|
||||
(defcube fg42/buffer-navigation-cube
|
||||
"This cube controls the different aspect of buffer navigation"
|
||||
(:title "Buffer navigation cube"
|
||||
:flag buffer-navigation
|
||||
:flag-default t)
|
||||
|
||||
(fpkg/use avy
|
||||
:bind ("M-1" . avy-goto-word-1)))
|
||||
|
||||
|
||||
(defcube fg42/window-navigation-cube
|
||||
"This cube controls the different aspect of buffer navigation"
|
||||
(:title "Window navigation cube"
|
||||
:flag window-navigation
|
||||
:flag-default t)
|
||||
|
||||
(fpkg/use ace-window
|
||||
:bind ("C-<tab>" . ace-window)))
|
||||
|
||||
|
||||
(defcube fg42/font-cube
|
||||
"This cube controls the font configuration of *FG42*"
|
||||
(:title "Font Cube"
|
||||
:no-flag t
|
||||
:flag-default t)
|
||||
|
||||
(let ((font (or (plist-get fg42/font-cube-params :font-name)
|
||||
"Fira Mono"))
|
||||
(size (or (plist-get fg42/font-cube-params :font-size)
|
||||
12)))
|
||||
;; Sets the default font to fg42 font
|
||||
(add-to-list 'default-frame-alist
|
||||
(cons 'font (format "%s-%d" font size)))
|
||||
|
||||
(set-face-attribute 'default t :font font)))
|
||||
|
||||
|
||||
;TODO: Replace this cube with a `theme-cube'
|
||||
(defcube fg42/dracula-theme-cube
|
||||
"Replace this with a theme cube"
|
||||
(:title "Dracula theme"
|
||||
:no-flag t)
|
||||
(require 'fg42/themes)
|
||||
|
||||
|
||||
(fpkg/use dracula-theme
|
||||
:init
|
||||
(fg42/setup-theme
|
||||
(load-theme 'dracula t)
|
||||
(custom-theme-set-faces
|
||||
'dracula
|
||||
'(match ((t (:background "#44475a"))))
|
||||
'(all-the-icons-lgreen ((t (:background "#bd93f9"))))
|
||||
'(all-the-icons-faicon ((t (:background "#bd93f9"))))
|
||||
'(font-lock-comment-face ((t (:foreground "#8B9298"))))
|
||||
'(font-lock-comment-delimiter-face ((t (:foreground "#5B6268")))))
|
||||
(enable-theme 'dracula))))
|
||||
|
||||
|
||||
(defcube fg42/selectrum-cube
|
||||
"This cube adds support for `selectrum' to FG42"
|
||||
(:title "Selectrum cube"
|
||||
:flag selectrum
|
||||
:flag-default t)
|
||||
(fpkg/use selectrum
|
||||
:defer nil
|
||||
:init
|
||||
(selectrum-mode +1))
|
||||
|
||||
(fpkg/use selectrum-prescient
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(setq prescient-filter-method '(literal fuzzy regexp initialism))
|
||||
(selectrum-prescient-mode +1)
|
||||
(prescient-persist-mode +1)))
|
||||
|
||||
;; TODO: Disbale ctrlf in WM mode
|
||||
(fpkg/use ctrlf
|
||||
:defer t
|
||||
:init
|
||||
(ctrlf-mode +1)))
|
||||
|
||||
|
||||
(defcube fg42/editor-cube
|
||||
"This is a meta cube that sets up the basic functionalities of an Editor"
|
||||
(:title "Editor cube"
|
||||
:no-flag t)
|
||||
|
||||
(fpkg/use rainbow-delimiters
|
||||
;; It doesn't work due to a problem/conflict in rainbow-delimiters
|
||||
;; But we use it any way they might fix it
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
(when-flag font-icon
|
||||
(fpkg/use all-the-icons))
|
||||
|
||||
;; In the following section we're setting some default behavior of FG42.
|
||||
;; Most of these configuration are opiniated and I think most of people
|
||||
;; shared the same opinion or don't care at all.
|
||||
|
||||
;; Remove splash screen
|
||||
(setq inhibit-splash-screen t)
|
||||
;; scratch should be scratch
|
||||
(setq initial-scratch-message nil)
|
||||
;; Don't allow tab as indent
|
||||
(setq-default indent-tabs-mode nil)
|
||||
;; Default indent width
|
||||
(setq tab-width 2)
|
||||
;; Share the clipboard with X applications
|
||||
(setq x-select-enable-clipboard t)
|
||||
;; Automatically removed excess backups of the file
|
||||
(setq delete-old-versions t)
|
||||
|
||||
;; Global configurations
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
(column-number-mode t)
|
||||
(show-paren-mode t)
|
||||
(electric-pair-mode 1)
|
||||
|
||||
;; Rectangular select
|
||||
(cua-selection-mode t)
|
||||
|
||||
;; Yank the region on type
|
||||
(delete-selection-mode 1)
|
||||
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; Hooks ---
|
||||
;; Deletel extra trailing white spaces on save
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
|
||||
;; Enable rainbow-delimiters for programming
|
||||
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
|
||||
|
||||
|
||||
(when-flag server
|
||||
(when (not (server-running-p))
|
||||
(when-wm
|
||||
(setq server-name "fg42-wm"))
|
||||
(server-start)))
|
||||
|
||||
;; Call the editor related cubes. They will be run only if
|
||||
;; their flag is active otherwise they will be skipped
|
||||
|
||||
(let ((mline (or (plist-get fg42/editor-cube-params :modeline)
|
||||
#'fg42/default-modeline)))
|
||||
;;(fg42/statusbar-cube)
|
||||
(fg42/modeline-cube)
|
||||
(fg42/setup-modeline-format mline))
|
||||
|
||||
(fg42/font-cube)
|
||||
(fg42/pinentry-cube)
|
||||
(fg42/exec-path-cube)
|
||||
(fg42/buffer-navigation-cube)
|
||||
(fg42/window-navigation-cube)
|
||||
(fg42/selectrum-cube)
|
||||
(fg42/cursor-cube)
|
||||
(fg42/hl-cube))
|
||||
|
||||
|
||||
(provide 'cubes/editor)
|
||||
;;; editor.el ends here
|
|
@ -0,0 +1,45 @@
|
|||
;;; ElispCube --- The elisp cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/elisp-cube
|
||||
"Elisp cube"
|
||||
(:title "cubes/fg42/elisp-cube.org"
|
||||
:no-flag t)
|
||||
|
||||
(fpkg/use rainbow-delimiters
|
||||
;; It doesn't work due to a problem/conflict in rainbow-delimiters
|
||||
;; But we use it any way they might fix it
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
(fpkg/use paredit
|
||||
:hook (emacs-lisp-mode . paredit-mode))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode))
|
||||
|
||||
|
||||
(provide 'cubes/elisp)
|
||||
;;; elisp.el ends here
|
|
@ -0,0 +1,40 @@
|
|||
;;; ElispCube --- The elisp cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
|
||||
(defun fg42/elisp-hook-handler ()
|
||||
"Configure the elisp mode."
|
||||
(require 'rainbow-delimiters)
|
||||
(require 'paredit)
|
||||
(rainbow-delimiters-mode t)
|
||||
(paredit-mode t)
|
||||
(message "Elisp cube is done"))
|
||||
|
||||
|
||||
(provide 'cubes/elisp/core)
|
||||
;;; core.el ends here
|
|
@ -0,0 +1,68 @@
|
|||
;;; FMCubes --- The file manager cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
;; TODO: Move this to an autoload file
|
||||
(defun fg42/dired-external-open ()
|
||||
"In dired, open the file named on this line."
|
||||
(interactive)
|
||||
(let ((file (dired-get-filename nil t)))
|
||||
(call-process "xdg-open" nil 0 nil file)))
|
||||
|
||||
|
||||
(defcube fg42/fm-cube
|
||||
"file manager"
|
||||
(:title "cubes/fg42/fm-cube.org"
|
||||
:flag fm
|
||||
:flag-default t)
|
||||
|
||||
;; Linux only
|
||||
;; TODO: change this to support OS X
|
||||
(setq dired-listing-switches "-lFaGh1v --group-directories-first")
|
||||
|
||||
;; Show directories first
|
||||
(setq ls-lisp-dirs-first t)
|
||||
|
||||
(setq dired-recursive-copies 'always)
|
||||
(setq dired-recursive-deletes 'always)
|
||||
|
||||
(define-key dired-mode-map (kbd "E") 'fg42/dired-external-open)
|
||||
(fpkg/use dired+)
|
||||
(add-to-list 'dired-mode-hook
|
||||
(lambda ()
|
||||
(require 'dired-x)
|
||||
(require 'dired-aux)))
|
||||
|
||||
(when-flag async
|
||||
(dired-async-mode 1))
|
||||
|
||||
(fpkg/use dired-narrow
|
||||
:bind (:map dired-mode-map
|
||||
("/" . dired-narrow))))
|
||||
|
||||
|
||||
(provide 'cubes/fm)
|
||||
;;; fm.el ends here
|
|
@ -0,0 +1,69 @@
|
|||
;;; GitCube --- The Git cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/diff-hl-cube
|
||||
"This cube highlights changes to the current buffer in respect to the
|
||||
VC status of the file. For example if you're using *git* in your project
|
||||
and you've made some changes to the current buffer that are not commited
|
||||
yet it will highlihgt them for you.
|
||||
|
||||
For more info check out [[https://github.com/dgutov/diff-hl][diff-hl]] 's page."
|
||||
(:title "Diff Highlight Cube"
|
||||
:flag diff-hl
|
||||
:flag-default t)
|
||||
|
||||
(fpkg/use diff-hl
|
||||
:init
|
||||
(progn
|
||||
(when-flag git
|
||||
(add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
|
||||
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh))
|
||||
(global-diff-hl-mode))))
|
||||
|
||||
|
||||
(defcube fg42/git-cube
|
||||
"This cube integrates *git* into *FG42*."
|
||||
(:title "Git Cube"
|
||||
:flag git
|
||||
:flag-default t)
|
||||
|
||||
(fpkg/use magit
|
||||
:bind (("C-x g" . magit-status)))
|
||||
|
||||
(fpkg/use magit-todos
|
||||
:after magit
|
||||
:init (require 'magit-todos))
|
||||
|
||||
(fg42/diff-hl-cube))
|
||||
|
||||
|
||||
(provide 'cubes/git)
|
||||
;;; git.el ends here
|
|
@ -0,0 +1,50 @@
|
|||
;;; GolangCubes --- The Golang cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
(require 'fg42/utils)
|
||||
|
||||
(autoload-cube 'fg42/initialize-golang "golang/core.el" "Initalize the go mode.")
|
||||
|
||||
(defcube fg42/golang-cube
|
||||
"Golang support cube for fg42."
|
||||
(:title "Golang cube" :flag golang)
|
||||
|
||||
(fpkg/use go-mode
|
||||
:defer t
|
||||
:mode "\\.go\\'"
|
||||
:config
|
||||
(progn
|
||||
(add-hook 'go-mode-hook 'fg42/initialize-golang)
|
||||
(when-flag lsp
|
||||
(add-hook 'go-mode-hook
|
||||
(lambda ()
|
||||
(when (not (boundp 'lsp))
|
||||
(require 'lsp)
|
||||
(lsp-deferred))))))))
|
||||
|
||||
|
||||
|
||||
(provide 'cubes/golang)
|
||||
;;; golang.el ends here
|
|
@ -0,0 +1,64 @@
|
|||
;;; GolangCubes --- The Golang cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fg42/flags)
|
||||
|
||||
|
||||
(defun fg42/go-path-from-env ()
|
||||
"Gets gopath from OS env."
|
||||
(exec-path-from-shell-copy-env "GOPATH"))
|
||||
|
||||
|
||||
(defun fg42/go-path-binary (gopath)
|
||||
"Gets Go binaries path with respect to the given GOPATH."
|
||||
;; TODO: Use `expand-file-name' here
|
||||
(concat gopath "/bin"))
|
||||
|
||||
(defun fg42/initialize-golang ()
|
||||
"Setup Emacs hooks and turn necessary modes on."
|
||||
(when-flag lsp
|
||||
(lsp-register-custom-settings
|
||||
'(("gopls.completeUnimported" t t)
|
||||
("gopls.staticcheck" t t)))
|
||||
(add-hook 'before-save-hook
|
||||
(lambda ()
|
||||
(when (eq major-mode 'go-mode)
|
||||
(lsp-format-buffer t)
|
||||
(lsp-organize-imports t)))))
|
||||
|
||||
(when-flag company
|
||||
(setq-local company-backends
|
||||
'(company-capf
|
||||
company-dabbrev
|
||||
company-dabbrev-code)))
|
||||
|
||||
(let ((go-path (or (plist-get fg42/golang-cube-params :go-path)
|
||||
(fg42/go-path-from-env))))
|
||||
(add-to-list 'exec-path (fg42/go-path-binary go-path)))
|
||||
|
||||
(local-set-key (kbd "M-.") #'godef-jump)
|
||||
(local-set-key (kbd "M-*") 'pop-tag-mark))
|
||||
|
||||
|
||||
(provide 'cubes/golang/core)
|
||||
;;; core.el ends here
|
|
@ -0,0 +1,59 @@
|
|||
;;; GraphCube --- The Graph utility cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/graphviz-cube
|
||||
"This cube enable =dot= file editing in *FG42*. Using this cube you should
|
||||
be able to edit =dot= files and use =C-c C-p= to see a preview of your =dot=
|
||||
file. Use =C-c C-c= to compile the =dot= file.
|
||||
|
||||
If =company= flag is enabled then =dot= autocomplete will be enabled as well."
|
||||
(:title "Graphviz Cube"
|
||||
:flag graphviz
|
||||
:flag-default t
|
||||
:modes 'graphviz-dot-mode)
|
||||
|
||||
(let ((indent-size (or (plist-get fg42/graphviz-cube-params :indent-size) 4)))
|
||||
(fg42/after-cubes
|
||||
(when-flag org
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((dot . t)
|
||||
(graphviz-dot . t)))))))
|
||||
|
||||
(fpkg/use graphviz-dot-mode
|
||||
:config
|
||||
(setq graphviz-dot-indent-width indent-size))))
|
||||
|
||||
|
||||
(provide 'cubes/graph)
|
||||
;;; graph.el ends here
|
|
@ -1,10 +1,10 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;; IconsCubes --- The modeline related cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://devheroes.codes/FG42/FG42
|
||||
;; Version: 4.0.0
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -21,21 +21,21 @@
|
|||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
(when-not-wm
|
||||
(use! perspective
|
||||
"The Perspective package provides multiple named workspaces (or perspectives)
|
||||
in Emacs"
|
||||
:commands persp-mode
|
||||
:hook (emacs-startup . persp-mode)
|
||||
:bind
|
||||
("C-x C-b" . persp-list-buffers)
|
||||
:custom
|
||||
;; This has a conflict with wm's C-c w
|
||||
(persp-mode-prefix-key (kbd "C-c w"))))
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(provide 'fg42/workspace)
|
||||
;;; workspace.el ends here
|
||||
;; TODO: Break this into two cubes
|
||||
(defcube fg42/all-the-icons-cube
|
||||
"Install the [[https://github.com/domtronn/all-the-icons.el][all-the-icons.el]]
|
||||
package."
|
||||
(:title "All the icons cube"
|
||||
:flag all-the-icons
|
||||
:flag-default t)
|
||||
|
||||
(fpkg/use all-the-icons
|
||||
:if (display-graphic-p)))
|
||||
|
||||
|
||||
(provide 'cubes/icons)
|
||||
;;; icons.el ends here
|
|
@ -0,0 +1,40 @@
|
|||
;;; IrcCubes --- The IRC related cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/rcirc-cube
|
||||
"IRC cube"
|
||||
(:title "cubes/fg42/rcirc-cube.org"
|
||||
:flag rcirc)
|
||||
(autoload-cube 'fg42/rcirc-connect "irc/core.el" "Connect to IRC via RCIRC." t)
|
||||
(defun fg42/connect-to-irc ()
|
||||
(interactive)
|
||||
(fg42/rcirc-connect)))
|
||||
|
||||
|
||||
|
||||
(provide 'cubes/irc)
|
||||
;;; irc.el ends here
|
|
@ -0,0 +1,46 @@
|
|||
;;; IrcCubes --- The IRC related cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
|
||||
(defvar fg42/default-rcirc-servers
|
||||
'(("irc.libera.chat/6697"
|
||||
:channels ("#fg42"))))
|
||||
|
||||
(defun fg42/rcirc-connect ()
|
||||
"Connect to IRC servers."
|
||||
(interactive)
|
||||
(require 'rcirc)
|
||||
|
||||
(let ((servers (or (plist-get fg42/rcirc-cube-params :server)
|
||||
fg42/default-rcirc-servers)))
|
||||
(setq rcirc-enable-authinfo-support t)
|
||||
(setq rcirc-server-alist servers)
|
||||
(add-hook 'rcirc-mode-hook
|
||||
(lambda ()
|
||||
(rcirc-track-minor-mode 1)))
|
||||
(irc nil)))
|
||||
|
||||
|
||||
(provide 'cubes/irc/core)
|
||||
;;; core.el ends here
|
|
@ -0,0 +1,69 @@
|
|||
;;; JavaCubes --- The Java cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/gradle-cube
|
||||
"Gradle support"
|
||||
(:title "cubes/fg42/java-cube.org"
|
||||
:flag gradle
|
||||
:flag-default t)
|
||||
|
||||
(fpkg/use groovy-mode
|
||||
:mode "\\.gradle\\'")
|
||||
|
||||
(fpkg/use gradle-mode
|
||||
:hook (java-mode-hook . gradle-mode))
|
||||
|
||||
(when-flag flycheck
|
||||
(fpkg/use flycheck-gradle)))
|
||||
|
||||
|
||||
(defcube fg42/java-cube
|
||||
"Java cube"
|
||||
(:title "cubes/fg42/java-cube.org"
|
||||
:flag java
|
||||
:flag-default t)
|
||||
|
||||
(add-hook 'java-mode-hook
|
||||
(lambda()
|
||||
;; To fix the indentation of function arguments
|
||||
(c-set-offset 'arglist-intro '+)
|
||||
(setq java-basic-offset 2)
|
||||
(setq c-basic-offset 2)
|
||||
(when-flag lsp-java
|
||||
(setq lsp-java-server-install-dir fg42-tmp)
|
||||
(lsp))))
|
||||
|
||||
(when-flag gradle
|
||||
(fg42/gradle-cube))
|
||||
|
||||
(when-flag lsp
|
||||
(fpkg/use lsp-java)))
|
||||
|
||||
|
||||
|
||||
(provide 'cubes/java)
|
||||
;;; java.el ends here
|
|
@ -0,0 +1,28 @@
|
|||
;;; KeyboardCubes --- The keyboard related cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
;; TODO: Add support for HALMAK layout
|
||||
|
||||
(provide 'cubes/keyboard)
|
||||
;;; keyboard.el ends here
|
|
@ -0,0 +1,113 @@
|
|||
;;; ModelineCubes --- The modeline related cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
(require 'cubes/icons)
|
||||
|
||||
(autoload-cube 'fg42/statusbar-default
|
||||
"modeline/statusbar-default.el"
|
||||
"The default StatusBar modeline.")
|
||||
|
||||
|
||||
;; TODO: Break this into two cubes
|
||||
(defcube fg42/modeline-cube
|
||||
"Modeline cube"
|
||||
(:title "Mini modeline"
|
||||
:flag mini-mode-line
|
||||
:group modeline
|
||||
:flag-default t)
|
||||
|
||||
(defun fg42/mini-modeline-setter (def)
|
||||
(if (null def)
|
||||
(let ((def-list (funcall def)))
|
||||
(setq-default mini-modeline-l-format (plist-get def-list :long))
|
||||
(setq-default mini-modeline-r-format (plist-get def-list :brief)))
|
||||
|
||||
(setq-default
|
||||
mini-modeline-r-format
|
||||
'("%e"
|
||||
mode-line-front-space
|
||||
mode-line-mule-info
|
||||
mode-line-client
|
||||
mode-line-modified
|
||||
mode-line-remote
|
||||
mode-line-frame-identification
|
||||
mode-line-buffer-identification
|
||||
mode-line-position
|
||||
evil-mode-line-tag
|
||||
(:eval (string-trim (format-mode-line mode-line-modes)))
|
||||
mode-line-misc-info ))))
|
||||
|
||||
(fpkg/use smart-mode-line
|
||||
:straight (smart-mode-line :source melpa)
|
||||
:defer nil
|
||||
:init
|
||||
(progn
|
||||
(setq sml/theme 'respectful)
|
||||
(setq sml/no-confirm-load-theme t)
|
||||
(sml/setup)))
|
||||
|
||||
(fpkg/use mini-modeline
|
||||
:straight (mini-modeline :repo "kiennq/emacs-mini-modeline"
|
||||
:host github
|
||||
:type git)
|
||||
:after smart-mode-line
|
||||
:init
|
||||
(progn
|
||||
(setq mini-modeline-enhance-visual nil)
|
||||
(setq fg42/modeline-setter #'fg42/mini-modeline-setter))
|
||||
:defer nil
|
||||
:config
|
||||
(add-hook 'fg42-after-init-hook #'mini-modeline-mode)))
|
||||
|
||||
|
||||
(defcube fg42/statusbar-cube
|
||||
"Status bar replaces the default mode line aned merges with
|
||||
the mini buffer to provide a minimal interface for displaying
|
||||
valuable information."
|
||||
(:title "Status bar cube"
|
||||
:flag status-bar
|
||||
:group modeline
|
||||
:flag-default t)
|
||||
|
||||
|
||||
(fg42/all-the-icons-cube)
|
||||
|
||||
(defun fg42/statusbar-setter (def)
|
||||
(unless (null def)
|
||||
(setq-default fg42/statusbar-components
|
||||
(plist-get (funcall def) :brief))
|
||||
(setq-default fg42/statusbar-components
|
||||
(plist-get (funcall #'fg42/statusbar-default) :brief))))
|
||||
|
||||
(setq fg42/modeline-setter #'fg42/statusbar-setter)
|
||||
|
||||
(add-hook 'fg42-after-init-hook
|
||||
(lambda ()
|
||||
(require 'fg42/statusbar)
|
||||
(fg42/statusbar-mode t))))
|
||||
|
||||
|
||||
(provide 'cubes/modeline)
|
||||
;;; modeline.el ends here
|
|
@ -0,0 +1,147 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fg42/modeline)
|
||||
(require 'fg42/statusbar)
|
||||
|
||||
|
||||
(defmacro fg42/percentage-face (value err warn)
|
||||
"Return the correct face with repect to VALUE and the given
|
||||
thresholds ERR adn WARN"
|
||||
`(cond ((> ,value ,err) 'error) ((> ,value ,warn) 'warning) (t 'success)))
|
||||
|
||||
(defbar-unit fg42/statusbar-battery 30 "B--"
|
||||
(format "B%s"
|
||||
(string-trim
|
||||
(with-temp-buffer
|
||||
(insert-file-contents "/sys/class/power_supply/BAT0/capacity")
|
||||
(buffer-string)))))
|
||||
|
||||
|
||||
(defbar-unit fg42/statusbar-memory 3 "M--S--"
|
||||
(let* ((struct (string-trim
|
||||
(shell-command-to-string "free -k|tail -n 2|awk '{printf(\"%s,%s,\", $3, $2)}'")))
|
||||
(vals (mapcar #'cl-parse-integer (butlast (split-string struct ","))))
|
||||
;; TODO: Check for division by zero
|
||||
(m (* 100 (/ (float(car vals)) (cadr vals))))
|
||||
;; TODO: Check for division by zero
|
||||
(s (* 100 (/ (float(caddr vals)) (cadddr vals))))
|
||||
(x ))
|
||||
|
||||
(format
|
||||
"M%sS%s"
|
||||
(propertize (format "%02d" m) 'face (fg42/percentage-face m 90 75))
|
||||
(propertize (format "%02d" s) 'face (fg42/percentage-face s 90 75)))))
|
||||
|
||||
|
||||
(defface fg42/statusbar-project-face
|
||||
'((t :inherit font-lock-type-face :bold t))
|
||||
"Project name face on status bar"
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
(defface fg42/statusbar-buffer-name-face
|
||||
'((t :inherit font-lock-variable-name-face))
|
||||
"Buffer name face on status line"
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defun fg42/statusbar-project-name ()
|
||||
(when-flag projectile
|
||||
(projectile-project-name)))
|
||||
|
||||
|
||||
(defun fg42/statusbar-buffer-and-project ()
|
||||
(format "%s:%s"
|
||||
(propertize (fg42/statusbar-project-name) 'face 'fg42/statusbar-project-face)
|
||||
(propertize (buffer-name) 'face 'fg42/statusbar-buffer-name-face)))
|
||||
|
||||
;; (defvar fg42/statusbar-git-branch "-")
|
||||
;; (defvar fg42/statusbar--last-branch "-")
|
||||
|
||||
|
||||
;; (defun fg42/statusbar-update-git-branch()
|
||||
;; (message "eeoeeeeee")
|
||||
;; (setq fg42/statusbar-git-branch
|
||||
;; (shell-command-to-string "git symbolic-ref --short HEAD")))
|
||||
|
||||
;; (defun fg42/statusbar-setup-git-branch-updater ()
|
||||
;; ;;(add-function :after after-focus-change-function #'fg42/statusbar-update-git-branch)
|
||||
|
||||
;; (add-hook 'window-configuration-change-hook (lambda () (message "window-configuration-change-hook")))
|
||||
;; (add-hook 'window-state-change-hook (lambda () (message "window-state-change-hook")))
|
||||
|
||||
;; (advice-add :after 'ace-select-window #'fg42/statusbar-update-git-branch)
|
||||
|
||||
;; 'fg42/statusbar-git-branch)
|
||||
|
||||
|
||||
(defmode-line fg42/statusbar-default
|
||||
(list
|
||||
:brief (list
|
||||
;;'(buffer-name)
|
||||
;;'fg42/statusbar-battery
|
||||
|
||||
"|"
|
||||
'(substring-no-properties (vc-mode vc-mode))
|
||||
"|"
|
||||
'(fg42/statusbar-buffer-and-project)
|
||||
"|"
|
||||
'fg42/statusbar-memory
|
||||
"|"
|
||||
'(format-mode-line "%03l:%02c")
|
||||
|
||||
;;'(format-time-string "%m-%d %H:%M")
|
||||
;; (let ((bar (format "%s" fg42/statusbar-memory))) (add-text-properties 0 (string-width bar) (cons 'face (cons '(:size 0.3) (or (get-text-property 0 'face bar) 'default-face))) bar)
|
||||
;; bar)
|
||||
)
|
||||
:long " ")
|
||||
;; No GUI
|
||||
|
||||
)
|
||||
;; The default modeline for FG42 WM that is compatible with
|
||||
;; the FG42's status bar only
|
||||
(defmode-line fg42/statusbar-default-wm
|
||||
(progn
|
||||
;; We are in the graphical world
|
||||
(require 'all-the-icons)
|
||||
;;(format "%s|%s|%s|%s|%s")
|
||||
(list
|
||||
:brief (list
|
||||
;;'(buffer-name)
|
||||
;;'fg42/statusbar-battery
|
||||
|
||||
'fg42/statusbar-memory
|
||||
'(format-mode-line "%03l:%02c")
|
||||
|
||||
;;'(format-time-string "%m-%d %H:%M")
|
||||
;; (let ((bar (format "%s" fg42/statusbar-memory))) (add-text-properties 0 (string-width bar) (cons 'face (cons '(:size 0.3) (or (get-text-property 0 'face bar) 'default-face))) bar)
|
||||
;; bar)
|
||||
)
|
||||
:long " "))
|
||||
;; No GUI
|
||||
|
||||
)
|
||||
|
||||
|
||||
(provide 'fg42/modeline/statusbar-default)
|
||||
;;; statusbar-default.el ends here
|
|
@ -0,0 +1,76 @@
|
|||
;;; OrgCube --- The org cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
(defcube fg42/org-cube
|
||||
"Org cube"
|
||||
(:title "cubes/fg42/org-cube.org"
|
||||
:flag org
|
||||
:flag-default t)
|
||||
|
||||
(let ((capture-key (or (plist-get fg42/org-cube-params :capture-key)
|
||||
(kbd "<f6>")))
|
||||
(org-home (or (plist-get fg42/org-cube-params :org-home) "~/orgs"))
|
||||
(notes-file (or (plist-get fg42/org-cube-params :org-home) "~/orgs/notes.org")))
|
||||
|
||||
(fpkg/use org-bullets
|
||||
:hook (org-mode . org-bullets-mode))
|
||||
|
||||
(fpkg/use org-mode
|
||||
:init
|
||||
(progn
|
||||
(require 'org-capture)
|
||||
(global-set-key capture-key 'org-capture)
|
||||
(setq org-directory org-home)
|
||||
(setq org-default-notes-file notes-file)
|
||||
(setq org-capture-templates
|
||||
(eval
|
||||
`(list
|
||||
'("t" "Todo" entry (file+headline ,(expand-file-name "main.org" org-home) "New Tasks")
|
||||
(file ,(expand-file-name "templates/todo" org-home))
|
||||
:prepend t)
|
||||
'("l" "Link" entry (file+headline ,(expand-file-name "bookmarks.org" org-home) "Links")
|
||||
(file ,(expand-file-name "templates/links" org-home))
|
||||
:prepend t
|
||||
:empty-lines 1)
|
||||
'("h" "Thoughts" entry (file+datetree ,(expand-file-name "journal.org" org-home))
|
||||
(file ,(expand-file-name "templates/thoughts" org-home))))))
|
||||
(setq org-refile-targets '((org-agenda-files :maxlevel . 3)))
|
||||
|
||||
(with-eval-after-load "ox-latex"
|
||||
(setq org-latex-default-packages-alist
|
||||
(append '(("hidelinks" "hyperref" nil))
|
||||
org-latex-default-packages-alist)))
|
||||
|
||||
(unless (server-running-p)
|
||||
(require 'org-protocol))))))
|
||||
|
||||
|
||||
(provide 'cubes/org)
|
||||
;;; org.el ends here
|
|
@ -0,0 +1,57 @@
|
|||
;;; ProjectCubes --- The project management cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
|
||||
(defcube fg42/projectile-cube
|
||||
"Projectile Cube"
|
||||
(:title "cubes/fg42/projectile-cube.org"
|
||||
:flag projectile
|
||||
:flag-default t)
|
||||
|
||||
(let ((project-dirs (or (plist-get fg42/projectile-cube-params :project-dirs)
|
||||
())))
|
||||
(fpkg/use projectile
|
||||
:init
|
||||
(projectile-mode +1)
|
||||
:config
|
||||
(progn
|
||||
;; We don't want the auto discovery on startup
|
||||
(setq projectile-auto-discover nil)
|
||||
(setq projectile-enable-caching t)
|
||||
(setq projectile-project-search-path project-dirs))
|
||||
:bind (:map projectile-mode-map
|
||||
("s-p" . projectile-command-map)
|
||||
("C-c p" . projectile-command-map)))
|
||||
|
||||
(fpkg/use projectile-ripgrep
|
||||
:after projectile)))
|
||||
|
||||
|
||||
|
||||
|
||||
(provide 'cubes/project)
|
||||
;;; project.el ends here
|
|
@ -0,0 +1,80 @@
|
|||
;;; PythonCubes --- The Python cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
(require 'fg42/utils)
|
||||
|
||||
|
||||
(defun fg42/py-workon-project-venv ()
|
||||
"Call pyenv-workon with the current projectile project name.
|
||||
This will return the full path of the associated virtual
|
||||
environment found in $WORKON_HOME, or nil if the environment does
|
||||
not exist."
|
||||
(require 'pyenv)
|
||||
(let ((pname (projectile-project-name)))
|
||||
(pyvenv-workon pname)
|
||||
(if (file-directory-p pyvenv-virtual-env)
|
||||
pyvenv-virtual-env
|
||||
(pyvenv-deactivate))))
|
||||
|
||||
|
||||
(defun fg42/py-auto-lsp ()
|
||||
"Turn on lsp mode in a Python project with some automated logic.
|
||||
Try to automatically determine which pyenv virtual environment to
|
||||
activate based on the project name, using
|
||||
`dd/py-workon-project-venv'. If successful, call `lsp'. If we
|
||||
cannot determine the virtualenv automatically, first call the
|
||||
interactive `pyvenv-workon' function before `lsp'"
|
||||
(interactive)
|
||||
(let ((pvenv (fg42/py-workon-project-venv)))
|
||||
(if pvenv
|
||||
(lsp)
|
||||
(progn
|
||||
(call-interactively #'pyvenv-workon)
|
||||
(lsp)))))
|
||||
|
||||
|
||||
(defcube fg42/python-cube
|
||||
"Python support cube."
|
||||
(:title "Python cube"
|
||||
:flag python)
|
||||
|
||||
(fpkg/use pyvenv
|
||||
:defer t
|
||||
:config
|
||||
(setenv "WORKON_HOME" "~/.pyenv/versions"))
|
||||
|
||||
(when-flag lsp
|
||||
(with-eval-after-load "lsp"
|
||||
(lsp-register-custom-settings
|
||||
'(("pyls.plugins.pyls_mypy.enabled" t t)
|
||||
("pyls.plugins.flake8.enabled" t t)
|
||||
("pyls.plugins.pyls_mypy.live_mode" nil t)
|
||||
("pyls.plugins.pyls_black.enabled" t t)
|
||||
("pyls.plugins.pyls_isort.enabled" t t)))
|
||||
(add-hook 'python-mode #'fg42/py-auto-lsp))))
|
||||
|
||||
|
||||
(provide 'cubes/python)
|
||||
;;; python.el ends here
|
|
@ -0,0 +1,36 @@
|
|||
;;; RegionExpansionCube --- The elisp cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/region-expansion-cube
|
||||
"RE cube"
|
||||
(:title "cubes/fg42/region-expansion.org")
|
||||
|
||||
(fpkg/use expand-region
|
||||
:bind ("C-=" . er/expand-region)))
|
||||
|
||||
(provide 'cubes/region-expansion)
|
||||
;;; region-expansion.el ends here
|
|
@ -0,0 +1,50 @@
|
|||
;;; JavaCubes --- The Java cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
(defcube fg42/yasnippet-cube
|
||||
"Yasnippet cube"
|
||||
(:title "cubes/fg42/yasnippet-cube.org"
|
||||
:flag yasnippet
|
||||
:flag-default t)
|
||||
|
||||
(fpkg/use yasnippet-snippets)
|
||||
|
||||
(fpkg/use yasnippet
|
||||
:init
|
||||
(let* ((snippet-home (expand-file-name "snippets"
|
||||
(file-name-directory (locate-library "yasnippet-snippets"))))
|
||||
(local-snippet (expand-file-name "core/cubes/snippets" fg42-home))
|
||||
(user-snippets (or (plist-get fg42/yasnippet-cube-params :snippets-dir)
|
||||
;; Just to make sure that we don't return nil. Since
|
||||
;; yas-snippet-dirs shoud not contain nil value
|
||||
local-snippet)))
|
||||
|
||||
(setq yas-snippet-dirs `(,user-snippets ,local-snippet ,snippet-home))
|
||||
(yas-global-mode 1))))
|
||||
|
||||
|
||||
(provide 'cubes/snippets)
|
||||
;;; snippets.el ends here
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex begin block
|
||||
# key: al*
|
||||
# --
|
||||
\begin{align*}
|
||||
$0
|
||||
\end{align*}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex begin block
|
||||
# key: begin
|
||||
# --
|
||||
\begin{$1}
|
||||
$0
|
||||
\end{$1}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex begin block
|
||||
# key: block
|
||||
# --
|
||||
#+BEGIN_{$1}
|
||||
$0
|
||||
#+END_{$1}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex equation* block
|
||||
# key: eq*
|
||||
# --
|
||||
\begin{equation*}
|
||||
$0
|
||||
\end{equation*}
|
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex frac
|
||||
# key: fr
|
||||
# --
|
||||
\frac{$1}{$2} $0
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex Definition box
|
||||
# key: def
|
||||
# --
|
||||
#+attr_latex: :options {Definition}
|
||||
#+BEGIN_infobox
|
||||
$0
|
||||
#+END_infobox
|
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex \prod
|
||||
# key: prod
|
||||
# --
|
||||
\prod ^{$1} _{$2} $0
|
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: lxsameer <lxsameer@gnu.org>
|
||||
# name: Latex \sum
|
||||
# key: sum
|
||||
# --
|
||||
\sum ^{$1} _{$2} $0
|
|
@ -0,0 +1,40 @@
|
|||
;;; TerminalCubes --- The terminal related cubes for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
(defcube fg42/vterm-cube
|
||||
"Vterm cube"
|
||||
(:title "cubes/fg42/vterm-cube.org"
|
||||
:flag vterm)
|
||||
(let ((_shell (or (plist-get fg42/vterm-cube-params :shell)
|
||||
(getenv "SHELL"))))
|
||||
(fpkg/use vterm
|
||||
:init
|
||||
(progn
|
||||
(setq vterm-shell _shell)))))
|
||||
|
||||
|
||||
(provide 'cubes/terminal)
|
||||
;;; terminal.el ends here
|
|
@ -0,0 +1,57 @@
|
|||
;;; Terraform --- The terraform cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defcube fg42/terraform-cube
|
||||
"terraform cube"
|
||||
(:title "cubes/fg42/terraform-cube.org"
|
||||
:flag terraform
|
||||
:flag-default t)
|
||||
|
||||
;; https://github.com/juliosueiras/terraform-lsp is required
|
||||
(let ((terraform-lsp (or (plist-get fg42/terraform-cube-params :terraform-lsp-path) "terraform-lsp"))
|
||||
(lsp-flags (or (plist-get fg42/terraform-cube-params :terraform-lsp-flags) "-enable-log-file")))
|
||||
(fpkg/use terraform-mode
|
||||
:config
|
||||
(progn
|
||||
(when-flag lsp
|
||||
(require 'lsp)
|
||||
(add-to-list 'lsp-language-id-configuration '(terraform-mode . "terraform"))
|
||||
|
||||
(lsp-register-client
|
||||
(make-lsp-client :new-connection (lsp-stdio-connection (list terraform-lsp lsp-flags))
|
||||
:major-modes '(terraform-mode)
|
||||
:server-id 'terraform-ls))
|
||||
|
||||
(add-hook 'terraform-mode-hook #'lsp))))))
|
||||
|
||||
|
||||
(provide 'cubes/terraform)
|
||||
;;; terraform.el ends here
|
|
@ -0,0 +1,49 @@
|
|||
;;; WMCube --- The elisp cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/flags)
|
||||
(require 'fg42/cube)
|
||||
(require 'fg42/utils)
|
||||
|
||||
(autoload-cube 'fg42/initialize-wm "wm/core.el" "Initalize the WM mode.")
|
||||
|
||||
(defflag wm
|
||||
"The flag to enable WM mode in FG42.")
|
||||
|
||||
|
||||
(defcube fg42/wm-cube
|
||||
"This cube will setup *FG42* to act as a window manager."
|
||||
(:title "Window manager cube"
|
||||
:no-flag t)
|
||||
|
||||
(if-flag wm
|
||||
(when-wm
|
||||
(message "[WM] Initilizing...")
|
||||
(fpkg/use exwm)
|
||||
(fg42/initialize-wm))
|
||||
(error "[SKIP] WM flag is not active")))
|
||||
|
||||
|
||||
(provide 'cubes/wm)
|
||||
;;; wm.el ends here
|
|
@ -0,0 +1,161 @@
|
|||
;;; WMCube --- The elisp cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fg42/flags)
|
||||
|
||||
(defun wm-randr ()
|
||||
"RandR support for wm."
|
||||
(when-wm
|
||||
(require 'exwm-randr)
|
||||
(setq exwm-randr-workspace-output-plist '(0 "HDMI-1"
|
||||
1 "HDMI-1"
|
||||
2 "HDMI-1"
|
||||
3 "HDMI-1"
|
||||
4 "HDMI-1"
|
||||
5 "HDMI-1"
|
||||
6 "eDP-1"
|
||||
7 "HDMI-1"
|
||||
8 "HDMI-1"
|
||||
9 "HDMI-1"))
|
||||
(add-hook 'exwm-randr-screen-change-hook
|
||||
(lambda ()
|
||||
(start-process-shell-command
|
||||
"xrandr" nil "xrandr --output HDMI-1 --above eDP-1 --mode 1920x1080")))
|
||||
(exwm-randr-enable)))
|
||||
|
||||
|
||||
(defun fg42/initialize-wm ()
|
||||
"Initilize EXWM window manager with the given PARAMS."
|
||||
(interactive)
|
||||
|
||||
(require 'exwm)
|
||||
(require 'exwm-config)
|
||||
(require 'exwm-systemtray)
|
||||
|
||||
(exwm-config-ido)
|
||||
|
||||
;; Set the initial number of workspaces (they can also be created later).
|
||||
(setq exwm-workspace-number 10)
|
||||
|
||||
;; All buffers created in EXWM mode are named "*EXWM*". You may want to
|
||||
;; change it in `exwm-update-class-hook' and `exwm-update-title-hook', which
|
||||
;; are run when a new X window class name or title is available. Here's
|
||||
;; some advice on this topic:
|
||||
;; + Always use `exwm-workspace-rename-buffer` to avoid naming conflict.
|
||||
;; + For applications with multiple windows (e.g. GIMP), the class names of
|
||||
;; all windows are probably the same. Using window titles for them makes
|
||||
;; more sense.
|
||||
;; In the following example, we use class names for all windows except for
|
||||
;; Java applications and GIMP.
|
||||
(add-hook 'exwm-update-class-hook
|
||||
(lambda ()
|
||||
(unless (or (string-prefix-p "sun-awt-X11-" exwm-instance-name)
|
||||
(string= "gimp" exwm-instance-name))
|
||||
(exwm-workspace-rename-buffer exwm-class-name))))
|
||||
|
||||
(add-hook 'exwm-update-title-hook
|
||||
(lambda ()
|
||||
(when (or (not exwm-instance-name)
|
||||
(string-prefix-p "sun-awt-X11-" exwm-instance-name)
|
||||
(string= "gimp" exwm-instance-name))
|
||||
(exwm-workspace-rename-buffer exwm-title))))
|
||||
|
||||
;; Global keybindings can be defined with `exwm-input-global-keys'.
|
||||
;; Here are a few examples:
|
||||
(setq exwm-input-global-keys
|
||||
`(
|
||||
|
||||
;; Bind "s-r" to exit char-mode and fullscreen mode.
|
||||
([?\s-r] . exwm-reset)
|
||||
([?\s-g] . keyboard-quit)
|
||||
([8388640] . other-window)
|
||||
;; Bind "s-w" to switch workspace interactively.
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
;; Bind "s-0" to "s-9" to switch to a workspace by its index.
|
||||
,@(mapcar (lambda (i)
|
||||
`(,(kbd (format "s-%d" i)) .
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(exwm-workspace-switch-create ,i))))
|
||||
(number-sequence 0 9))
|
||||
;; Bind "s-&" to launch applications ('M-&' also works if the output
|
||||
;; buffer does not bother you).
|
||||
([?\s-d] . (lambda (command)
|
||||
(interactive (list (read-shell-command "$ ")))
|
||||
(start-process-shell-command command nil command)))
|
||||
;; Bind "s-<f2>" to "slock", a simple X display locker.
|
||||
([s-f2] . (lambda ()
|
||||
(interactive)
|
||||
(start-process "" nil "/usr/bin/slock")))))
|
||||
;; To add a key binding only available in line-mode, simply define it in
|
||||
;; `exwm-mode-map'. The following example shortens 'C-c q' to 'C-q'.
|
||||
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
|
||||
|
||||
(push ?\C-c exwm-input-prefix-keys)
|
||||
|
||||
;; The following example demonstrates how to use simulation keys to mimic
|
||||
;; the behavior of Emacs. The value of `exwm-input-simulation-keys` is a
|
||||
;; list of cons cells (SRC . DEST), where SRC is the key sequence you press
|
||||
;; and DEST is what EXWM actually sends to application. Note that both SRC
|
||||
;; and DEST should be key sequences (vector or string).
|
||||
(setq exwm-input-simulation-keys
|
||||
`(
|
||||
;; movement
|
||||
(,(kbd "C-b") . left)
|
||||
(,(kbd "M-b") . ,(kbd "C-<left>"))
|
||||
(,(kbd "C-f") . right)
|
||||
(,(kbd "M-f") . ,(kbd "C-<right>"))
|
||||
(,(kbd "C-p") . up)
|
||||
(,(kbd "C-n") . down)
|
||||
(,(kbd "C-a") . home)
|
||||
(,(kbd "C-e") . end)
|
||||
(,(kbd "M-v") . prior)
|
||||
(,(kbd "C-v") . next)
|
||||
(,(kbd "C-d") . delete)
|
||||
;;(,(kbs "C-k") . [S-end delete])
|
||||
;; navigation
|
||||
(,(kbd "C-c b") . ,(kbd "M-<left>"))
|
||||
(,(kbd "C-c f") . ,(kbd "M-<right>"))
|
||||
(,(kbd "C-c w") . ,(kbd "C-w"))
|
||||
(,(kbd "C-w") . ,(kbd "C-x"))
|
||||
(,(kbd "M-w") . ,(kbd "C-c"))
|
||||
(,(kbd "C-y") . ,(kbd "C-v"))
|
||||
;; search
|
||||
(,(kbd "C-s") . ,(kbd "C-f"))))
|
||||
|
||||
;; You can hide the minibuffer and echo area when they're not used, by
|
||||
;; uncommenting the following line.
|
||||
;;(setq exwm-workspace-minibuffer-position 'bottom)
|
||||
|
||||
;; Do not forget to enable EXWM. It will start by itself when things are
|
||||
;; ready. You can put it _anywhere_ in your configuration.
|
||||
(exwm-enable)
|
||||
(exwm-systemtray-enable)
|
||||
(wm-randr)
|
||||
;; (with-flag nlinum
|
||||
;; (add-hook 'exwm-mode-hook 'disable-nlinum))
|
||||
)
|
||||
|
||||
|
||||
(provide 'cubes/wm/core)
|
||||
;;; core.el ends here
|
|
@ -1,10 +1,10 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://devheroes.codes/FG42/FG42
|
||||
;; Version: 4.0.0
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -21,22 +21,21 @@
|
|||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
(require 'fg42/core)
|
||||
(require 'fg42/utils)
|
||||
|
||||
|
||||
(use! vterm
|
||||
"A real terminal emulator in Emacs."
|
||||
:hook (vterm-mode . (lambda ()
|
||||
(display-line-numbers-mode -1))))
|
||||
(defun fg42/before-initialize ()
|
||||
"Initialize the package manager before rendering the window instance."
|
||||
(require 'fpkg/core)
|
||||
(fpkg/initialize))
|
||||
|
||||
|
||||
(use! vterm-toggle
|
||||
"Automatically toggle to vterm and back. Quak style (kinda)."
|
||||
:init
|
||||
(require 'vterm-toggle)
|
||||
(global-set-key (kbd "<f2>") #'vterm-toggle))
|
||||
(defun fg42/initialize ()
|
||||
"Initialize FG42 after the Emacs window is rendered by loading the user init file."
|
||||
(when (file-exists-p user-init-file)
|
||||
(load user-init-file)))
|
||||
|
||||
|
||||
(provide 'fg42/terminal)
|
||||
;;; terminal.el ends here
|
||||
(provide 'fg42)
|
||||
;;; fg42.el ends here
|
|
@ -1,10 +1,10 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://devheroes.codes/FG42/FG42
|
||||
;; Version: 4.0.0
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -21,18 +21,22 @@
|
|||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
(defgroup fg42 nil
|
||||
"Customize your FG42 instance via this group of configurations.")
|
||||
|
||||
(defvar fg42-after-init-hook nil
|
||||
"The hook tha runs when FG42 finished running the user configuration")
|
||||
|
||||
(defvar fg42/debug-p nil
|
||||
"The hook tha runs when FG42 finished running the user configuration")
|
||||
|
||||
(defvar fg42-home (getenv "FG42_HOME")
|
||||
"The pass to fg42-home.")
|
||||
|
||||
|
||||
(use! pdf-tools
|
||||
"A complete pdf suit for Emacs."
|
||||
:config
|
||||
;; open pdfs scaled to fit page
|
||||
(setq-default pdf-view-display-size 'fit-page)
|
||||
;; automatically annotate highlights
|
||||
(setq pdf-annot-activate-created-annotations t))
|
||||
(defvar fg42-tmp (concat fg42-home "/tmp"))
|
||||
|
||||
|
||||
(provide 'fg42/document-viewer)
|
||||
;;; document-viewer.el ends here
|
||||
(provide 'fg42/core)
|
||||
;;; core.el ends here
|
|
@ -0,0 +1,170 @@
|
|||
;;; Cube --- Cube library of FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
|
||||
;; unit which defines different abilities in a deterministic and idempotent
|
||||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'seq)
|
||||
(require 'fg42/utils)
|
||||
|
||||
(defvar fg42/after-cubes-setup-hook nil
|
||||
"A hook that will be run after all the active cubes got setup. This hook
|
||||
is dedicated for the codes that needs to do stuff based on other cubes
|
||||
presence. With this hook we eliminate the need for cube ordering.
|
||||
|
||||
It will be called in the `fg42-config' and the proper way to use
|
||||
it is to use `fg42/after-cubes' macro. ")
|
||||
|
||||
|
||||
(defvar fg42/available-cubes '()
|
||||
"A list of all the registered cubes.")
|
||||
|
||||
|
||||
(defmacro defcube (cube-name docs props &rest body)
|
||||
"Define a cube with the given CUBE-NAME, a list of PROPS, DOCS and a BODY."
|
||||
(declare (indent defun) (doc-string 2))
|
||||
|
||||
;; Make sure that props is a plist and contains the `:docs' key
|
||||
;; TODO: Maybe use `cl-check-type' here
|
||||
(when (not (stringp docs))
|
||||
(error "Missing docstring for '%s' cube" cube-name))
|
||||
|
||||
(when (not (plist-get props :title))
|
||||
(error "Missing :titel key for '%s' cube" cube-name))
|
||||
|
||||
(let ((complete-props (plist-put props :docs docs))
|
||||
(cube-name-internal (intern (format "%s-internal" cube-name)))
|
||||
(params-var (intern (format "%s-params" cube-name)))
|
||||
(active-var (intern (format "%s-active-p" cube-name)))
|
||||
(pre-lang-server-up-hook (intern (format "%s-pre-lang-server-up-hook" cube-name)))
|
||||
(post-lang-server-up-hook (intern (format "%s-post-lang-server-up-hook" cube-name)))
|
||||
(pre-lang-server-down-hook (intern (format "%s-pre-lang-server-down-hook" cube-name)))
|
||||
(post-lang-server-down-hook (intern (format "%s-post-lang-server-down-hook" cube-name)))
|
||||
(pre-init-hook (intern (format "%s-pre-init-hook" cube-name)))
|
||||
(post-init-hook (intern (format "%s-post-init-hook" cube-name)))
|
||||
(post-init-hook (intern (format "%s-post-init-hook" cube-name)))
|
||||
|
||||
(flag-var (or (plist-get props :flag) cube-name))
|
||||
(flag-docstring-var (or (plist-get props :flag-doc)
|
||||
(format "The flag to enable/disable the '%s' cube." cube-name)))
|
||||
(flag-default (plist-get props :flag-default))
|
||||
(flag-conflict (plist-get props :conflicts-with))
|
||||
(no-flag? (or (plist-get props :no-flag) ())))
|
||||
|
||||
(add-to-list 'fg42/available-cubes cube-name)
|
||||
|
||||
`(progn
|
||||
|
||||
;; Create a new flag for each cube to control the cubes systemwide.
|
||||
(when (not ,no-flag?)
|
||||
(defflag ,flag-var ,flag-docstring-var ,flag-default))
|
||||
|
||||
;; Params variable contains the list of params the is passed to
|
||||
;; the current cube call
|
||||
(defvar ,params-var nil
|
||||
,(format "Parameters for the '%s' cube." cube-name))
|
||||
|
||||
;; * Hooks
|
||||
|
||||
;; This hook can be used by others to run code just before running that
|
||||
;; code body
|
||||
(defvar ,pre-init-hook nil
|
||||
,(format "The hook that runs befor the '%s' cube initialization." cube-name))
|
||||
|
||||
|
||||
;; This hook can be used by others to run code just after the body of
|
||||
;; the cube
|
||||
(defvar ,post-init-hook nil
|
||||
,(format "The hook that runs after the '%s' cube initialization." cube-name))
|
||||
|
||||
|
||||
;; TODO: Move language server related hooks to lang-server
|
||||
;; TODO: Provide a way to let different parts of the
|
||||
;; codebase to create cube hooks
|
||||
|
||||
;; ** Language Server
|
||||
;;; The hook that enables users to change the language server configuration
|
||||
;;; of the current cube before activating the server
|
||||
(defvar ,pre-lang-server-up-hook nil
|
||||
,(format "The hook that runs befor the '%s' cube's language server activates ." cube-name))
|
||||
|
||||
;;; The hook to do any post configuration for the lang server of the cube
|
||||
(defvar ,post-lang-server-up-hook nil
|
||||
,(format "The hook that runs after the '%s' cube's language server activates." cube-name))
|
||||
|
||||
;;; The hook to run code just before the language server is about to shutdown
|
||||
(defvar ,pre-lang-server-down-hook nil
|
||||
,(format "The hook that runs befor the '%s' cube's language server shuts down." cube-name))
|
||||
|
||||
;;; The hook to run code after the language server successfully shuts down
|
||||
(defvar ,post-lang-server-down-hook nil
|
||||
,(format "The hook that runs after the '%s' cube's language server shuts down." cube-name))
|
||||
|
||||
;; This way we can bypass the flag system if we really really want to.
|
||||
(defun ,cube-name-internal (params)
|
||||
(if (or (not (boundp (quote ,active-var)))
|
||||
(not ,active-var))
|
||||
(progn
|
||||
;; Mark this cube as active
|
||||
(setq ,active-var t)
|
||||
|
||||
;; Set the parameters in CUBE-NAME-params to be accessable
|
||||
;; in the body
|
||||
(setq ,params-var params)
|
||||
|
||||
;; Run the pre init hook
|
||||
(run-hooks (quote ,pre-init-hook))
|
||||
|
||||
(fg42/info "Initializing '%s' cube." (quote ,cube-name))
|
||||
;; Run the body
|
||||
(let ((result (progn ,@body)))
|
||||
;; Run the post init hook
|
||||
(run-hooks (quote ,post-init-hook))
|
||||
result))
|
||||
(fg42/info "The '%s' cube is already active." ',cube-name)))
|
||||
|
||||
(defun ,cube-name (&rest params)
|
||||
(interactive)
|
||||
(if ,no-flag?
|
||||
;; If no flag is need to control this cube
|
||||
(,cube-name-internal params)
|
||||
;; Otherwise check for the flag to be active
|
||||
(if-flag ,flag-var
|
||||
(,cube-name-internal params)
|
||||
(fg42/info "The flag for '%s' cube is disabled. Skiping." ,(symbol-name cube-name)))))
|
||||
|
||||
;; Set the symbol-plist of the cube-name to its props
|
||||
(setplist ',cube-name ',complete-props))))
|
||||
|
||||
|
||||
(defmacro fg42/after-cubes (&rest body)
|
||||
"Add the BODY to `fg42/after-cubes-setup-hook' hook."
|
||||
(declare (indent defun))
|
||||
`(add-hook 'fg42/after-cubes-setup-hook
|
||||
(lambda ()
|
||||
,@body)))
|
||||
|
||||
|
||||
(provide 'fg42/cube)
|
||||
;;; cube.el ends here
|
|
@ -0,0 +1,131 @@
|
|||
;;; Flags --- Flags library of FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'seq)
|
||||
(require 'fg42/core)
|
||||
|
||||
|
||||
(defvar fg42/available-flags nil
|
||||
"A list of defined flags.
|
||||
|
||||
Only use \\[defflag] to add a new flag to this list")
|
||||
|
||||
|
||||
(defcustom fg42/flags nil
|
||||
"A set of flags to mark the functionalities that expected from FG42.
|
||||
Flags are defined using the \\[defflag] through out the source code.
|
||||
|
||||
To see a list of available flags use \\[fg42/show-all-flags] and to see
|
||||
the documentation of each flag simply use \\[describe-flag]."
|
||||
:group 'fg42
|
||||
:package-version '(FG42 . "3.x")
|
||||
:type '(symbol)
|
||||
:tag "FG42 Flags")
|
||||
|
||||
|
||||
(defmacro use-flags (flags)
|
||||
"Set the given FLAGS to activate their functionalities in FG42."
|
||||
`(progn
|
||||
(setq fg42/flags ,flags)
|
||||
t))
|
||||
|
||||
|
||||
(defun fg42/-merge-flags (flags-set &rest new-flags)
|
||||
"Merge the given NEW-FLAGS into the FLAGS-SET and return the result."
|
||||
(cl-remove-duplicates
|
||||
(seq-reduce
|
||||
(lambda (result flag)
|
||||
(let ((flag-str (symbol-name flag)))
|
||||
(if (string-prefix-p "-" flag-str)
|
||||
(let ((actual-flag (intern (substring flag-str 1))))
|
||||
(if (member actual-flag result)
|
||||
(remove actual-flag result)
|
||||
result))
|
||||
;; We don't want to check for duplicates here since we remove them
|
||||
;; later
|
||||
(cons flag result))))
|
||||
new-flags
|
||||
flags-set)))
|
||||
|
||||
|
||||
(defmacro fg42/merge-flags (flags-set &rest new-flags)
|
||||
"Merge the given NEW-FLAGS into the FLAGS-SET and return the result.
|
||||
|
||||
If any flag name in NEW-FLAGS list starts with `-' (a dash) it implies that
|
||||
that functionality has to be disabled and removed from FLAGS-SET. For example,
|
||||
`-lsp' implies that we DO NOT want to have `lsp' flag enabled and it should not
|
||||
exist in the return value.
|
||||
|
||||
For example, `(fg42/merge-flags (list f1 f2 f3) f4 -f2)' will return `(f1 f3 f4)'"
|
||||
`(fg42/-merge-flags ,flags-set ,@(mapcar (lambda (x) `',x) new-flags)))
|
||||
|
||||
|
||||
(defmacro fg42/merge-with-default-flags (&rest new-flags)
|
||||
"Merge the given list of NEW-FLAGS with default flags of FG42 and return the new set."
|
||||
`(fg42/merge-flags fg42/flags ,@new-flags))
|
||||
|
||||
|
||||
(defmacro defflag (flag-name docstring &optional default-value)
|
||||
"Define a new flag FLAG-NAME with the given DOCSTRING.
|
||||
If the DEFAULT-VALUE is a non nil value, then the flag will be
|
||||
added to the activa flags list."
|
||||
(let ((var-name (intern (format "fg42/-flag-%s" flag-name)))
|
||||
(set-default (if default-value `((add-to-list 'fg42/flags ',flag-name)) ())))
|
||||
`(if (boundp ',var-name)
|
||||
(warn (format "Flag name `%s' already defined" ,(format "%s" flag-name)))
|
||||
(progn
|
||||
(defvar ,var-name t)
|
||||
(add-to-list 'fg42/available-flags ',flag-name)
|
||||
,@set-default))))
|
||||
|
||||
|
||||
(defmacro when-flag (flag &rest body)
|
||||
"Evaluate the BODY only if the given FLAG is active."
|
||||
(declare (indent defun))
|
||||
;; The `cube-local-flags' variable here is going to be
|
||||
;; defined in cubes to hold the local flags for each cube
|
||||
(if (and (boundp 'cube-local-flags)
|
||||
(member flag cube-local-flags))
|
||||
`,@body
|
||||
`(if (member ',flag fg42/flags)
|
||||
,@body
|
||||
nil)))
|
||||
|
||||
|
||||
(defmacro if-flag (flag then else)
|
||||
"Evaluate the THEN expr only if the given FLAG is active otherwise ELSE."
|
||||
(declare (indent defun))
|
||||
;; The `cube-local-flags' variable here is going to be
|
||||
;; defined in cubes to hold the local flags for each cube
|
||||
(if (and (boundp 'cube-local-flags)
|
||||
(member flag cube-local-flags))
|
||||
`,@then
|
||||
`(if (member ',flag fg42/flags)
|
||||
,then
|
||||
,else)))
|
||||
|
||||
|
||||
(provide 'fg42/flags)
|
||||
;;; flags.el ends here
|
|
@ -1,10 +1,10 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;; Flags --- Flags library of FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://devheroes.codes/FG42/FG42
|
||||
;; Version: 4.0.0
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -21,16 +21,10 @@
|
|||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
(require 'fg42/flags)
|
||||
|
||||
|
||||
(use! elfeed
|
||||
"The best rss reader you can ask for."
|
||||
:commands elfeed
|
||||
:bind
|
||||
("C-x w" . elfeed))
|
||||
|
||||
|
||||
(provide 'fg42/rss)
|
||||
;;; rss.el ends here
|
||||
(provide 'lang-servers)
|
||||
;;; lang-servers.el ends here
|
|
@ -0,0 +1,51 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defvar fg42/modeline-setter #'fg42/default-mode-line-setter)
|
||||
|
||||
|
||||
(defmacro defmode-line (name &rest body)
|
||||
`(defun ,name () ,@body))
|
||||
|
||||
|
||||
;; The default modeline has to be nil to let the
|
||||
;; modeline setters know that they can use their
|
||||
;; default modeline
|
||||
(defmode-line fg42/default-modeline)
|
||||
|
||||
|
||||
(defun fg42/default-mode-line-setter (def)
|
||||
"Set the modeline definition in X to the `fg42-modeline'."
|
||||
(unless (null def)
|
||||
(setq mode-line-format (plist-get def :brief))
|
||||
(setq mode-line-format (plist-get (fg42/default-modeline) :brief))))
|
||||
|
||||
|
||||
(defun fg42/setup-modeline-format (definition)
|
||||
"Setup the modeline by calling the setter function and passing the DEFINITION."
|
||||
(funcall fg42/modeline-setter definition))
|
||||
|
||||
|
||||
(provide 'fg42/modeline)
|
||||
;;; modeline.el ends here
|
|
@ -0,0 +1,501 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
;; Some of the functions in this module are borrowed from `mini-modeline'
|
||||
;; at https://github.com/kiennq/emacs-mini-modeline (GPL). I modified to
|
||||
;; fit my needs.
|
||||
|
||||
;;; Require
|
||||
(require 'minibuffer)
|
||||
(require 'frame)
|
||||
(require 'timer)
|
||||
(require 'face-remap)
|
||||
|
||||
;; ============================================================================
|
||||
;; customizations
|
||||
;; ============================================================================
|
||||
|
||||
(defgroup fg42/statusbar nil
|
||||
"Status bar group."
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defcustom fg42/statusbar-components
|
||||
'("random" (buffer-name))
|
||||
"Default active components."
|
||||
:type 'list
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defcustom fg42/statusbar-truncate-p t
|
||||
"Truncates fg42/statusbar or not."
|
||||
:type 'boolean
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defcustom fg42/statusbar-echo-duration 5
|
||||
"Duration to keep display echo."
|
||||
:type 'integer
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
(defcustom fg42/statusbar-refresh-idle-delay 0.1
|
||||
"Update idle delay of bar in seconds."
|
||||
:type 'double
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defcustom fg42/statusbar-frame nil
|
||||
"Frame to display fg42/statusbar on.
|
||||
Nil means current selected frame."
|
||||
:type 'sexp
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defcustom fg42/statusbar-display-gui-line t
|
||||
"Display thin line at the bottom of the window."
|
||||
:type 'boolean
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defvar fg42/statusbar-height 4)
|
||||
|
||||
(defcustom fg42/statusbar-face-attr `(:background ,(face-attribute 'mode-line :background))
|
||||
"Plist of face attribute/value pair for fg42/statusbar."
|
||||
:type '(plist)
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
;; ============================================================================
|
||||
;; Faces
|
||||
;; ============================================================================
|
||||
|
||||
(defface fg42/statusbar-mode-line
|
||||
'((((background light))
|
||||
:background "#55ced1" :height 0.1 :box nil)
|
||||
(t
|
||||
:background "#3f3f3f" :height 0.2 :box nil))
|
||||
|
||||
"Modeline face for active window."
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
(defface fg42/statusbar-components
|
||||
'((t :inherit t :height 0.7))
|
||||
|
||||
"Modeline face for active window."
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
(defface fg42/statusbar-mode-line-inactive
|
||||
'((((background light))
|
||||
:background "#dddddd" :height 0.1 :box nil)
|
||||
(t
|
||||
:background "#333333" :height 0.1 :box nil))
|
||||
"Modeline face for inactive window."
|
||||
:group 'fg42/statusbar)
|
||||
|
||||
|
||||
;; ============================================================================
|
||||
;; Vars
|
||||
;; ============================================================================
|
||||
(defvar fg42/statusbar-info-padding-right 0)
|
||||
|
||||
(defvar fg42/statusbar--msg nil)
|
||||
|
||||
(defvar fg42/statusbar--msg-message nil
|
||||
"Store the string from `message'.")
|
||||
|
||||
(defvar fg42/statusbar--last-update (current-time))
|
||||
|
||||
(defvar fg42/statusbar--last-change-size (current-time))
|
||||
|
||||
(defvar fg42/statusbar--last-echoed nil)
|
||||
|
||||
(defvar fg42/statusbar-timer nil)
|
||||
|
||||
(defvar fg42/statusbar-active-p nil)
|
||||
|
||||
(defvar fg42/statusbar--cache nil)
|
||||
|
||||
(defvar fg42/statusbar--orig-resize-mini-windows resize-mini-windows)
|
||||
|
||||
(defvar fg42/statusbar--minibuffer nil)
|
||||
|
||||
(defvar fg42/statusbar--echo-keystrokes echo-keystrokes)
|
||||
|
||||
(defvar fg42/statusbar-command-state 'begin
|
||||
"The state of current executed command begin -> [exec exec-read] -> end.")
|
||||
|
||||
(defvar fg42/statusbar-enable-hook nil)
|
||||
(defvar fg42/statusbar-disable-hook nil)
|
||||
|
||||
(defvar-local fg42/statusbar--orig-mode-line mode-line-format)
|
||||
|
||||
(defvar-local fg42/statusbar--face-cookie nil)
|
||||
|
||||
(defvar fg42/statusbar--orig-mode-line-remap
|
||||
(or (alist-get 'mode-line face-remapping-alist) 'mode-line))
|
||||
|
||||
(defvar fg42/statusbar--orig-mode-line-inactive-remap
|
||||
(or (alist-get 'mode-line-inactive face-remapping-alist) 'mode-line-inactive))
|
||||
|
||||
;; ============================================================================
|
||||
;; Definitions
|
||||
;; ============================================================================
|
||||
(defmacro fg42/statusbar-wrap (func &rest body)
|
||||
"Add an advice around FUNC with name fg42/statusbar--%s.
|
||||
BODY will be supplied with orig-func and args."
|
||||
(let ((name (intern (format "fg42/statusbar--%s" func))))
|
||||
`(advice-add #',func :around
|
||||
(lambda (orig-func &rest args)
|
||||
,@body)
|
||||
'((name . ,name)))))
|
||||
|
||||
|
||||
(defmacro defbar-unit (name interval default &rest body)
|
||||
"Create a status bar unit with a dedicated timer.
|
||||
|
||||
It will create a unit with the given NAME and DEFAULT value and a timer
|
||||
that runs the given BODY at the given INTERVAL."
|
||||
(declare (indent defun))
|
||||
(let ((timer-name (intern (format "$%s-timer" name))))
|
||||
`(progn
|
||||
(defvar ,name ,default)
|
||||
(defvar ,timer-name)
|
||||
(let ((fn (lambda () ,@body)))
|
||||
(add-hook 'fg42/statusbar-enable-hook
|
||||
(lambda ()
|
||||
(setq ,timer-name
|
||||
(run-with-timer 0 ,interval
|
||||
(lambda ()
|
||||
(setq ,name (funcall fn))))))))
|
||||
|
||||
(add-hook 'fg42/statusbar-disable-hook
|
||||
(lambda ()
|
||||
(when (timerp ,timer-name)
|
||||
(cancel-timer ,timer-name)))))))
|
||||
|
||||
|
||||
(defsubst fg42/statusbar-pre-cmd ()
|
||||
"Pre command hook of fg42/statusbar."
|
||||
(setq fg42/statusbar-command-state 'begin))
|
||||
|
||||
|
||||
(defsubst fg42/statusbar-post-cmd ()
|
||||
"Post command hook of fg42/statusbar."
|
||||
(setq fg42/statusbar-command-state 'end
|
||||
echo-keystrokes fg42/statusbar--echo-keystrokes))
|
||||
|
||||
|
||||
(defsubst fg42/statusbar-enter-minibuffer ()
|
||||
"`minibuffer-setup-hook' of fg42/statusbar."
|
||||
(fg42/statusbar--set-buffer-face)
|
||||
(setq resize-mini-windows 'grow-only))
|
||||
|
||||
|
||||
(defsubst fg42/statusbar-exit-minibuffer ()
|
||||
"`minibuffer-exit-hook' of fg42/statusbar."
|
||||
(with-current-buffer fg42/statusbar--minibuffer
|
||||
(fg42/statusbar--set-buffer-face))
|
||||
(setq resize-mini-windows nil))
|
||||
|
||||
|
||||
(defun fg42/statusbar--set-buffer-face ()
|
||||
"Set buffer default face for current buffer."
|
||||
(setq fg42/statusbar--face-cookie
|
||||
(face-remap-add-relative 'default fg42/statusbar-face-attr)))
|
||||
|
||||
|
||||
(defun fg42/statusbar-enable ()
|
||||
"Enable the statusbar."
|
||||
|
||||
;; Hide modeline for terminal, or use empty modeline for GUI.
|
||||
(setq-default fg42/statusbar--orig-mode-line mode-line-format)
|
||||
(setq-default mode-line-format (when (and fg42/statusbar-display-gui-line
|
||||
(display-graphic-p))
|
||||
'(" ")))
|
||||
;; Do the same thing with opening buffers.
|
||||
(mapc
|
||||
(lambda (buf)
|
||||
(with-current-buffer buf
|
||||
(when (local-variable-p 'mode-line-format)
|
||||
(setq fg42/statusbar--orig-mode-line mode-line-format)
|
||||
(setq mode-line-format (when (and fg42/statusbar-display-gui-line
|
||||
(display-graphic-p))
|
||||
'(" "))))
|
||||
|
||||
(when (or (minibufferp buf)
|
||||
(string-prefix-p " *Echo Area" (buffer-name)))
|
||||
(fg42/statusbar--set-buffer-face))
|
||||
;; Make the modeline in GUI a thin bar.
|
||||
(when (and fg42/statusbar-display-gui-line
|
||||
(local-variable-p 'face-remapping-alist)
|
||||
(display-graphic-p))
|
||||
(setf (alist-get 'mode-line face-remapping-alist)
|
||||
'fg42/statusbar-mode-line
|
||||
(alist-get 'mode-line-inactive face-remapping-alist)
|
||||
'fg42/statusbar-mode-line-inactive))))
|
||||
(buffer-list))
|
||||
|
||||
;; Make the modeline in GUI a thin bar.
|
||||
(when (and fg42/statusbar-display-gui-line
|
||||
(display-graphic-p))
|
||||
(let ((face-remaps (default-value 'face-remapping-alist)))
|
||||
(setf (alist-get 'mode-line face-remaps)
|
||||
'fg42/statusbar-mode-line
|
||||
(alist-get 'mode-line-inactive face-remaps)
|
||||
'fg42/statusbar-mode-line-inactive
|
||||
(default-value 'face-remapping-alist) face-remaps)))
|
||||
|
||||
(setq fg42/statusbar--orig-resize-mini-windows resize-mini-windows)
|
||||
(setq resize-mini-windows nil)
|
||||
(redisplay)
|
||||
|
||||
(advice-add #'message :around #'fg42/statusbar-message-advice)
|
||||
|
||||
;; Add update timer.
|
||||
(setq fg42/statusbar-timer
|
||||
(run-with-timer 0 fg42/statusbar-refresh-idle-delay #'fg42/statusbar-display))
|
||||
|
||||
(add-hook 'minibuffer-setup-hook #'fg42/statusbar-enter-minibuffer)
|
||||
(add-hook 'minibuffer-exit-hook #'fg42/statusbar-exit-minibuffer)
|
||||
(add-hook 'pre-command-hook #'fg42/statusbar-pre-cmd)
|
||||
(add-hook 'post-command-hook #'fg42/statusbar-post-cmd)
|
||||
|
||||
;;(add-hook 'focus-in-hook 'fg42/statusbar-show-info)
|
||||
(add-function :after after-focus-change-function #'fg42/statusbar-display)
|
||||
|
||||
;; read-key-sequence
|
||||
(fg42/statusbar-wrap
|
||||
read-key-sequence
|
||||
(progn
|
||||
(setq fg42/statusbar-command-state 'exec-read)
|
||||
(apply orig-func args)))
|
||||
|
||||
(fg42/statusbar-wrap
|
||||
read-key-sequence-vector
|
||||
(progn
|
||||
(setq fg42/statusbar-command-state 'exec-read)
|
||||
(apply orig-func args)))
|
||||
|
||||
(run-hooks 'fg42/statusbar-enable-hook)
|
||||
(setq fg42/statusbar-active-p t))
|
||||
|
||||
|
||||
(defun fg42/statusbar-disable ()
|
||||
"Disable the status bar."
|
||||
|
||||
(setq-default mode-line-format (default-value 'fg42/statusbar--orig-mode-line))
|
||||
(when (display-graphic-p)
|
||||
(let ((face-remaps (default-value 'face-remapping-alist)))
|
||||
(setf (alist-get 'mode-line face-remaps)
|
||||
fg42/statusbar--orig-mode-line-remap
|
||||
(alist-get 'mode-line-inactive face-remaps)
|
||||
fg42/statusbar--orig-mode-line-inactive-remap
|
||||
(default-value 'face-remapping-alist) face-remaps)))
|
||||
|
||||
(mapc
|
||||
(lambda (buf)
|
||||
(with-current-buffer buf
|
||||
(when (local-variable-p 'mode-line-format)
|
||||
(setq mode-line-format fg42/statusbar--orig-mode-line))
|
||||
(when fg42/statusbar--face-cookie
|
||||
(face-remap-remove-relative fg42/statusbar--face-cookie))
|
||||
(when (and (local-variable-p 'face-remapping-alist)
|
||||
(display-graphic-p))
|
||||
(setf (alist-get 'mode-line face-remapping-alist)
|
||||
fg42/statusbar--orig-mode-line-remap
|
||||
(alist-get 'mode-line-inactive face-remapping-alist)
|
||||
fg42/statusbar--orig-mode-line-inactive-remap))))
|
||||
|
||||
(buffer-list))
|
||||
|
||||
(setq resize-mini-windows fg42/statusbar--orig-resize-mini-windows)
|
||||
(redisplay)
|
||||
|
||||
(advice-remove #'message #'fg42/statusbar-message-advice)
|
||||
(advice-remove #'read-key-sequence 'fg42/statusbar--read-key-sequence)
|
||||
(advice-remove #'read-key-sequence-vector 'fg42/statusbar--read-key-sequence-vector)
|
||||
|
||||
(remove-hook 'minibuffer-setup-hook #'fg42/statusbar-enter-minibuffer)
|
||||
(remove-hook 'minibuffer-exit-hook #'fg42/statusbar-exit-minibuffer)
|
||||
(remove-hook 'pre-command-hook #'fg42/statusbar-pre-cmd)
|
||||
(remove-hook 'post-command-hook #'fg42/statusbar-post-cmd)
|
||||
|
||||
;; Cancel timer.
|
||||
(when (timerp fg42/statusbar-timer)
|
||||
(cancel-timer fg42/statusbar-timer))
|
||||
|
||||
(remove-function after-focus-change-function #'fg42/statusbar-display)
|
||||
|
||||
;; Update mode-line.
|
||||
(force-mode-line-update)
|
||||
(redraw-display)
|
||||
|
||||
(with-current-buffer " *Minibuf-0*"
|
||||
(erase-buffer))
|
||||
|
||||
(run-hooks 'fg42/statusbar-disable-hook)
|
||||
(setq fg42/statusbar-active-p nil))
|
||||
|
||||
|
||||
(defun fg42/statusbar-build-active-info ()
|
||||
"Collect the information from active components."
|
||||
(mapconcat
|
||||
(lambda (form)
|
||||
(let ((result (eval form)))
|
||||
(when (not (stringp result))
|
||||
(error "The result of %s is not string" result))
|
||||
(when (> (length result) 0)
|
||||
result)))
|
||||
fg42/statusbar-components
|
||||
""))
|
||||
|
||||
|
||||
(defun fg42/statusbar-get-frame-width ()
|
||||
"Only calculating a main Frame width, to avoid wrong width when new frame, such
|
||||
as `snails'."
|
||||
(if (display-graphic-p)
|
||||
(with-selected-frame (car (last (frame-list)))
|
||||
(frame-width))
|
||||
(frame-width)))
|
||||
|
||||
|
||||
(defun fg42/statusbar-get-echo-format-string (info message-string)
|
||||
(let* ((blank-length (- (fg42/statusbar-get-frame-width)
|
||||
(string-width info)
|
||||
(string-width (or message-string ""))
|
||||
fg42/statusbar-info-padding-right)))
|
||||
(cond
|
||||
;; Fill message's end with whitespace to keep the info at right of minibuffer.
|
||||
((> blank-length 0)
|
||||
(progn
|
||||
(let* ((inhibit-message t))
|
||||
(concat message-string
|
||||
(make-string (max 0 (- (fg42/statusbar-get-frame-width)
|
||||
(string-width (or message-string ""))
|
||||
(string-width info)
|
||||
fg42/statusbar-info-padding-right)) ?\ )
|
||||
info))))
|
||||
(t message-string))))
|
||||
|
||||
|
||||
(defsubst fg42/statusbar--overduep (since duration)
|
||||
"Check if time already pass DURATION from SINCE."
|
||||
(>= (float-time (time-since since)) duration))
|
||||
|
||||
|
||||
(defun fg42/statusbar--log (&rest args)
|
||||
"Log message into message buffer with ARGS as same parameters in `message'."
|
||||
(save-excursion
|
||||
(with-current-buffer "*Messages*"
|
||||
(let ((inhibit-read-only t))
|
||||
(goto-char (point-max))
|
||||
(insert (apply #'format args))))))
|
||||
|
||||
|
||||
(defun fg42/statusbar-display (&optional arg)
|
||||
"Update fg42/statusbar.
|
||||
When ARG is:
|
||||
- `force', force update the minibuffer.
|
||||
- `clear', clear the minibuffer. This implies `force'."
|
||||
(save-match-data
|
||||
(let ((bar-info (fg42/statusbar-build-active-info)))
|
||||
(condition-case err
|
||||
|
||||
(cl-letf (((symbol-function 'completion-all-completions) #'ignore))
|
||||
(unless (or (active-minibuffer-window)
|
||||
(input-pending-p))
|
||||
(setq fg42/statusbar--minibuffer
|
||||
(window-buffer (minibuffer-window fg42/statusbar-frame)))
|
||||
(with-current-buffer fg42/statusbar--minibuffer
|
||||
(let ((truncate-lines fg42/statusbar-truncate-p)
|
||||
(inhibit-read-only t)
|
||||
(inhibit-redisplay t)
|
||||
(buffer-undo-list t)
|
||||
modeline-content)
|
||||
(when (or (memq arg '(force clear))
|
||||
(fg42/statusbar--overduep fg42/statusbar--last-update
|
||||
fg42/statusbar-refresh-idle-delay))
|
||||
(when-let ((msg (or fg42/statusbar--msg-message (current-message))))
|
||||
;; Clear echo area and start new timer for echo message
|
||||
(message nil)
|
||||
(setq fg42/statusbar--last-echoed (current-time))
|
||||
;; we proritize the message from `message'
|
||||
;; or the message when we're not in middle of a command running.
|
||||
(when (or fg42/statusbar--msg-message
|
||||
(eq fg42/statusbar-command-state 'begin))
|
||||
(setq fg42/statusbar-command-state 'exec)
|
||||
;; Don't echo keystrokes when in middle of command
|
||||
(setq echo-keystrokes 0))
|
||||
(setq fg42/statusbar--msg msg))
|
||||
;; Reset echo message when timeout and not in middle of command
|
||||
(when (and fg42/statusbar--msg
|
||||
(not (memq fg42/statusbar-command-state '(exec exec-read)))
|
||||
(fg42/statusbar--overduep fg42/statusbar--last-echoed
|
||||
fg42/statusbar-echo-duration))
|
||||
(setq fg42/statusbar--msg nil))
|
||||
;; Showing fg42/statusbar
|
||||
(if (eq arg 'clear)
|
||||
(setq modeline-content nil)
|
||||
(setq modeline-content
|
||||
(fg42/statusbar-get-echo-format-string bar-info fg42/statusbar--msg))
|
||||
(setq fg42/statusbar--last-update (current-time)))
|
||||
|
||||
;; write to minibuffer
|
||||
(unless (equal modeline-content
|
||||
fg42/statusbar--cache))
|
||||
(setq fg42/statusbar--cache modeline-content)
|
||||
(erase-buffer)
|
||||
(when fg42/statusbar--cache
|
||||
(let (
|
||||
;;let fg42/statusbar take control of mini-buffer size
|
||||
(resize-mini-windows t))
|
||||
(insert fg42/statusbar--cache))))))))
|
||||
((error debug)
|
||||
(fg42/statusbar--log "fg42/statusbar: %s\n" err))))))
|
||||
|
||||
|
||||
(defun fg42/statusbar-message-advice (f &rest args)
|
||||
"Wrap `message' make status bar information visible always
|
||||
even other plugins call `message' to flush minibufer."
|
||||
(if inhibit-message
|
||||
(apply f args)
|
||||
(let* ((inhibit-message t)
|
||||
(fg42/statusbar--msg-message (apply f args)))
|
||||
(fg42/statusbar-display 'force)
|
||||
fg42/statusbar--msg-message)))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode fg42/statusbar-mode
|
||||
"Super simple status bar for FG42."
|
||||
:require 'fg42/statusbar-mode
|
||||
:lighter "SB"
|
||||
:global t
|
||||
(if fg42/statusbar-mode
|
||||
(fg42/statusbar-enable)
|
||||
(fg42/statusbar-disable)))
|
||||
|
||||
|
||||
(provide 'fg42/statusbar)
|
||||
;;; statusbar.el ends here
|
|
@ -1,10 +1,10 @@
|
|||
;;; Themes --- Theme library of FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://devheroes.codes/FG42/FG42
|
||||
;; Version: 4.0.0
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,16 +25,8 @@
|
|||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg)
|
||||
(require 'fg42/config))
|
||||
|
||||
(require 'fg42/utils)
|
||||
|
||||
(defvar fg42/ui-hook ()
|
||||
"A hook that cubes can use via :ui-hook property.
|
||||
It executes way before the rest of the cubes.")
|
||||
|
||||
(defvar fg42/before-initializing-theme-hook ()
|
||||
"The hook to plug any configuration to before initialize event of themes.")
|
||||
|
||||
|
@ -42,17 +34,12 @@ It executes way before the rest of the cubes.")
|
|||
"The hook to plug any configuration to after initialize event of themes.")
|
||||
|
||||
|
||||
(defmacro fg42/setup-theme! ()
|
||||
"Grab the them provided by `fg42/theme' and load it.
|
||||
|
||||
Load the theme via `use!' and pass the BODY to the `use!' macroro.
|
||||
If the theme name and the theme package name are different the package
|
||||
name can be set via `fg42/theme-package'."
|
||||
`(use! ,(intern (config-get-or theme-package-name (config-get theme)))
|
||||
"Setting up the ,pkg package."
|
||||
:config
|
||||
(progn
|
||||
(load-theme ',(intern (config-get theme)) t))))
|
||||
(defmacro fg42/setup-theme (&rest body)
|
||||
"Run the BODY inside the FG42 theme setup context."
|
||||
`(progn
|
||||
(run-hooks 'fg42/before-initializing-theme-hook)
|
||||
,@body
|
||||
(run-hooks 'fg42/after-initializing-theme-hook)))
|
||||
|
||||
|
||||
(provide 'fg42/themes)
|
|
@ -1,10 +1,10 @@
|
|||
;;; Utils --- Utils library of FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://devheroes.codes/FG42/FG42
|
||||
;; Version: 4.0.0
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -97,6 +97,29 @@ with is the buffer."
|
|||
,@form))
|
||||
|
||||
|
||||
;; TODO: A good candidate for an inline function
|
||||
(defun find-value-for (lst key)
|
||||
"Return the value of the given KEY in the given LST.
|
||||
For example for a list like (list :x 4 :y 5) we can find the value of
|
||||
`:x' by doing `(get-value-for lst :x)'."
|
||||
(let ((pairs (seq-partition lst 2)))
|
||||
(let ((pair (assq key pairs)))
|
||||
(when pair
|
||||
(cadr pair)))))
|
||||
|
||||
|
||||
(defun comp (&rest fns)
|
||||
"Compose the given list of FNS into one function that accepts multiple values.
|
||||
For example:
|
||||
(funcall (compose (lambda (x) (+ 1 x)) (lambda (x) (* x s))) 5)
|
||||
or
|
||||
(funcall (compose #'some-fn #'message) some-value)"
|
||||
(lambda (&rest values)
|
||||
(cl-reduce 'funcall (butlast fns)
|
||||
:from-end t
|
||||
:initial-value (apply (car (last fns)) values))))
|
||||
|
||||
|
||||
(defun path-join (&rest paths)
|
||||
"Join the given PATHS."
|
||||
(apply #'concat
|
||||
|
@ -134,27 +157,38 @@ last item in second form, etc."
|
|||
(:else `(->> (->> ,x ,form) ,@more))))
|
||||
|
||||
|
||||
(defun load-user-config (file)
|
||||
"Load the given FILE as user config file."
|
||||
(if (file-exists-p file)
|
||||
(load-file file)))
|
||||
|
||||
|
||||
(defmacro autoload-cube (fn file docstring &optional interactive)
|
||||
"A wrapper for autloading FN at FILE with the given DOCSTRING.
|
||||
This macro looks inside of the cubes directories. If the INTERACTIVE param
|
||||
is non-nil value it means that the function can be called interactively."
|
||||
`(autoload ,fn (expand-file-name (format "core/cubes/%s" ,file) fg42-home)
|
||||
,docstring ,interactive))
|
||||
|
||||
|
||||
(defmacro when-wm (&rest body)
|
||||
"Run the BODY only if in wm mode."
|
||||
(if (string= (getenv "FG42_WM") "true")
|
||||
`(progn ,@body)
|
||||
nil))
|
||||
|
||||
(defmacro when-not-wm (&rest body)
|
||||
"Run the BODY only if not in the wm mode."
|
||||
(if (not (string= (getenv "FG42_WM") "true"))
|
||||
`(progn ,@body)
|
||||
|
||||
(defmacro fg42/log (tag args)
|
||||
"If the debug is enabled log the give ARGS."
|
||||
(if fg42/debug-p
|
||||
`(message "[%s]: %s" ,tag (apply #'format ,args))
|
||||
nil))
|
||||
|
||||
|
||||
(defun get-base16-color-or (color-name default)
|
||||
"Return the color for COLOR-NAME if a base16 theme is loade otherwise DEFAULT."
|
||||
(let* ((theme (car custom-enabled-themes))
|
||||
(theme-sym (intern (format "%s-theme-colors" theme))))
|
||||
(defmacro fg42/info (&rest args)
|
||||
"If the debug is enabled log the give ARGS."
|
||||
(fg42/log "INFO" args))
|
||||
|
||||
(if (boundp theme-sym)
|
||||
(or (eval `(plist-get ,theme-sym ,color-name)) default)
|
||||
default)))
|
||||
|
||||
|
||||
(provide 'fg42/utils)
|
|
@ -0,0 +1,56 @@
|
|||
;;; fpkg --- a simple package manager for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2010-2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; Keywords: lisp fg42 IDE package manager
|
||||
;; Version: 1.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Simple package manager for FG42
|
||||
;;
|
||||
;;; Code:
|
||||
;;(require 'use-package)
|
||||
|
||||
|
||||
(defun inject-straight (args)
|
||||
"Inject `:straight t' to ARGS it the key was missing."
|
||||
(if (member :straight args)
|
||||
args
|
||||
(append args '(:straight t))))
|
||||
|
||||
|
||||
(defun inject-defer (args)
|
||||
"Inject `:defer t' to ARGS it the key was missing."
|
||||
(if (member :defer args)
|
||||
args
|
||||
(append args '(:defer t))))
|
||||
|
||||
|
||||
(defmacro fpkg/use (pkg &rest details)
|
||||
"Install the given package DETAILS PKG via use-package and straight."
|
||||
(declare (indent defun))
|
||||
|
||||
(if (and (listp details) (< 0 (length details)))
|
||||
(let ((params (inject-straight (inject-defer details))))
|
||||
(progn
|
||||
`(use-package ,pkg ,@params)))
|
||||
`(use-package ,pkg :straight t :defer t)))
|
||||
|
||||
|
||||
(provide 'fpkg)
|
||||
;;; fpkg.el ends here
|
|
@ -0,0 +1,64 @@
|
|||
;;; fpkg --- a simple package manager for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2010-2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; Keywords: lisp fg42 IDE package manager
|
||||
;; Version: 1.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Simple package manager for FG42
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'fg42/core)
|
||||
|
||||
|
||||
(defvar bootstrap-version 5)
|
||||
|
||||
(defcustom fpkg-package-directory (concat fg42-home "/.fpkg")
|
||||
"Specify the directory to store all the dependencies."
|
||||
:group 'fpkg
|
||||
:type 'string)
|
||||
|
||||
|
||||
(defun fpkg/install-and-load-use-package ()
|
||||
"Install and load the use-package in compile time."
|
||||
;; TODO Enable use-package on compile time
|
||||
;;(eval-when-compile)
|
||||
(straight-use-package 'use-package)
|
||||
(setq use-package-always-ensure t)
|
||||
(require 'use-package))
|
||||
|
||||
|
||||
|
||||
(defun fpkg/initialize ()
|
||||
"Initialize FPKG."
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)))
|
||||
|
||||
(unless (file-exists-p bootstrap-file)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
|
||||
'silent 'inhibit-cookies)
|
||||
(goto-char (point-max))
|
||||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage)
|
||||
(fpkg/install-and-load-use-package)))
|
||||
|
||||
(provide 'fpkg/core)
|
||||
;;; core.el ends here
|
|
@ -0,0 +1,85 @@
|
|||
;;; ob-gharphviz --- org-babel functions for gharphviz evaluation of FG42
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
|
||||
;; This file location is important and can't be under `fg42/' dir even
|
||||
;; though it is part of the FG42. That's due to the `org-babel' mechanism
|
||||
;; to automatically load the language backend. SO DO NOT MOVE IT.
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
(require 'ob-ref)
|
||||
(require 'ob-comint)
|
||||
(require 'ob-eval)
|
||||
(require 'ob-dot)
|
||||
|
||||
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("graphviz-dot" . "dot"))
|
||||
|
||||
(defvar org-babel-default-header-args:graphviz-dot
|
||||
'((:results . "file") (:exports . "results")))
|
||||
|
||||
(defun org-babel-expand-body:ghraphviz-dot (body params &optional processed-params)
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
(let ((vars (org-babel--get-vars params)))
|
||||
(mapc
|
||||
(lambda (pair)
|
||||
(let ((name (symbol-name (car pair)))
|
||||
(value (cdr pair)))
|
||||
(setq body
|
||||
(replace-regexp-in-string
|
||||
(concat "$" (regexp-quote name))
|
||||
(if (stringp value) value (format "%S" value))
|
||||
body
|
||||
t
|
||||
t))))
|
||||
vars)
|
||||
body))
|
||||
|
||||
(defun org-babel-execute:graphviz-dot (body params)
|
||||
"Execute a block of Template code with org-babel.
|
||||
This function is called by `org-babel-execute-src-block'"
|
||||
(let* ((out-file (cdr (or (assq :file params)
|
||||
(error "You need to specify a :file parameter"))))
|
||||
(cmdline (or (cdr (assq :cmdline params))
|
||||
(format "-T%s" (file-name-extension out-file))))
|
||||
(cmd (or (cdr (assq :cmd params)) "dot"))
|
||||
(coding-system-for-read 'utf-8) ;use utf-8 with sub-processes
|
||||
(coding-system-for-write 'utf-8)
|
||||
(in-file (org-babel-temp-file "dot-")))
|
||||
(with-temp-file in-file
|
||||
(insert (org-babel-expand-body:dot body params)))
|
||||
(org-babel-eval
|
||||
(concat cmd
|
||||
" " (org-babel-process-file-name in-file)
|
||||
" " cmdline
|
||||
" -o " (org-babel-process-file-name out-file)) "")
|
||||
;; signal that output has already been written to file
|
||||
nil))
|
||||
|
||||
|
||||
(defun org-babel-prep-session:graphviz-dot (session params)
|
||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
(error "Dot does not support sessions"))
|
||||
|
||||
(provide 'ob-graphviz-dot)
|
||||
;;; ob-graphviz-dot.el ends here
|
|
@ -0,0 +1,71 @@
|
|||
#+TITLE: FG42 Development
|
||||
#+AUTHOR: Sameer Rahmani
|
||||
#+SEQ_TODO: TODO(t/!) NEXT(n/!) BLOCKED(b@/!) | DONE(d%) WONT_DO(c@/!) FAILED(f@/!)
|
||||
#+TAGS: DOCS(d) EXAMPLES(e) Misc(m) Lib(l)
|
||||
#+STARTUP: logdrawer logdone logreschedule indent content align constSI entitiespretty nolatexpreview
|
||||
#+OPTIONS: tex:t
|
||||
#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Eule
|
||||
#+LATEX_CLASS: article
|
||||
#+LATEX_CLASS_OPTIONS: [a4paper]
|
||||
#+LATEX_HEADER: \usepackage{tcolorbox}
|
||||
#+LATEX_HEADER: \usepackage{mathabx}
|
||||
#+LATEX_HEADER: \newtcolorbox{infobox}[2][]{colback=cyan!5!white,before skip=14pt,after skip=8pt,colframe=cyan!75!black,sharp corners,title={#2},#1}
|
||||
|
||||
This document is dedicated to the resources, TODOs, research summary, ideas and whatever that is
|
||||
part of the development process.
|
||||
|
||||
|
||||
* Development Goals
|
||||
In the past we tried many different ideas and features but since we didn't have a clear goal set,
|
||||
we couldn't really make it work and differentiate good ideas from bad ones.
|
||||
|
||||
** Who are the target audience?
|
||||
On the first level, I should feel comfortable with it.
|
||||
** What set of features are important to us?
|
||||
|
||||
|
||||
* Tools
|
||||
|
||||
** Straight
|
||||
We gave it a shot before and it didn't work out but our requirements were different back then.
|
||||
We should give it a shot again
|
||||
|
||||
* Libraries
|
||||
|
||||
** Midnight mode
|
||||
It's a cool library that run some action every midnight, we can use it to clean up old buffers
|
||||
or other maintenance jobs
|
||||
|
||||
* Tasks
|
||||
** TODO =fpkg/use= doesn't work with =:init=
|
||||
** TODO Add a =:default= key to the cube indicating whether it should be enabled by default or not
|
||||
** TODO Reformat the modeline
|
||||
** TODO Create a macro similar to =with-ability= to run a block of code only if the given cube was active
|
||||
** TODO Enable =straight= and =use-package= integration on compile time. Checout out =fpkg/core.el=
|
||||
** TODO Check the =dracula= theme settings and configurations
|
||||
** TODO Add support for MacOS by create a cube with the following content
|
||||
#+BEGIN_SRC elisp
|
||||
(package-install 'exec-path-from-shell)
|
||||
(exec-path-from-shell-initialize)
|
||||
#+END_SRC
|
||||
** TODO Integrate window-purpose mode
|
||||
** TODO Turn on yasnippet mode for Go mode
|
||||
* Things that didn't work out
|
||||
- rbenv
|
||||
- helm
|
||||
- linum
|
||||
- tabbar
|
||||
- ido
|
||||
- ivy
|
||||
- spaceline
|
||||
- doom-modeline
|
||||
- smart-mode-line
|
||||
- desktop-mode
|
||||
- jedi
|
||||
- file-browser
|
||||
- dired+
|
||||
- guru
|
||||
- emoji
|
||||
- elpy
|
||||
- github
|
||||
- versioned-backup
|
|
@ -0,0 +1,61 @@
|
|||
[appendix]
|
||||
= Contributor Covenant Code of Conduct
|
||||
|
||||
== Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers
|
||||
pledge to making participation in our project and our community a harassment-free experience for everyone,
|
||||
regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
== Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
== Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to
|
||||
take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits,
|
||||
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban
|
||||
temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening,
|
||||
offensive, or harmful.
|
||||
|
||||
== Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing
|
||||
the project or its community. Examples of representing a project or community include using an official project
|
||||
e-mail address, posting via an official social media account, or acting as an appointed representative at an
|
||||
online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
== Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project
|
||||
team at devs@codamic.tech. The project team will review and investigate all complaints, and will respond in
|
||||
a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality
|
||||
with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
|
||||
repercussions as determined by other members of the project's leadership.
|
||||
|
||||
== Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at http://contributor-covenant.org/version/1/4[version]
|
||||
|
||||
http://contributor-covenant.org[homepage]
|
||||
http://contributor-covenant.org/version/1/4/[version]
|
|
@ -0,0 +1,59 @@
|
|||
[appendix]
|
||||
= Contributing to HellHound
|
||||
|
||||
Wow, thanks for your interest in helping out with HellHound. Let this document
|
||||
serve as your guide.
|
||||
|
||||
== Looking for work?
|
||||
|
||||
If you're looking for a task to work on, check out the
|
||||
http://github.com/Codamic/hellhound/issues?labels=TODO[TODO] in our issues.
|
||||
|
||||
Less defined tasks will be marked with the
|
||||
http://github.com/Codamic/hellhound/issues?labels=discuss[discuss label]. Jump in here if you want to be
|
||||
a part of something big.
|
||||
|
||||
== New Features
|
||||
|
||||
HellHound is the thinking persons framework, so every contribution starts with
|
||||
some *deeeep* thought. Finished?
|
||||
|
||||
Alright, your next step is to start a discussion.
|
||||
|
||||
Create an https://github.com/Codamic/hellhound/issues/new[issue] to start
|
||||
a conversation. Tell us what you're trying to accomplish and how you think you
|
||||
might do it. If all is well, we'll probably give you the :thumbsup: to
|
||||
start developing.
|
||||
|
||||
== Bugs
|
||||
|
||||
Of course, if you run into any straight-up bugs or weirdness feel free to skip
|
||||
the thinking (or at least too much of it) and immediately submit an https://github.com/codamic/hellhound/issues/new[issue].
|
||||
|
||||
|
||||
We have an issue template in place that will ask you some details
|
||||
about the platform you are running and how to reproduce the bug. (If
|
||||
you can reproduce it reliably. If not, go ahead and file the issue
|
||||
anyway so we can start looking at it.)
|
||||
|
||||
Some of the usual stuff we'll want to know:
|
||||
|
||||
* What happened?
|
||||
** "I manifested a being from the outer dimensions."
|
||||
* What did you expect to happen?
|
||||
** "Hello, world."
|
||||
* How can you reprodice it?
|
||||
** "I created a new HellHound service with the template, then installed some code that Bob Howard gave me."
|
||||
* What operating system and version are you using?
|
||||
** e.g. "OS X 10.8"
|
||||
* What version of Clojure, Java, and Leiningen or Boot are you using?
|
||||
** e.g. "Leiningen 2.5.2 on Java 1.8.0_u40 Java HotSpot(TM) 64-Bit Server VM"
|
||||
* What HellHound version are you using?
|
||||
** e.g. "0.5.0"
|
||||
** or, for a SNAPSHOT: "0.5.1-SNAPSHOT at d0cf2b4"
|
||||
|
||||
Even better, include a link to a gist or repository where we can jump straight
|
||||
to the problem.
|
||||
|
||||
== Tests
|
||||
<PLACEHOLDER TEXT>
|
|
@ -0,0 +1,31 @@
|
|||
== Getting Started
|
||||
In this section i'm going to walk you through the installation process of *FG42* and some basic usage. Also
|
||||
If you already know how to use Emacs you just need the installation subsection of this section.
|
||||
|
||||
=== Installation
|
||||
In order to run *FG42* you need *GNU Emacs >= 25*. FG42 uses several extensions internally
|
||||
which each of the has different external dependencies. To gain more information about external
|
||||
dependencies ( If we failed to tell you inside the **FG42** ) just run the `describe-extension`
|
||||
command. Also I have plans in near future to create some packages for popular gnu/linux distros
|
||||
and MacOS as well, but untill then you have to take care of the external dependencies by yourself.
|
||||
|
||||
In order to install **FG42**, issue the following commands:
|
||||
|
||||
[source,bash,linum]
|
||||
----
|
||||
# clonse the FG42 repository in ~/.fg42 directory
|
||||
git clone git://gitlab.com/FG42/FG42.git ~/.fg42/
|
||||
# You can clone it where ever your want
|
||||
cd ~/.fg42/
|
||||
# You need to be sudoer, the install script will ask for your password.
|
||||
make install
|
||||
----
|
||||
|
||||
Since the installer script uses `sudo`, during the installation process,
|
||||
you'll have to enter your password. Make sure that you're user account has
|
||||
a `sudo` access.
|
||||
|
||||
=== Execution
|
||||
If you installed FG42 using git your installation does not contain any elisp package. So, when for the
|
||||
first time you executes FG42 it detects the missing libraries and download them from Melpa. It might
|
||||
take a while depends on your internet connection.
|
|
@ -0,0 +1,10 @@
|
|||
#+AUTHOR: Sameer Rahmani
|
||||
#+EMAIL: lxsameer@gnu.org
|
||||
#+LANGUAGE: en
|
||||
#+OPTIONS: toc:nil <:t
|
||||
#+options: html5-fancy:t tex:t
|
||||
#+html_doctype: html5
|
||||
#+HTML_CONTAINER: div class="column"
|
||||
#+HTML_CONTENT_CLASS: row
|
||||
#+creator: <a href="https://www.gnu.org/software/emacs/">Emacs</a> 27.1 (<a href="https://orgmode.org">Org</a> mode )
|
||||
#+HTML_LINK_HOME: https://fg42.org/
|
|
@ -0,0 +1,7 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+PAGE: true
|
||||
#+TITLE: Categories
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+TITLE: <<<title>>>
|
||||
#+PAGE: true
|
||||
|
||||
|
||||
- [[file:../config.org][nil]]
|
|
@ -0,0 +1,14 @@
|
|||
#+SETUPFILE: ../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+DATE: 2021-07-01
|
||||
#+TITLE: FG42, The ultimate editor for true believers
|
||||
#+PAGE: true
|
||||
#+DESC: An GNU/Emacs based editor for hackers
|
||||
|
||||
#+INCLUDE: "../../../README.org::*Future Gadgets 42" :only-contents t
|
||||
|
||||
* Recent updates:
|
||||
|
||||
|
||||
#+INCLUDE: "../../../README.org::*License"
|
|
@ -0,0 +1,9 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: cube.html
|
||||
#+DATE: 2021-07-01
|
||||
#+TITLE: What is a Cube?
|
||||
#+PAGE: true
|
||||
#+DESC: What is a Cube? How to use it and How to define one?
|
||||
|
||||
TBD
|
|
@ -0,0 +1,9 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+DATE: 2021-07-01
|
||||
#+TITLE: FG42 Manual
|
||||
#+PAGE: true
|
||||
#+DESC: FG42 Manual
|
||||
|
||||
TBD
|
|
@ -0,0 +1,8 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+PAGE: true
|
||||
#+TITLE: Tags
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#+TITLE: FG42, The ultimate editor for true believers
|
||||
|
||||
- [[file:categories/nil.org][<<<title>>>]]
|
||||
- [[file:config.org][config]]
|
||||
- [[file:tags/index.org][Tags]]
|
||||
- [[file:categories/index.org][Categories]]
|
||||
- [[file:index.org][The little nest of mine]]
|
||||
- [[file:templates/tags.org][Tags]]
|
||||
- [[file:templates/index.org][The little nest of mine]]
|
||||
- [[file:templates/links_template.org][<<<title>>>]]
|
||||
- [[file:templates/categories.org][Categories]]
|
|
@ -0,0 +1,51 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{title}}</title>
|
||||
<meta name="description" content="FG42, The ultimate editor for true believers">
|
||||
<meta name="keywords" content="Emacs, GNU, Editor, Hackers, software, lisp">
|
||||
<meta name="author" content="Sameer Rahmani">
|
||||
<meta property="og:title" content="{{title}}" />
|
||||
<meta property="og:description" content="{{description}}" />
|
||||
|
||||
{{{head}}}
|
||||
<link rel="stylesheet" href="{{base-url}}/assets/styles/dark.css?1">
|
||||
<link rel="stylesheet" href="{{base-url}}/assets/styles/main.css?1">
|
||||
<link rel="stylesheet" href="{{base-url}}/assets/styles/arta.css?1">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<nav style="text-align: center;">
|
||||
<a href="/">HOME</a> | <a href="/manual/">Manual</a> | <a href="/cubes/">Cubes</a> | <a href="https://devheroes.codes/FG42/FG42">Source</a> | <a href="/categories/">Categories</a> | <a href="/tags/">Tags</a>
|
||||
</nav>
|
||||
<hr/>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
{{{preamble}}}
|
||||
</article>
|
||||
|
||||
<main id="content">
|
||||
{{{content}}}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<span>© 2010-2021 Sameer Rahmani</span><br/>
|
||||
<span>Built with <a href="https://www.gnu.org/software/emacs/">Emacs Lisp</a> and <a href="https://orgmode.org/">org-mode</a>.</span><br/>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="{{base-url}}/assets/js/highlight.pack.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
hljs.configure({languageDetectRe: /\bsrc-([\w-]+)\b/i})
|
||||
document.querySelectorAll('pre.src').forEach((block) => {
|
||||
console.dir(block);
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,7 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+PAGE: true
|
||||
#+TITLE: Categories
|
||||
|
||||
<<<links>>>
|
|
@ -0,0 +1,6 @@
|
|||
#+SETUPFILE: ../../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+TITLE: <<<:title>>>
|
||||
#+PAGE: true
|
||||
|
||||
<<<:docs>>>
|
|
@ -0,0 +1,13 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+PAGE: true
|
||||
#+TITLE: Cubes
|
||||
|
||||
*FG42* is built on top of an abstraction unit called *Cube* that logically groups a set of feature related
|
||||
to a functionality in a single callable and function like entity. For more info on cubes check out their
|
||||
[[../manual/cube.html
|
||||
][documentation]]. Here is a list of available cubes:
|
||||
|
||||
|
||||
<<<links>>>
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
<div class="container">
|
|
@ -0,0 +1,14 @@
|
|||
#+SETUPFILE: ../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+DATE: 2021-07-01
|
||||
#+TITLE: FG42, The ultimate editor for true believers
|
||||
#+PAGE: true
|
||||
#+DESC: An GNU/Emacs based editor for hackers
|
||||
|
||||
#+INCLUDE: "../../../README.org::*Future Gadgets 42" :only-contents t
|
||||
|
||||
* Recent updates:
|
||||
<<<links>>>
|
||||
|
||||
#+INCLUDE: "../../../README.org::*License"
|
|
@ -0,0 +1,7 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+TITLE: <<<title>>>
|
||||
#+PAGE: true
|
||||
|
||||
|
||||
<<<links>>>
|
|
@ -0,0 +1 @@
|
|||
<h1>{{title}}</h1>
|
|
@ -0,0 +1,2 @@
|
|||
<h1 class="title">{{title}}</h1>
|
||||
<span class="tags">{{{tags}}}</span> - <time>{{date}}</time>
|
|
@ -0,0 +1,3 @@
|
|||
<div class="tags">
|
||||
<span>{{tags}}</span>
|
||||
</div>
|
|
@ -0,0 +1,8 @@
|
|||
#+SETUPFILE: ../../config.org
|
||||
#+OPTIONS: toc:nil
|
||||
#+EXPORT_FILE_NAME: index.html
|
||||
#+PAGE: true
|
||||
#+TITLE: Tags
|
||||
|
||||
|
||||
<<<links>>>
|
859
docs/videos.org
859
docs/videos.org
|
@ -1,10 +1,9 @@
|
|||
#+TITLE: Emacs From Scratch - An Emacs tutorial for beginners
|
||||
#+TITLE: How to build an editor with Emacs Lisp
|
||||
#+SEQ_TODO: TODO(t/!) NEXT(n/!) BLOCKED(b@/!) | DONE(d%) CANCELLED(c@/!) FAILED(f@/!)
|
||||
#+TAGS: READER(r) MISC(m)
|
||||
#+STARTUP: logdrawer logdone logreschedule indent content align constSI entitiespretty overview
|
||||
|
||||
* DONE Episode 1 - Introduction
|
||||
CLOSED: [2022-01-09 Sun 19:03]
|
||||
* Episode 1 - Introduction
|
||||
** What is it all about?
|
||||
- Create an editor, development environment and Window Manager (yeah window manager) and ...
|
||||
- GNU/Emacs is amazing
|
||||
|
@ -39,857 +38,3 @@ CLOSED: [2022-01-09 Sun 19:03]
|
|||
- Repository: https://devheroes.codes/FG42
|
||||
- Website: https://lxsameer.com
|
||||
- Email: lxsameer@gnu.org or lxsameer@lxsameer.com
|
||||
* DONE Episode 2 - Survive on the first day
|
||||
CLOSED: [2022-02-11 Fri 10:28]
|
||||
** Why bother?
|
||||
** Why GNU/Emacs?
|
||||
*** People might say because of
|
||||
- Org-mode
|
||||
- LSP support
|
||||
- Support for many many languages
|
||||
- It's lightweight
|
||||
- Tons of plugins
|
||||
- ...
|
||||
*** I'd say
|
||||
- Coz it's a lisp environment with an editor attached to it
|
||||
- Lisp is the difference
|
||||
+ It's super easy to extend/hack emacs
|
||||
+ In compare to other editors
|
||||
- You can do pretty much whatever your like in ELisp
|
||||
- It's like a framework for building an editor
|
||||
|
||||
** FAQ
|
||||
*** What is the difference between Doom, Spacemacs, FG42 and ...?
|
||||
Different editors based on Emacs
|
||||
*** Which one should I use?
|
||||
*** How to install Emacs packages?
|
||||
|
||||
** UI Basics & Basic Concepts
|
||||
- Window
|
||||
- Frame
|
||||
- Mode line
|
||||
- Buffers
|
||||
- Mini buffer/Echo area
|
||||
- Point
|
||||
- Major mode
|
||||
- Minor mode
|
||||
|
||||
** Basic Keybindings
|
||||
How to read key bindings? Here is an example =C-x M-e 4=, it means press =x= key while
|
||||
holding =Control= and then press =e= key while pressing down =Alt= and finally press =4=.
|
||||
|
||||
- Emacs tutorial =C-h t= (or https://www.gnu.org/software/emacs/tour/)
|
||||
- Quit emacs =C-x C-c=
|
||||
- Abort =C-g=
|
||||
- Get Help =C-h= family
|
||||
+ =C-h f=
|
||||
+ =C-h v=
|
||||
+ =C-h m=
|
||||
+ =C-h k=
|
||||
+ =C-h a=
|
||||
|
||||
- Run a command (function) =M-x=
|
||||
- Visit a file =C-x C-f=
|
||||
- Search in Buffer =C-s=
|
||||
- Save buffer =C-x C-s=
|
||||
- Select region =C-SPC=
|
||||
- Copy =M-w=
|
||||
- Cut(killing) =C-w=
|
||||
- Paste(yanking) =C-y=
|
||||
- Kill buffer =C-x k=
|
||||
- Switch buffer =C-x b=
|
||||
- Undo =C-/=
|
||||
- Eval expression =C-x C-e=
|
||||
- =describe-mode=
|
||||
** Lisp basics
|
||||
- Expressions everywhere
|
||||
- Code a data structure
|
||||
- Almost everything in Lisp evaluates to themselves except:
|
||||
+ lists
|
||||
+ Symbols
|
||||
+ ...
|
||||
- Lisp laws:
|
||||
1. Everything in Lisp is an expression and evaluation of an expression
|
||||
means replacing it with its value
|
||||
|
||||
2. Almost everything in Lisp evaluates to themselves except:
|
||||
- Lists
|
||||
- Symbols
|
||||
- Quotes
|
||||
- ...
|
||||
-
|
||||
3. List evaluation
|
||||
* DONE Episode 3 - Lisp Basics
|
||||
CLOSED: [2022-03-12 Sat 18:38]
|
||||
** FAQ:
|
||||
- How to install Emacs?
|
||||
+ Just make sure to have *Emacs >= 27.1*
|
||||
- What's the routine to use Emacs ?
|
||||
+ Don't use Emacs like how you use other Editors.
|
||||
+ There is no limits(Almost).
|
||||
|
||||
- How evaluate forms?
|
||||
+ *C-x C-e* at the end of any expression and anywhere
|
||||
+ ielm
|
||||
+ Batch mode
|
||||
|
||||
** So Fare:
|
||||
|
||||
*** Lisp rules:
|
||||
1. Lisp is made of Expressions and they evaluate to a value.
|
||||
2. All the expression types evaluates to themselves with some exceptions.
|
||||
3. List evaluation
|
||||
|
||||
*** We will continue with Lisp basics for few episodes
|
||||
** Variables
|
||||
- How to define variables and constants
|
||||
- Set the value of a variable
|
||||
- Global and local scope
|
||||
- Lexical bindings vs Dynamic bindings
|
||||
+ =-*- lexical-binding: t; -*-=
|
||||
|
||||
** Functions
|
||||
- How to define functions
|
||||
- vs macros
|
||||
- vs special forms
|
||||
* DONE Episode 4 - Conditionals
|
||||
CLOSED: [2022-04-09 Sat 11:24]
|
||||
** What we learned so far
|
||||
** what is true and what's not
|
||||
** Let & prog family
|
||||
** Conditional special forms
|
||||
- if
|
||||
- when
|
||||
- unless
|
||||
- cond
|
||||
** Useful forms and functions
|
||||
- eq
|
||||
- equal
|
||||
- and
|
||||
- not
|
||||
- or
|
||||
- ...
|
||||
|
||||
** Type Predicts
|
||||
- numberp
|
||||
- stringp
|
||||
- listp
|
||||
- boundp
|
||||
- More at https://www.gnu.org/software/emacs/manual/html_node/elisp/Type-Predicates.html
|
||||
** type-of
|
||||
* DONE Episode 5 - Lists
|
||||
CLOSED: [2022-05-18 Wed 12:40]
|
||||
** What is a list?
|
||||
- Not a primitive type
|
||||
- A linked list made out of cons cells
|
||||
|
||||
** Cons Cells
|
||||
- A container for pairs
|
||||
- CAR
|
||||
- CDR (could-er)
|
||||
#+NAME: ep-5-cons
|
||||
#+BEGIN_SRC graphviz-dot :file /tmp/cons.svg :cmdline -Kdot -Tsvg
|
||||
digraph {
|
||||
graph [bgcolor=transparent]
|
||||
fontcolor="gray80"
|
||||
node [color=gray80 shape="box", fontcolor="gray80"]
|
||||
edge [color=gray80]
|
||||
rankdir = "LR"
|
||||
|
||||
subgraph cluster_0 {
|
||||
label="Cell"
|
||||
color="gray80"
|
||||
|
||||
graph [bgcolor=transparent, fontcolor="gray80"]
|
||||
node [color=gray80 shape="box", fontcolor="gray80"]
|
||||
a0[label="car: 'head"]
|
||||
b0[label="cdr: 'tail"]
|
||||
}
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS: ep-5-cons
|
||||
[[file:/tmp/cons.svg]]
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x1 (cons 'head 'tail))
|
||||
(car x1)
|
||||
(cdr x1)
|
||||
|
||||
'(head . tail)
|
||||
(cons 2 nil)
|
||||
(cons 1 x1)
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: ep-5-list
|
||||
#+BEGIN_SRC graphviz-dot :file /tmp/list.svg :cmdline -Kdot -Tsvg
|
||||
digraph {
|
||||
graph [bgcolor=transparent]
|
||||
fontcolor="gray80"
|
||||
node [color=gray80 shape="box", fontcolor="gray80"]
|
||||
edge [color=gray80]
|
||||
rankdir = "LR"
|
||||
|
||||
subgraph cluster_0 {
|
||||
label="Cell"
|
||||
color="gray80"
|
||||
graph [bgcolor=transparent, fontcolor="gray80"]
|
||||
node [color=gray80 shape="box", fontcolor="gray80"]
|
||||
a0[label="car: 1"]
|
||||
b0[label="cdr: "]
|
||||
}
|
||||
subgraph cluster_1 {
|
||||
label="Cell"
|
||||
color="gray80"
|
||||
node [color=gray80 shape="box"]
|
||||
a1[label="car: 2"]
|
||||
b1[label="cdr: "]
|
||||
b0 -> a1
|
||||
}
|
||||
subgraph cluster_2 {
|
||||
label="Cell"
|
||||
color="gray80"
|
||||
node [color=gray80 shape="box"]
|
||||
a2[label="car: 3"]
|
||||
b2[label="cdr: nil"]
|
||||
b1 -> a2
|
||||
}
|
||||
}
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS: ep-5-list
|
||||
[[file:/tmp/list.svg]]
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x2 (cons 1 (cons 2 (cons 3 nil))))
|
||||
(setq x3 (list 1 2 3))
|
||||
#+END_SRC
|
||||
|
||||
** Some useful functions
|
||||
- add-to-list
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x4 (list 1 2 3 4))
|
||||
(add-to-list 'x4 3)
|
||||
(add-to-list 'x4 6)
|
||||
#+END_SRC
|
||||
|
||||
- push & pop
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x5 (list 1 2 3 4))
|
||||
(push 1 x5)
|
||||
(pop x5)
|
||||
#+END_SRC
|
||||
|
||||
- member
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x6 (list 'a 'b 1 2))
|
||||
(member 'z x6)
|
||||
(member 1 x6)
|
||||
#+END_SRC
|
||||
|
||||
- delete
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x7 (list 1 2 3 4 5))
|
||||
(delete 3 x7)
|
||||
x7
|
||||
#+END_SRC
|
||||
|
||||
- remove
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x8 (list 1 2 3 4 5))
|
||||
(remove 3 x8)
|
||||
x8
|
||||
#+END_SRC
|
||||
|
||||
- car
|
||||
- cdr
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x9 (list 1 2 3 4))
|
||||
(car x9)
|
||||
(cdr x9)
|
||||
#+END_SRC
|
||||
|
||||
* DONE Episode 6 - Property & Association Lists
|
||||
CLOSED: [2022-06-13 Mon 10:38]
|
||||
** I have an idea
|
||||
- Develop *FG42* on stream
|
||||
- I'll announce the date and time on:
|
||||
+ Twitter: @lxsameer
|
||||
+ Youtube Community (maybe)
|
||||
|
||||
** eq vs equal
|
||||
- ~eq~ checks whether two objects are the same
|
||||
- ~equal~ checks whether two objects have similar structure and content.
|
||||
|
||||
** Property List (plist)
|
||||
- Is a list of paired elements
|
||||
- Each of the pairs associates a property name with a property or value
|
||||
- The order of the property names (keys) is not significant
|
||||
- Keys must be unique
|
||||
- Emacs uses plists to store text properties and symbol properties
|
||||
|
||||
*** Examples
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq x '(:a 1 "b" 2 c 3 :d ("foo" "bar") :j nil))
|
||||
x
|
||||
#+END_SRC
|
||||
|
||||
*** Functions
|
||||
- ~plist-get~ or ~lax-plist-get~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(plist-get x :a)
|
||||
(plist-get x "b")
|
||||
(lax-plist-get x "b")
|
||||
#+END_SRC
|
||||
|
||||
- ~plist-put~ or ~lax-plist-put~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(plist-put x :z 325)
|
||||
(plist-put x :z 10)
|
||||
(lax-plist-put x "b" 20)
|
||||
#+END_SRC
|
||||
|
||||
- ~plist-member~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(plist-get x :j)
|
||||
(plist-get x :g)
|
||||
(plist-member x :j)
|
||||
(plist-member x :g)
|
||||
#+END_SRC
|
||||
|
||||
** An example use case of plist
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun foo (&rest args)
|
||||
(message "ARGS: %s" args)
|
||||
(plist-get args :name))
|
||||
|
||||
(foo :age 20 :name 'bob "blah" '(12 34 4))
|
||||
#+END_SRC
|
||||
|
||||
** Association List (alist)
|
||||
- It is a list of cons cells called associations
|
||||
- Mapping some keys to some values
|
||||
- The ~CAR~ of each cons cell is the key, and the ~CDR~ is the associated value
|
||||
- The order of associations matters
|
||||
|
||||
*** Examples
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq y '((:a . 1) ("b" . 2) (c . 3) (:d "foo" "bar")))
|
||||
y
|
||||
#+END_SRC
|
||||
|
||||
*** Functions
|
||||
- ~assoc~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(assoc :a y)
|
||||
(assoc "b" y)
|
||||
#+END_SRC
|
||||
|
||||
- ~rassoc~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(rassoc 1 y)
|
||||
(rassoc 3 y)
|
||||
#+END_SRC
|
||||
|
||||
- ~assq~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(assq :a y)
|
||||
(assq "b" y)
|
||||
#+END_SRC
|
||||
|
||||
- ~alist-get~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(alist-get :a y)
|
||||
(alist-get :z y "blah")
|
||||
#+END_SRC
|
||||
|
||||
- ~cons~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq y1 (cons '(:z . 31) y))
|
||||
(assoc :z y1)
|
||||
#+END_SRC
|
||||
|
||||
** References
|
||||
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Association-Lists.html
|
||||
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Plist-Access.html
|
||||
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Plists-and-Alists.html
|
||||
|
||||
* DONE Episode 7 - Basic Loops
|
||||
CLOSED: [2022-07-09 Sat 10:31]
|
||||
** About previous episode
|
||||
- Duplicate keys in an association list
|
||||
- ~eval-defun~
|
||||
** While
|
||||
- Form:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(while CONDITION
|
||||
...body...)
|
||||
#+END_SRC
|
||||
- Loops and evaluates ~body~ as long as the ~CONDITION~ evaluates to true.
|
||||
- It always evaluats to the value of the ~CONDITION~ which will be false aaaaall the time.
|
||||
- We need to explicitly manage the condition.
|
||||
- Example:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(let ((foo 1))
|
||||
(while (< foo 10)
|
||||
(message ">> %s" foo)
|
||||
(setq foo (+ 1 foo))))
|
||||
|
||||
(let ((foo '(bar baz)))
|
||||
(while foo
|
||||
(message ">> %s" (car foo))
|
||||
(setq foo (cdr foo))))
|
||||
#+END_SRC
|
||||
|
||||
** dolist
|
||||
- It's a macro
|
||||
- Form:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(dolist (element list [result])
|
||||
...body...)
|
||||
#+END_SRC
|
||||
|
||||
- Evaluates the ~body~ with ~element~ set to the CAR of ~list~ on each iteration
|
||||
- At the ends evaluates ~result~ and return the evaluation result (if ~result~ is provided)
|
||||
- Example:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(let ((foo '(9 8 7 6 5 4)))
|
||||
(dolist (x foo (+ 10 1))
|
||||
(message ">> %s" x)))
|
||||
|
||||
|
||||
(let ((foo '(9 8 7 6 5 4)))
|
||||
(macroexpand-1
|
||||
'(dolist (x foo 10)
|
||||
(message ">> %s" x))))
|
||||
#+END_SRC
|
||||
|
||||
** dotimes
|
||||
- It's a macro too
|
||||
- Form:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(dotimes (var number)
|
||||
...body...)
|
||||
#+END_SRC
|
||||
- It's similar to ~dolist~ but iterates ~number~ of times
|
||||
- ~var~ in will contains the number of current iteration
|
||||
- Example:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(let ((foo 10))
|
||||
(dotimes (x foo)
|
||||
(message ">> %s" x)))
|
||||
|
||||
|
||||
(let ((foo 10))
|
||||
(macroexpand-1
|
||||
'(dotimes (x foo)
|
||||
(message ">> %s" x))))
|
||||
#+END_SRC
|
||||
|
||||
* DONE Episode 8 - More Loops
|
||||
CLOSED: [2022-07-29 Fri 15:11]
|
||||
** Recursion
|
||||
- A *Recursive* function, is a function that defines in terms of itself
|
||||
- Easy to implement
|
||||
- But should be careful with it to aviod infinit loops
|
||||
|
||||
*** Example
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun foo (int)
|
||||
(print int)
|
||||
(when (> int 0)
|
||||
(foo (- int 1))))
|
||||
|
||||
(foo 10)
|
||||
#+END_SRC
|
||||
|
||||
** Functional style loops
|
||||
*** Mapping functions Family
|
||||
- ~mapcar~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(mapcar #'1+ '(1 2 3 4 5))
|
||||
|
||||
(mapcar (lambda (x) (* x x))
|
||||
'(1 2 3 4))
|
||||
#+END_SRC
|
||||
|
||||
- ~mapc~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(mapc #'1+ '(1 2 3 4 5))
|
||||
(mapc #'print '(1 2 3 4 5))
|
||||
#+END_SRC
|
||||
|
||||
- ~map-concat~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(mapconcat (lambda (x)
|
||||
(format "[%s]" x))
|
||||
'(1 2 3 4 5)
|
||||
" <|> ")
|
||||
#+END_SRC
|
||||
|
||||
*** Seq module
|
||||
A collection of handy functions that operate on ~sequences~.
|
||||
|
||||
- ~seq-reduce~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(require 'seq)
|
||||
|
||||
(seq-reduce
|
||||
|
||||
(lambda (acc x)
|
||||
(+ acc x))
|
||||
|
||||
'(1 2 3 4)
|
||||
|
||||
0)
|
||||
#+END_SRC
|
||||
|
||||
- ~seq-filter~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(seq-filter (lambda (x) (< x 10))
|
||||
'(8 12 22 9))
|
||||
#+END_SRC
|
||||
- ~seq-partition~
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(seq-partition '(a b c d e f) 2)
|
||||
|
||||
#+END_SRC
|
||||
- ~seq-min~, ~seq-max~
|
||||
* DONE Episode 9 - Introduction to Macros
|
||||
CLOSED: [2022-09-11 Sun 11:08]
|
||||
** What is a macro?
|
||||
- A macro is defined much like a function
|
||||
- It works on compile time
|
||||
- It returns a new expression as the return value
|
||||
- The compiler "expands" a macro by replacing the macro call with the return value of the macro
|
||||
- Different evaluation rule than functions
|
||||
+ Unlike function calls, the arguments to a macro will be passed to the macro as they are,
|
||||
without evaluation.
|
||||
- Macros vs inline functions
|
||||
|
||||
** How to define and expand a macro?
|
||||
- We can define a macro using ~defmacro~ form
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro inc (val)
|
||||
(list #'1+ val))
|
||||
|
||||
(defmacro mydef (name val)
|
||||
(list 'setq (intern (concat "my-" (symbol-name name))) val))
|
||||
|
||||
(defmacro foo (val)
|
||||
(1+ val))
|
||||
#+END_SRC
|
||||
|
||||
- We can inspect the expansion process using the ~macroexpand~ function family.
|
||||
+ ~macroexpand~: Expands the macros until no macro exists in the top level forms
|
||||
+ ~macroexpand-all~: Expands the macros all the way down to the subforms
|
||||
+ ~macroexpand-1~: Expands the macro only for one level or cycle
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(macroexpand-1 '(inc 10))
|
||||
(macroexpand-1 '(mydef blah 20))
|
||||
(print (macroexpand-1 '(when (> 10 5) (print "something"))))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
** Feedback or question
|
||||
- https://lxsameer.com
|
||||
- [[https://twitter.com/lxsameer][@lxsameer]] on Twitter
|
||||
|
||||
* DONE Episode 10 - More on Macros
|
||||
CLOSED: [2022-11-04 Fri 15:25]
|
||||
** Quasiquote aka backquote (`)
|
||||
- Backquote constructs allow us to quote an expression, but selectively evaluate sub-expressions
|
||||
- Similar to a template engine for lisp expressions
|
||||
- It can be used on its own but it will shine in macro definitions
|
||||
- On the simplest form it is identical to ~quote~
|
||||
- Special markers ~,~ and ~,@~ can be used to mark expressions for evaluation
|
||||
- ~,~ will replace the return value of the evaluation with the expression
|
||||
- ~,@~ will replace and splice the return value of the evaluation
|
||||
*** Examples
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
`3
|
||||
`(1 2 3 4)
|
||||
`(1 2 3 ,(+ 5 6))
|
||||
`(1 2 3 ,(list 4 5 6))
|
||||
`(1 2 3 ,@(list 4 5 6))
|
||||
|
||||
`(setq ,(intern (upcase "some_var")) 3)
|
||||
#+END_SRC
|
||||
|
||||
** ~declare~ form
|
||||
- It's a special macro which can be used to add meta properties to a function or macro
|
||||
+ ~doc-string~
|
||||
+ ~indent~
|
||||
|
||||
** Real Examples
|
||||
Let's discuss ~defflag~ and ~when-flag~ macros in [[file:../core/fg42/flags.el]]
|
||||
|
||||
* DONE Episode 11 - Common pitfalls of Macros
|
||||
CLOSED: [2022-12-04 Sun 12:15]
|
||||
** Compiletime vs runtime
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; `do-something-with-side-effect' evaluates on compile time
|
||||
;; in the macro's context
|
||||
(defmacro wrong (x)
|
||||
(when x
|
||||
(do-something-with-side-effect x)))
|
||||
|
||||
;; `do-something-with-side-effect' evaluates on run time
|
||||
;; in the caller's context
|
||||
(defmacro correct (x)
|
||||
(when x
|
||||
`(do-something-with-side-effect ,x)))
|
||||
#+END_SRC
|
||||
** Variable Capture
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; `result' will hide any binding with the same name in the
|
||||
;; parent scope
|
||||
(defmacro wrong (f &rest body)
|
||||
`(let ((result ,f))
|
||||
(if result
|
||||
,@body
|
||||
(message "Failed: %s" result))))
|
||||
|
||||
(defvar result 1)
|
||||
(wrong 200 (message "> %s" result))
|
||||
|
||||
;; Instead we need to generate a local binding
|
||||
(defmacro correct (f &rest body)
|
||||
(let ((var (gensym)))
|
||||
`(let ((,var ,f))
|
||||
(if ,var
|
||||
,@body
|
||||
(message "Failed: %s" ,var)))))
|
||||
|
||||
(defvar result 1)
|
||||
(correct 200 (message "%s" result))
|
||||
#+END_SRC
|
||||
|
||||
More on *uninterned* symbols: https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Symbols.html
|
||||
|
||||
** Many evaluation
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; The argument `x' will be evaluated 2 times in this example.
|
||||
;; what if it contains side effects?
|
||||
(defmacro wrong (x)
|
||||
`(if ,x
|
||||
(do-something-with ,x)
|
||||
(do-somthing-else ,x)))
|
||||
|
||||
;; It's better to use a local binding for it and evaluate it
|
||||
;; just once
|
||||
(defmacro correct (x)
|
||||
(let ((var (gensym)))
|
||||
`(let ((,var ,x))
|
||||
(if ,var
|
||||
(do-something-with ,var)
|
||||
(do-somthing-else ,var)))))
|
||||
#+END_SRC
|
||||
** Evaluating arguments of a macro
|
||||
Never evaluate the arguments of a macro manually. E.g. with =eval=
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; `eval' here will be evaluated before the caller context
|
||||
;; is even populated
|
||||
(defmacro wrong (x)
|
||||
(list 'setq (eval x) 'blah))
|
||||
|
||||
;; The correct way is to mark `x' for evaluation instead
|
||||
(defmacro correct (x)
|
||||
`(setq ,x 'blah))
|
||||
#+END_SRC
|
||||
|
||||
More info: https://www.gnu.org/software/emacs/manual/html_node/elisp/Eval-During-Expansion.html
|
||||
** What's next?
|
||||
* DONE Episode 12 - Features & Load Paths
|
||||
CLOSED: [2023-01-14 Sat 11:44]
|
||||
** Emacs Lisp files
|
||||
Write elisp code in files with =.el= suffix.
|
||||
|
||||
*** Batch mode
|
||||
Execute an elisp file via Emacs in a non-interactive (script like) fashion:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
emacs --batch -l /path/to/the/file
|
||||
#+END_SRC
|
||||
|
||||
*** =load= function
|
||||
Loads an elisp file into the running Emacs process. For more info ~C-h f load~.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(load "/path/to/the/file")
|
||||
(load "PATH1")
|
||||
#+END_SRC
|
||||
|
||||
- It first looks for the =PATH + .elc= combination
|
||||
- If not successful, looks for the =PATH + .el= combination
|
||||
- If not successful, looks for platform dependent suffixes
|
||||
- If not successful, tries to load the =PATH= as it is
|
||||
|
||||
** Load Path
|
||||
*** =load-path=
|
||||
List of directories to search for files to load.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'load-path "/path/to/a/directory")
|
||||
#+END_SRC
|
||||
|
||||
*** =EMACSLOADPATH= environment variable
|
||||
|
||||
** Emacs =feature=
|
||||
Emacs tracks loaded packages and file via =features=. Each elisp file can =provide=, zero or
|
||||
more =features=.
|
||||
|
||||
Features are just symbols.
|
||||
|
||||
*** =features= list
|
||||
A list of all loaded features. For more info, try ~C-h v features~.
|
||||
|
||||
*** =featurep=
|
||||
A predicate function to check whether a feature is loaded or not.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(featurep 'some-feature)
|
||||
#+END_SRC
|
||||
|
||||
*** =provide=
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(provide 'some-feature)
|
||||
#+END_SRC
|
||||
|
||||
*** =require=
|
||||
If the given feature as the parameter is not loaded yet, loads it via the =load=
|
||||
function. For more info, ~C-h f require~.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(require 'some-feature)
|
||||
|
||||
;; Or
|
||||
|
||||
(require 'some-feature "/path/to/file")
|
||||
#+END_SRC
|
||||
|
||||
** Installing Emacs packages the hard way
|
||||
We can clone a library somewhere on the disk and add the path to it to the =load-path= list
|
||||
and load the library files.
|
||||
|
||||
But that would be tedious to do so for all the libraries. That's why we use a package manager
|
||||
* DONE Episode 13 - Editing Modes, Part 1
|
||||
CLOSED: [2023-06-10 Sat 15:44]
|
||||
Emacs provides a concept called ~editing mode~ that allows
|
||||
us to control different aspect of the editor.
|
||||
|
||||
** Major Modes
|
||||
Major modes are mutually exclusive, so each Buffer has exactly on
|
||||
major mode and just one major mode can be active at any given
|
||||
time. So, it is possible to switch between different major modes.
|
||||
|
||||
Major modes control the main behaviour of your editor for each buffer.
|
||||
For example, The active major mode might:
|
||||
|
||||
- Provide syntax highlighter
|
||||
- Control the indentation
|
||||
- Provide a local =keymap=
|
||||
- ...
|
||||
|
||||
To put it simply, major modes are specialized to handle certain files
|
||||
and buffers.
|
||||
|
||||
*** Naming Convenstion
|
||||
Usually, the name of a major mode is like =<major-mode-name>-mode= which is
|
||||
an interactive function that we can call either directly or via =M-x= interface.
|
||||
For example:
|
||||
|
||||
- python-mode
|
||||
- fundamental-mode
|
||||
- emacs-lisp-mode
|
||||
- ...
|
||||
|
||||
**** Keymap
|
||||
*We will take about Keymaps in the future*
|
||||
|
||||
Major modes usually have a keymap to hold their local keybindings that has the
|
||||
the =-map= suffix.
|
||||
|
||||
**** Hooks
|
||||
*We will take about Hooks in the future*
|
||||
|
||||
Hooks are lists of functions that can be called on certain occasions. For example,
|
||||
after a major mode activates.
|
||||
|
||||
Usually major modes come with at least one hook called =<major-mode-name>-hook= that
|
||||
runs after the major mode activates. E.g. =emacs-lisp-mode-hook= or =python-mode-hook=.
|
||||
|
||||
*** How Emacs choose a major mode for a buffer?
|
||||
When we open a file, Emacs goes through some hoops to figure out what major mode
|
||||
should it choose for that buffer.
|
||||
|
||||
To put it simply and avoid a lot of details, Emacs will try to match the buffer name
|
||||
against the keys in ~auto-mode-alist~ and uses the mode provided by that key as a value.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(("\\`/tmp/fol/" . text-mode)
|
||||
("\\.texinfo\\'" . texinfo-mode)
|
||||
("\\.texi\\'" . texinfo-mode)
|
||||
|
||||
("\\.el\\'" . emacs-lisp-mode)
|
||||
("\\.c\\'" . c-mode)
|
||||
("\\.h\\'" . c-mode)
|
||||
…)
|
||||
#+END_SRC
|
||||
|
||||
For more info check out:
|
||||
https://www.gnu.org/software/emacs/manual/html_node/elisp/Auto-Major-Mode.html
|
||||
|
||||
*** How to switch the major mode
|
||||
Just call the other mode or
|
||||
- ~major-mode-suspend~: Kills all the buffer local variables and record them
|
||||
- ~major-mode-restore~: This function restores the major mode recorded by ~major-mode-suspend~
|
||||
|
||||
For more info:
|
||||
https://www.gnu.org/software/emacs/manual/html_node/elisp/Major-Modes.html
|
||||
|
||||
** Minor Modes
|
||||
A minor mode provides optional features that users may enable or disable independently of
|
||||
the choice of major mode. Minor modes can be enabled individually or in combination.
|
||||
|
||||
The main difference with major modes is that minor modes are not mutually exclusive and
|
||||
are not tied to buffers. They can operate globally or local to buffers.
|
||||
|
||||
*** How to enable/disable minor modes?
|
||||
In order to toggle a minor mode we just have to call its function with no argument
|
||||
*interactively*. In order to disable a minor mode we can pass a negative integer,
|
||||
and to enable it we can pass a positive integer.
|
||||
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; Enable
|
||||
(blah-mode 1)
|
||||
|
||||
;; Disable
|
||||
(blah-mode -1)
|
||||
#+END_SRC
|
||||
|
||||
** Useful functions and variables
|
||||
- ~describe-mode~: Display documentation of current major mode and minor modes and a brief
|
||||
summary of the state of the current buffer.
|
||||
- ~local-minor-modes~: This buffer-local variable lists the currently enabled minor modes
|
||||
in the current buffer, and is a list of symbols.
|
||||
- ~global-minor-modes~: This variable lists the currently enabled global minor modes,
|
||||
and is a list of symbols.
|
||||
- ~minor-mode-list~: The value of this variable is a list of all minor mode commands.
|
||||
* Episode 14 - Editing Modes, Part 2
|
||||
** Quick overview:
|
||||
*** A simple minor mode
|
||||
*** Interactive functions
|
||||
*** Hooks
|
||||
*** Keymaps
|
||||
** Let's do it
|
||||
** Resources:
|
||||
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers
|
||||
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks.html
|
||||
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Keymaps.html
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
;; Version: 3.0.0
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(setq debug-on-error t)
|
||||
(defvar fg42-v3 "true")
|
||||
|
||||
(add-to-list 'load-path (concat (getenv "FG42_HOME") "/core"))
|
||||
|
||||
;; Prevent package.el to install anything at startup
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
(setq tab-width 2)
|
||||
|
||||
(setq custom-file (format "%s/.fg42.custom.el" (getenv "HOME")))
|
||||
(setq user-emacs-directory "~/.fg42/emacs.d")
|
||||
(setq user-init-file
|
||||
(format "%s/.fg42.%s"
|
||||
(getenv "HOME")
|
||||
(if fg42-v3 "v3.el" "el")))
|
||||
|
||||
|
||||
;; Load the custom ization file. In FG42 it is different than
|
||||
;; the default `user-init-file'
|
||||
(if (file-exists-p custom-file)
|
||||
(load custom-file))
|
||||
|
||||
(require 'fg42)
|
||||
|
||||
(fg42/before-initialize)
|
||||
(fg42/initialize)
|
||||
|
||||
(run-hooks 'fg42/after-cubes-setup-hook)
|
||||
(run-hooks 'fg42-after-init-hook)
|
||||
|
||||
(provide 'fg42-config)
|
||||
;;; fg42-config.el ends here
|
|
@ -0,0 +1,4 @@
|
|||
#! /bin/sh
|
||||
#export FG42_HOME=/Users/sameer.rahmani/.fg42
|
||||
#open -a emacs --args ' --no-splash --title FG42 -l $FG42_HOME/fg42-config.el "$@"'
|
||||
do shell script "/usr/bin/emacs --name FG42 --no-splash --title FG42 -l /Users/sameer.rahmani/.fg42/fg42-config.el"
|
277
flake.lock
277
flake.lock
|
@ -1,277 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"emacs-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715274454,
|
||||
"narHash": "sha256-QnQwZXWFE9fj1Y/0DZPRcVQIY/J8ejP6QtWd5QhMpQ8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "c6e7308733e76548d10615d74669919a243e93c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "c6e7308733e76548d10615d74669919a243e93c8",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"emacs-overlay_2": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-stable": "nixpkgs-stable_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1707815184,
|
||||
"narHash": "sha256-WFoDXgaPdhjgQB3ut+ZN+VT7e60Yw+KUyvUkOSu5Wto=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "0f7f3b39157419f3035a2dad39fbaf8a4ba0448d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "0f7f3b39157419f3035a2dad39fbaf8a4ba0448d",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714641030,
|
||||
"narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_2": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1712014858,
|
||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1707451808,
|
||||
"narHash": "sha256-UwDBUNHNRsYKFJzyTMVMTF5qS4xeJlWoeyJf+6vvamU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "442d407992384ed9c0e6d352de75b69079904e4e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "442d407992384ed9c0e6d352de75b69079904e4e",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1714640452,
|
||||
"narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib_2": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1711703276,
|
||||
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1715106579,
|
||||
"narHash": "sha256-gZMgKEGiK6YrwGBiccZ1gemiUwjsZ1Zv49KYOgmX2fY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8be0d8a1ed4f96d99b09aa616e2afd47acc3da89",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable_2": {
|
||||
"locked": {
|
||||
"lastModified": 1707650010,
|
||||
"narHash": "sha256-dOhphIA4MGrH4ElNCy/OlwmN24MsnEqFjRR6+RY7jZw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "809cca784b9f72a5ad4b991e0e7bcf8890f9c3a6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1707689078,
|
||||
"narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"noether": {
|
||||
"inputs": {
|
||||
"emacs-overlay": "emacs-overlay_2",
|
||||
"flake-parts": "flake-parts_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715464233,
|
||||
"narHash": "sha256-VPhsO6yVPq1h0pI+tBnH+/JCDWUZVaFrPy782dOmu2c=",
|
||||
"ref": "refs/tags/v0.3.0",
|
||||
"rev": "5c40c1a5783b0904fb106bd6cc70671e7b1e7320",
|
||||
"revCount": 57,
|
||||
"type": "git",
|
||||
"url": "https://devheroes.codes/lxsameer/noether"
|
||||
},
|
||||
"original": {
|
||||
"ref": "refs/tags/v0.3.0",
|
||||
"type": "git",
|
||||
"url": "https://devheroes.codes/lxsameer/noether"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"noether": "noether"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
106
flake.nix
106
flake.nix
|
@ -1,106 +0,0 @@
|
|||
# Fg42 - Emacs Editor for advance users
|
||||
#
|
||||
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{
|
||||
description = "FG42 - Emacs Editor for advance users";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
|
||||
inputs.noether = {
|
||||
url = "git+https://devheroes.codes/lxsameer/noether?ref=refs/tags/v0.3.0";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
inputs.emacs-overlay = {
|
||||
url = "github:nix-community/emacs-overlay/c6e7308733e76548d10615d74669919a243e93c8"; #"github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
outputs = { self, nixpkgs, flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = [
|
||||
"aarch64-darwin"
|
||||
"riscv64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
flake = {
|
||||
|
||||
# The home-manager integration. The can use FG42 with home-manager by including
|
||||
# this module.
|
||||
hm-module = rec {
|
||||
fg42 = import ./nix/hm;
|
||||
default = fg42;
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = { config, self', inputs', pkgs, system, ... }:
|
||||
let
|
||||
test-x = pkgs.writeShellApplication {
|
||||
name = "test-x";
|
||||
runtimeInputs = [ pkgs.xorg.xorgserver ];
|
||||
|
||||
text = ''
|
||||
${pkgs.xorg.xorgserver.out}/bin/Xephyr -br -ac -noreset -screen 800x600 :1
|
||||
'';
|
||||
};
|
||||
|
||||
app = pkgs.callPackage ./nix/fg42 {
|
||||
inherit nixpkgs;
|
||||
extraPackages = {
|
||||
noether = inputs.noether.outputs.packages.${system}.default;
|
||||
};
|
||||
};
|
||||
|
||||
fg42 = app.drv;
|
||||
|
||||
run-test-wm = pkgs.writeShellApplication {
|
||||
name = "run-test-wm";
|
||||
runtimeInputs = [ fg42 ];
|
||||
|
||||
text = ''
|
||||
DISPLAY=:1 ${fg42}/bin/fg42-wm
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
packages = app.emacsPkgs // {
|
||||
default = fg42;
|
||||
wm = fg42;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = [ fg42 pkgs.fish test-x run-test-wm ];
|
||||
buildInputs = [ fg42 ];
|
||||
};
|
||||
|
||||
apps.wm = {
|
||||
type = "app";
|
||||
program = "${run-test-wm}/bin/run-test-wm";
|
||||
};
|
||||
|
||||
apps.x = {
|
||||
type = "app";
|
||||
program = "${test-x}/bin/test-x";
|
||||
};
|
||||
|
||||
apps.default = {
|
||||
type = "app";
|
||||
program = "${fg42}/bin/fg42";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
;; Important Note: On linux you need to add your user to 'dialout' group
|
||||
;; OS reqyurements: You need to install these utilities:
|
||||
;; * arduino-mk
|
||||
;; * python-serial
|
||||
;; * avrdude
|
||||
;; * libdevice-serialport-perl
|
||||
;; * libyaml-perl
|
||||
;;
|
||||
;; You need following environments veriables:
|
||||
;; export ARDUINO_DIR=$HOME/bin/arduino-1.6.8
|
||||
;; export ARDMK_DIR=/usr/share/arduino
|
||||
;; export ARDMK_PATH=/usr/bin
|
||||
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/arduino/init)
|
||||
|
||||
;; Dependencies ----------------------------------
|
||||
(depends-on 'arduino-mode)
|
||||
(depends-on 'company-arduino)
|
||||
(depends-on 'mustache)
|
||||
|
||||
;; Extension -------------------------------------
|
||||
(extension arduino
|
||||
:version "2.31"
|
||||
:on-initialize extensions/arduino-initialize)
|
||||
|
||||
(provide 'extensions/arduino)
|
||||
;;; arduino.el ends here
|
|
@ -0,0 +1,10 @@
|
|||
# If you didn't define these environment variables, uncomment these and fix the paths
|
||||
#ARDUINO_DIR=$HOME/bin/arduino-1.6.8
|
||||
#ARDMK_DIR=/usr/share/arduino
|
||||
#ARDMK_PATH=/usr/bin
|
||||
|
||||
BOARD_TAG=uno
|
||||
ARDUINO_PORT=/dev/ttyACM0
|
||||
ARDUINO_LIBS=
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
|
@ -0,0 +1,67 @@
|
|||
;;; Code:
|
||||
|
||||
;; Functions -------------------------------------------------
|
||||
|
||||
;;;###autoload
|
||||
(defun create-makefile ()
|
||||
"Create the arduino make file in the same directory as the ino file if doesn't exits."
|
||||
(let ((makefile (concat (file-name-directory buffer-file-name) "Makefile"))
|
||||
(makefile-src (concat fg42-home "/lib/extensions/arduino/Makefile")))
|
||||
(if (not (file-exists-p makefile))
|
||||
(progn (message "Creating arduino make file")
|
||||
(copy-file makefile-src makefile)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun arduino/compilation-finished (buffer result)
|
||||
(cond ((string-match "finished" result)
|
||||
(bury-buffer "*compilation*")
|
||||
(message "Compilation done."))
|
||||
(t
|
||||
(message "Compilation field."))))
|
||||
|
||||
;;;###autoload
|
||||
(defun arduino/compilation-and-upload-finished (buffer result)
|
||||
(cond ((string-match "finished" result)
|
||||
(bury-buffer "*compilation*")
|
||||
(message "Compilation done.")
|
||||
(message "Uploading")
|
||||
(arduino/upload))
|
||||
(t
|
||||
(message "Compilation field."))))
|
||||
|
||||
;;;###autoload
|
||||
(defun arduino/compile ()
|
||||
"Compile the current arduino project."
|
||||
(interactive)
|
||||
(let ((compilation-finish-functions 'arduino/compilation-finished))
|
||||
(recompile)))
|
||||
|
||||
|
||||
(defun arduino/upload ()
|
||||
(interactive)
|
||||
(let ((compile-command "make upload"))
|
||||
(recompile)))
|
||||
|
||||
;;;###autoload
|
||||
(defun arduino/compile-and-upload ()
|
||||
"Compile and upload the current arduino project."
|
||||
(interactive)
|
||||
(let ((compilation-finish-functions 'arduino/compilation-and-upload-finished))
|
||||
(recompile)))
|
||||
|
||||
;;;###autoload
|
||||
(defun extensions/arduino-initialize ()
|
||||
"Arduino development plugin initialization."
|
||||
|
||||
(ability arduino-editor ('flycheck)
|
||||
"Gives FG42 the ability to edit arduino related contents."
|
||||
(add-hook 'arduino-mode-hook 'create-makefile)
|
||||
(setq auto-mode-alist (cons '("\\.\\(pde\\|ino\\)$" . arduino-mode) auto-mode-alist))
|
||||
|
||||
(global-set-key (kbd "C-c c") 'arduino/compile)
|
||||
(global-set-key (kbd "C-c u") 'arduino/upload)
|
||||
(autoload 'arduino-mode "arduino-mode" "Arduino editing mode." t))
|
||||
(message "'arduino' extension has been initialized."))
|
||||
|
||||
|
||||
(provide 'extensions/arduino/init)
|
|
@ -0,0 +1,22 @@
|
|||
;;; Auth --- Secret management extension for FG42
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/auth/init)
|
||||
|
||||
;; Dependencies ----------------------------------
|
||||
(depends-on 'rcauth-notify)
|
||||
|
||||
(defun auth-doc ()
|
||||
"TBD"
|
||||
"TBD")
|
||||
|
||||
;; Extension -------------------------------------
|
||||
(extension auth
|
||||
:version "2.32"
|
||||
:on-initialize extensions/auth-initialize
|
||||
:docs "lib/extensions/auth/readme.org")
|
||||
|
||||
(provide 'extensions/auth)
|
||||
;;; auth.el ends here
|
|
@ -0,0 +1,45 @@
|
|||
;;; Auth --- Secret management extension for FG42
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'auth-source)
|
||||
|
||||
(defvar auht/sources '((:sources "~/.authinfo.gpg")))
|
||||
|
||||
(defun auth/find-credential (host)
|
||||
"Find the credential for the given HOST.
|
||||
Return a list of credential pairs."
|
||||
(let (auth-list '())
|
||||
(dolist (cred (auth-source-search :host host
|
||||
:require '(:user :secret)))
|
||||
(let ((user (plist-get cred :user))
|
||||
(secret (plist-get cred :secret)))
|
||||
(add-to-list 'auth-list
|
||||
(list user
|
||||
(if (functionp secret)
|
||||
(funcall secret)
|
||||
secret)))))
|
||||
auth-list))
|
||||
|
||||
(defun utils/bold (text)
|
||||
"Make the TEXT appears in bold form."
|
||||
(propertize text 'face 'bold))
|
||||
|
||||
|
||||
(defun auth/credential-for (args host)
|
||||
"Return the credential for the given HOST.
|
||||
ARGS should be ignored."
|
||||
(interactive "P\nsHost: ")
|
||||
(dolist (pair (auth/find-credential host))
|
||||
(let* ((user (car pair))
|
||||
(pass (car (cdr pair)))
|
||||
(msg (concat "User: " (utils/bold user)
|
||||
" Passowrd: " (utils/bold pass))))
|
||||
(message msg))))
|
||||
|
||||
|
||||
(defun extensions/irc-initialize ()
|
||||
"Initialize the Auth extension."
|
||||
(setq auth-sources auth/sources))
|
||||
|
||||
(provide 'extensions/irc/init)
|
||||
;;; init.el ends here
|
|
@ -0,0 +1,27 @@
|
|||
(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/clojure/init)
|
||||
|
||||
;; Dependencies ----------------------------------
|
||||
(depends-on 'clojure-mode)
|
||||
(depends-on 'cider)
|
||||
(depends-on 'paredit)
|
||||
(depends-on 'flycheck)
|
||||
(depends-on 'flycheck-clojure)
|
||||
(depends-on 'clj-refactor)
|
||||
(depends-on 'let-alist)
|
||||
(depends-on 'clojure-mode-extra-font-locking)
|
||||
(depends-on 'flycheck-clj-kondo)
|
||||
;(depends-on 'core-async-mode)
|
||||
(depends-on 'yesql-ghosts)
|
||||
(depends-on 'rainbow-delimiters)
|
||||
|
||||
(defun clojure-doc ()
|
||||
"something fun")
|
||||
;; Extension -------------------------------------
|
||||
(extension clojure
|
||||
:version "2.32"
|
||||
:on-initialize extensions/clojure-initialize
|
||||
:docs "lib/extensions/clojure/readme.org")
|
||||
|
||||
(provide 'extensions/clojure)
|
|
@ -0,0 +1,320 @@
|
|||
(defun setup-keys ()
|
||||
(define-key clojure-mode-map (kbd "M-<right>") 'paredit-forward-slurp-sexp)
|
||||
(define-key clojure-mode-map (kbd "M-<left>") 'paredit-backward-slurp-sexp)
|
||||
|
||||
(define-key clojure-mode-map (kbd "C-<right>") 'right-word)
|
||||
(define-key clojure-mode-map (kbd "C-<left>") 'left-word)
|
||||
(global-set-key (kbd "C-<right>") 'right-word)
|
||||
(global-set-key (kbd "C-<left>") 'left-word))
|
||||
|
||||
;; Add requires to blank devcards files
|
||||
(defun cljr--find-source-ns-of-devcard-ns (test-ns test-file)
|
||||
(let* ((ns-chunks (split-string test-ns "[.]" t))
|
||||
(test-name (car (last ns-chunks)))
|
||||
(src-dir-name (s-replace "devcards/" "src/" (file-name-directory test-file)))
|
||||
(replace-underscore (-partial 's-replace "_" "-"))
|
||||
(src-ns (car (--filter (or (s-prefix-p it test-name)
|
||||
(s-suffix-p it test-name))
|
||||
(-map (lambda (file-name)
|
||||
(funcall replace-underscore
|
||||
(file-name-sans-extension file-name)))
|
||||
(directory-files src-dir-name))))))
|
||||
(when src-ns
|
||||
(mapconcat 'identity (append (butlast ns-chunks) (list src-ns)) "."))))
|
||||
|
||||
(defun clj--find-devcards-component-name ()
|
||||
(or
|
||||
(ignore-errors
|
||||
(with-current-buffer
|
||||
(find-file-noselect (clj--src-file-name-from-cards (buffer-file-name)))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(search-backward "defcomponent ")
|
||||
(clojure-forward-logical-sexp)
|
||||
(skip-syntax-forward " ")
|
||||
(let ((beg (point))
|
||||
(end (progn (re-search-forward "\\w+")
|
||||
(point))))
|
||||
(buffer-substring-no-properties beg end)))))
|
||||
""))
|
||||
|
||||
(defun cljr--add-card-declarations ()
|
||||
(save-excursion
|
||||
(let* ((ns (clojure-find-ns))
|
||||
(source-ns (cljr--find-source-ns-of-devcard-ns ns (buffer-file-name))))
|
||||
(cljr--insert-in-ns ":require")
|
||||
(when source-ns
|
||||
(insert "[" source-ns " :refer [" (clj--find-devcards-component-name) "]]"))
|
||||
(cljr--insert-in-ns ":require")
|
||||
(insert "[devcards.core :refer-macros [defcard]]"))
|
||||
(indent-region (point-min) (point-max))))
|
||||
|
||||
(defun live-delete-and-extract-sexp ()
|
||||
"Delete the sexp and return it."
|
||||
(interactive)
|
||||
(let* ((begin (point)))
|
||||
(forward-sexp)
|
||||
(let* ((result (buffer-substring-no-properties begin (point))))
|
||||
(delete-region begin (point))
|
||||
result)))
|
||||
|
||||
(defun live-cycle-clj-coll ()
|
||||
"convert the coll at (point) from (x) -> {x} -> [x] -> (x) recur"
|
||||
(interactive)
|
||||
(let* ((original-point (point)))
|
||||
(while (and (> (point) 1)
|
||||
(not (equal "(" (buffer-substring-no-properties (point) (+ 1 (point)))))
|
||||
(not (equal "{" (buffer-substring-no-properties (point) (+ 1 (point)))))
|
||||
(not (equal "[" (buffer-substring-no-properties (point) (+ 1 (point))))))
|
||||
(backward-char))
|
||||
(cond
|
||||
((equal "(" (buffer-substring-no-properties (point) (+ 1 (point))))
|
||||
(insert "{" (substring (live-delete-and-extract-sexp) 1 -1) "}"))
|
||||
((equal "{" (buffer-substring-no-properties (point) (+ 1 (point))))
|
||||
(insert "[" (substring (live-delete-and-extract-sexp) 1 -1) "]"))
|
||||
((equal "[" (buffer-substring-no-properties (point) (+ 1 (point))))
|
||||
(insert "(" (substring (live-delete-and-extract-sexp) 1 -1) ")"))
|
||||
((equal 1 (point))
|
||||
(message "beginning of file reached, this was probably a mistake.")))
|
||||
(goto-char original-point)))
|
||||
|
||||
|
||||
(defun my-toggle-expect-focused ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(search-backward "(expect" (cljr--point-after 'cljr--goto-toplevel))
|
||||
(forward-word)
|
||||
(if (looking-at "-focused")
|
||||
(paredit-forward-kill-word)
|
||||
(insert "-focused"))))
|
||||
|
||||
(defun my-remove-all-focused ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "(expect-focused" nil t)
|
||||
(delete-char -8))))
|
||||
|
||||
(defun clj-duplicate-top-level-form ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(cljr--goto-toplevel)
|
||||
(insert (cljr--extract-sexp) "\n")
|
||||
(cljr--just-one-blank-line)))
|
||||
|
||||
(defun clj-hippie-expand-no-case-fold ()
|
||||
(interactive)
|
||||
(let ((old-syntax (char-to-string (char-syntax ?/))))
|
||||
(modify-syntax-entry ?/ " ")
|
||||
(hippie-expand-no-case-fold)
|
||||
(modify-syntax-entry ?/ old-syntax)))
|
||||
|
||||
(defun nrepl-warn-when-not-connected ()
|
||||
(interactive)
|
||||
(message "Oops! You're not connected to an nREPL server. Please run M-x cider or M-x cider-jack-in to connect."))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun cljr-init ()
|
||||
(interactive)
|
||||
(require 'clj-refactor)
|
||||
|
||||
(clj-refactor-mode 1)
|
||||
|
||||
(setq cljr-magic-require-namespaces
|
||||
'(("io" . "clojure.java.io")
|
||||
("set" . "clojure.set")
|
||||
("str" . "clojure.string")
|
||||
("walk" . "clojure.walk")
|
||||
("zip" . "clojure.zip")
|
||||
("time" . "clj-time.core")
|
||||
("log" . "clojure.tools.logging")
|
||||
("json" . "cheshire.core")))
|
||||
|
||||
;; refer all from expectations
|
||||
(setq cljr-expectations-test-declaration "[expectations :refer :all]")
|
||||
|
||||
;; insert keybinding setup here
|
||||
(cljr-add-keybindings-with-prefix "C-c v")
|
||||
(setq cljr-favor-prefix-notation nil)
|
||||
(setq cljr-favor-private-functions nil)
|
||||
|
||||
;; Don't warn me about the dangers of clj-refactor, fire the missiles!
|
||||
(setq cljr-warn-on-eval nil)
|
||||
|
||||
(add-hook 'clojure-mode-hook #'yas-minor-mode)
|
||||
|
||||
;; no auto sort
|
||||
(setq cljr-auto-sort-ns nil)
|
||||
|
||||
;; do not prefer prefixes when using clean-ns
|
||||
(setq cljr-favor-prefix-notation nil)
|
||||
|
||||
(cljr-add-keybindings-with-modifier "C-s-")
|
||||
|
||||
(define-key clj-refactor-map (kbd "C-x C-r") 'cljr-rename-file)
|
||||
(define-key clojure-mode-map [remap paredit-forward] 'clojure-forward-logical-sexp)
|
||||
(define-key clojure-mode-map [remap paredit-backward] 'clojure-backward-logical-sexp)
|
||||
(define-key clojure-mode-map (kbd "C->") 'cljr-thread)
|
||||
(define-key clojure-mode-map (kbd "C-<") 'cljr-unwind)
|
||||
|
||||
(define-key clj-refactor-map
|
||||
(cljr--key-pairs-with-modifier "C-s-" "xf") 'my-toggle-expect-focused)
|
||||
(define-key clj-refactor-map
|
||||
(cljr--key-pairs-with-modifier "C-s-" "xr") 'my-remove-all-focused)
|
||||
|
||||
(defadvice cljr--add-ns-if-blank-clj-file (around add-devcards activate)
|
||||
(ignore-errors
|
||||
(when (and cljr-add-ns-to-blank-clj-files
|
||||
(cljr--clojure-ish-filename-p (buffer-file-name))
|
||||
(= (point-min) (point-max)))
|
||||
ad-do-it
|
||||
(when (clj--is-card? (buffer-file-name))
|
||||
(cljr--add-card-declarations)))))
|
||||
|
||||
(defadvice cljr-find-usages (before setup-grep activate)
|
||||
(window-configuration-to-register ?$)))
|
||||
|
||||
;;;###autoload
|
||||
(defun clojure-mode-init ()
|
||||
(interactive)
|
||||
|
||||
(require 'clojure-mode-extra-font-locking)
|
||||
(require 'cider)
|
||||
(require 'paredit)
|
||||
|
||||
;; indent [quiescent.dom :as d] specially
|
||||
(define-clojure-indent
|
||||
(d/a 1)
|
||||
(d/button 1)
|
||||
(d/div 1)
|
||||
(d/form 1)
|
||||
(d/h1 1)
|
||||
(d/h2 1)
|
||||
(d/h3 1)
|
||||
(d/h4 1)
|
||||
(d/h5 1)
|
||||
(d/hr 1)
|
||||
(d/img 1)
|
||||
(d/label 1)
|
||||
(d/li 1)
|
||||
(d/option 1)
|
||||
(d/p 1)
|
||||
(d/pre 1)
|
||||
(d/select 1)
|
||||
(d/small 1)
|
||||
(d/span 1)
|
||||
(d/strong 1)
|
||||
(d/ul 1)
|
||||
(d/svg 1)
|
||||
|
||||
;; Hafslund specifics
|
||||
(e/prose 1)
|
||||
(e/value 1)
|
||||
(e/section 1)
|
||||
(e/section-prose 1)
|
||||
(e/page 1)
|
||||
(e/instructions 1)
|
||||
(l/padded 1)
|
||||
(l/bubble-grid 1)
|
||||
(l/slider 1)
|
||||
(l/bottom-fixed 1)
|
||||
(c/box 1)
|
||||
(c/group 1)
|
||||
(c/list 1))
|
||||
|
||||
(defadvice clojure-test-run-tests (before save-first activate)
|
||||
(save-buffer))
|
||||
|
||||
(defadvice nrepl-load-current-buffer (before save-first activate)
|
||||
(save-buffer))
|
||||
|
||||
(setq cider-pprint-fn 'pprint)
|
||||
|
||||
(setq cider-repl-history-file (concat tmp-directory "/cider-repl-history"))
|
||||
|
||||
;; nice pretty printing
|
||||
(setq cider-repl-use-pretty-printing t)
|
||||
|
||||
;; nicer font lock in REPL
|
||||
(setq cider-repl-use-clojure-font-lock t)
|
||||
|
||||
;; result prefix for the REPL
|
||||
(setq cider-repl-result-prefix ";; => ")
|
||||
|
||||
;; never ending REPL history
|
||||
(setq cider-repl-wrap-history t)
|
||||
|
||||
;; looong history
|
||||
(setq cider-repl-history-size 3000)
|
||||
|
||||
|
||||
;; error buffer not popping up
|
||||
(setq cider-show-error-buffer nil)
|
||||
|
||||
;; Use figwheel for cljs repl
|
||||
(setq cider-cljs-lein-repl "(do (use 'figwheel-sidecar.repl-api) (start-figwheel!) (cljs-repl))")
|
||||
|
||||
;; Indent and highlight more commands
|
||||
(put-clojure-indent 'match 'defun)
|
||||
|
||||
;; Hide nrepl buffers when switching buffers (switch to by prefixing with space)
|
||||
(setq nrepl-hide-special-buffers t)
|
||||
|
||||
;; Enable error buffer popping also in the REPL:
|
||||
(setq cider-repl-popup-stacktraces t)
|
||||
|
||||
;; Specify history file
|
||||
(setq cider-history-file (concat (getenv "HOME") "/.tmp/nrepl-history"))
|
||||
|
||||
;; auto-select the error buffer when it's displayed
|
||||
(setq cider-auto-select-error-buffer t)
|
||||
|
||||
;; Prevent the auto-display of the REPL buffer in a separate window after connection is established
|
||||
(setq cider-repl-pop-to-buffer-on-connect nil)
|
||||
|
||||
;; Pretty print results in repl
|
||||
(setq cider-repl-use-pretty-printing t)
|
||||
|
||||
;; Don't prompt for symbols
|
||||
(setq cider-prompt-for-symbol nil)
|
||||
|
||||
;; eldoc for clojure
|
||||
(add-hook 'cider-repl-mode-hook #'paredit-mode)
|
||||
(setup-keys)
|
||||
(rainbow-delimiters-mode)
|
||||
|
||||
(define-key clojure-mode-map (kbd "C-`") 'live-cycle-clj-coll)
|
||||
(define-key cider-repl-mode-map (kbd "<home>") nil)
|
||||
(define-key cider-repl-mode-map (kbd "C-,") 'complete-symbol)
|
||||
(define-key cider-mode-map (kbd "C-,") 'complete-symbol)
|
||||
(define-key cider-mode-map (kbd "C-c C-q") 'nrepl-close)
|
||||
(define-key cider-mode-map (kbd "C-c C-Q") 'cider-quit)
|
||||
(define-key clojure-mode-map (kbd "M-s-d") 'clj-duplicate-top-level-form)
|
||||
|
||||
(add-to-list 'cljr-project-clean-functions 'cleanup-buffer)
|
||||
|
||||
(define-key clojure-mode-map (kbd "s-j") 'clj-jump-to-other-file)
|
||||
;;(define-key clojure-mode-map (kbd "C-.") 'clj-hippie-expand-no-case-fold)
|
||||
(define-key clojure-mode-map (kbd "C-M-x") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-x C-e") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-e") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-l") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-r") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-z") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-k") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-n") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-q") 'nrepl-warn-when-not-connected)
|
||||
|
||||
(define-key clojure-mode-map (kbd "M-<right>") 'paredit-forward-slurp-sexp)
|
||||
(define-key clojure-mode-map (kbd "M-<left>") 'paredit-backward-slurp-sexp)
|
||||
|
||||
(define-key clojure-mode-map (kbd "C-<right>") 'right-word)
|
||||
(define-key clojure-mode-map (kbd "C-<left>") 'left-word)
|
||||
(global-set-key (kbd "C-<right>") 'right-word)
|
||||
(global-set-key (kbd "C-<left>") 'left-word)
|
||||
|
||||
|
||||
(message "Clojure mode hook ran and initialized clojure-editor ability."))
|
||||
|
||||
(provide 'extensions/clojure/core)
|
|
@ -0,0 +1,65 @@
|
|||
(require 'extensions/clojure/core)
|
||||
|
||||
;;;###autoload
|
||||
(defun set-clojure-favorite-buffer ()
|
||||
"Set the favorite buffer to cider repl"
|
||||
(setq *favorite-buffer* "\*cider-repl\s.*\*"))
|
||||
|
||||
;;;###autoload
|
||||
(defun clojure-pretty-symbol ()
|
||||
(interactive)
|
||||
(setq prettify-symbols-alist
|
||||
'(
|
||||
("fn" . 955) ; λ
|
||||
("->" . 8594)))) ; →
|
||||
; ⇒
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun extensions/clojure-initialize ()
|
||||
; Clojure development initialization
|
||||
(ability clojure-editor ('flycheck)
|
||||
(require 'clojure-mode)
|
||||
(require 'flycheck-clj-kondo)
|
||||
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.cljc$" . clojurec-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.cljs$" . clojurescript-mode))
|
||||
|
||||
(add-hook 'cider-mode-hook #'eldoc-mode)
|
||||
(add-hook 'cider-mode-hook #'set-clojure-favorite-buffer)
|
||||
(add-hook 'clojure-mode-hook #'paredit-mode)
|
||||
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
|
||||
|
||||
(setq cider-cljs-lein-repl "(do (use 'figwheel-sidecar.repl-api) (start-figwheel!) (cljs-repl))")
|
||||
|
||||
(add-hook 'clojure-mode-hook 'clojure-mode-init)
|
||||
(setq tmp-directory (concat (getenv "HOME") "/.tmp")))
|
||||
|
||||
|
||||
(ability pretty-symbols ()
|
||||
(add-hook 'clojure-mode-hook 'clojure-pretty-symbol))
|
||||
|
||||
|
||||
(ability clojure-completion ('code-completion)
|
||||
;; company mode for completion
|
||||
(add-hook 'cider-repl-mode-hook #'company-mode)
|
||||
(add-hook 'cider-mode-hook #'company-mode))
|
||||
|
||||
(ability clojure-refactore ()
|
||||
(add-hook 'clojure-mode-hook 'cljr-init)))
|
||||
|
||||
;; (ability clojure-check ('flycheck)
|
||||
;; (require 'flycheck-clojure)
|
||||
;; (eval-after-load 'flycheck '(add-to-list 'flycheck-checkers 'clojure-cider-eastwood))
|
||||
;; (eval-after-load 'flycheck '(flycheck-clojure-setup))
|
||||
;; (add-hook 'after-init-hook #'global-flycheck-mode)
|
||||
;; ;; Set up linting of clojure code with eastwood
|
||||
|
||||
;; ;; Make sure to add [acyclic/squiggly-clojure "0.1.2-SNAPSHOT"]
|
||||
;; ;; to your :user :dependencies in .lein/profiles.clj
|
||||
|
||||
;; (add-hook 'cider-mode-hook
|
||||
;; '(lambda ()
|
||||
;; (message "Make sure to add [acyclic/squiggly-clojure \"0.1.2-SNAPSHOT\"] to your :user :dependencies in .lein/profiles.clj")))))
|
||||
|
||||
(provide 'extensions/clojure/init)
|
|
@ -0,0 +1,6 @@
|
|||
* Clojure Extension
|
||||
|
||||
This extension provides an integrated environment for developing clojure applications
|
||||
using FG42 on top of cider.
|
||||
|
||||
** Usage
|
|
@ -0,0 +1,311 @@
|
|||
(require 'clojure-mode)
|
||||
(require 'clojure-mode-extra-font-locking)
|
||||
|
||||
(defadvice clojure-test-run-tests (before save-first activate)
|
||||
(save-buffer))
|
||||
|
||||
(defadvice nrepl-load-current-buffer (before save-first activate)
|
||||
(save-buffer))
|
||||
|
||||
(require 'clj-refactor)
|
||||
|
||||
(setq cljr-favor-prefix-notation nil)
|
||||
(setq cljr-favor-private-functions nil)
|
||||
|
||||
(cljr-add-keybindings-with-modifier "C-s-")
|
||||
(define-key clj-refactor-map (kbd "C-x C-r") 'cljr-rename-file)
|
||||
|
||||
(define-key clojure-mode-map [remap paredit-forward] 'clojure-forward-logical-sexp)
|
||||
(define-key clojure-mode-map [remap paredit-backward] 'clojure-backward-logical-sexp)
|
||||
|
||||
(setq cider-pprint-fn 'pprint)
|
||||
|
||||
(require 'core-async-mode)
|
||||
|
||||
(defun enable-clojure-mode-stuff ()
|
||||
(clj-refactor-mode 1)
|
||||
(when (not (s-ends-with-p "/dev/user.clj" (buffer-file-name)))
|
||||
(core-async-mode 1)))
|
||||
|
||||
(add-hook 'clojure-mode-hook 'enable-clojure-mode-stuff)
|
||||
|
||||
(require 'symbol-focus)
|
||||
(define-key clojure-mode-map (kbd "M-s-f") 'sf/focus-at-point)
|
||||
|
||||
(defun clj-duplicate-top-level-form ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(cljr--goto-toplevel)
|
||||
(insert (cljr--extract-sexp) "\n")
|
||||
(cljr--just-one-blank-line)))
|
||||
|
||||
(define-key clojure-mode-map (kbd "M-s-d") 'clj-duplicate-top-level-form)
|
||||
|
||||
(add-to-list 'cljr-project-clean-functions 'cleanup-buffer)
|
||||
|
||||
(define-key clojure-mode-map (kbd "C->") 'cljr-thread)
|
||||
(define-key clojure-mode-map (kbd "C-<") 'cljr-unwind)
|
||||
|
||||
(define-key clojure-mode-map (kbd "s-j") 'clj-jump-to-other-file)
|
||||
|
||||
(define-key clojure-mode-map (kbd "C-.") 'clj-hippie-expand-no-case-fold)
|
||||
|
||||
(defun clj-hippie-expand-no-case-fold ()
|
||||
(interactive)
|
||||
(let ((old-syntax (char-to-string (char-syntax ?/))))
|
||||
(modify-syntax-entry ?/ " ")
|
||||
(hippie-expand-no-case-fold)
|
||||
(modify-syntax-entry ?/ old-syntax)))
|
||||
|
||||
(require 'cider)
|
||||
|
||||
(define-key cider-repl-mode-map (kbd "<home>") nil)
|
||||
(define-key cider-repl-mode-map (kbd "C-,") 'complete-symbol)
|
||||
(define-key cider-mode-map (kbd "C-,") 'complete-symbol)
|
||||
(define-key cider-mode-map (kbd "C-c C-q") 'nrepl-close)
|
||||
(define-key cider-mode-map (kbd "C-c C-Q") 'cider-quit)
|
||||
|
||||
(require 'yesql-ghosts)
|
||||
|
||||
;; indent [quiescent.dom :as d] specially
|
||||
|
||||
(define-clojure-indent
|
||||
(d/a 1)
|
||||
(d/button 1)
|
||||
(d/div 1)
|
||||
(d/form 1)
|
||||
(d/h1 1)
|
||||
(d/h2 1)
|
||||
(d/h3 1)
|
||||
(d/h4 1)
|
||||
(d/h5 1)
|
||||
(d/hr 1)
|
||||
(d/img 1)
|
||||
(d/label 1)
|
||||
(d/li 1)
|
||||
(d/option 1)
|
||||
(d/p 1)
|
||||
(d/pre 1)
|
||||
(d/select 1)
|
||||
(d/small 1)
|
||||
(d/span 1)
|
||||
(d/strong 1)
|
||||
(d/ul 1)
|
||||
(d/svg 1)
|
||||
|
||||
;; Hafslund specifics
|
||||
(e/prose 1)
|
||||
(e/value 1)
|
||||
(e/section 1)
|
||||
(e/section-prose 1)
|
||||
(e/page 1)
|
||||
(e/instructions 1)
|
||||
(l/padded 1)
|
||||
(l/bubble-grid 1)
|
||||
(l/slider 1)
|
||||
(l/bottom-fixed 1)
|
||||
(c/box 1)
|
||||
(c/group 1)
|
||||
(c/list 1))
|
||||
|
||||
;; Don't warn me about the dangers of clj-refactor, fire the missiles!
|
||||
(setq cljr-warn-on-eval nil)
|
||||
|
||||
;; Use figwheel for cljs repl
|
||||
(setq cider-cljs-lein-repl "(do (use 'figwheel-sidecar.repl-api) (start-figwheel!) (cljs-repl))")
|
||||
|
||||
;; Indent and highlight more commands
|
||||
(put-clojure-indent 'match 'defun)
|
||||
|
||||
;; Hide nrepl buffers when switching buffers (switch to by prefixing with space)
|
||||
(setq nrepl-hide-special-buffers t)
|
||||
|
||||
;; Enable error buffer popping also in the REPL:
|
||||
(setq cider-repl-popup-stacktraces t)
|
||||
|
||||
;; Specify history file
|
||||
(setq cider-history-file "~/.emacs.d/nrepl-history")
|
||||
|
||||
;; auto-select the error buffer when it's displayed
|
||||
(setq cider-auto-select-error-buffer t)
|
||||
|
||||
;; Prevent the auto-display of the REPL buffer in a separate window after connection is established
|
||||
(setq cider-repl-pop-to-buffer-on-connect nil)
|
||||
|
||||
;; Pretty print results in repl
|
||||
(setq cider-repl-use-pretty-printing t)
|
||||
|
||||
;; Don't prompt for symbols
|
||||
(setq cider-prompt-for-symbol nil)
|
||||
|
||||
;; Enable eldoc in Clojure buffers
|
||||
(add-hook 'cider-mode-hook #'eldoc-mode)
|
||||
|
||||
;; Some expectations features
|
||||
|
||||
(require 'clj-autotest)
|
||||
|
||||
(defun my-toggle-expect-focused ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(search-backward "(expect" (cljr--point-after 'cljr--goto-toplevel))
|
||||
(forward-word)
|
||||
(if (looking-at "-focused")
|
||||
(paredit-forward-kill-word)
|
||||
(insert "-focused"))))
|
||||
|
||||
(defun my-remove-all-focused ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "(expect-focused" nil t)
|
||||
(delete-char -8))))
|
||||
|
||||
(define-key clj-refactor-map
|
||||
(cljr--key-pairs-with-modifier "C-s-" "xf") 'my-toggle-expect-focused)
|
||||
|
||||
(define-key clj-refactor-map
|
||||
(cljr--key-pairs-with-modifier "C-s-" "xr") 'my-remove-all-focused)
|
||||
|
||||
;; Cycle between () {} []
|
||||
|
||||
(defun live-delete-and-extract-sexp ()
|
||||
"Delete the sexp and return it."
|
||||
(interactive)
|
||||
(let* ((begin (point)))
|
||||
(forward-sexp)
|
||||
(let* ((result (buffer-substring-no-properties begin (point))))
|
||||
(delete-region begin (point))
|
||||
result)))
|
||||
|
||||
(defun live-cycle-clj-coll ()
|
||||
"convert the coll at (point) from (x) -> {x} -> [x] -> (x) recur"
|
||||
(interactive)
|
||||
(let* ((original-point (point)))
|
||||
(while (and (> (point) 1)
|
||||
(not (equal "(" (buffer-substring-no-properties (point) (+ 1 (point)))))
|
||||
(not (equal "{" (buffer-substring-no-properties (point) (+ 1 (point)))))
|
||||
(not (equal "[" (buffer-substring-no-properties (point) (+ 1 (point))))))
|
||||
(backward-char))
|
||||
(cond
|
||||
((equal "(" (buffer-substring-no-properties (point) (+ 1 (point))))
|
||||
(insert "{" (substring (live-delete-and-extract-sexp) 1 -1) "}"))
|
||||
((equal "{" (buffer-substring-no-properties (point) (+ 1 (point))))
|
||||
(insert "[" (substring (live-delete-and-extract-sexp) 1 -1) "]"))
|
||||
((equal "[" (buffer-substring-no-properties (point) (+ 1 (point))))
|
||||
(insert "(" (substring (live-delete-and-extract-sexp) 1 -1) ")"))
|
||||
((equal 1 (point))
|
||||
(message "beginning of file reached, this was probably a mistake.")))
|
||||
(goto-char original-point)))
|
||||
|
||||
(define-key clojure-mode-map (kbd "C-`") 'live-cycle-clj-coll)
|
||||
|
||||
;; Warn about missing nREPL instead of doing stupid things
|
||||
|
||||
(defun nrepl-warn-when-not-connected ()
|
||||
(interactive)
|
||||
(message "Oops! You're not connected to an nREPL server. Please run M-x cider or M-x cider-jack-in to connect."))
|
||||
|
||||
(define-key clojure-mode-map (kbd "C-M-x") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-x C-e") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-e") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-l") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-r") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-z") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-k") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-n") 'nrepl-warn-when-not-connected)
|
||||
(define-key clojure-mode-map (kbd "C-c C-q") 'nrepl-warn-when-not-connected)
|
||||
|
||||
(setq cljr-magic-require-namespaces
|
||||
'(("io" . "clojure.java.io")
|
||||
("set" . "clojure.set")
|
||||
("str" . "clojure.string")
|
||||
("walk" . "clojure.walk")
|
||||
("zip" . "clojure.zip")
|
||||
("time" . "clj-time.core")
|
||||
("log" . "clojure.tools.logging")
|
||||
("json" . "cheshire.core")))
|
||||
|
||||
;; refer all from expectations
|
||||
(setq cljr-expectations-test-declaration "[expectations :refer :all]")
|
||||
|
||||
;; Add requires to blank devcards files
|
||||
(defun cljr--find-source-ns-of-devcard-ns (test-ns test-file)
|
||||
(let* ((ns-chunks (split-string test-ns "[.]" t))
|
||||
(test-name (car (last ns-chunks)))
|
||||
(src-dir-name (s-replace "devcards/" "src/" (file-name-directory test-file)))
|
||||
(replace-underscore (-partial 's-replace "_" "-"))
|
||||
(src-ns (car (--filter (or (s-prefix-p it test-name)
|
||||
(s-suffix-p it test-name))
|
||||
(-map (lambda (file-name)
|
||||
(funcall replace-underscore
|
||||
(file-name-sans-extension file-name)))
|
||||
(directory-files src-dir-name))))))
|
||||
(when src-ns
|
||||
(mapconcat 'identity (append (butlast ns-chunks) (list src-ns)) "."))))
|
||||
|
||||
(defun clj--find-devcards-component-name ()
|
||||
(or
|
||||
(ignore-errors
|
||||
(with-current-buffer
|
||||
(find-file-noselect (clj--src-file-name-from-cards (buffer-file-name)))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(search-backward "defcomponent ")
|
||||
(clojure-forward-logical-sexp)
|
||||
(skip-syntax-forward " ")
|
||||
(let ((beg (point))
|
||||
(end (progn (re-search-forward "\\w+")
|
||||
(point))))
|
||||
(buffer-substring-no-properties beg end)))))
|
||||
""))
|
||||
|
||||
(defun cljr--add-card-declarations ()
|
||||
(save-excursion
|
||||
(let* ((ns (clojure-find-ns))
|
||||
(source-ns (cljr--find-source-ns-of-devcard-ns ns (buffer-file-name))))
|
||||
(cljr--insert-in-ns ":require")
|
||||
(when source-ns
|
||||
(insert "[" source-ns " :refer [" (clj--find-devcards-component-name) "]]"))
|
||||
(cljr--insert-in-ns ":require")
|
||||
(insert "[devcards.core :refer-macros [defcard]]"))
|
||||
(indent-region (point-min) (point-max))))
|
||||
|
||||
(defadvice cljr--add-ns-if-blank-clj-file (around add-devcards activate)
|
||||
(ignore-errors
|
||||
(when (and cljr-add-ns-to-blank-clj-files
|
||||
(cljr--clojure-ish-filename-p (buffer-file-name))
|
||||
(= (point-min) (point-max)))
|
||||
ad-do-it
|
||||
(when (clj--is-card? (buffer-file-name))
|
||||
(cljr--add-card-declarations)))))
|
||||
|
||||
;; Set up linting of clojure code with eastwood
|
||||
|
||||
;; Make sure to add [acyclic/squiggly-clojure "0.1.2-SNAPSHOT"]
|
||||
;; to your :user :dependencies in .lein/profiles.clj
|
||||
|
||||
(require 'flycheck-clojure)
|
||||
|
||||
(defun my-cider-mode-enable-flycheck ()
|
||||
;; (when (and (s-ends-with-p ".clj" (buffer-file-name))
|
||||
;; (not (s-ends-with-p "/dev/user.clj" (buffer-file-name))))
|
||||
;; (flycheck-mode 1))
|
||||
)
|
||||
|
||||
(add-hook 'cider-mode-hook 'my-cider-mode-enable-flycheck)
|
||||
|
||||
(eval-after-load 'flycheck '(add-to-list 'flycheck-checkers 'clojure-cider-eastwood))
|
||||
|
||||
;; Make q quit out of find-usages to previous window config
|
||||
|
||||
(defadvice cljr-find-usages (before setup-grep activate)
|
||||
(window-configuration-to-register ?$))
|
||||
|
||||
;; ------------
|
||||
|
||||
;; TODO: Loot more stuff from:
|
||||
;; - https://github.com/overtone/emacs-live/blob/master/packs/dev/clojure-pack/config/paredit-conf.el
|
||||
|
||||
|
||||
(provide 'setup-clojure-mode)
|
|
@ -0,0 +1,28 @@
|
|||
;;; CommonLispExtension --- Enables common lisp development on FG42
|
||||
;;; Commentary:
|
||||
;; In order to user racket extension `racket' itself should
|
||||
;; be available on the path provided by `exec-path'.
|
||||
;;; Code:
|
||||
|
||||
(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/common-lisp/init)
|
||||
|
||||
;; Dependencies ----------------------------------
|
||||
(depends-on 'paredit)
|
||||
(depends-on 'flycheck)
|
||||
(depends-on 'rainbow-delimiters)
|
||||
(depends-on 'slime)
|
||||
(depends-on 'slime-company)
|
||||
|
||||
(defun common-lisp-doc ()
|
||||
"TBD")
|
||||
|
||||
;; Extension -------------------------------------
|
||||
(extension common-lisp
|
||||
:version "2.32"
|
||||
:on-initialize extensions/common-lisp-initialize
|
||||
:docs "lib/extensions/common-lisp/readme.org")
|
||||
|
||||
(provide 'extensions/common-lisp)
|
||||
;;; common-lisp.el ends here
|
|
@ -0,0 +1,30 @@
|
|||
;;; common-lisp-init --- The entry point for common lisp extension
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(defvar default-lisp-platform "sbcl"
|
||||
"The default Lisp compiler/interpreter to be used with common-lisp extension.")
|
||||
|
||||
(defvar ql-slime-helper-path "~/quicklisp/slime-helper.el"
|
||||
"Default path for the slime-helper installed using quicklisp.")
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun extensions/common-lisp-initialize ()
|
||||
"Initialize the common Lisp extension."
|
||||
(require 'slime)
|
||||
|
||||
(setq inferior-lisp-program default-lisp-platform)
|
||||
(setq slime-contribs '(slime-fancy))
|
||||
(slime-setup '(slime-company))
|
||||
|
||||
(add-hook 'slime-load-hook
|
||||
(lambda ()
|
||||
(define-key slime-prefix-map (kbd "M-h")
|
||||
'slime-documentation-lookup)))
|
||||
|
||||
(let ((ql-slime-helper (expand-file-name ql-slime-helper-path)))
|
||||
(when (file-exists-p ql-slime-helper)
|
||||
(load ql-slime-helper))))
|
||||
|
||||
(provide 'extensions/common-lisp/init)
|
||||
;;; init ends here
|
|
@ -0,0 +1,82 @@
|
|||
(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/development/init)
|
||||
|
||||
;; Dependencies ----------------------------------
|
||||
(depends-on 'company)
|
||||
(depends-on 'company-statistics)
|
||||
(depends-on 'projectile)
|
||||
(depends-on 'yasnippet)
|
||||
(depends-on 'yasnippet-snippets)
|
||||
(depends-on 'smart-mode-line)
|
||||
|
||||
(depends-on 'quickrun)
|
||||
(depends-on 'dash)
|
||||
(depends-on 'websocket)
|
||||
|
||||
|
||||
(with-ability terraform
|
||||
(depends-on 'terraform-mode))
|
||||
|
||||
(with-ability yaml
|
||||
(depends-on 'yaml-mode))
|
||||
;; (with-ability hl
|
||||
;; (depends-on 'hl-sexp))
|
||||
|
||||
(with-ability dumb-jump
|
||||
(depends-on 'dumb-jump))
|
||||
|
||||
(with-ability bookmarks
|
||||
(depends-on 'bm))
|
||||
|
||||
(with-ability git
|
||||
(depends-on 'diff-hl)
|
||||
(depends-on 'magit)
|
||||
(depends-on 'gh)
|
||||
(when (is-evil?)
|
||||
(depends-on 'evil-magit)))
|
||||
|
||||
(with-ability github
|
||||
(depends-on 'magithub))
|
||||
|
||||
(with-ability focus
|
||||
(depends-on 'focus))
|
||||
|
||||
(with-ability code-browser
|
||||
(depends-on 'neotree))
|
||||
|
||||
(with-ability pt
|
||||
(depends-on 'pt))
|
||||
|
||||
(with-ability spell
|
||||
(depends-on 'flyspell))
|
||||
|
||||
(with-ability file-browser
|
||||
(depends-on 'ranger))
|
||||
|
||||
(with-ability shell
|
||||
(depends-on 'eshell-prompt-extras)
|
||||
(depends-on 'shell-pop))
|
||||
|
||||
(with-ability imenu
|
||||
(depends-on 'imenu)
|
||||
(depends-on 'imenu-list)
|
||||
(depends-on 'imenu-anywhere))
|
||||
|
||||
(with-ability lsp
|
||||
(depends-on 'lsp-mode)
|
||||
(depends-on 'lsp-ui)
|
||||
(depends-on 'company-lsp))
|
||||
|
||||
(with-ability dap
|
||||
(depends-on 'dap-mode))
|
||||
|
||||
;; TODO: Add flycheck-color-modebar
|
||||
;; TODO Add flycheck-tip
|
||||
|
||||
;; Extension -------------------------------------
|
||||
(extension development
|
||||
:version "2.31"
|
||||
:on-initialize extension/development-initialize)
|
||||
|
||||
(provide 'extensions/development)
|
|
@ -0,0 +1,368 @@
|
|||
;;; development-extension --- A general extension for general development
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
;; Functions -------------------------------------------------
|
||||
;;;###autoload
|
||||
(defun disable-projectile ()
|
||||
(interactive)
|
||||
(projectile-global-mode nil))
|
||||
|
||||
;; Quick fix for company-mode and yasnippet clashing
|
||||
(defun company-yasnippet-or-completion ()
|
||||
(interactive)
|
||||
(if (yas/expansion-at-point)
|
||||
(progn (company-abort)
|
||||
(yas/expand))
|
||||
(company-complete-common)))
|
||||
|
||||
(defun yas/expansion-at-point ()
|
||||
"Tested with v0.6.1. Extracted from `yas/expand-1'"
|
||||
(first (yas/current-key)))
|
||||
|
||||
|
||||
(defun eval-and-replace ()
|
||||
"Replace the preceding sexp with its value."
|
||||
(interactive)
|
||||
(backward-kill-sexp)
|
||||
(condition-case nil
|
||||
(prin1 (eval (read (current-kill 0)))
|
||||
(current-buffer))
|
||||
(error (message "Invalid expression")
|
||||
(insert (current-kill 0)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun enable-pt-search ()
|
||||
(interactive)
|
||||
(define-key projectile-mode-map (kbd "C-c p s s") 'projectile-pt)
|
||||
(define-key projectile-mode-map (kbd "C-c p s r") 'pt-regexp))
|
||||
|
||||
|
||||
(defun load-necessary-modes-and-keybindings ()
|
||||
"Load the modes and keybindings which at necessary and are not part ofcourse an ability."
|
||||
(which-function-mode))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun extension/development-initialize ()
|
||||
"Development plugin initialization."
|
||||
(load-necessary-modes-and-keybindings)
|
||||
|
||||
(ability project-config ()
|
||||
"Makes projects configurable."
|
||||
(require 'projects/configuration))
|
||||
|
||||
(ability pretty-symbols ()
|
||||
"Replace some symbols with icons"
|
||||
(global-prettify-symbols-mode 1))
|
||||
|
||||
|
||||
(ability lsp ()
|
||||
"LSP integration for FG42"
|
||||
(require 'lsp-mode)
|
||||
(require 'lsp-ui-imenu)
|
||||
|
||||
;; Disabling inline actions. Accessable via lsp-execute-code-action
|
||||
(setq lsp-ui-sideline-show-code-actions nil)
|
||||
(add-hook 'lsp-after-open-hook 'lsp-enable-imenu)
|
||||
(setq lsp-ui-sideline-ignore-duplicate t)
|
||||
(setq lsp-prefer-flymake nil)
|
||||
(add-hook 'lsp-mode-hook 'lsp-ui-mode))
|
||||
|
||||
(ability dap ('lsp)
|
||||
(dap-mode 1)
|
||||
(dap-ui-mode 1))
|
||||
|
||||
(ability bookmarks ()
|
||||
(setq bm-restore-repository-on-load t)
|
||||
|
||||
(require 'bm)
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "M-p"
|
||||
:description "Toggle bookmarks")
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "M-]"
|
||||
:description "Jump to next bookmark")
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "M-["
|
||||
:description "Jump to previous bookmark")
|
||||
|
||||
(global-set-key (kbd "M-p") 'bm-toggle)
|
||||
(global-set-key (kbd "M-]") 'bm-next)
|
||||
(global-set-key (kbd "M-[") 'bm-previous)
|
||||
|
||||
(setq bm-restore-repository-on-load t)
|
||||
(setq bm-in-lifo-order t)
|
||||
(setq bm-cycle-all-buffers t)
|
||||
(setq-default bm-buffer-persistence t)
|
||||
|
||||
(setq bm-repository-file (locate-user-emacs-file "bm-repository"))
|
||||
|
||||
;; (add-hook' after-init-hook 'bm-repository-load)
|
||||
;; (add-hook 'kill-buffer-hook #'bm-buffer-save)
|
||||
;; ;; Restoring bookmarks
|
||||
;; (add-hook 'find-file-hooks #'bm-buffer-restore)
|
||||
;; (add-hook 'after-revert-hook #'bm-buffer-restore)
|
||||
|
||||
;; The `after-revert-hook' is not necessary to use to achieve persistence,
|
||||
;; but it makes the bookmark data in repository more in sync with the file
|
||||
;; state. This hook might cause trouble when using packages
|
||||
;; that automatically reverts the buffer (like vc after a check-in).
|
||||
;; This can easily be avoided if the package provides a hook that is
|
||||
;; called before the buffer is reverted (like `vc-before-checkin-hook').
|
||||
;; Then new bookmarks can be saved before the buffer is reverted.
|
||||
;; Make sure bookmarks is saved before check-in (and revert-buffer)
|
||||
;; (add-hook 'vc-before-checkin-hook #'bm-buffer-save)
|
||||
(add-hook' after-init-hook 'bm-repository-load)
|
||||
|
||||
(add-hook 'kill-emacs-hook '(lambda nil
|
||||
(bm-buffer-save-all)
|
||||
(bm-repository-save))))
|
||||
|
||||
(ability livemd ()
|
||||
"Live markdown preview."
|
||||
(require 'extensions/development/livemd))
|
||||
|
||||
(ability imenu ()
|
||||
"IMenu integration for FG42"
|
||||
(require 'imenu)
|
||||
(require 'imenu-list)
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "C-'"
|
||||
:description "Toggle IMenu list which shows the symbol definitions based on major mode.")
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "C-<2>"
|
||||
:description "Search for the definition of the symbol you want anywhere.")
|
||||
|
||||
;; (imenu-list-minor-mode)
|
||||
(setq imenu-list-focus-after-activation t)
|
||||
(setq imenu-list-auto-resize t)
|
||||
(global-set-key (kbd "C-'") #'imenu-list-smart-toggle)
|
||||
(global-set-key (kbd "C-<f2>") #'imenu-anywhere)
|
||||
(global-set-key (kbd "<f13>") #'imenu-anywhere))
|
||||
|
||||
|
||||
(ability dumb-jump ()
|
||||
"Easily jump to defination for most langs using ag"
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "M-g o"
|
||||
:description "Jump to definition in another window")
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "C-u y or M-g j"
|
||||
:description "Jump to definition in current buffer")
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "C-u i or M-g x"
|
||||
:description "Jump to definition using an external tool")
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "M-g z"
|
||||
:description "Jump to definition in another window using an external tool")
|
||||
|
||||
(require 'dumb-jump)
|
||||
(dumb-jump-mode t)
|
||||
(define-key dumb-jump-mode-map (kbd "M-g o") 'dumb-jump-go-other-window)
|
||||
(define-key dumb-jump-mode-map (kbd "M-g j") 'dumb-jump-go)
|
||||
(define-key dumb-jump-mode-map (kbd "C-u y") 'dumb-jump-go)
|
||||
(define-key dumb-jump-mode-map (kbd "M-g x") 'dumb-jump-go-prefer-external)
|
||||
(define-key dumb-jump-mode-map (kbd "C-u i") 'dumb-jump-go-prefer-external)
|
||||
(define-key dumb-jump-mode-map (kbd "M-g z") 'dumb-jump-go-prefer-external-other-window))
|
||||
|
||||
(ability git ()
|
||||
"A wonderful git interface for FG42"
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "C-x g"
|
||||
:description "Rise up MAGIT. Git interface for FG42")
|
||||
(global-set-key (kbd "C-x g") 'magit-status)
|
||||
(when (is-evil?)
|
||||
(add-hook 'magit-mode-hook (lambda () (require 'evil-magit)))
|
||||
(defkey global-map 'magit-status :evil (:normal "SPC g s"))))
|
||||
|
||||
|
||||
(ability github ()
|
||||
"Github support"
|
||||
(require 'magithub)
|
||||
(magithub-feature-autoinject t))
|
||||
|
||||
;; (ability hl ()
|
||||
;; "Highligh the current block of code. This ability may slows you down."
|
||||
;; (require 'hl-sexp)
|
||||
;; (add-hook 'prog-mode-hook #'hl-sexp-mode))
|
||||
|
||||
(ability code-completion ()
|
||||
"Use company mode to provides a complete auto completion framwork."
|
||||
(require 'company)
|
||||
(global-company-mode t)
|
||||
|
||||
;; Bigger popup window
|
||||
(setq company-tooltip-limit 20)
|
||||
|
||||
;; Align annotations to the right tooltip border
|
||||
(setq company-tooltip-align-annotations 't)
|
||||
|
||||
;; Decrease delay before autocompletion popup shows
|
||||
(setq company-idle-delay 0.1)
|
||||
(setq company-minimum-prefix-length 2)
|
||||
|
||||
;; Start autpocompletion only after typing
|
||||
(setq company-begin-commands '(self-insert-command))
|
||||
|
||||
;; Force complete file names on "C-c /" key
|
||||
(global-set-key (kbd "C-c /") 'company-files)
|
||||
|
||||
(add-hook 'after-init-hook 'company-statistics-mode)
|
||||
(define-key company-active-map "\t" 'company-yasnippet-or-completion)
|
||||
|
||||
(setq dabbrev-case-fold-search t)
|
||||
|
||||
(add-to-list 'company-backends 'company-dabbrev)
|
||||
(add-to-list 'company-backends 'company-dabbrev-code))
|
||||
|
||||
(ability yas ()
|
||||
"Snippet configuration."
|
||||
(let ((snippet_home (concat (file-name-directory
|
||||
(locate-library "yasnippet-snippets"))
|
||||
"snippets"))
|
||||
(my_snippet (concat fg42-home "/lib/snippets")))
|
||||
(setq yas-snippet-dirs (list my_snippet snippet_home)))
|
||||
|
||||
(yas-global-mode 1))
|
||||
|
||||
(ability project-management ()
|
||||
"Ability to manage projects and project navigation."
|
||||
(projectile-global-mode)
|
||||
(setq projectile-enable-caching t))
|
||||
|
||||
(ability spell ()
|
||||
"Check spell of any word using ispell. This ability may slows you down"
|
||||
(global-set-key (kbd "<f2>") 'ispell-word)
|
||||
(setq flyspell-issue-message-flg nil))
|
||||
|
||||
(ability diff-highlight ()
|
||||
"Highlight the diffs based on VCS."
|
||||
(add-hook 'prog-mode-hook 'turn-on-diff-hl-mode)
|
||||
(add-hook 'vc-dir-mode-hook 'turn-on-diff-hl-mode))
|
||||
|
||||
(ability auto-pair ()
|
||||
"Auto pair stuffs like brackets begin/ends etc."
|
||||
;; TODO: use autopair mode if electric pair was not as good as autopair
|
||||
(electric-pair-mode))
|
||||
|
||||
(ability yaml ()
|
||||
"YAML editor."
|
||||
(require 'yaml-mode)
|
||||
(add-hook 'yaml-mode-hook (lambda () (interactive) (whitespace-mode 1)))
|
||||
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.sls\\'" . yaml-mode)))
|
||||
|
||||
(ability terraform ()
|
||||
"Terraform editor."
|
||||
(require 'terraform-mode)
|
||||
(add-to-list 'auto-mode-alist '("\\.tf\\'" . terraform-mode)))
|
||||
|
||||
(ability code-browser ()
|
||||
"Adds the code browser to FG42."
|
||||
(require 'neotree)
|
||||
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "f8"
|
||||
:description "Toggle project browser sidebar. See ProjectBrowser")
|
||||
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "n"
|
||||
:description "Next line")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "p"
|
||||
:description "Previous line")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "g"
|
||||
:description "Refresh the tree")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "A"
|
||||
:description "Maximize/Minimize the project browser")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "H"
|
||||
:description "Toggle display hidden files")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "C-c C-n"
|
||||
:description "Create a file or create a directory if filename ends with a '/'")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "C-c C-d"
|
||||
:description "Delete a file or a directory.")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "C-c C-r"
|
||||
:description "Rename a file or a directory.")
|
||||
(cheatsheet-add :group '--ProjectBrowser--
|
||||
:key "C-c C-c"
|
||||
:description "Chande root directory.")
|
||||
|
||||
(global-set-key [f8] 'neotree-toggle))
|
||||
|
||||
(ability shell ()
|
||||
"Eshell enhancements."
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "M-`'"
|
||||
:description "Brings up the eshell")
|
||||
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(shell-pop-default-directory "$HOME")
|
||||
;;'(shell-pop-shell-type (quote ("ansi-term" "*ansi-term*" (lambda nil (ansi-term shell-pop-term-shell)))))
|
||||
'(shell-pop-shell-type (quote ("eshell" "*shell*" (lambda nil (eshell shell-pop-term-shell)))))
|
||||
;;'(shell-pop-term-shell "/bin/zsh")
|
||||
'(shell-pop-term-shell "eshell")
|
||||
|
||||
'(shell-pop-window-size 30)
|
||||
'(shell-pop-full-span t)
|
||||
'(shell-pop-window-position "full")))
|
||||
|
||||
;; (require 'eshell-prompt-extras)
|
||||
;; (with-eval-after-load "esh-opt"
|
||||
;; (autoload 'epe-theme-lambda "eshell-prompt-extras")
|
||||
;; (setq eshell-highlight-prompt nil
|
||||
;; eshell-prompt-function 'epe-theme-lambda))
|
||||
|
||||
|
||||
(ability focus ()
|
||||
"Provides means for focusing on code review."
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "M-x focus-mode"
|
||||
:description "Highlights only the paragraph of code which you are reading for better focus."))
|
||||
(ability pt ()
|
||||
"Provides fast search ability via platinium search"
|
||||
(require 'pt)
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "C-c p s s"
|
||||
:description "Search within a project using pt. It's fast.")
|
||||
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "C-c p s r"
|
||||
:description "Search for a regexp in a project.")
|
||||
(advice-add 'projectile-ag :around #'projectile-pt)
|
||||
(add-hook 'projectile-mode-hook 'enable-pt-search))
|
||||
|
||||
(ability file-browser ()
|
||||
"A ranger like file browser for FG42"
|
||||
(cheatsheet-add :group '--Development--
|
||||
:key "f7"
|
||||
:description "A ranger like file browser for FG42")
|
||||
(setq ranger-cleanup-eagerly t)
|
||||
(setq ranger-show-dotfiles nil)
|
||||
(global-set-key [f7] 'ranger))
|
||||
|
||||
(ability smart-mode-line ()
|
||||
"Smarter modeline for FG42"
|
||||
(setq sml/no-confirm-load-theme t)
|
||||
(setq sml/theme 'respectful)
|
||||
(sml/setup))
|
||||
(message "'development' extension has been initialized."))
|
||||
|
||||
(provide 'extensions/development/init)
|
|
@ -0,0 +1,77 @@
|
|||
;;; livemd.el --- Realtime Markdown previews for FG42.
|
||||
|
||||
;; Copyright (C) 2014-2016 Hrvoje Simic
|
||||
;; Copyright (C) 2019 Sameer Rahmani <lxsameer@gnu.org>
|
||||
|
||||
;; Author: Hrvoje Simic <hrvoje@twobucks.co>
|
||||
;; Version: 1.0.0
|
||||
;; Keywords: markdown, preview, live
|
||||
;; URL: https://gitlab.com/FG42/FG42
|
||||
|
||||
;; This is a clone of https://github.com/shime/emacs-livedown
|
||||
;; Kudos to Hrvoje Simic for his great work.
|
||||
|
||||
;;; Commentary:
|
||||
;; Realtime Markdown previews for Emacs. install `livedown' package
|
||||
;; using npm like: `npm install -g livedown' and then use `livemd-preview'
|
||||
;; function to start the dev server.
|
||||
|
||||
;;; Code:
|
||||
(defgroup livemd nil
|
||||
"Realtime Markdown previews"
|
||||
:group 'livemd
|
||||
:prefix "livemd-")
|
||||
|
||||
(defcustom livedown-path "livedown"
|
||||
"Path to livedown executable."
|
||||
:type 'string
|
||||
:group 'livemd)
|
||||
|
||||
(defcustom livemd-port 1337
|
||||
"Port on which livemd server will run."
|
||||
:type 'integer
|
||||
:group 'livemd)
|
||||
|
||||
(defcustom livemd-open t
|
||||
"Open browser automatically."
|
||||
:type 'boolean
|
||||
:group 'livemd)
|
||||
|
||||
(defcustom livemd-browser nil
|
||||
"Open alternative browser."
|
||||
:type 'string
|
||||
:group 'livemd)
|
||||
|
||||
(defcustom livemd-autostart nil
|
||||
"Auto-open previews when opening markdown files."
|
||||
:type 'boolean
|
||||
:group 'livemd)
|
||||
|
||||
;;;###autoload
|
||||
(defun livemd-preview ()
|
||||
"Preview the current file in livemd."
|
||||
(interactive)
|
||||
(call-process-shell-command (format "livedown stop --port %s &" livemd-port))
|
||||
(start-process-shell-command
|
||||
"livedown"
|
||||
"*fg42-livemd-buffer*"
|
||||
(format "%s start %s --port %s %s %s "
|
||||
livedown-path
|
||||
buffer-file-name
|
||||
livemd-port
|
||||
(if livemd-browser (concat "--browser " livemd-browser) "")
|
||||
(if livemd-open "--open" "")))
|
||||
|
||||
(add-hook 'kill-emacs-query-functions (lambda () (livemd-kill t)))
|
||||
(print (format "%s rendered @ %s" buffer-file-name livemd-port) (get-buffer "emacs-livemd-buffer")))
|
||||
|
||||
;;;###autoload
|
||||
(defun livemd-kill (&optional async)
|
||||
"Stop the livemd process ASYNC or otherwise."
|
||||
(interactive)
|
||||
(let ((stop-livemd (if async 'async-shell-command 'call-process-shell-command)))
|
||||
(funcall stop-livemd (format "%s stop --port %s &" livedown-path livemd-port))))
|
||||
|
||||
|
||||
(provide 'extensions/development/livemd)
|
||||
;;; livemd.el ends here
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue