################################################################################
#
# emacs.cygclass - functions for installing Emacs lisp files
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006-2016 Yaakov Selkowitz
# Provided by the Cygwin Ports project <http://sourceware.org/cygwinports/>
#
# cygport 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.
#
# cygport 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 cygport.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

#****h* Cygclasses/emacs.cygclass
#  DESCRIPTION
#  Emacs is a programmers' text editor which is extensible through libraries
#  written in its own Lisp dialect, which is also bytecode compilable.
#
#  This cygclass includes helper functions for installing Emacs Lisp (.el)
#  libraries.
#****

#****d* emacs.cygclass/EMACS
#  DESCRIPTION
#  Absolute path to the emacs command.
#****
EMACS=/usr/bin/emacs

#****d* emacs.cygclass/EMACS_SITE
#  DESCRIPTION
#  Path of Emacs' site-lisp directory, where third-party libraries are installed.
#****
EMACS_SITE=/usr/share/emacs/site-lisp

#****I* emacs.cygclass/doemacs
#  SYNOPSIS
#  doemacs FILE [FILE2] ...
#  DESCRIPTION
#  Installs one or more Emacs Lisp libraries into EMACS_SITE (under $D).
#****
doemacs() {
	local i

	dodir ${EMACS_SITE}

	for i
	do
		if [ ! -e ${i} ]
		then
			error "file ${i} does not exist"
		fi

		__doinstall 0644 ${i} ${EMACS_SITE} || error "doemacs ${i} failed"
	done
}

# deprecated by auto-compile in postinstall
emacs_compile() { :; }

readonly -f doemacs
