Update and clean-up some templates
This commit is contained in:
parent
470f450cbd
commit
13c5f7b9f7
123
templates
123
templates
|
@ -48,43 +48,6 @@ texinfo-mode
|
|||
(code "@code{" p "}")
|
||||
(var "@var{" p "}")
|
||||
|
||||
emacs-lisp-mode
|
||||
|
||||
(autoload ";;;###autoload")
|
||||
(pt "(point)")
|
||||
(var "(defvar " p "\n \"" p "\")")
|
||||
(local "(defvar-local " p "\n \"" p "\")")
|
||||
(const "(defconst " p "\n \"" p "\")")
|
||||
(custom "(defcustom " p "\n \"" p "\"" n> ":type '" p ")")
|
||||
(face "(defface " p " '((t :inherit " p "))\n \"" p "\")")
|
||||
(group "(defgroup " p " nil\n \"" p "\"" n> ":group '" p n> ":prefix \"" p "-\")")
|
||||
(macro "(defmacro " p " (" p ")\n \"" p "\"" n> r> ")")
|
||||
(alias "(defalias '" p " '" p ")")
|
||||
(fun "(defun " p " (" p ")\n \"" p "\"" n> r> ")")
|
||||
(iflet "(if-let (" p ")" n> r> ")")
|
||||
(whenlet "(when-let (" p ")" n> r> ")")
|
||||
(whilelet "(while-let (" p ")" n> r> ")")
|
||||
(andlet "(and-let* (" p ")" n> r> ")")
|
||||
(cond "(cond" n "(" q "))" >)
|
||||
(pcase "(pcase " (p "scrutinee") n "(" q "))" >)
|
||||
(let "(let (" p ")" n> r> ")")
|
||||
(lett "(let* (" p ")" n> r> ")")
|
||||
(pcaselet "(pcase-let (" p ")" n> r> ")")
|
||||
(pcaselett "(pcase-let* (" p ")" n> r> ")")
|
||||
(rec "(letrec (" p ")" n> r> ")")
|
||||
(dotimes "(dotimes (" p ")" n> r> ")")
|
||||
(dolist "(dolist (" p ")" n> r> ")")
|
||||
(loop "(cl-loop for " p " in " p " do" n> r> ")")
|
||||
(command "(defun " p " (" p ")\n \"" p "\"" n> "(interactive" p ")" n> r> ")")
|
||||
(advice "(defun " (p "adv" name) " (&rest app)" n> p n> "(apply app))" n>
|
||||
"(advice-add #'" (p "fun") " " (p ":around") " #'" (s name) ")")
|
||||
(header ";;; " (file-name-nondirectory (or (buffer-file-name) (buffer-name)))
|
||||
" -- " p " -*- lexical-binding: t -*-" n
|
||||
";;; Commentary:" n ";;; Code:" n n)
|
||||
(provide "(provide '" (file-name-base (or (buffer-file-name) (buffer-name))) ")" n
|
||||
";;; " (file-name-nondirectory (or (buffer-file-name) (buffer-name)))
|
||||
" ends here" n)
|
||||
|
||||
text-mode
|
||||
|
||||
(box "┌─" (make-string (length str) ?─) "─┐" n
|
||||
|
@ -130,75 +93,25 @@ org-mode
|
|||
|
||||
nix-mode
|
||||
|
||||
(buildphase > "buildPhase= ''" n
|
||||
(p "Build Instructions") n
|
||||
" '';")
|
||||
(checkPhase > "checkPhase= ''" n
|
||||
(p "") n
|
||||
" '';")
|
||||
(configurephase > "configurePhase= ''" n
|
||||
(p "") n
|
||||
" '';")
|
||||
(fixupphase > "fixupPhase= ''" n
|
||||
(p "") n
|
||||
" '';")
|
||||
(distphase > "distPhase= ''" n
|
||||
(p "") n
|
||||
" '';")
|
||||
(patchphase > "patchPhase= ''" n
|
||||
(p "") n
|
||||
" '';")
|
||||
(unpackphase > "unpackPhase= ''" n
|
||||
(p "") n
|
||||
" '';")
|
||||
(installCheckPhasephase > "installCheckPhasePhase= ''" n
|
||||
(p "") n
|
||||
" '';")
|
||||
(installphase > "installphase= ''" n
|
||||
p " mkdir -p $out/bin" n
|
||||
> "for f in $(find . -executable -type f);" n
|
||||
> "do" n
|
||||
> "cp $f $out/bin" n
|
||||
> "done}" n
|
||||
> " '';")
|
||||
|
||||
(pkgs "pkgs = import " (p "<nixpkgs>") " {};")
|
||||
|
||||
(gitpackage "{ lib" n ", stdenv" n ", fetchFromGitHub" n ", " (p "inputs") n ", " (p "inputs") n "}:" n n>
|
||||
"stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n>
|
||||
"src = fetchFromGitHub {" n> "owner = \"" (p "" own) "\";" n> "repo = \"" (s pkgn) "\";" n>
|
||||
"rev = \"" "v${version}" "\";" n> "sha256 = \"" "${lib.fakeSha256}" "\";" n> "};" n n>
|
||||
"nativeBuildInputs = [ " (p "makeWrapper") " ];" n n> "BuildInputs = [ " (p) " ];" n n>
|
||||
"meta = with lib; {" n>
|
||||
"homepage = \"" "https://github.com/" (s own) "/" (s pkgn) "\";" n>
|
||||
"description = \"" (p) "\";" n>
|
||||
"license = licenses." (p (completing-read "License: " '("agpl3" "asl20" "bsd1" "bsd2" "bsd3" "free" "gpl2" "gpl2Only" "gpl2Plus" "gpl3" "gpl3Only" "gpl3Plus" "isc" "lgpl21Only" "lgpl21Plus" "lgpl2Only" "lgpl2Plus" "lgpl3" "lgpl3Only" "mit" "mpl20" "ofl" "unfree"))) ";" n>
|
||||
"maintainers = with maintainers; [ " (s own) " ];" n>
|
||||
"platforms = platforms."
|
||||
(p (completing-read "Platform: " '("all" "allBut" "arm" "cygwin" "darwin" "freebsd" "gnu" "i686" "illumos" "linux" "mesaPlatforms" "mips" "netbsd" "none" "openbsd" "unix" "x86"))) ";" n> q "};" n> "}"
|
||||
)
|
||||
|
||||
(pyderivation "{ buildPythonPackage, " (p "poetry-core" build) ", " (p "" dependencies) "}:" n
|
||||
"buildPythonPackage {" n
|
||||
> "pname = \"" (p "package") "\";" n
|
||||
> "version = \"" (p "0.1.0") "\";" n
|
||||
> "src = ./.;" n
|
||||
> "build-system = [ " (s build)" ];" n
|
||||
> "dependencies = [ " (string-replace "," "" dependencies) " ];" n
|
||||
> "}")
|
||||
(pydefault "let" n
|
||||
> "pkgs = import " (p "<nixpkgs>") " { };" n
|
||||
> "python3 = pkgs." (p "python3.override { packageOverrides = final: prev: {}; }") ";" n
|
||||
> "pyproject-nix = import (builtins.fetchGit {" n
|
||||
> "url = \"https://github.com/pyproject-nix/pyproject.nix.git\";" n
|
||||
> "}) { inherit (pkgs) lib; };" n
|
||||
> "python = pkgs." (p "python3") ";" n
|
||||
> "project = pyproject-nix.lib.project.loadPoetryPyproject { projectRoot = ./.; };" n
|
||||
"in" n
|
||||
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
|
||||
> "python.pkgs.buildPythonPackage (project.renderers.buildPythonPackage { inherit python; })")
|
||||
(pyshell "let" n
|
||||
> "pkgs = import " (p "<nixpkgs>") " { };" n
|
||||
> "pyproject-nix = import (builtins.fetchGit {" n
|
||||
> "url = \"https://github.com/pyproject-nix/pyproject.nix.git\";" n
|
||||
> "}) { inherit (pkgs) lib; };" n
|
||||
> "python3 = pkgs." (p "python3") ";" n
|
||||
> "python = pkgs." (p "python3") ";" n
|
||||
> "project = pyproject-nix.lib.project.loadPoetryPyproject { projectRoot = ./.; };" n
|
||||
> "pythonEnv = python3.withPackages (project.renderers.withPackages { python = python3; });" n
|
||||
> "extraPackages = (ps: with ps; [" (p "flake8 isort mypy") "]);" n
|
||||
> "pythonEnv = python3.withPackages (project.renderers.withPackages { inherit python extraPackages; });" n
|
||||
"in" n
|
||||
"pkgs.mkShellNoCC {" n
|
||||
> "packages = [pythonEnv];" n
|
||||
|
@ -207,7 +120,6 @@ nix-mode
|
|||
> "export MPLBACKEND=" (p "TkAgg") n
|
||||
> "'';"n
|
||||
"}")
|
||||
|
||||
(sal > "pkgs.fetchFromGitHub {" n
|
||||
> "owner = \"pixelifytica\";" n
|
||||
> "repo = \"simple-access-layer\";" n
|
||||
|
@ -228,23 +140,6 @@ python-base-mode
|
|||
(logg "logger = logging.getLogger(__name__)")
|
||||
(nimp "raise NotImplementedError")
|
||||
|
||||
envrc-file-mode
|
||||
|
||||
;; (python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n
|
||||
;; "ZLIB=\"$(nix build nixpkgs#zlib --print-out-paths --no-link)\"" n
|
||||
;; "PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n
|
||||
;; "VENV_DIR=" (p ".venv") n
|
||||
;; "export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n
|
||||
;; "if [ ! -f $VENV_DIR/bin/activate ]; then" n
|
||||
;; > "$PYTHON -m venv --clear $VENV_DIR" n
|
||||
;; "else" n
|
||||
;; > "$PYTHON -m venv --upgrade $VENV_DIR" n
|
||||
;; "fi" n
|
||||
;; "source $VENV_DIR/bin/activate")
|
||||
(python "use nix" n
|
||||
"SRC=$(readlink -f " (p "./" ) ")" n
|
||||
"export PYTHONPATH=$SRC:" q "$PYTHONPATH")
|
||||
|
||||
;; Local Variables:
|
||||
;; mode: lisp-data
|
||||
;; outline-regexp: "[a-z]"
|
||||
|
|
Loading…
Reference in a new issue