diff --git a/dotemacs.el b/dotemacs.el index 034d975..9180e94 100644 --- a/dotemacs.el +++ b/dotemacs.el @@ -7,4 +7,4 @@ (global-font-lock-mode t) ;; enable visual feedback on selections -(setq transient-mark-mode t) +;(setq transient-mark-mode t) diff --git a/emacs.spec b/emacs.spec index ab111ce..4789979 100644 --- a/emacs.spec +++ b/emacs.spec @@ -2,10 +2,10 @@ %define muleucs_ver current -Summary: The libraries needed to run the GNU Emacs text editor. +Summary: GNU Emacs text editor Name: emacs Version: 21.3 -Release: 7 +Release: 9 License: GPL URL: http://www.gnu.org/software/emacs/ Group: Applications/Editors @@ -15,12 +15,11 @@ Source3: emacs.desktop Source4: emacs.png Source5: dotemacs.el Source6: site-start.el -Source7: python-mode.el -Source8: http://www.tihlde.org/~stigb/rpm-spec-mode.el -#Source9: emacs-asian-0.2.tar.bz2 +Source7: http://www.python.org/emacs/python-mode/python-mode.el +Source8: http://cvs.xemacs.org/viewcvs.cgi/XEmacs/packages/xemacs-packages/prog-modes/rpm-spec-mode.el Source10: ftp://ftp.gnu.org/gnu/emacs/elisp-manual-21-2.8.tar.bz2 # 1.0.2 - http://prdownloads.sourceforge.net/php-mode/php-mode-102.el -Source11: php-mode.el +Source11: http://prdownloads.sourceforge.net/php-mode/php-mode.el Source12: php-mode-init.el Source13: ssl.el Source16: python-mode-init.el @@ -33,7 +32,7 @@ Source23: po-mode-auto-replace-date-71264.patch Source24: ftp://ftp.m17n.org/pub/mule/Mule-UCS/test/Mule-UCS-%{muleucs_ver}.tar.gz Source25: lang-coding-systems-init.el Source26: default.el -#Patch1: emacs-21.2-pop.patch +Source27: rfc1345.el Patch2: emacs-21.2-s390.patch Patch3: emacs-21.2-x86_64.patch Patch4: emacs-21.2-sticky-bit-80049.patch @@ -42,13 +41,18 @@ Patch6: emacs-21.2-menubar-games.patch Patch7: emacs-21.2-alloc-blockinput-83600.patch Patch8: browse-url-htmlview-84262.patch Patch9: emacs-21.3-ppc64.patch +Patch10: editfns.c-Fformat-multibyte-davej.patch Buildroot: %{_tmppath}/%{name}-%{version}-root Prereq: /sbin/install-info, dev -BuildRequires: glibc-devel, gcc, XFree86-devel, bzip2, ncurses-devel, zlib-devel, libpng-devel, libjpeg-devel, libungif-devel, libtiff-devel +BuildRequires: glibc-devel, gcc, bzip2, ncurses-devel, zlib-devel, autoconf213 +Buildrequires: XFree86-devel, Xaw3d-devel, libpng-devel, libjpeg-devel, libungif-devel, libtiff-devel +Requires: ncurses, zlib +Requires: XFree86-libs, Xaw3d, libpng, libjpeg, libungif, libtiff %ifarch %{ix86} BuildRequires: setarch %endif -Obsoletes: emacs-nox, emacs-X11 +Requires: emacs-common = %{version}-%{release} +Obsoletes: emacs-X11 Conflicts: gettext < 0.10.40 %description @@ -57,10 +61,39 @@ editor. Emacs contains special code editing features, a scripting language (elisp), and the capability to read mail, news, and more without leaving the editor. -%package el -Summary: The sources for elisp programs included with Emacs. +This package provides an emacs binary with support for X windows. + +%package nox +Summary: GNU Emacs text editor without X support Group: Applications/Editors -Requires: emacs +Requires: ncurses, zlib +Requires: emacs-common = %{version}-%{release} + +%description nox +Emacs is a powerful, customizable, self-documenting, modeless text +editor. Emacs contains special code editing features, a scripting +language (elisp), and the capability to read mail, news, and more +without leaving the editor. + +This package provides an emacs binary with no X windows support for running +on a terminal. + +%package common +Summary: Emacs common files +Group: Applications/Editors + +%description common +Emacs is a powerful, customizable, self-documenting, modeless text +editor. Emacs contains special code editing features, a scripting +language (elisp), and the capability to read mail, news, and more +without leaving the editor. + +This package contains all the common files needed by emacs or emacs-nox. + +%package el +Summary: Emacs Lisp source files included with Emacs. +Group: Applications/Editors +Requires: emacs = %{version} %description el Emacs-el contains the emacs-elisp sources for many of the elisp @@ -70,9 +103,9 @@ You need to install emacs-el only if you intend to modify any of the Emacs packages or see some elisp examples. %package leim -Summary: Emacs Lisp code for input methods for international characters. +Summary: Emacs Lisp files for input methods for international characters. Group: Applications/Editors -Requires: emacs +Requires: emacs = %{version} %description leim The emacs-leim package contains Emacs Lisp code for input methods for @@ -92,6 +125,7 @@ sets are included in this package. # block input in `allocate_vectorlike' (alloc.c) %patch7 -p1 -b .block %patch9 -p1 -b .ppc64 +%patch10 -p1 -b .multibyte ## Lisp patches # remove game we can't ship @@ -102,9 +136,12 @@ rm lisp/finder-inf.el lisp/play/tetris.el* # patches 2 and 3 touch configure.in autoconf-2.13 +# add rfc1345 input method (default for UTF-8 lang env) +cp -pi %SOURCE27 leim/quail + %build export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS" -%configure --with-gcc --with-pop --with-sound +%configure --with-pop --with-sound # workaround #101818 (vm/break dumper problem) %ifarch %{ix86} @@ -114,23 +151,25 @@ export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS" %__make %{?_smp_mflags} # remove versioned file so that we end up with .1 suffix and only one DOC file rm src/emacs-%{version}.* + +TOPDIR=${PWD} +%define emacsbatch ${TOPDIR}/src/emacs -batch --no-init-file --no-site-file + +# setup site-lisp files +cp %SOURCE7 %SOURCE8 %SOURCE11 %SOURCE13 %SOURCE20 %SOURCE21 site-lisp +# xemacs compat patch +patch -d site-lisp < %SOURCE18 +# fix po-auto-replace-revision-date nil +patch -d site-lisp < %SOURCE23 + # make sure patched lisp files get byte-compiled -src/emacs -batch -f batch-byte-recompile-directory lisp +%emacsbatch -f batch-byte-recompile-directory lisp +%emacsbatch -f batch-byte-compile leim/quail/rfc1345.el site-lisp/*.el + %__make %{?_smp_mflags} -C lisp updates -%define emacsbatch src/emacs -batch --no-init-file --no-site-file - -# bytecompile python-mode, ssl, php-mode and rpm-spec-mode -cp %SOURCE7 %SOURCE8 %SOURCE11 %SOURCE13 %SOURCE20 %SOURCE21 . - -# xemacs compat patch -patch < %SOURCE18 -# fix po-auto-replace-revision-date nil -patch < %SOURCE23 -%{emacsbatch} -f batch-byte-compile *.el - ( cd Mule-UCS-%{muleucs_ver} - ../%{emacsbatch} -q --no-site-file -l mucs-comp.el ) + %{emacsbatch} -l mucs-comp.el ) %install rm -rf $RPM_BUILD_ROOT @@ -142,20 +181,29 @@ rm -rf $RPM_BUILD_ROOT %makeinstall +# rebuild without X support +%configure --without-x +%__make %{?_smp_mflags} + +# install the emacs without X +install -m 0755 src/emacs $RPM_BUILD_ROOT%{_bindir}/emacs-nox +install -m 0755 src/emacs-%{version}.2 $RPM_BUILD_ROOT%{_bindir}/emacs-nox-%{version} +install -m 0644 etc/DOC-%{version}.2 $RPM_BUILD_ROOT%{_datadir}/emacs/%{version}/etc/ +install -m 0644 lib-src/fns-%{version}.2.el $RPM_BUILD_ROOT%{_libexecdir}/emacs/%{version}/*/ + # make sure movemail isn't setgid chmod 755 $RPM_BUILD_ROOT%{_libexecdir}/emacs/%{version}/*/movemail -# # install lisp files for Japanese and other Asian languages -# tar jxC $RPM_BUILD_ROOT -f %{SOURCE9} - rm -f $RPM_BUILD_ROOT%{_infodir}/dir mkdir -p $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp install -m 0644 %SOURCE6 $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/site-start.el install -m 0644 %SOURCE26 $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp -mv $RPM_BUILD_ROOT%{_mandir}/man1/ctags.1 $RPM_BUILD_ROOT%{_mandir}/man1/gctags.1 -mv $RPM_BUILD_ROOT%{_bindir}/ctags $RPM_BUILD_ROOT%{_bindir}/gctags +mv $RPM_BUILD_ROOT%{_bindir}/{etags,etags.emacs} +mv $RPM_BUILD_ROOT%{_mandir}/man1/{ctags.1,gctags.1} +mv $RPM_BUILD_ROOT%{_bindir}/{ctags,ctags.emacs} +ln -s ctags.emacs $RPM_BUILD_ROOT%{_bindir}/gctags # GNOME / KDE files mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications @@ -164,7 +212,7 @@ mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps install -m 0644 %SOURCE4 $RPM_BUILD_ROOT%{_datadir}/pixmaps/ # install site-lisp files -install -m 0644 *.el *.elc $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/ +install -m 0644 site-lisp/*.el{,c} $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/ mkdir -p $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/site-start.d install -m 0644 $RPM_SOURCE_DIR/*-init.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/site-start.d @@ -176,7 +224,7 @@ install -m 0644 %SOURCE5 $RPM_BUILD_ROOT%{_sysconfdir}/skel/.emacs # elisp reference manual tar jxf %{SOURCE10} ( cd elisp-manual-21-2.8 - install -m 644 elisp elisp-? elisp-?? $RPM_BUILD_ROOT%{_infodir} ) + install -m 644 elisp elisp-* $RPM_BUILD_ROOT%{_infodir} ) ( cd Mule-UCS-%{muleucs_ver}/lisp mkdir %buildroot%{_datadir}/emacs/site-lisp/Mule-UCS @@ -185,19 +233,18 @@ tar jxf %{SOURCE10} # # create file lists # -SRC_TOP=$PWD -rm -f *-filelist {base,el,leim}-*-files -pushd $RPM_BUILD_ROOT +rm -f *-filelist {common,el,leim}-*-files +( TOPDIR=${PWD} + cd $RPM_BUILD_ROOT -find .%{_datadir}/emacs/%{version}/lisp .%{_datadir}/emacs/site-lisp \( -type f -not -name '*.el' -fprint $SRC_TOP/base-lisp-none-elc-files \) -o \( -type d -fprintf $SRC_TOP/base-lisp-dir-files "%%%%dir %%p\n" \) -o \( -name '*.el' \( -exec test -e '{}'c \; -fprint $SRC_TOP/el-bytecomped-files -o -fprint $SRC_TOP/base-not-comped-files \) \) + find .%{_datadir}/emacs/%{version}/lisp .%{_datadir}/emacs/site-lisp \( -type f -not -name '*.el' -fprint $TOPDIR/common-lisp-none-elc-files \) -o \( -type d -fprintf $TOPDIR/common-lisp-dir-files "%%%%dir %%p\n" \) -o \( -name '*.el' ! -name site-start.el \( -exec test -e '{}'c \; -fprint $TOPDIR/el-bytecomped-files -o -fprint $TOPDIR/common-not-comped-files \) \) -find .%{_datadir}/emacs/%{version}/leim \( -name '*.elc' -fprint $SRC_TOP/leim-elc-files \) -o \( -type d -fprintf $SRC_TOP/leim-dir-files "%%%%dir %%p\n" -fprintf $SRC_TOP/el-leim-dir-files "%%%%dir %%p\n" \) -o \( -name '*.el' \( -exec test -e '{}'c \; -fprint $SRC_TOP/el-leim-bytecomped-files -o -fprint $SRC_TOP/leim-not-comped-files \) \) - -popd + find .%{_datadir}/emacs/%{version}/leim \( -name '*.elc' -fprint $TOPDIR/leim-elc-files \) -o \( -type d -fprintf $TOPDIR/leim-dir-files "%%%%dir %%p\n" -fprintf $TOPDIR/el-leim-dir-files "%%%%dir %%p\n" \) -o \( -name '*.el' \( -exec test -e '{}'c \; -fprint $TOPDIR/el-leim-bytecomped-files -o -fprint $TOPDIR/leim-not-comped-files \) \) +) # put the lists together after filtering ./usr to /usr perl -pi -e "s|\.%{_prefix}|%{_prefix}|" *-files -cat base-*-files > base-filelist +cat common-*-files > common-filelist cat el-*-files > el-filelist cat leim-*-files > leim-filelist @@ -205,12 +252,15 @@ cat leim-*-files > leim-filelist rm -rf $RPM_BUILD_ROOT %define info_files ccmode cl dired-x ediff emacs forms gnus info message mh-e reftex sc vip viper widget elisp -%post +%post common for f in %{info_files}; do /sbin/install-info %{_infodir}/$f.gz %{_infodir}/dir --section="GNU Emacs" 2> /dev/null || : done -%preun +# make etags a symlink to etags.emacs if etags doesn't exist +[ -e %{_bindir}/etags ] || ln -s etags.emacs %{_bindir}/etags + +%preun common if [ "$1" = 0 ]; then for f in %{info_files}; do /sbin/install-info --delete %{_infodir}/$f.gz %{_infodir}/dir \ @@ -218,30 +268,44 @@ for f in %{info_files}; do done fi +%files +%defattr(-,root,root) +%{_bindir}/emacs +%{_bindir}/emacs-%{version} +%dir %{_datadir}/emacs/%{version}/etc +%{_datadir}/emacs/%{version}/etc/DOC-%{version}.1 +%dir %{_libexecdir}/emacs/%{version}/* +%{_libexecdir}/emacs/%{version}/*/fns-%{version}.1.el -%files -f base-filelist +%files nox +%defattr(-,root,root) +%{_bindir}/emacs-nox +%{_bindir}/emacs-nox-%{version} +%dir %{_datadir}/emacs/%{version}/etc +%{_datadir}/emacs/%{version}/etc/DOC-%{version}.2 +%dir %{_libexecdir}/emacs/%{version}/* +%{_libexecdir}/emacs/%{version}/*/fns-%{version}.2.el + +%files -f common-filelist common %defattr(-,root,root) %config(noreplace) %{_sysconfdir}/skel/.emacs %doc etc/NEWS BUGS README +%exclude %{_bindir}/emacs +%exclude %{_bindir}/emacs-%{version} +%exclude %{_bindir}/emacs-nox +%exclude %{_bindir}/emacs-nox-%{version} %{_bindir}/* %{_mandir}/*/* %{_infodir}/* %dir %{_datadir}/emacs -# %dir %{_datadir}/emacs/site-lisp -# %{_datadir}/emacs/site-lisp/python-mode.elc -# %{_datadir}/emacs/site-lisp/php-mode.elc -# %{_datadir}/emacs/site-lisp/po-*.elc -# %{_datadir}/emacs/site-lisp/rpm-spec-mode.elc -# %{_datadir}/emacs/site-lisp/ssl.elc -# %{_datadir}/emacs/site-lisp/subdirs.el -# %{_datadir}/emacs/site-lisp/site-start.d/*.el -# %{_datadir}/emacs/site-lisp/lang %dir %{_datadir}/emacs/%{version} %{_datadir}/emacs/%{version}/etc +%exclude %{_datadir}/emacs/%{version}/etc/DOC-%{version}.* # quieten startup when -leim and -el aren't installed %dir %{_datadir}/emacs/%{version}/leim %{_datadir}/emacs/%{version}/site-lisp %{_libexecdir}/emacs +%exclude %{_libexecdir}/emacs/%{version}/*/fns-%{version}.*.el %attr(0644,root,root) %config %{_datadir}/emacs/site-lisp/site-start.el # %dir %{_datadir}/emacs/site-lisp/site-start.d %{_datadir}/applications/gnu-emacs.desktop @@ -249,16 +313,42 @@ fi %files -f el-filelist el %defattr(-,root,root) -# %{_datadir}/emacs/site-lisp/python-mode.el -# %{_datadir}/emacs/site-lisp/php-mode.el -# %{_datadir}/emacs/site-lisp/po-*.el -# %{_datadir}/emacs/site-lisp/ssl.el -# %{_datadir}/emacs/site-lisp/rpm-spec-mode.el %files -f leim-filelist leim %defattr(-,root,root) %changelog +* Sat Jan 24 2004 Jens Petersen - 21.3-9 +- base emacs package now only contains emacs binary built with X support +- bring back emacs-nox subpackage (emacs built without X support) (#113001) + [suggested by Frank Kruchio] +- all the common files required by emacs and emacs-nox are now in emacs-common +- emacs no longer obsoletes emacs-nox +- update php-mode.el to 1.0.5 +- add missing rfc1345.el leim input method +- update po-compat.el to version in gettext-0.13.1 +- update base package summary +- add url for python-mode.el and php-mode.el +- gctags is now a symlink to ctags.emacs + +* Wed Jan 14 2004 Jens Petersen - 21.3-8 +- comment out setting transient-mark-mode in skel .emacs (#102441,#90193) + [reported by mal@gromco.com, Jonathan Kamens] +- improve lang-coding-systems-init.el to set-language-environment for CJK + utf-8 locale too and use utf-8 for default-coding-systems and + terminal-coding-system (#111172) [Yoshinori Kuniga] +- update rpm-spec-mode.el to newer one in xemacs package cvs (#105888) [Dams] +- rename etags to etags.emacs and make etags a symlink to it at install time + if it doesn't exist (#92256) [marc_soft@merlins.org] +- apply editfns.c-Fformat-multibyte-davej.patch to fix multibyte code typo + in Fformat [patch from Dave Jones] +- add runtime requirements for XFree86-libs, image libraries, ncurses and zlib +- improve -el and -leim package summaries +- no longer configure build with redundant --with-gcc + +* Tue Nov 25 2003 Jens Petersen +- buildrequire autoconf213 (#110741) [reported by mvd@mylinux.com.ua] + * Mon Oct 27 2003 Jens Petersen - 21.3-7 - use "setarch i386" to build on ix86 (#101818) [reported by Michael Redinger] - use __make to %%build and %%install diff --git a/rfc1345.el b/rfc1345.el new file mode 100644 index 0000000..87c62b2 Binary files /dev/null and b/rfc1345.el differ diff --git a/rpm-spec-mode.el b/rpm-spec-mode.el index bc147b4..b1e7336 100644 --- a/rpm-spec-mode.el +++ b/rpm-spec-mode.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1997-2002 Stig Bjørlykke, ;; Author: Stig Bjørlykke, -;; Keywords: unix, languages +;; Keywords: unix, languages, rpm ;; Version: 0.12 ;; This file is part of XEmacs. @@ -33,6 +33,7 @@ ;; Tim Powers and Trond Eivind Glomsrød ;; for Red Hat adaptions and some fixes. ;; Chmouel Boudjnah for Mandrake fixes. +;; Ville Skyttä for some fixes. ;;; ToDo: @@ -69,11 +70,6 @@ :prefix "rpm-spec-" :group 'languages) -(defcustom rpm-spec-build-command "rpmbuild" - "Command for building a RPM package." - :type 'string - :group 'rpm-spec) - (defcustom rpm-spec-add-attr nil "Add \"%attr\" entry for file listings or not." :type 'boolean @@ -95,7 +91,7 @@ timecheck age." :group 'rpm-spec) (defcustom rpm-spec-buildroot "" - "Override the BuildRoot tag with directory ." + "When building, override the BuildRoot tag with directory ." :type 'string :group 'rpm-spec) @@ -125,11 +121,20 @@ This is used during Tempo template completion." :type 'boolean :group 'rpm-spec) +(define-obsolete-variable-alias + 'rpm-spec-test 'rpm-spec-nobuild) + (defcustom rpm-spec-nobuild nil "Do not execute any build stages. Useful for testing out spec files." :type 'boolean :group 'rpm-spec) +(defcustom rpm-spec-quiet nil + "Print as little as possible. +Normally only error messages will be displayed." + :type 'boolean + :group 'rpm-spec) + (defcustom rpm-spec-sign-gpg nil "Embed a GPG signature in the package. This signature can be used to verify the integrity and the origin of @@ -142,11 +147,6 @@ the package." :type 'boolean :group 'rpm-spec) -(defcustom rpm-spec-old-rpm nil - "Set if using `rpm' as command for building packages." - :type 'boolean - :group 'rpm-spec) - (define-obsolete-variable-alias 'rpm-initialize-sections 'rpm-spec-initialize-sections) @@ -179,8 +179,50 @@ value returned by function `user-mail-address'." string) :group 'rpm-spec) +(defcustom rpm-spec-indent-heading-values nil + "*Indent values for all tags in the \"heading\" of the spec file." + :type 'boolean + :group 'rpm-spec) + +(defcustom rpm-spec-use-compilation-mode t + "*If non-nil, build in `compilation-mode' if it's available." + :type 'boolean + :group 'rpm-spec) + +(defcustom rpm-spec-default-release "1" + "*Default value for the Release tag in new spec files." + :type 'string + :group 'rpm-spec) + +(defcustom rpm-spec-default-epoch nil + "*If non-nil, default value for the Epoch tag in new spec files." + :type '(choice (const :tag "No Epoch" nil) integer) + :group 'rpm-spec) + +(defcustom rpm-spec-default-buildroot + "%{_tmppath}/%{name}-%{version}-%{release}-root" + "*Default value for the BuildRoot tag in new spec files." + :type 'integer + :group 'rpm-spec) + +(defcustom rpm-spec-default-build-section "" + "*Default %build section in new spec files." + :type 'string + :group 'rpm-spec) + +(defcustom rpm-spec-default-install-section "rm -rf $RPM_BUILD_ROOT\n" + "*Default %install section in new spec files." + :type 'string + :group 'rpm-spec) + +(defcustom rpm-spec-default-clean-section "rm -rf $RPM_BUILD_ROOT\n" + "*Default %clean section in new spec files." + :type 'string + :group 'rpm-spec) + (defgroup rpm-spec-faces nil "Font lock faces for `rpm-spec-mode'." + :prefix "rpm-spec-" :group 'rpm-spec :group 'faces) @@ -188,12 +230,12 @@ value returned by function `user-mail-address'." ;; variables used by navigation functions. (defconst rpm-sections - '("preamble" "description" "prep" "setup" "build" "install" "clean" + '("preamble" "description" "prep" "setup" "build" "install" "check" "clean" "changelog" "files") "Partial list of section names.") (defvar rpm-section-list '(("preamble") ("description") ("prep") ("setup") ("build") ("install") - ("clean") ("changelog") ("files")) + ("check") ("clean") ("changelog") ("files")) "Partial list of section names.") (defconst rpm-scripts '("pre" "post" "preun" "postun" @@ -204,60 +246,67 @@ value returned by function `user-mail-address'." (eval-when-compile (concat "^%" (regexp-opt - ;; From RPM 4.1 sources, file build/parseSpec.c: partList[]. - '("build" "changelog" "clean" "description" "files" "install" - "package" "post" "postun" "pre" "prep" "preun" "trigger" - "triggerin" "triggerpostun" "triggerun" "verifyscript") t) + ;; From RPM 4.2 sources, file build/parseSpec.c: partList[]. + '("build" "changelog" "check" "clean" "description" "files" + "install" "package" "post" "postun" "pre" "prep" "preun" + "trigger" "triggerin" "triggerpostun" "triggerun" + "verifyscript") t) "\\b")) "Regular expression to match beginning of a section.") ;;------------------------------------------------------------ (defface rpm-spec-tag-face - '(( ((class color) (background light)) (:foreground "blue") ) + '(( ((class color) (background light)) (:foreground "blue3") ) ( ((class color) (background dark)) (:foreground "blue") )) - "*The face used for tags." + "*Face for tags." :group 'rpm-spec-faces) (defface rpm-spec-macro-face '(( ((class color) (background light)) (:foreground "purple") ) ( ((class color) (background dark)) (:foreground "yellow") )) - "*The face used for macros." + "*Face for RPM macros and variables." :group 'rpm-spec-faces) (defface rpm-spec-var-face '(( ((class color) (background light)) (:foreground "maroon") ) ( ((class color) (background dark)) (:foreground "maroon") )) - "*The face used for environment variables." + "*Face for environment variables." :group 'rpm-spec-faces) (defface rpm-spec-doc-face - '(( ((class color) (background light)) (:foreground "magenta") ) + '(( ((class color) (background light)) (:foreground "magenta3") ) ( ((class color) (background dark)) (:foreground "magenta") )) - "*The face used for document files." + "*Face for %doc entries in %files." :group 'rpm-spec-faces) (defface rpm-spec-dir-face - '(( ((class color) (background light)) (:foreground "green") ) + '(( ((class color) (background light)) (:foreground "green4") ) ( ((class color) (background dark)) (:foreground "green") )) - "*The face used for directories." + "*Face for %dir entries in %files." :group 'rpm-spec-faces) (defface rpm-spec-package-face - '(( ((class color) (background light)) (:foreground "red") ) + '(( ((class color) (background light)) (:foreground "red3") ) ( ((class color) (background dark)) (:foreground "red") )) - "*The face used for files." + "*Face for package tag." :group 'rpm-spec-faces) (defface rpm-spec-ghost-face - '(( ((class color) (background light)) (:foreground "red") ) + '(( ((class color) (background light)) (:foreground "gray50") ) ( ((class color) (background dark)) (:foreground "red") )) - "*The face used for ghost tags." + "*Face for %ghost and %config entries in %files." + :group 'rpm-spec-faces) + +(defface rpm-spec-section-face + '(( ((class color) (background light)) (:foreground "purple" :underline t) ) + ( ((class color) (background dark)) (:foreground "yellow" :underline t) )) + "*Face for section markers." :group 'rpm-spec-faces) ;;; GNU emacs font-lock needs these... (defvar rpm-spec-macro-face - 'rpm-spec-macro-face "*Face for macros.") + 'rpm-spec-macro-face "*Face for RPM macros and variables.") (defvar rpm-spec-var-face 'rpm-spec-var-face "*Face for environment variables.") (defvar rpm-spec-tag-face @@ -265,11 +314,13 @@ value returned by function `user-mail-address'." (defvar rpm-spec-package-face 'rpm-spec-package-face "*Face for package tag.") (defvar rpm-spec-dir-face - 'rpm-spec-dir-face "*Face for directory entries.") + 'rpm-spec-dir-face "*Face for %dir entries in %files.") (defvar rpm-spec-doc-face - 'rpm-spec-doc-face "*Face for documentation entries.") + 'rpm-spec-doc-face "*Face for %doc entries in %files.") (defvar rpm-spec-ghost-face - 'rpm-spec-ghost-face "*Face for \"%ghost\" files.") + 'rpm-spec-ghost-face "*Face for %ghost and %config entries in %files.") +(defvar rpm-spec-section-face + 'rpm-spec-section-face "*Face for section markers.") (defvar rpm-default-umask "-" "*Default umask for files, specified with \"%attr\".") @@ -281,9 +332,11 @@ value returned by function `user-mail-address'." ;;------------------------------------------------------------ (defvar rpm-no-gpg nil "Tell rpm not to sign package.") +(defvar rpm-spec-build-command "rpmbuild" "Command to build rpms.") +(defvar rpm-spec-nobuild-option "--nobuild" "Option for no build.") (defvar rpm-tags-list - ;; From RPM 4.1 sources, file build/parsePreamble.c: preambleList[].") + ;; From RPM 4.2 sources, file build/parsePreamble.c: preambleList[].") '(("AutoProv") ("AutoReq") ("AutoReqProv") @@ -332,7 +385,7 @@ value returned by function `user-mail-address'." "List of elements that are valid tags.") (defvar rpm-group-tags-list - ;; From RPM 4.1 sources, file GROUPS. + ;; From RPM 4.2 sources, file GROUPS. '(("Amusements/Games") ("Amusements/Graphics") ("Applications/Archiving") @@ -421,9 +474,10 @@ value returned by function `user-mail-address'." (define-key rpm-spec-mode-map "\C-c\C-xi" 'rpm-change-timecheck-option) (define-key rpm-spec-mode-map "\C-c\C-xn" 'rpm-toggle-nobuild) (define-key rpm-spec-mode-map "\C-c\C-xo" 'rpm-files-owner) - (define-key rpm-spec-mode-map "\C-c\C-xp" 'rpm-change-target-option) (define-key rpm-spec-mode-map "\C-c\C-xr" 'rpm-toggle-rmsource) + (define-key rpm-spec-mode-map "\C-c\C-xq" 'rpm-toggle-quiet) (define-key rpm-spec-mode-map "\C-c\C-xs" 'rpm-toggle-short-circuit) + (define-key rpm-spec-mode-map "\C-c\C-xt" 'rpm-change-target-option) (define-key rpm-spec-mode-map "\C-c\C-xu" 'rpm-files-umask) ;;(define-key rpm-spec-mode-map "\C-q" 'indent-spec-exp) ;;(define-key rpm-spec-mode-map "\t" 'sh-indent-line) @@ -466,6 +520,8 @@ value returned by function `user-mail-address'." :style toggle :selected rpm-spec-clean] ["No build" rpm-toggle-nobuild :style toggle :selected rpm-spec-nobuild] + ["Quiet" rpm-toggle-quiet + :style toggle :selected rpm-spec-quiet] ["GPG sign" rpm-toggle-sign-gpg :style toggle :selected rpm-spec-sign-gpg] ["Ignore dependencies" rpm-toggle-nodeps @@ -488,33 +544,35 @@ value returned by function `user-mail-address'." ))) (defvar rpm-spec-font-lock-keywords - '( - ("%[a-zA-Z0-9_]+" 0 rpm-spec-macro-face) - ("^\\([a-zA-Z0-9]+\\)\\(\([a-zA-Z0-9,]+\)\\):" + (list + (cons rpm-section-regexp rpm-spec-section-face) + '("%[a-zA-Z0-9_]+" 0 rpm-spec-macro-face) + '("^\\([a-zA-Z0-9]+\\)\\(\([a-zA-Z0-9,_]+\)\\):" (1 rpm-spec-tag-face) (2 rpm-spec-ghost-face)) - ("^\\([a-zA-Z0-9]+\\):" 1 rpm-spec-tag-face) - ("%\\(de\\(fine\\|scription\\)\\|files\\|package\\)[ \t]+\\([^-][^ \t\n]*\\)" + '("^\\([a-zA-Z0-9]+\\):" 1 rpm-spec-tag-face) + '("%\\(de\\(fine\\|scription\\)\\|files\\|package\\)[ \t]+\\([^-][^ \t\n]*\\)" (3 rpm-spec-package-face)) - ("%p\\(ost\\|re\\)\\(un\\)?[ \t]+\\([^-][^ \t\n]*\\)" + '("%p\\(ost\\|re\\)\\(un\\)?[ \t]+\\([^-][^ \t\n]*\\)" (3 rpm-spec-package-face)) - ("%configure " 0 rpm-spec-macro-face) - ("%dir[ \t]+\\([^ \t\n]+\\)[ \t]*" 1 rpm-spec-dir-face) - ("%doc\\(dir\\)?[ \t]+\\(.*\\)\n" 2 rpm-spec-doc-face) - ("%\\(ghost\\|config\\)[ \t]+\\(.*\\)\n" 2 rpm-spec-ghost-face) - ("^%.+-[a-zA-Z][ \t]+\\([a-zA-Z0-9\.-]+\\)" 1 rpm-spec-doc-face) - ("^\\(.+\\)(\\([a-zA-Z]\\{2,2\\}\\)):" + '("%configure " 0 rpm-spec-macro-face) + '("%dir[ \t]+\\([^ \t\n]+\\)[ \t]*" 1 rpm-spec-dir-face) + '("%doc\\(dir\\)?[ \t]+\\(.*\\)\n" 2 rpm-spec-doc-face) + '("%\\(ghost\\|config\\([ \t]*(.*)\\)?\\)[ \t]+\\(.*\\)\n" + 3 rpm-spec-ghost-face) + '("^%.+-[a-zA-Z][ \t]+\\([a-zA-Z0-9\.-]+\\)" 1 rpm-spec-doc-face) + '("^\\(.+\\)(\\([a-zA-Z]\\{2,2\\}\\)):" (1 rpm-spec-tag-face) (2 rpm-spec-doc-face)) - ("^\\*\\(.*[0-9] \\)\\(.*\\)\\(<.*>\\)\\(.*\\)\n" + '("^\\*\\(.*[0-9] \\)\\(.*\\)<\\(.*\\)>\\(.*\\)\n" (1 rpm-spec-dir-face) (2 rpm-spec-package-face) (3 rpm-spec-tag-face) - (4 font-lock-warning-face)) - ("%{[^{}]*}" 0 rpm-spec-macro-face) - ("$[a-zA-Z0-9_]+" 0 rpm-spec-var-face) - ("${[a-zA-Z0-9_]+}" 0 rpm-spec-var-face) - ) + (4 rpm-spec-ghost-face)) + '("%{[^{}]*}" 0 rpm-spec-macro-face) + '("$[a-zA-Z0-9_]+" 0 rpm-spec-var-face) + '("${[a-zA-Z0-9_]+}" 0 rpm-spec-var-face) + ) "Additional expressions to highlight in `rpm-spec-mode'.") ;;Initialize font lock for xemacs @@ -526,6 +584,8 @@ value returned by function `user-mail-address'." ;;------------------------------------------------------------ +(add-hook 'rpm-spec-mode-new-file-hook 'rpm-spec-initialize) + ;;;###autoload (defun rpm-spec-mode () "Major mode for editing RPM spec files. @@ -553,13 +613,13 @@ with no args, if that value is non-nil." "Post menu for `rpm-spec-mode'." rpm-spec-mode-menu) (easy-menu-add rpm-spec-mode-menu) - (if (= (buffer-size) 0) - (rpm-spec-initialize)) + (if (and (= (buffer-size) 0) rpm-spec-initialize-sections) + (run-hooks 'rpm-spec-mode-new-file-hook)) - (if (executable-find "rpmbuild") - (setq rpm-spec-build-command "rpmbuild") - (setq rpm-spec-old-rpm t) - (setq rpm-spec-build-command "rpm")) + (if (not (executable-find "rpmbuild")) + (progn + (setq rpm-spec-build-command "rpm") + (setq rpm-spec-nobuild-option "--test"))) (make-local-variable 'paragraph-start) (setq paragraph-start (concat "$\\|" page-delimiter)) @@ -608,7 +668,7 @@ with no args, if that value is non-nil." (substring (current-time-string) -4) " " fullname " <" address ">" (and rpm-spec-insert-changelog-version - (concat " " (rpm-find-spec-version t)))))) + (concat " - " (rpm-find-spec-version t)))))) (if (not (search-forward string nil t)) (insert "\n" string "\n") (forward-line 2)) @@ -878,6 +938,9 @@ leave point at previous location." (defun rpm-build (buildoptions) "Build this RPM package." + (if (and (buffer-modified-p) + (y-or-n-p (format "Buffer %s modified, save it? " (buffer-name)))) + (save-buffer)) (setq rpm-buffer-name (concat "*" rpm-spec-build-command " " buildoptions " " (file-name-nondirectory buffer-file-name) "*")) @@ -906,18 +969,23 @@ leave point at previous location." (setq buildoptions (cons "--target" (cons rpm-spec-target buildoptions)))) (if rpm-spec-nobuild - (setq buildoptions (cons (if rpm-spec-old-rpm "--test" "--nobuild") - buildoptions))) + (setq buildoptions (cons rpm-spec-nobuild-option buildoptions))) + (if rpm-spec-quiet + (setq buildoptions (cons "--quiet" buildoptions))) (if rpm-spec-nodeps (setq buildoptions (cons "--nodeps" buildoptions))) (if (and rpm-spec-sign-gpg (not rpm-no-gpg)) (setq buildoptions (cons "--sign" buildoptions))) (save-excursion (set-buffer (get-buffer rpm-buffer-name)) + (and rpm-spec-use-compilation-mode + (fboundp 'compilation-mode) + (compilation-mode)) (goto-char (point-max))) - (let ((process - (apply 'start-process rpm-spec-build-command rpm-buffer-name - rpm-spec-build-command buildoptions))) + (let* ((process-environment (cons "EMACS=t" process-environment)) + (process + (apply 'start-process rpm-spec-build-command rpm-buffer-name + rpm-spec-build-command buildoptions))) (if (and rpm-spec-sign-gpg (not rpm-no-gpg)) (let ((rpm-passwd-cache (read-passwd "GPG passphrase: "))) (process-send-string process (concat rpm-passwd-cache "\n")))) @@ -1022,9 +1090,17 @@ command." (interactive "p") (setq rpm-spec-nobuild (not rpm-spec-nobuild)) (rpm-update-mode-name) - (message (concat "Turned `" (if rpm-spec-old-rpm "--test" "--nobuild") "' " + (message (concat "Turned `" rpm-spec-nobuild-option "' " (if rpm-spec-nobuild "on" "off") "."))) +(defun rpm-toggle-quiet (&optional arg) + "Toggle `rpm-spec-quiet'." + (interactive "p") + (setq rpm-spec-quiet (not rpm-spec-quiet)) + (rpm-update-mode-name) + (message (concat "Turned `--quiet' " + (if rpm-spec-quiet "on" "off") "."))) + (defun rpm-toggle-sign-gpg (&optional arg) "Toggle `rpm-spec-sign-gpg'." (interactive "p") @@ -1059,6 +1135,7 @@ command." (if rpm-spec-nobuild "N") (if rpm-spec-rmsource "R") (if rpm-spec-short-circuit "S") + (if rpm-spec-quiet "Q") )) (if (not (equal modes "")) (setq mode-name (concat mode-name ":" modes)))) @@ -1128,14 +1205,19 @@ See `search-forward-regexp'." (search-forward-regexp (concat field ":[ \t]*\\(.*?\\)[ \t]*$") max) (match-string 1)))) - (if (string-match "%{?\\([^}]*\\)}?$" str) - (progn - (goto-char (point-min)) - (search-forward-regexp - (concat "%define[ \t]+" (substring str (match-beginning 1) - (match-end 1)) - "[ \t]+\\(.*\\)")) - (match-string 1)) + (if (string-match "\\(%{?\\)\\([a-zA-Z0-9_]*\\)\\(}?\\)" str) + (let ((end-string (substring str (match-end 3)))) + (concat (substring str 0 (match-beginning 1)) + (progn + (goto-char (point-min)) + (search-forward-regexp + (concat "%define[ \t]+" + (substring str + (match-beginning 2) + (match-end 2)) + "[ \t]+\\(.*\\)")) + (match-string 1)) + end-string)) str))))) (defun rpm-find-spec-version (&optional with-epoch) @@ -1182,7 +1264,7 @@ if one is present in the file." (defun rpm-spec-initialize () "Create a default spec file if one does not exist or is empty." - (let (file name version (release "1")) + (let (file name version (release rpm-spec-default-release)) (setq file (if (buffer-file-name) (file-name-nondirectory (buffer-file-name)) (buffer-name))) @@ -1197,30 +1279,52 @@ if one is present in the file." ((eq (string-match "\\(.*\\).spec" file) 0) (setq name (match-string 1 file)))) + (if rpm-spec-indent-heading-values + (insert + "Summary: " + "\nName: " (or name "") + "\nVersion: " (or version "") + "\nRelease: " (or release "") + (if rpm-spec-default-epoch + (concat "\nEpoch: " + (int-to-string rpm-spec-default-epoch)) + "") + "\nLicense: " + "\nGroup: " + "\nURL: " + "\nSource0: %{name}-%{version}.tar.gz" + "\nBuildRoot: " rpm-spec-default-buildroot) + (insert + "Summary: " + "\nName: " (or name "") + "\nVersion: " (or version "") + "\nRelease: " (or release "") + (if rpm-spec-default-epoch + (concat "\nEpoch: " (int-to-string rpm-spec-default-epoch)) + "") + "\nLicense: " + "\nGroup: " + "\nURL: " + "\nSource0: %{name}-%{version}.tar.gz" + "\nBuildRoot: " rpm-spec-default-buildroot)) + (insert - "Summary: " - "\nName: " (or name "") - "\nVersion: " (or version "") - "\nRelease: " (or release "") - "\nLicense: " - "\nGroup: " - "\nURL: " - "\nSource0: %{name}-%{version}.tar.gz" - "\nBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot" "\n\n%description\n" "\n%prep" "\n%setup -q" - "\n\n%build" - "\n\n%install" - "\nrm -rf $RPM_BUILD_ROOT" - "\n\n%clean" - "\nrm -rf $RPM_BUILD_ROOT" + "\n\n%build\n" + (or rpm-spec-default-build-section "") + "\n%install\n" + (or rpm-spec-default-install-section "") + "\n%clean\n" + (or rpm-spec-default-clean-section "") "\n\n%files" "\n%defattr(-,root,root,-)" "\n%doc\n" "\n\n%changelog\n") - (rpm-add-change-log-entry "Initial build.\n"))) + (end-of-line 1) + (rpm-add-change-log-entry "Initial build."))) ;;------------------------------------------------------------ @@ -1232,8 +1336,7 @@ if one is present in the file." rpm-spec-mode-version " by Stig Bjørlykke, "))) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.spec$" . rpm-spec-mode)) +;;;###autoload(add-to-list 'auto-mode-alist '("\\.spec\\(\\.in\\)?$" . rpm-spec-mode)) (provide 'rpm-spec-mode)