diff --git a/CONTRIBUTE b/CONTRIBUTE index 7977911..e7100b7 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -39,6 +39,7 @@ accept code without a proper header file. 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. @@ -55,7 +56,9 @@ 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. +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/): diff --git a/core/fg42/utils.el b/core/fg42/utils.el index ebbe37c..35bce53 100644 --- a/core/fg42/utils.el +++ b/core/fg42/utils.el @@ -104,8 +104,9 @@ with is the buffer." 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))) - (when-let (pair (assq key pairs)) - (cadr pair)))) + (let ((pair (assq key pairs))) + (when pair + (cadr pair))))) (defun comp (&rest fns) diff --git a/fbt b/fbt new file mode 100755 index 0000000..c11bb53 --- /dev/null +++ b/fbt @@ -0,0 +1,53 @@ +:;exec emacs --no-site-file --no-site-lisp -batch -l "$0" -f main "$@" +;;; FGBuildTool --- The build tool for FG42 +;; +;; Copyright (c) 2010-2020 Sameer Rahmani +;; +;; Author: Sameer Rahmani +;; 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 . +;; +;; +;;; Commentary: +;;; Code: + +(defun compile (dir) + "Compile all the elisp files in the given DIR regardless of timestamp. +The DIR should be relative to FG42_HOME." + (let ((target (concat (getenv "FG42_HOME") (format "/%s" dir)))) + (message "Compiling '%s'..." target) + (add-to-list 'load-path target) + (byte-recompile-directory target 0 t))) + + +(defun build (&rest params) + "Compile the core and install the dependencies with the given PARAMS." + (compile "core")) + + +(defun main () + "Execute a subcommand by looking into input arguments of the script." + (print (version)) + (let ((command (car command-line-args-left)) + (args (cdr command-line-args-left))) + (cond + ((string= command "compile") (funcall #'compile (or (car args) "core"))) + ((string= command "build") (funcall #'build args))))) + +;; Local Variables: +;; mode: emacs-lisp +;; End: +;;; fbt ends here diff --git a/fg42-new b/fg42-new index 31a6d86..291f236 100755 --- a/fg42-new +++ b/fg42-new @@ -1,7 +1,8 @@ #! /bin/sh -export FG42_HOME=/home/lxsameer/.fg42 -FG42_WM=false /home/lxsameer/src/emacs/build/bin/emacs --name FG42 \ +export FG42_HOME="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" + +FG42_WM=false emacs --name FG42 \ --no-site-file --no-site-lisp --no-splash --title FG42 \ -L $FG42_HOME/core \ -L $FG42_HOME/extensions \