old src removed. Installer completed
This commit is contained in:
parent
d1ab2642b6
commit
1cc0615d2f
|
@ -1,4 +1,3 @@
|
|||
conf/emacs.d/session*
|
||||
./kuso.config.el
|
||||
kuso.d/*
|
||||
.build/*
|
||||
|
|
11
TODO.org
11
TODO.org
|
@ -3,17 +3,16 @@
|
|||
*** TODO Add a directory scanning mode. load each workgroup by name only.
|
||||
** TODO Provide a variable (defcustom) which allow user to easily change them from customize menu
|
||||
** DONE Add auto-pair mode to kuso-base
|
||||
** TODO Add 'helm mode'
|
||||
** TODO add markdown and rst plugin
|
||||
** DONE add markdown and rst plugin
|
||||
** TODO add org-mode support
|
||||
*** TODO add support to main todo repository and collect todo form projects repositories
|
||||
** TODO add startup custom buffer for kuso
|
||||
** TODO add per project configuration support
|
||||
** Ruby Mode
|
||||
*** TODO activate rinari mode by default
|
||||
*** TODO add rscene2
|
||||
* New Plugings
|
||||
** TODO Add hs-minor-mode to the plugin mojor mode load hook
|
||||
** TODO add the custom snippets path to yasnippet load path
|
||||
** DONE Add hs-minor-mode to the plugin mojor mode load hook
|
||||
** DONE add the custom snippets path to yasnippet load path
|
||||
|
||||
* Release
|
||||
** TODO remove '-dev' suffix from executable filename
|
||||
** DONE remove '-dev' suffix from executable filename
|
||||
|
|
50
config.sh
50
config.sh
|
@ -1,50 +0,0 @@
|
|||
#! /usr/bin/env bash
|
||||
# Copyright (c) 2014 lxsameer <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, 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/.
|
||||
|
||||
. ./scripts/check_dep.sh
|
||||
. ./scripts/make_files.sh
|
||||
. ./scripts/install_files.sh
|
||||
. ./scripts/version.sh
|
||||
. ./scripts/plugins.sh
|
||||
|
||||
|
||||
echo " _ __ ___ ___ ___ ";
|
||||
echo " | |/ / _ ___ ___ |_ _| \| __|";
|
||||
echo " | ' < || (_-</ _ \ | || |) | _| ";
|
||||
echo " |_|\_\_,_/__/\___/ |___|___/|___|";
|
||||
echo " ";
|
||||
echo ""
|
||||
echo "Version $VERSION released under the term of GPLv2"
|
||||
echo "Copyright 2010-2014 Sameer Rahmani <lxsameer@gnu.org"
|
||||
echo "If your find any bug or have any idea please report it to me via"
|
||||
echo "https://github.com/KusoIDE/KusoIDE/issues"
|
||||
echo ""
|
||||
warn "This installation will alter your exist one (if you already have one)."
|
||||
read -p "Continue ([y]/n)? " answer
|
||||
|
||||
if [ "$answer" == "" -o "$answer" == "y" ]
|
||||
then
|
||||
|
||||
ask_for_plugins
|
||||
|
||||
info "Checking for dependencies . . ."
|
||||
do_check
|
||||
|
||||
info "Making source files . . ."
|
||||
#do_make
|
||||
|
||||
info "Installing kuso files . . ."
|
||||
#do_install
|
||||
fi
|
197
install.sh
197
install.sh
|
@ -1,162 +1,55 @@
|
|||
#! /bin/bash
|
||||
#! /usr/bin/env bash
|
||||
# Copyright (c) 2014 lxsameer <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, 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/.
|
||||
|
||||
. ./scripts/check_dep.sh
|
||||
. ./scripts/make_files.sh
|
||||
. ./scripts/install_files.sh
|
||||
. ./scripts/version.sh
|
||||
. ./scripts/plugins.sh
|
||||
|
||||
# Kuso IDE installer script
|
||||
# Its a very quick way to install Kuso IDE
|
||||
# I now this code is not very nice but who cares it works
|
||||
|
||||
echo " _ __ ___ ___ ___ ";
|
||||
echo " | |/ / _ ___ ___ |_ _| \| __|";
|
||||
echo " | ' < || (_-</ _ \ | || |) | _| ";
|
||||
echo " |_|\_\_,_/__/\___/ |___|___/|___|";
|
||||
echo " ";
|
||||
echo ""
|
||||
echo "Version $VERSION released under the term of GPLv2"
|
||||
echo "Copyright 2010-2014 Sameer Rahmani <lxsameer@gnu.org"
|
||||
echo "If your find any bug or have any idea please report it to me via"
|
||||
echo "https://github.com/KusoIDE/KusoIDE/issues"
|
||||
echo ""
|
||||
warn "This installation will alter your exist one (if you already have one)."
|
||||
read -p "Continue ([y]/n)? " answer
|
||||
|
||||
VERSION=1.0.0
|
||||
|
||||
remoteconffile="http://raw.github.com/Karajlug/KusoIDE/master/conf/dotkuso"
|
||||
remoteexecutable="http://raw.github.com/Karajlug/KusoIDE/master/bin/kuso"
|
||||
|
||||
conffile=conf/dotkuso
|
||||
|
||||
mode="basic"
|
||||
|
||||
REQUIREMENTS=(emacs git)
|
||||
|
||||
# Coloring Functions
|
||||
function info() {
|
||||
echo -e "[\033[01;32mINFO\033[00m]: $1"
|
||||
}
|
||||
|
||||
function error(){
|
||||
echo -e "[\033[01;31mERR\033[00m]: $1"
|
||||
}
|
||||
|
||||
function warn(){
|
||||
echo -e "[\033[01;33mWARN\033[00m]: $1"
|
||||
}
|
||||
|
||||
function requirements_check(){
|
||||
for app in "${REQUIRMENTS[@]}"
|
||||
do
|
||||
info "Check for $app"
|
||||
if hash $1 2>/dev/null; then
|
||||
info "$app is present"
|
||||
else
|
||||
REQUIREMENTS_CHECK=false
|
||||
error "Can not find $app"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
while getopts ":e" option
|
||||
do
|
||||
case "${option}"
|
||||
in
|
||||
e)mode="expert";;
|
||||
esac
|
||||
done
|
||||
|
||||
# Gathering informations
|
||||
echo -e "\n\033[01;32mKuso IDE\033[00m $VERSION copyright 2010-2013 \033[01;34mSameer Rahmani <lxsameer@gnu.org>\033[00m\n\n"
|
||||
|
||||
# Requirments check to make sure everything is ok
|
||||
echo -e "Requirment Check"
|
||||
# if this variable changed to fasle , means we have something to install
|
||||
REQUIREMENTS_CHECK=true
|
||||
requirements_check $REQUIREMENTS
|
||||
# exit if our requirement check
|
||||
if [ $REQUIREMENTS_CHECK == false ]; then
|
||||
error "Please install requirments first";
|
||||
exit;
|
||||
fi
|
||||
echo -e "\n\n"
|
||||
|
||||
echo "Enter requested informations. You can change it later in top"
|
||||
echo -e "your init file.\n\n"
|
||||
|
||||
condition="1"
|
||||
while [ "$condition" == "1" ] ; do
|
||||
read -p "Do you want to install Kuso IDE as an stand alone application ([y]/n)? " standalone
|
||||
|
||||
if [ "$standalone" == "" -o "$standalone" == "y" ]
|
||||
then
|
||||
standalone="y"
|
||||
dotemacs=~/.kuso
|
||||
repo=~/.kuso.d
|
||||
condition="0"
|
||||
executable=kuso
|
||||
fi
|
||||
|
||||
if [ "$standalone" == "n" ]
|
||||
then
|
||||
dotemacs=~/.emacs
|
||||
repo=~/.emacs.d
|
||||
condition="0"
|
||||
executable=kuso
|
||||
fi
|
||||
|
||||
done
|
||||
read -p "Enter your full name: " fullname
|
||||
read -p "Enter your email address: " mail
|
||||
read -p "Where is your workspace directory[~/src/]: " workspace
|
||||
|
||||
# Validating informations
|
||||
if [ "$workspace" == "" ]
|
||||
if [ "$answer" == "" -o "$answer" == "y" ]
|
||||
then
|
||||
workspace="$HOME/src/"
|
||||
|
||||
ask_for_plugins
|
||||
|
||||
info "Checking for dependencies . . ."
|
||||
do_check
|
||||
|
||||
info "Making source files . . ."
|
||||
do_make
|
||||
|
||||
info "Installing kuso files . . ."
|
||||
do_install
|
||||
fi
|
||||
|
||||
# Installing stage1
|
||||
info "Creating configuration folder in $repo"
|
||||
mkdir -p $repo
|
||||
|
||||
if [ -e $dotemacs ]; then
|
||||
info "An init file already exists."
|
||||
info "Backing up exists init file to $dotemacs.backup . . ."
|
||||
#cp $dotemacs "$dotemacs.backup"
|
||||
fi
|
||||
|
||||
if [ -e $conffile ]
|
||||
then
|
||||
info "Copying init files . . . "
|
||||
cp $conffile $dotemacs
|
||||
|
||||
if [ "$standalone" == "y" ]
|
||||
then
|
||||
cp bin/$executable $repo/$executable
|
||||
fi
|
||||
else
|
||||
info "Downloading init file and executable . . ."
|
||||
wget $remoteconffile -q -O $dotemacs
|
||||
|
||||
if [ "$standalone" == "y" ]
|
||||
then
|
||||
wget $remoteexecutable -q -O $repo/$executable
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$standalone" == "" -o "$standalone" == "y" ]
|
||||
then
|
||||
info "Creating a link in globe PATH . . ."
|
||||
sudo ln -s $repo/$executable /usr/bin/$executable
|
||||
chmod +x $repo/$executable
|
||||
fi
|
||||
|
||||
sed "s/--EMAIL--/$mail/mg" -i $dotemacs
|
||||
sed "s/--FULLNAME--/$fullname/mg" -i $dotemacs
|
||||
sed "s,--WORKSPACE--,$workspace,mg" -i $dotemacs
|
||||
sed "s,--REPO--,$repo,mg" -i $dotemacs
|
||||
|
||||
|
||||
#if [ $mode == "expert" ]
|
||||
#then
|
||||
# info "Installing base system . . ."
|
||||
# echo "(setq KUSO-INSTALL-MODE \"expert\")" > /tmp/init_kuso_installer.el
|
||||
# `which emacs` --batch -l /tmp/init_kuso_installer.el -l $dotemacs
|
||||
#else
|
||||
# info "Installing base system . . ."
|
||||
# `which emacs` --batch -l $dotemacs
|
||||
#fi
|
||||
|
||||
echo -e "\nNow run 'kuso' and have fun ;)"
|
||||
echo
|
||||
info "KUSO is now installed. If you find my job interesting please give"
|
||||
info "a kudos in: http://ohloh.org/accounts/lxsameer"
|
||||
echo
|
||||
info "Have fun ;)"
|
||||
|
|
|
@ -15,6 +15,35 @@
|
|||
. scripts/versioncmp.sh
|
||||
. scripts/log.sh
|
||||
|
||||
required_packages=("emacs" "jedi" "epc" "ruby")
|
||||
unmet_deps=()
|
||||
|
||||
function can_we_continue() {
|
||||
local deps=()
|
||||
local failed="0"
|
||||
for elem in "${required_packages[@]}"
|
||||
do
|
||||
if [[ "${unmet_deps[*]}" == *"$elem"* ]]
|
||||
then
|
||||
deps+=($elem)
|
||||
failed="1"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $failed == "1" ]
|
||||
then
|
||||
error "Can't continue. There are some requirements are missing:"
|
||||
echo
|
||||
for i in "${deps[@]}"
|
||||
do
|
||||
echo "$i"
|
||||
done
|
||||
echo
|
||||
echo "Install them and retry please."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function check_dep() {
|
||||
local package=$1
|
||||
local hint=$2
|
||||
|
@ -35,6 +64,7 @@ function check_dep() {
|
|||
then
|
||||
error "$package version $version_to_check required. Yours is $version"
|
||||
info "$hint"
|
||||
unmet_deps+=($package)
|
||||
else
|
||||
echo "$package version $version is fine. need ($version_to_check)"
|
||||
|
||||
|
@ -46,6 +76,7 @@ function check_dep() {
|
|||
else
|
||||
error "Can't find '$package'."
|
||||
info "$hint"
|
||||
unmet_deps+=($package)
|
||||
fi
|
||||
else
|
||||
error "first argument is empty"
|
||||
|
@ -62,6 +93,7 @@ function py_check_dep() {
|
|||
else
|
||||
error "Can't find python package '$package'."
|
||||
info "$hint"
|
||||
unmet_deps+=($package)
|
||||
fi
|
||||
|
||||
}
|
||||
|
@ -111,4 +143,6 @@ function do_check() {
|
|||
check_dep 'xmlstarlet' 'On Debian you can install xmlstarlet by installing "xmlstarlet" package.'
|
||||
check_dep 'csslint' 'For installing csslint you need "nodejs". You can install "csslint" via "npm"'
|
||||
fi
|
||||
|
||||
can_we_continue
|
||||
}
|
||||
|
|
|
@ -13,5 +13,9 @@
|
|||
# this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
function do_install() {
|
||||
cp .build/share /usr/local/share -rv
|
||||
info "Install files in /usr/local/share"
|
||||
info "If you are not a sudoer just copy ./.build/share to /usr/local/share manually"
|
||||
info "and create a link to ./kuso in your /usr/local/bin/kuso"
|
||||
sudo cp .build/share /usr/local/share -rv
|
||||
sudo ln -f -s `pwd`/kuso /usr/local/bin/kuso
|
||||
}
|
||||
|
|
|
@ -13,30 +13,31 @@
|
|||
# this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
function pre_make() {
|
||||
rm `find kuso.d -inam "*.elc"`
|
||||
rm `find kuso.d -iname "*.elc"` 2> /dev/null
|
||||
if [ -a "`pwd`/.build" ]
|
||||
then
|
||||
rm "`pwd`/.build -rf"
|
||||
rm "`pwd`/.build -rf" 2> /dev/null
|
||||
fi
|
||||
|
||||
rm ./kuso.config.el
|
||||
rm ./kuso.config.el 2> /dev/null
|
||||
|
||||
mkdir -p `pwd`/.build/
|
||||
cp ./share/ .build/share
|
||||
cp ./share/ .build/share -r
|
||||
cp ./conf/ .build/ -r
|
||||
}
|
||||
|
||||
|
||||
function do_make() {
|
||||
pre_make
|
||||
|
||||
files=("conf/kuso.config.el" "share/applications/kuso.desktop")
|
||||
files=("conf/kuso.config.el" "share/applications/Kuso.desktop")
|
||||
|
||||
read -p "Enter your full name: " fullname
|
||||
read -p "Enter your email address: " mail
|
||||
read -p "Where is your workspace directory[~/src/]: " workspace
|
||||
|
||||
current_path=`pwd`
|
||||
$plugins_list=$selected_plugins
|
||||
plugins_list=${selected_plugins[@]}
|
||||
|
||||
# Validating informations
|
||||
if [ "$workspace" == "" ]
|
||||
|
@ -47,19 +48,20 @@ function do_make() {
|
|||
for file in "${files[@]}"
|
||||
do
|
||||
cp $file ".build/$file"
|
||||
sed "s/--EMAIL--/$mail/mg" -i $file
|
||||
sed "s/--FULLNAME--/$fullname/mg" -i $file
|
||||
sed "s,--WORKSPACE--,$workspace,mg" -i $file
|
||||
sed "s,--REPO--,$repo,mg" -i $file
|
||||
sed "s,--PATH--,$current_path,mg" -i $file
|
||||
sed "s,--PLUGINS--,$plugins_list,mg" -i $file
|
||||
sed "s/--EMAIL--/$mail/mg" -i ".build/$file"
|
||||
sed "s/--FULLNAME--/$fullname/mg" -i ".build/$file"
|
||||
sed "s,--WORKSPACE--,$workspace,mg" -i ".build/$file"
|
||||
sed "s,--REPO--,$repo,mg" -i ".build/$file"
|
||||
sed "s,--PATH--,$current_path,mg" -i ".build/$file"
|
||||
sed "s,--PLUGINS--,$plugins_list,mg" -i ".build/$file"
|
||||
sed "s,--VERSION--,$VERSION,mg" -i ".build/$file"
|
||||
done
|
||||
|
||||
post_make
|
||||
}
|
||||
|
||||
function post_make() {
|
||||
cp .build/conf/kuso.config.el ./
|
||||
cp .build/conf/kuso.config.el ./ -f
|
||||
# Byte compile everything
|
||||
emacs --batch --eval "(byte-recompile-directory \"./kuso.d/\" 0)" -Q -l kuso.config.el
|
||||
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
|
||||
;; --------------------------------------------------------------------
|
||||
;; Global variables
|
||||
;; --------------------------------------------------------------------
|
||||
|
||||
;; Turning on debuggin for development
|
||||
(defvar DEBUG 1
|
||||
"Kuso IDE will produce more output in the debug mode (DEBUG = 1). log
|
||||
function outputs will appear in *Messages* buffer."
|
||||
)
|
||||
|
||||
(defvar ROOTPATH nil
|
||||
"This variable refer to absolute path to Kuso IDE source tree."
|
||||
)
|
||||
|
||||
(defvar LIBPATH nil
|
||||
"This variable refer to 'lib' directory of Kuso IDE that contains the
|
||||
internal libraries for KusoIDE."
|
||||
)
|
||||
|
||||
(defvar PLUGINPATH nil
|
||||
"This variable refer to 'plugin' directory of KusoIDE that contains
|
||||
Kuso plugins."
|
||||
)
|
||||
|
||||
(defvar TEMPLATESPATH nil
|
||||
"This variable refer to 'template' directory of KusoIDE where plugins
|
||||
store their code templates."
|
||||
)
|
||||
|
||||
;; -------------------------------------------------------------------
|
||||
;; Functions
|
||||
;; -------------------------------------------------------------------
|
||||
(defun strip-el-ext (STR) "strinp the lastest elist extension suffix"
|
||||
(let (ext)
|
||||
(setq ext (replace-regexp-in-string "\.el$" "" STR))
|
||||
(setq ext (replace-regexp-in-string "\.elc$" "" ext))
|
||||
)
|
||||
)
|
||||
|
||||
(defun load-dir (path) "Load entire directory"
|
||||
(let (load-elc load-el filelist tmp)
|
||||
(setq load-elc (concat path "*.elc"))
|
||||
(setq load-el (concat path "*.el"))
|
||||
(setq filelist (file-expand-wildcards load-elc))
|
||||
(setq tmp (file-expand-wildcards load-el))
|
||||
(setq filelist (append filelist tmp))
|
||||
(log (format "%s libraries found" filelist))
|
||||
;; TODO: delete unkown filetypes from filelist
|
||||
(setq filelist (mapcar 'strip-el-ext filelist))
|
||||
(mapcar 'load filelist)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun init-kuso () "Inittialize Kuso IDE environment"
|
||||
(log "initializing Kuso . . .")
|
||||
(let (cur-path-list)
|
||||
(setq cur-path-list (split-string load-file-name "/"))
|
||||
(nbutlast cur-path-list)
|
||||
(setq ROOTPATH (concat (mapconcat 'identity cur-path-list "/") "/"))
|
||||
(setq PLUGINPATH (concat ROOTPATH "plugins/"))
|
||||
(setq TEMPLATESPATH (concat ROOTPATH "templates/"))
|
||||
(setq LIBPATH (concat ROOTPATH "lib/"))
|
||||
(log (format "Running on %s" ROOTPATH))
|
||||
(log (format "lib : %s" LIBPATH))
|
||||
(log (format "plugins : %s" PLUGINPATH))
|
||||
(log (format "templates : %s" TEMPLATESPATH))
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
(defun load-lib (ADDR) "load the kuso library on the ADDR path"
|
||||
(interactive)
|
||||
(let (tmp)
|
||||
(setq tmp (concat LIBPATH ADDR))
|
||||
(load tmp)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun log (ARG) "print a log on message buffer."
|
||||
(if (= DEBUG 1) (message "[Kuso] DEBUG >>> %s" ARG))
|
||||
)
|
||||
|
||||
|
||||
(defun warning (ARG) "A wrapper around elisp built-in warn
|
||||
function."
|
||||
(warn "[Kuso] WARNING >>> %s ARG")
|
||||
)
|
||||
|
||||
(defun start-kuso ()
|
||||
"A peace of kuso configuration that tune emacs to be an IDE."
|
||||
(interactive)
|
||||
|
||||
(let ()
|
||||
(log "Starting kuso mode . . .")
|
||||
(init-kuso)
|
||||
(load-dir LIBPATH)
|
||||
(load-dir PLUGINPATH)
|
||||
(if kuso-workspace (cd kuso-workspace))
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
(defun kuso-reload ()
|
||||
"Reloading Kuso IDE."
|
||||
(interactive)
|
||||
;; TODO: use compiled version in main release
|
||||
(load-file (concat ROOTPATH "kuso-ide.el"))
|
||||
)
|
||||
(define-key global-map (kbd "<f5>") 'kuso-reload)
|
||||
(start-kuso)
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; IO library
|
||||
|
||||
|
||||
(defun io/read-buf (FILE)
|
||||
"Read the file content of FILE into a buffer and return
|
||||
the buffer it self."
|
||||
(if (file-readable-p FILE)
|
||||
(let (read-buffer)
|
||||
(setq read-buffer (find-file FILE))
|
||||
)
|
||||
(error "Can't read '%s' file.")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun io/read (FILE)
|
||||
"Read the contents of FILE into a buffer and return the content.
|
||||
already opend buffer died after reading content."
|
||||
(let (buf data)
|
||||
(setq buf (io/read-buf FILE))
|
||||
(setq data (buffer-string))
|
||||
(kill-buffer buf)
|
||||
(identity data)
|
||||
)
|
||||
)
|
||||
|
||||
(defun io/write (FILE STRING)
|
||||
"Write the STRING into FILE if file was writable."
|
||||
(if (file-writable-p FILE)
|
||||
(with-temp-buffer
|
||||
(insert STRING)
|
||||
(write-region (point-min)
|
||||
(point-max)
|
||||
FILE)
|
||||
)
|
||||
)
|
||||
)
|
|
@ -1,103 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Variables
|
||||
;; ---------------------------------------------------------------------
|
||||
(defvar my-desktop-session-dir
|
||||
(concat (getenv "HOME") "/.tmp/sessions/")
|
||||
"*Directory to save desktop sessions in")
|
||||
|
||||
(defvar my-desktop-session-name-hist nil
|
||||
"Desktop session name history")
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Functions
|
||||
;; ---------------------------------------------------------------------
|
||||
(defun pymenu () "draw python project menu"
|
||||
;; Python submenu
|
||||
(define-key global-map [Ctrl-x p p d] 'django-proj)
|
||||
(define-key global-map [menu-bar file new-proj pyproj djproj] '("Django project" . django-proj))
|
||||
|
||||
(define-key global-map [Ctrl-x p p g] 'generic-py)
|
||||
(define-key global-map [menu-bar file new-proj pyproj pygeneric] '("Generic project" . generic-py))
|
||||
)
|
||||
|
||||
(defun elmenu () "draw elisp project menu"
|
||||
;; Elisp menu
|
||||
(define-key global-map [Ctrl-x p e s] 'kuso-plugin)
|
||||
(define-key global-map [menu-bar file new-proj elproj splug] '("Kuso plugin" . kuso-plugin))
|
||||
|
||||
(define-key global-map [Ctrl-x p e g] 'elgeneric)
|
||||
(define-key global-map [menu-bar file new-proj elproj elgeneric] '("Generic project" . elgeneric))
|
||||
)
|
||||
|
||||
(defun save-session () "wrap the desktop-save"
|
||||
(let (path)
|
||||
(desktop-save-in-desktop-dir)
|
||||
)
|
||||
)
|
||||
|
||||
(defun my-desktop-save (&optional name)
|
||||
"Save desktop with a name."
|
||||
(interactive)
|
||||
(unless name
|
||||
(setq name (my-desktop-get-session-name "Save session as: ")))
|
||||
(make-directory (concat my-desktop-session-dir name) t)
|
||||
(desktop-save (concat my-desktop-session-dir name) t)
|
||||
)
|
||||
|
||||
(defun my-desktop-read (&optional name)
|
||||
"Read desktop with a name."
|
||||
(interactive)
|
||||
(unless name
|
||||
(setq name (my-desktop-get-session-name "Load session: ")))
|
||||
(desktop-read (concat my-desktop-session-dir name))
|
||||
)
|
||||
|
||||
(defun my-desktop-get-session-name (prompt)
|
||||
(completing-read prompt (and (file-exists-p my-desktop-session-dir)
|
||||
(directory-files my-desktop-session-dir))
|
||||
nil nil nil my-desktop-session-name-hist)
|
||||
)
|
||||
|
||||
(defun menu/init-menu () "Initializing Kuso IDE menu"
|
||||
;; New Project Menu
|
||||
(interactive)
|
||||
(define-key-after global-map [menu-bar file new-proj] (cons "New Project" (make-sparse-keymap "new project")) 'new-file)
|
||||
(define-key-after global-map [menu-bar file load-session] '("Load Session" . my-desktop-read) 'new-proj)
|
||||
(define-key-after global-map [menu-bar file save-session] '("Save Session" . my-desktop-save) 'load-session)
|
||||
|
||||
(define-key global-map (kbd "<f11>") 'my-desktop-read)
|
||||
(define-key global-map (kbd "<f12>") 'my-desktop-save)
|
||||
|
||||
;; New Project sub menus
|
||||
(define-key-after global-map [menu-bar file new-proj cproj] (cons "C/C++" (make-sparse-keymap "c-cpp-proj")))
|
||||
(define-key-after global-map [menu-bar file new-proj pyproj] (cons "Python" (make-sparse-keymap "python-proj")) 'cproj)
|
||||
(define-key-after global-map [menu-bar file new-proj elproj] (cons "Elisp" (make-sparse-keymap "el-proj")) 'phpproj)
|
||||
(define-key-after global-map [menu-bar file new-proj jproj] (cons "Java" (make-sparse-keymap "j-proj")) 'elproj)
|
||||
(define-key-after global-map [menu-bar file new-proj jsproj] (cons "JS" (make-sparse-keymap "js-proj")) 'jproj)
|
||||
(define-key-after global-map [menu-bar file new-proj phpproj] (cons "PHP" (make-sparse-keymap "php-proj")) 'pyproj)
|
||||
(define-key-after global-map [menu-bar help-menu about-kuso] '("About KusoIDE" . about-kuso-f) 'about-emacs)
|
||||
(message "Menus Initinalized")
|
||||
)
|
||||
|
||||
(defun menu/destruct-menu ()
|
||||
"Remove Kuso provided menu form emacs menus"
|
||||
(interactive)
|
||||
(global-unset-key [menu-bar file new-proj])
|
||||
|
||||
)
|
|
@ -1,151 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010-2011 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; This file will define the most popular modes for KusoIDE
|
||||
|
||||
;; -------------------------------------------------------------------
|
||||
;; Variables
|
||||
;; -------------------------------------------------------------------
|
||||
(defvar project-path ""
|
||||
"Project source tree path.")
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Hooks
|
||||
;; ---------------------------------------------------------------------
|
||||
(defvar kuso-preinit-mode-hook '()
|
||||
"This hook runs before initializing the 'kuso-mode' minor mode."
|
||||
)
|
||||
|
||||
(defvar kuso-postinit-mode-hook '()
|
||||
"This hook runs after 'kuso-mode' minor mode initialized."
|
||||
)
|
||||
|
||||
(defvar kuso-prerm-mode-hook '()
|
||||
"This hook runs before deactivating 'kuso-mode' minor mode."
|
||||
)
|
||||
|
||||
(defvar kuso-postrm-mode-hook '()
|
||||
"This hook runs after 'kuso-mode' minor mode deactivated."
|
||||
)
|
||||
|
||||
(defvar kuso-plugin-preinit-hook '()
|
||||
"This hook runs before initializing the plugins of Kuso IDE"
|
||||
)
|
||||
|
||||
(defvar kuso-plugin-init-hook '()
|
||||
"This hook allow plugins to initialize them self in Kuso IDE."
|
||||
)
|
||||
|
||||
(defvar kuso-plugin-postinit-hook '()
|
||||
"This hook runs after initializing the plugins of Kuso IDE"
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Keymaps
|
||||
;; ---------------------------------------------------------------------
|
||||
(defvar kuso-map (make-sparse-keymap)
|
||||
"Default keymap for kuso-mode minor mode that hold the global key
|
||||
binding for Kuso IDE. each language plugin will have their own minor-mode
|
||||
and keymap for their actions."
|
||||
)
|
||||
|
||||
(defvar kuso-prefix-map (make-sparse-keymap)
|
||||
"Make s-c as the default prefix for Kuso IDE minor mode.
|
||||
By this prefix all the plugins that have small amount of keybindings
|
||||
can define their key bindings easily."
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Groups
|
||||
;; ---------------------------------------------------------------------
|
||||
(defgroup kuso-ide nil
|
||||
"Default values for KusoIDE configuration will are categorized here."
|
||||
:group 'emacs
|
||||
)
|
||||
|
||||
(defgroup kuso-features nil
|
||||
"This group contains all the optional components of KusoIDE."
|
||||
:group 'kuso-ide
|
||||
)
|
||||
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Functions
|
||||
;; ----------------------------------------------------------------------
|
||||
(defun get-project-path ()
|
||||
"Get the project path."
|
||||
(setq project-path (read-directory-name "Project source tree: "))
|
||||
)
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Minor Modes
|
||||
;; ----------------------------------------------------------------------
|
||||
(define-minor-mode kuso-mode
|
||||
"Toggle Kuso mode.
|
||||
This mode provide a basic configuration for an IDE."
|
||||
:lighter " Kuso"
|
||||
:keymap kuso-map
|
||||
:global t
|
||||
:group 'kuso-group
|
||||
|
||||
(if kuso-mode
|
||||
;; kuso-mode is not loaded
|
||||
(let ()
|
||||
;; before initiazing mode
|
||||
(run-hooks 'kuso-preinit-mode-hook)
|
||||
|
||||
;; i really found toolbar and scrollbar useless so i disabled them
|
||||
(if tool-bar-mode (tool-bar-mode))
|
||||
(if scroll-bar-mode (scroll-bar-mode))
|
||||
(menu/init-menu)
|
||||
;; Global emacs configuration -----------------------------------
|
||||
|
||||
;; frame resizing bindings
|
||||
(define-key kuso-map (kbd "s-c") 'kuso-prefix-map)
|
||||
(global-set-key (kbd "s-;") 'shrink-window-horizontally)
|
||||
(global-set-key (kbd "s-'") 'enlarge-window-horizontally)
|
||||
(global-set-key (kbd "s-[") 'enlarge-window)
|
||||
(global-set-key (kbd "s-/") 'shrink-window)
|
||||
;; Centralize backups
|
||||
(setq backup-directory-alist
|
||||
`((".*" . ,"~/.tmp/")))
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,"~/.tmp" t)))
|
||||
(if kuso-workspace (cd kuso-workspace))
|
||||
(run-hooks 'kuso-plugin-preinit-hook)
|
||||
(run-hooks 'kuso-plugin-init-hook)
|
||||
(run-hooks 'kuso-plugin-postinit-hook)
|
||||
;; after mode was initialized
|
||||
(run-hooks 'kuso-postinit-mode-hook)
|
||||
|
||||
)
|
||||
;; kuso-mode already loaded
|
||||
(let ()
|
||||
;; before deactivating mode
|
||||
(run-hooks 'kuso-prerm-mode-hook)
|
||||
|
||||
;; return everything to normal
|
||||
(if (not tool-bar-mode) (tool-bar-mode))
|
||||
(if (not scroll-bar-mode) (scroll-bar-mode))
|
||||
(menu/destruct-menu)
|
||||
;; after deactivating mode
|
||||
(run-hooks 'kuso-postrm-mode-hook)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; TODO: provide a easy way for plugins to define a minor mode
|
|
@ -1,161 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; project.el - Kuso providen API for projects
|
||||
|
||||
;; Some of the context variable that template render
|
||||
;; enginge will render are:
|
||||
;; ::license:: -- already rendered license info
|
||||
;; ::author:: -- Author name
|
||||
;; ::email:: -- author email
|
||||
;; ::project:: -- project proper name
|
||||
;; ::unixname:: -- project unix name (escaped for shell)
|
||||
;; ::desc:: -- project description
|
||||
|
||||
;; --------------------------------------------------------------------
|
||||
;; Variables
|
||||
;; --------------------------------------------------------------------
|
||||
;; Known licenses - Only free softwares license
|
||||
;; I do not like users who use non-free licenses
|
||||
;; TODO: gather a complete list of free software licenses
|
||||
;; TODO: build a hash variable from licenses
|
||||
(defvar known-licenses '("gpl")
|
||||
"The free software licenses for using as the project license."
|
||||
)
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Functions
|
||||
;; ----------------------------------------------------------------------
|
||||
|
||||
;; Each project plugin should use this function for initializing a versy
|
||||
;; basic New Project environment.
|
||||
(defun new-project () "New project basic function"
|
||||
|
||||
;; If user defined the developer details in user preferences Kuso use them
|
||||
;; as default values
|
||||
(setq project-author developer-name)
|
||||
(setq project-author-email developer-email)
|
||||
|
||||
;; Project name
|
||||
(setq project-name (read-string "Project Name: "))
|
||||
(if (string= project-name "") (error "Project name must not be emty"))
|
||||
;; Kuso IDE use unix-project-name for dealing with project OS activity stuffs
|
||||
(setq unix-project-name (downcase (replace-regexp-in-string " " "_" project-name)))
|
||||
;; if specified directory does not exists, Kuso will make it
|
||||
(setq project-path (read-directory-name "Project Path: " nil nil nil unix-project-name))
|
||||
|
||||
(if (not (file-exists-p project-path))
|
||||
(progn
|
||||
(mkdir project-path)
|
||||
(log "Project directory created")
|
||||
)
|
||||
)
|
||||
;; TODO: find a way to ask a multi choices question
|
||||
(setq project-license (read-string "Project License: "))
|
||||
(if (not (member project-license known-licenses))
|
||||
(progn
|
||||
(setq project-license nil)
|
||||
(setq project-desc nil)
|
||||
)
|
||||
(progn
|
||||
(if (not project-author)
|
||||
(setq project-author (read-string "Project Author: "))
|
||||
)
|
||||
(if (not project-author-email)
|
||||
(setq project-author-email (read-string "Project Author Email: "))
|
||||
)
|
||||
(setq project-desc (read-string "Description: "))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
|
||||
(defun project/render (data)
|
||||
"Render the data with known context variables and return rendered daa"
|
||||
(setq data (replace-regexp-in-string "::project::" project-name data))
|
||||
(setq data (replace-regexp-in-string "::desc::" project-desc data))
|
||||
(setq data (replace-regexp-in-string "::author::" project-author data))
|
||||
(setq data (replace-regexp-in-string "::email::" project-author-email data))
|
||||
(setq data (replace-regexp-in-string "::year::" (format-time-string "%Y") data))
|
||||
)
|
||||
|
||||
|
||||
(defun project/copying-license-copy ()
|
||||
"Copy COPYING file into source tree of project."
|
||||
(if project-license
|
||||
(let (copying dest)
|
||||
(setq copying (concat TEMPLATESPATH (concat "licenses/" (format "/%s/COPYING" project-license))))
|
||||
(setq dest (expand-file-name project-path "COPYING"))
|
||||
(if (not (file-exists-p dest))
|
||||
(progn
|
||||
(copy-file copying )
|
||||
(log "'COPYING' file copied.")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun insert-license ()
|
||||
"Return the prepared license string."
|
||||
(if project-license
|
||||
(let (license-data license-file)
|
||||
(setq license-file (concat TEMPLATESPATH (concat "licenses/" (concat project-license ".tmpl"))))
|
||||
;; loading template file
|
||||
(setq license-data (io/read license-file))
|
||||
;; Rendering template
|
||||
(setq license-data (project/render license-data))
|
||||
(identity license-data)
|
||||
)
|
||||
(let (license-data)
|
||||
(setq license-data "Put you GOD DAMN, FUCKing license here")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun project/render-template (template)
|
||||
"Render the template and return the rendered template string"
|
||||
(let (data license-data)
|
||||
(setq data (io/read template))
|
||||
(setq data (project/render data))
|
||||
;; add the license header
|
||||
(setq license-data (insert-license))
|
||||
(setq data (replace-regexp-in-string "::license::" license-data data))
|
||||
)
|
||||
)
|
||||
|
||||
(defun project/write-dest-file (FILE DATA)
|
||||
"Write the rendered DATA to its destenation file in project source tree.
|
||||
destenation file address created from template FILE name.
|
||||
FILE : (string) Address of corresponding template
|
||||
DATA : (string) Rendered data"
|
||||
|
||||
(let (curfile destfile)
|
||||
(setq curfile (split-string FILE "/"))
|
||||
|
||||
(setq curfile (car (last curfile)))
|
||||
(setq curfile (replace-regexp-in-string "__project__" unix-project-name curfile))
|
||||
(setq curfile (replace-regexp-in-string "\.tmpl" "" curfile))
|
||||
;; safe path join (path generated here)
|
||||
(setq destfile (expand-file-name curfile project-path))
|
||||
(io/write destfile DATA)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; --------------------------------------------------------------------
|
||||
;; Groups
|
||||
;; --------------------------------------------------------------------
|
||||
(defgroup kuso-user-preferences nil
|
||||
"User preferences group. this group contain user specified options for
|
||||
Kuso IDE"
|
||||
:group 'kuso-ide
|
||||
:tag '"User Preferences"
|
||||
)
|
||||
|
||||
;; --------------------------------------------------------------------
|
||||
;; Custom Variables
|
||||
;; --------------------------------------------------------------------
|
||||
(defcustom developer-name nil
|
||||
"KusoIDE use this option as author name in project if the value be non-nil"
|
||||
:group 'kuso-user-preferences
|
||||
:type 'string
|
||||
:tag '"Developer full name"
|
||||
)
|
||||
|
||||
(defcustom developer-email nil
|
||||
"KusoIDE use this option as author email in project if the value be non-nil"
|
||||
:group 'kuso-user-preferences
|
||||
:type 'string
|
||||
:tag '"Developer Email"
|
||||
)
|
||||
|
||||
(defcustom kuso-workspace "~/src/"
|
||||
"KusoIDE use this option as default path for new project."
|
||||
:group 'kuso-user-preferences
|
||||
:type 'string
|
||||
:tag '"Workspace"
|
||||
)
|
|
@ -1,26 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010-2011 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
(defvar KUSO-VERSION "v0.14.1"
|
||||
"KusoIDE version string")
|
||||
|
||||
|
||||
(defun get_version ()
|
||||
"Return the Version number, to use in shell script"
|
||||
(let (version)
|
||||
(setq version KUSO-VERSION)
|
||||
)
|
||||
)
|
|
@ -1,216 +0,0 @@
|
|||
;; Kuso - My personal emacs IDE
|
||||
;; Copyright (C) 2010 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; C project plugin for Kuso IDE
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Groups
|
||||
;; ---------------------------------------------------------------------
|
||||
(defgroup kuso-cplugin nil
|
||||
"This group contains all the optional components of Kuso IDE C plugin."
|
||||
:group 'kuso-ide
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Custom Variables
|
||||
;; ---------------------------------------------------------------------
|
||||
(defcustom c-plugin nil
|
||||
"KusoIDE C programming language plugin."
|
||||
:group 'kuso-features
|
||||
:type 'boolean
|
||||
:tag '"C Plugin")
|
||||
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Minor Mode Initialization
|
||||
;; ----------------------------------------------------------------------
|
||||
|
||||
;; If user dont want the plug in so it should not loaded
|
||||
;; -------------------------------------------------------------------
|
||||
;; Hooks
|
||||
;; -------------------------------------------------------------------
|
||||
(defvar kuso-cplug-preinit-hook '()
|
||||
"This hook runs before initializing the Kuso c-plugin minor mode."
|
||||
)
|
||||
|
||||
(defvar kuso-cplug-postinit-hook '()
|
||||
"This hook runs after Kuso c-plugin minor mode initialized."
|
||||
)
|
||||
|
||||
(defvar kuso-cplug-prerm--hook '()
|
||||
"This hook runs before deactivating Kuso c-plugin minor mode."
|
||||
)
|
||||
|
||||
(defvar kuso-cplug-postrm-hook '()
|
||||
"This hook runs after Kuso c-plugin minor mode deactivated."
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Keymaps
|
||||
;; ---------------------------------------------------------------------
|
||||
(defvar kuso-cplugin-map (make-sparse-keymap)
|
||||
"Default keymap for Kuso c-plugin minor mode that hold the global key
|
||||
binding for Kuso IDE C projects section."
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Functions
|
||||
;; ---------------------------------------------------------------------
|
||||
(defun cplugin/init-menus () "Draw required menu for C mode"
|
||||
|
||||
(interactive)
|
||||
(define-key-after global-map [menu-bar file new-proj cproj] (cons "C/C++" (make-sparse-keymap "c-cpp-proj")))
|
||||
|
||||
;; (define-key global-map [menu-bar file new-proj cproj separator2] '("--"))
|
||||
|
||||
; (define-key global-map [Ctrl-x p c n ] 'make-cpp)
|
||||
;; (define-key global-map [menu-bar file new-proj cproj cpp-make] '("Make project (C++)" . make-cpp))
|
||||
|
||||
;; (define-key global-map [Ctrl-x p c m ] 'make-c)
|
||||
;; (define-key global-map [menu-bar file new-proj cproj c-make] '("Make project (C)" . make-c))
|
||||
|
||||
;; (define-key global-map [menu-bar file new-proj cproj separator1] '("--"))
|
||||
|
||||
(define-key global-map (kbd "\C-x n \C-c") 'generic-cpp)
|
||||
(define-key global-map [menu-bar file new-proj cproj cppgeneric] '("Generic project (C++)" . generic-cpp))
|
||||
|
||||
(define-key global-map (kbd "\C-x n c") 'generic-c)
|
||||
(define-key global-map [menu-bar file new-proj cproj cgeneric] '("Generic project (C)" . generic-c))
|
||||
|
||||
(define-key global-map (kbd "\C-x n k") 'kernel-module)
|
||||
(define-key global-map [menu-bar file new-proj cproj kernmod] '("Kernel module" . kernel-module))
|
||||
|
||||
)
|
||||
|
||||
;; Thsi function exists because maybe Kuso needs more information
|
||||
;; about new project in the feature the new-prject function did not
|
||||
;; cover
|
||||
(defun c-new-project () "Create a new C/C++ project"
|
||||
(new-project)
|
||||
(project/copying-license-copy)
|
||||
)
|
||||
|
||||
|
||||
(defun compile ()
|
||||
"Run the make command and return the putput"
|
||||
(interactive)
|
||||
(let (output)
|
||||
(setq output (shell-command-to-string "make"))
|
||||
(message output)
|
||||
)
|
||||
)
|
||||
|
||||
(defun generic-c () "Create a generic type C project"
|
||||
(interactive)
|
||||
(c-new-project)
|
||||
|
||||
(let (template-file-regexp license-data filelist cur template-data)
|
||||
(setq template-file-regexp (concat TEMPLATESPATH "c/generic_c/*.tmpl"))
|
||||
(setq filelist (file-expand-wildcards template-file-regexp))
|
||||
(while filelist
|
||||
(setq cur (pop filelist))
|
||||
(setq template-data (project/render-template cur))
|
||||
(setq template-data (replace-regexp-in-string "::unixname::" unix-project-name template-data))
|
||||
(setq template-data (replace-regexp-in-string "::UNIXNAME::" unix-project-name template-data))
|
||||
(project/write-dest-file cur template-data)
|
||||
)
|
||||
)
|
||||
(find-file (expand-file-name (concat unix-project-name ".c") project-path))
|
||||
|
||||
)
|
||||
|
||||
|
||||
(defun kernel-module () "Create a linux kernel module project"
|
||||
(interactive)
|
||||
(c-new-project)
|
||||
|
||||
(let (template-file-regexp license-data filelist cur template-data)
|
||||
(setq template-file-regexp (concat TEMPLATESPATH "c/kernel_module/*.tmpl"))
|
||||
(setq filelist (file-expand-wildcards template-file-regexp))
|
||||
(while filelist
|
||||
(setq cur (pop filelist))
|
||||
(setq template-data (project/render-template cur))
|
||||
(setq template-data (replace-regexp-in-string "::unixname::" unix-project-name template-data))
|
||||
(setq template-data (replace-regexp-in-string "::UNIXNAME::" unix-project-name template-data))
|
||||
(project/write-dest-file cur template-data)
|
||||
)
|
||||
)
|
||||
|
||||
(find-file (expand-file-name (concat unix-project-name ".c") project-path))
|
||||
|
||||
)
|
||||
|
||||
|
||||
(defun cplugin/initial-keymap ()
|
||||
"Set the key binding for C project."
|
||||
(define-key kuso-cplugin-map (kbd "<f9>") 'compile)
|
||||
)
|
||||
|
||||
(defun cplugin/destruct-menu ()
|
||||
"clean up the created menus."
|
||||
(interactive)
|
||||
(global-unset-key [menu-bar file new-proj cproj])
|
||||
)
|
||||
|
||||
;; Initializing c menus at the load time
|
||||
;; (add-hook 'kuso-postinit-mode-hook 'cplugin/init-menus)
|
||||
;; (add-hook 'kuso-plugin-init-hook 'kuso-cplugin-mode)
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Minor Modes
|
||||
;; ----------------------------------------------------------------------
|
||||
(define-minor-mode kuso-cplugin-mode
|
||||
"Toggle Kuso C plugin mode.
|
||||
This mode provide C language plugin for Kuso IDE."
|
||||
:lighter " kuso-c"
|
||||
:keymap kuso-cplugin-map
|
||||
:global t
|
||||
:group 'kuso-group
|
||||
|
||||
(if kuso-cplugin-mode
|
||||
;; kuso-cplugin-mode is not loaded
|
||||
(let ()
|
||||
(message "sssscccccccccccccccccc")
|
||||
(if kuso-cplugin-mode
|
||||
(progn
|
||||
;; before initiazing mode
|
||||
(run-hooks 'kuso-cplug-preinit-hook)
|
||||
(cplugin/init-menus)
|
||||
(cplugin/initial-keymap)
|
||||
|
||||
(define-key global-map (kbd "s-p") 'kuso-cplugin-map)
|
||||
(message "ssssssssssssssssssssssssssssss")
|
||||
;; after mode was initialized
|
||||
(run-hooks 'kuso-cplug-postinit-hook)
|
||||
(log "C Plugin turned on")
|
||||
)
|
||||
(log "Can't load Cplugin")
|
||||
)
|
||||
)
|
||||
;; kuso-mode already loaded
|
||||
(let ()
|
||||
;; before deactivating mode
|
||||
(run-hooks 'kuso-cplug-prerm-hook)
|
||||
(cplugin/destruct-menu)
|
||||
;; after deactivating mode
|
||||
(run-hooks 'kuso-cplug-postrm-hook)
|
||||
(log "C Plugin turned off")
|
||||
)
|
||||
)
|
||||
)
|
||||
(provide 'cproject)
|
|
@ -1,289 +0,0 @@
|
|||
;; lxdjango-mode - My personal emacs IDE
|
||||
;; Copyright (C) 2010-2011 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; lxdjango plugin
|
||||
|
||||
(require 'cl)
|
||||
(require 'comint)
|
||||
;; -------------------------------------------------------------------
|
||||
;; Constant
|
||||
;; -------------------------------------------------------------------
|
||||
(defconst *python* "/usr/bin/python")
|
||||
|
||||
;; -------------------------------------------------------------------
|
||||
;; Variables
|
||||
;; -------------------------------------------------------------------
|
||||
(defvar project-path ""
|
||||
"Project source tree path.")
|
||||
|
||||
;; -------------------------------------------------------------------
|
||||
;; Hooks
|
||||
;; -------------------------------------------------------------------
|
||||
(defvar django-preinit-hook '()
|
||||
"This hook runs before initializing the lxdjango minor mode."
|
||||
)
|
||||
|
||||
(defvar django-postinit-hook '()
|
||||
"This hook runs after lxdjango minor mode initialized."
|
||||
)
|
||||
|
||||
(defvar django-prerm--hook '()
|
||||
"This hook runs before deactivating lxdjango minor mode."
|
||||
)
|
||||
|
||||
(defvar django-postrm-hook '()
|
||||
"This hook runs after lxdjango minor mode deactivated."
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Keymaps
|
||||
;; ---------------------------------------------------------------------
|
||||
(defvar django-map (make-sparse-keymap)
|
||||
"Default keymap for lxdjango minor mode"
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Groups
|
||||
;; ---------------------------------------------------------------------
|
||||
(defgroup django nil
|
||||
"Django minor mode for Emacs."
|
||||
:group 'programming
|
||||
:prefix "lxdjango")
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Custom Variables
|
||||
;; ---------------------------------------------------------------------
|
||||
(defcustom django-plugin t
|
||||
"Django framework minor mode."
|
||||
:group 'django
|
||||
:type 'boolean
|
||||
:tag '"django plugins")
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Functions
|
||||
;; ----------------------------------------------------------------------
|
||||
(defun django/init-keymap ()
|
||||
"Initialize the keymap for django plugin."
|
||||
(define-key django-map (kbd "<f6>") 'django-runserver)
|
||||
(define-key django-map (kbd "<f7>") 'django-syncdb)
|
||||
(define-key django-map (kbd "s-<f1>") 'python/gethelp)
|
||||
(define-key django-map (kbd "\C-c s") 'django-shell)
|
||||
)
|
||||
|
||||
(defun django/init-menus ()
|
||||
"Initialize menu entry for django plugin."
|
||||
(define-key-after global-map [menu-bar django] (cons "Django" (make-sparse-keymap "django-map")))
|
||||
(define-key-after global-map [menu-bar django manage] (cons "Management" (make-sparse-keymap "django-manage-map")))
|
||||
(define-key-after global-map [menu-bar django manage runserver] '("Development Server" . django-runserver))
|
||||
(define-key-after global-map [menu-bar django manage runserver-extra] '("Development Server Extended" . django-runserver-extra) 'runserver)
|
||||
(define-key-after global-map [menu-bar django manage syncdb] '("Syncdb" . django-syncdb) 'runserver-extra)
|
||||
(define-key-after global-map [menu-bar django manage syncdb-extra] '("Syncdb with extra options" . django-syncdb-extra) 'syncdb)
|
||||
(define-key-after global-map [menu-bar django manage custom-command] '("Custom Command" . django-command) 'syncdb-extra)
|
||||
(define-key-after global-map [menu-bar django shell] '("Project shell" . django-shell) 'manage)
|
||||
(define-key-after global-map [menu-bar django sep2] '("--") 'runserver-extra)
|
||||
(define-key-after global-map [menu-bar django pylintcheck] '("Check buffer with pylint" . pylint-check-current-buffer) 'django-shell)
|
||||
(define-key-after global-map [menu-bar django cleanup] '("Cleanup source tree" . django/cleanup) 'pylintcheck)
|
||||
(define-key-after global-map [menu-bar django sep3] '("--") 'cleanup)
|
||||
(define-key-after global-map [menu-bar django cwordhelp] '("Current word help" . python/gethelp) 'sep3)
|
||||
)
|
||||
|
||||
(defun django/destruct-menus ()
|
||||
"Remove menus from menubar"
|
||||
(global-unset-key [menu-bar django])
|
||||
)
|
||||
|
||||
(defun get-project-path ()
|
||||
"Get the project path."
|
||||
(setq project-path (read-directory-name "Project source tree: "))
|
||||
)
|
||||
|
||||
|
||||
(defun manage-command (buffername command-process-name command)
|
||||
"Run the given command in e new buffer."
|
||||
(let (fullcommand lastslash)
|
||||
(if (string= project-path "")
|
||||
(get-project-path)
|
||||
)
|
||||
(cd project-path)
|
||||
(setq newcommand-buffer (get-buffer-create buffername))
|
||||
(ansi-color-for-comint-mode-on)
|
||||
(switch-to-buffer newcommand-buffer)
|
||||
(add-hook 'after-change-functions 'buffer-change-colorizing t t)
|
||||
(setq fullcommand (expand-file-name "manage.py" project-path))
|
||||
(message fullcommand)
|
||||
(setq commandp (apply 'make-comint-in-buffer command-process-name newcommand-buffer *python* nil (list fullcommand command)))
|
||||
(cd django-cwd)
|
||||
)
|
||||
)
|
||||
|
||||
(defun* django-syncdb (&optional (extra ""))
|
||||
"Run the django syndb"
|
||||
(interactive)
|
||||
(let (params)
|
||||
(if (not (string= extra ""))
|
||||
(setq params (concat "syncdb " extra))
|
||||
(setq params "syncdb")
|
||||
)
|
||||
(manage-command "*Syncdb*" "syncdb" params)
|
||||
)
|
||||
)
|
||||
|
||||
(defun django-syncdb-extra ()
|
||||
"Run the django syndb with extra options."
|
||||
(interactive "sEnter extra options for syncdb: ")
|
||||
(django-syncdb extra)
|
||||
)
|
||||
|
||||
(defun buffer-change-colorizing (start end length)
|
||||
"colorizing the region from start to end."
|
||||
(ansi-color-apply-on-region start end)
|
||||
)
|
||||
|
||||
(defun* django-runserver (&optional (extra ""))
|
||||
"Run the project development server in a new buffer"
|
||||
(interactive)
|
||||
(let (params)
|
||||
(if (not (string= extra ""))
|
||||
(setq params (concat "runserver " extra))
|
||||
(setq params "runserver")
|
||||
)
|
||||
(manage-command "*Runserver*" "Runserver" params)
|
||||
)
|
||||
)
|
||||
|
||||
(defun django-runserver-extra (args)
|
||||
"Run the development server with extra options."
|
||||
(interactive "sEnter extra arguments for runserver: ")
|
||||
(django-runserver args)
|
||||
)
|
||||
(defun django-shell ()
|
||||
"Running Django shell."
|
||||
(interactive)
|
||||
(manage-command "*Shell*" "Shell" "shell")
|
||||
)
|
||||
|
||||
(defun django-command (command)
|
||||
"Run the specified command with manage.py"
|
||||
(interactive "sEnter command: ")
|
||||
(manage-command "*Custom*" "custom" command)
|
||||
)
|
||||
|
||||
|
||||
(defun django/cleanup ()
|
||||
"Remove all the unneecessary files form project."
|
||||
(interactive)
|
||||
(let (buffer commands)
|
||||
(if (string= project-path "")
|
||||
(get-project-path)
|
||||
)
|
||||
(setq commands "rm -fv `find @@pp@@ -iname \"*.pyc\"` && rm -fv `find @@pp@@ -iname \"*~\"` && rm -fv `find @@pp@@ -iname \"\.#*\"` && rm -vf `find @@pp@@ -iname \"#*\"`")
|
||||
(setq commands (replace-regexp-in-string "@@pp@@" project-path commands))
|
||||
(setq buffer (get-buffer-create "*Cleanup*"))
|
||||
(switch-to-buffer buffer)
|
||||
(start-process-shell-command "Cleanup" buffer commands)
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
(defun django/get-todo ()
|
||||
"Get a list of TODO entries from the project source tree"
|
||||
(interactive)
|
||||
(let (command gbuffer commandp)
|
||||
(if (string= project-path "")
|
||||
(get-project-path)
|
||||
)
|
||||
(setq command (concat "grep \"# TODO:\" " project-path " -Rn -T --color"))
|
||||
(message command)
|
||||
(setq gbuffer (get-buffer-create "*Grep*"))
|
||||
(ansi-color-for-comint-mode-on)
|
||||
(switch-to-buffer gbuffer)
|
||||
(add-hook 'after-change-functions 'buffer-change-colorizing t t)
|
||||
(setq commandp (start-process-shell-command "grep" gbuffer command))
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun pylint-check-current-buffer ()
|
||||
"Run pylint on current buffer."
|
||||
(interactive)
|
||||
(let (cbuffer-file pylint-buffer commandp)
|
||||
(setq cbuffer-file (buffer-file-name))
|
||||
(if (stringp cbuffer-file)
|
||||
(progn
|
||||
(setq pylint-buffer (get-buffer-create "*Pylint*"))
|
||||
(ansi-color-for-comint-mode-on)
|
||||
(switch-to-buffer pylint-buffer)
|
||||
(add-hook 'after-change-functions 'buffer-change-colorizing t t)
|
||||
(setq fullcommand (concat "pylint -f colorized " cbuffer-file))
|
||||
(setq commandp (start-process-shell-command "pylint" pylint-buffer fullcommand))
|
||||
)
|
||||
(message "This buffer did not visit any file.")
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
(defun python/gethelp ()
|
||||
"Show the python help of current word"
|
||||
(interactive)
|
||||
(let (cword pybuffer fullcommand)
|
||||
(setq pybuffer (get-buffer-create "*PyHelp*"))
|
||||
(setq cword (thing-at-point 'word))
|
||||
(ansi-color-for-comint-mode-on)
|
||||
(switch-to-buffer-other-window pybuffer)
|
||||
(erase-buffer)
|
||||
(setq fullcommand (concat *python* " -c 'help(\"" cword "\")'"))
|
||||
(setq commandp (start-process-shell-command *python* pybuffer fullcommand))
|
||||
;;(setq fullcommand (concat "-c 'help(\"" cword "\")'"))
|
||||
;;(setq commandp (apply 'make-comint-in-buffer "python" pybuffer "python" nil (list fullcommand)))
|
||||
)
|
||||
)
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Minor Modes
|
||||
;; ----------------------------------------------------------------------
|
||||
(define-minor-mode django-mode
|
||||
"Toggle lxdjango minor mode.
|
||||
This plugin provide some functionality for speedup django development on
|
||||
GNUEmacs."
|
||||
:global nil
|
||||
:lighter nil
|
||||
:keymap django-map
|
||||
:group 'django
|
||||
|
||||
(if django-mode
|
||||
;; lxdjango minor mode is not loaded
|
||||
(let ()
|
||||
;; before initiazing mode
|
||||
(run-hooks 'django-preinit-hook)
|
||||
(django/init-keymap)
|
||||
(django/init-menus)
|
||||
(setq django-cwd default-directory)
|
||||
;;(put 'django-region 'menu-enable nil)
|
||||
;; after mode was initialized
|
||||
(run-hooks 'django-postinit-hook)
|
||||
)
|
||||
;; lxdjango plugin already loaded
|
||||
(let ()
|
||||
;; before deactivating mode
|
||||
(run-hooks 'django-prerm-hook)
|
||||
(django/destruct-menus)
|
||||
(setq project-path "")
|
||||
;; after deactivating mode
|
||||
(run-hooks 'django-postrm-hook)
|
||||
)
|
||||
)
|
||||
)
|
||||
(provide 'django)
|
|
@ -1,171 +0,0 @@
|
|||
;; nodejs-mode - NodeJs plugin for KusoIDE
|
||||
;; Copyright (C) 2010-2011 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, either version 3 of the License, or
|
||||
;; 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/>.
|
||||
|
||||
;; nodejs plugin
|
||||
|
||||
;; TODO: Add a function to check for nodejs installation
|
||||
|
||||
(require 'cl)
|
||||
(require 'comint)
|
||||
;; -------------------------------------------------------------------
|
||||
;; Constant
|
||||
;; -------------------------------------------------------------------
|
||||
(defconst *node* "node")
|
||||
|
||||
;; -------------------------------------------------------------------
|
||||
;; Variables
|
||||
;; -------------------------------------------------------------------
|
||||
(defvar project-path ""
|
||||
"Project source tree path.")
|
||||
|
||||
;; -------------------------------------------------------------------
|
||||
;; Hooks
|
||||
;; -------------------------------------------------------------------
|
||||
(defvar nodejs-preinit-hook '()
|
||||
"This hook runs before initializing the nodejs minor mode."
|
||||
)
|
||||
|
||||
(defvar nodejs-postinit-hook '()
|
||||
"This hook runs after nodejs minor mode initialized."
|
||||
)
|
||||
|
||||
(defvar nodejs-prerm--hook '()
|
||||
"This hook runs before deactivating nodejs minor mode."
|
||||
)
|
||||
|
||||
(defvar nodejs-postrm-hook '()
|
||||
"This hook runs after nodejs minor mode deactivated."
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Keymaps
|
||||
;; ---------------------------------------------------------------------
|
||||
(defvar nodejs-map (make-sparse-keymap)
|
||||
"Default keymap for nodejs minor mode"
|
||||
)
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Groups
|
||||
;; ---------------------------------------------------------------------
|
||||
(defgroup nodejs nil
|
||||
"Nodejs minor mode for Emacs."
|
||||
:group 'programming
|
||||
:prefix "nodejs")
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Custom Variables
|
||||
;; ---------------------------------------------------------------------
|
||||
(defcustom nodejs-plugin t
|
||||
"Nodejs framework minor mode."
|
||||
:group 'nodejs
|
||||
:type 'boolean
|
||||
:tag '"nodejs plugins")
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Functions
|
||||
;; ----------------------------------------------------------------------
|
||||
(defun nodejs/init-keymap ()
|
||||
"Initialize the keymap for nodejs plugin."
|
||||
(define-key nodejs-map (kbd "<f6>") 'nodejs-run)
|
||||
(define-key nodejs-map (kbd "<f7>") 'nodejs-npm)
|
||||
)
|
||||
|
||||
(defun nodejs/init-menus ()
|
||||
"Initialize menu entry for nodejs plugin."
|
||||
(define-key-after global-map [menu-bar nodejs] (cons "Nodejs" (make-sparse-keymap "nodejs-map")))
|
||||
(define-key-after global-map [menu-bar nodejs run] '("Run" . nodejs-run))
|
||||
(define-key-after global-map [menu-bar nodejs npm] '("Install package (npm)" . nodejs-npm) 'run)
|
||||
)
|
||||
|
||||
(defun nodejs/destruct-menus ()
|
||||
"Remove menus from menubar"
|
||||
(global-unset-key [menu-bar nodejs])
|
||||
)
|
||||
|
||||
|
||||
(defun nodejs-run ()
|
||||
"Run current buffer with node"
|
||||
(interactive)
|
||||
(let (fullcommand command)
|
||||
(setq command (buffer-file-name))
|
||||
(if (eq command nil)
|
||||
(progn
|
||||
(save-buffer)
|
||||
(setq command (buffer-file-name))
|
||||
)
|
||||
)
|
||||
(message command)
|
||||
(setq newcommand-buffer (get-buffer-create "*NodeJS*"))
|
||||
(ansi-color-for-comint-mode-on)
|
||||
(switch-to-buffer newcommand-buffer)
|
||||
(add-hook 'after-change-functions 'buffer-change-colorizing t t)
|
||||
(setq fullcommand *node*)
|
||||
(message fullcommand)
|
||||
(setq commandp (apply 'make-comint-in-buffer *node* newcommand-buffer *node* nil (list command)))
|
||||
)
|
||||
)
|
||||
|
||||
(defun nodejs-npm (package)
|
||||
"Install a package using npm utility"
|
||||
(interactive "sPackage name: ")
|
||||
(let (fullcommand command)
|
||||
(setq command (concat "install " package))
|
||||
(message command)
|
||||
(setq newcommand-buffer (get-buffer-create "*npm*"))
|
||||
(ansi-color-for-comint-mode-on)
|
||||
(switch-to-buffer newcommand-buffer)
|
||||
(add-hook 'after-change-functions 'buffer-change-colorizing t t)
|
||||
(setq fullcommand "npm")
|
||||
(message fullcommand)
|
||||
(setq commandp (apply 'make-comint-in-buffer "npm" newcommand-buffer "npm" nil (list "install" package)))
|
||||
)
|
||||
)
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; Minor Modes
|
||||
;; ----------------------------------------------------------------------
|
||||
(define-minor-mode nodejs-mode
|
||||
"Toggle nodejs minor mode.
|
||||
This plugin provide some functionality for speedup nodejs development on
|
||||
GNUEmacs."
|
||||
:global nil
|
||||
:lighter nil
|
||||
:keymap nodejs-map
|
||||
:group 'nodejs
|
||||
|
||||
(if nodejs-mode
|
||||
;; nodejs minor mode is not loaded
|
||||
(let ()
|
||||
;; before initiazing mode
|
||||
(run-hooks 'nodejs-preinit-hook)
|
||||
(nodejs/init-keymap)
|
||||
(nodejs/init-menus)
|
||||
(setq nodejs-cwd default-directory)
|
||||
;;(put 'nodejs-region 'menu-enable nil)
|
||||
;; after mode was initialized
|
||||
(run-hooks 'nodejs-postinit-hook)
|
||||
)
|
||||
;; nodejs plugin already loaded
|
||||
(let ()
|
||||
;; before deactivating mode
|
||||
(run-hooks 'nodejs-prerm-hook)
|
||||
(nodejs/destruct-menus)
|
||||
(setq project-path "")
|
||||
;; after deactivating mode
|
||||
(run-hooks 'nodejs-postrm-hook)
|
||||
)
|
||||
)
|
||||
)
|
||||
(provide 'nodejs)
|
|
@ -1,27 +0,0 @@
|
|||
CC = gcc
|
||||
CFLAGS = -g -Wall
|
||||
OBJECTS = ::unixname::.o
|
||||
INCFLAGS =
|
||||
LDFLAGS = -Wl,-rpath,/usr/local/lib
|
||||
LIBS =
|
||||
|
||||
all: ::unixname::
|
||||
|
||||
::unixname::: $(OBJECTS)
|
||||
$(CC) -o ::unixname:: $(OBJECTS) $(LDFLAGS) $(LIBS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .cc .C .cpp .o
|
||||
|
||||
.c.o :
|
||||
$(CC) -o $@ -c $(CFLAGS) $< $(INCFLAGS)
|
||||
|
||||
count:
|
||||
wc *.c *.cc *.C *.cpp *.h *.hpp
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
.PHONY: all
|
||||
.PHONY: count
|
||||
.PHONY: clean
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
::license::
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "::unixname::.h"
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
printf("Hello SHIT World\n");
|
||||
return 0;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
/*
|
||||
::license::
|
||||
*/
|
||||
|
||||
#ifndef ::UNIXNAME::_H
|
||||
#define ::UNIXNAME::_H
|
||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||
# Comment/uncomment the following line to disable/enable debugging
|
||||
#DEBUG = y
|
||||
|
||||
# Add your debugging flag (or not) to CFLAGS
|
||||
ifeq ($(DEBUG),y)
|
||||
DEBFLAGS = -O -g # "-O" is needed to expand inlines
|
||||
else
|
||||
DEBFLAGS = -O2
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINCDIR)
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
# call from kernel build system
|
||||
|
||||
obj-m := ::unixname::.o
|
||||
|
||||
else
|
||||
|
||||
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
|
||||
PWD := $(shell pwd)
|
||||
|
||||
default:
|
||||
$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINCDIR=$(PWD)/../include modules
|
||||
|
||||
endif
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
|
||||
|
||||
depend .depend dep:
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -M *.c > .depend
|
||||
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
::license::
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("::author:: <::email::>");
|
||||
MODULE_DESCRIPTION("::desc::");
|
||||
|
||||
|
||||
static int __init module_initial(void)
|
||||
{
|
||||
printk(KERN_ALERT "Hello, world\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void module_cleanup(void)
|
||||
{
|
||||
printk(KERN_ALERT "Goodbye, cruel world\n");
|
||||
}
|
||||
|
||||
|
||||
module_init(module_initial);
|
||||
module_exit(module_cleanup);
|
|
@ -1,15 +0,0 @@
|
|||
::project:: - ::desc::
|
||||
Copyright (C) ::year:: ::author:: <::email::>
|
||||
|
||||
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
|
||||
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/>.
|
|
@ -1,339 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 2 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
Loading…
Reference in New Issue