From d31aa3654e995ff6a321698574759cb41228e503 Mon Sep 17 00:00:00 2001 From: cvsdist Date: Sep 09 2004 04:35:28 +0000 Subject: auto-import changelog data from emacs-21.2-33.src.rpm Thu Feb 20 2003 Jens Petersen - 21.2-33 - default browse-url to use htmlview (#84262) - remove info dir file rather than excluding it Sat Feb 08 2003 Jens Petersen - 21.2-32 - set X copy'n'paste encoding to extended compound-text (#74100) by default in .emacs file [suggested by olonho@hotmail.com] - .emacs file cleanup (xemacs now has a separate init file) Fri Feb 07 2003 Jens Petersen - 21.2-31 - block input in allocate_vectorlike to prevent malloc hangs (#83600) [thanks to Jim Blandy] - set startup wmclass notify in desktop file Wed Jan 22 2003 Tim Powers - rebuilt Wed Jan 15 2003 Jens Petersen 21.2-29 - update to newer po-mode.el and po-compat.el from gettext-0.11.4 - patch po-mode's po-replace-revision-date for when po-auto-replace-revision-date is nil (#71264) - update po-mode-init.el - examine LC_ALL before LC_CTYPE in site-start.el for utf-8 (#79535) - don't install etc/DOC files explicitly by hand - make sure all lisp .elc files are up to date - pass _smp_mflags to make - remove games that we shouldn't ship Mon Jan 13 2003 Karsten Hopp 21.2-28 - s390x lib64 fix Fri Jan 03 2003 Jens Petersen 21.2-27 - look at LANG after LC_CTYPE when checking for UTF-8 locale encoding in site-start.el (#79535) - don't set desktop file config(noreplace) Fri Dec 20 2002 Jens Petersen 21.2-26 - unset the sticky bit of emacs in bindir (#80049) Wed Dec 18 2002 Jens Petersen 21.2-25 - no need to patch config.{sub,guess} Tue Dec 03 2002 Tim Waugh - Fix python-mode-init.el (bug #78910). Sun Dec 01 2002 Jens Petersen 21.2-24 - rpm-spec-mode update fixes - patch in XEmacs compat functions rather than defining them with apel macros in init file (#78764) - autoload "rpm-spec-mode" not "rpm-spec-mode.el" in same file - let emacs base also own leim dir to avoid startup warning about missing dir when -el and -leim aren't installed (#78764) Thu Nov 28 2002 Jens Petersen - use LC_CTYPE rather than LANG to determine default encoding (#78678) [reported by starback@stp.ling.uu.se] Wed Nov 27 2002 Jens Petersen 21.2-23 - set transient-mark-mode in dotemacs for Emacs not XEmacs (#75440) - update rpm-spec-mode.el to 0.12 - define needed XEmacs compat functions in new rpm-spec-mode-init.el - tidy site-start.el - move python-mode setup to python-mode - don't build with sbin in path - use _libexecdir, _bindir and _sysconfdir - don't gzip info files explicitly - use tar's C and j options - generate lisp file-lists in single find sweeps over lisp and leim dirs - use -fprint and -fprintf - correct more dir ownerships Sun Nov 24 2002 Florian La Roche 21.2-22 - add correct alloca defines for s390 Wed Nov 06 2002 Jens Petersen 21.2-21 - uses patches for x86_64 and s390 support and config.{guess,sub} updating Tue Nov 05 2002 Jens Petersen 21.2-20 - add support for x86_64 and merge in s390 support from cvs - add alloca defines to amdx86-64.h (from SuSE) Wed Oct 30 2002 Jens Petersen 21.2-19 - own our libexec dir (#73984) - only set transient-mark-mode in dotemacs for Emacs (#75440) - update to latest config.{guess,sub} - use _datadir macro --- diff --git a/emacs.desktop b/emacs.desktop index c77a49c..5336649 100644 --- a/emacs.desktop +++ b/emacs.desktop @@ -31,5 +31,4 @@ Terminal=0 MapNotify=false Categories=TextEditor;Development;X-Red-Hat-Base;Application; Encoding=UTF-8 - - +StartupWMClass=Emacs diff --git a/emacs.spec b/emacs.spec index 3a90f46..4e476ac 100644 --- a/emacs.spec +++ b/emacs.spec @@ -1,8 +1,9 @@ -# [for (x)emacs] -*- coding: utf-8 -*- +# This file is encoded in UTF-8. -*- coding: utf-8 -*- + Summary: The libraries needed to run the GNU Emacs text editor. Name: emacs Version: 21.2 -Release: 18 +Release: 33 License: GPL URL: http://www.gnu.org/software/emacs/ Group: Applications/Editors @@ -20,17 +21,26 @@ Source10: ftp://ftp.gnu.org/gnu/emacs/elisp-manual-21-2.8.tar.bz2 Source11: php-mode.el Source12: php-mode-init.el Source13: ssl.el -Source14: po-mode.el -Source15: po-mode-init.el +Source16: python-mode-init.el +Source17: rpm-spec-mode-init.el +Source18: rpm-spec-mode.el-0.14-xemacs-compat.patch +Source20: po-mode.el +Source21: po-compat.el +Source22: po-mode-init.el +Source23: po-mode-auto-replace-date-71264.patch Patch1: emacs-21.2-pop.patch -Patch50: emacs-21.2-s390.patch +Patch2: emacs-21.2-s390.patch +Patch3: emacs-21.2-x86_64.patch +Patch4: emacs-21.2-sticky-bit-80049.patch +Patch5: emacs-21.2-s390x.patch +Patch6: emacs-21.2-menubar-games.patch +Patch7: emacs-21.2-alloc-blockinput-83600.patch +Patch8: browse-url-htmlview-84262.patch Buildroot: %{_tmppath}/%{name}-%{version}-root -Prereq: /sbin/install-info -BuildRequires: glibc-devel gcc XFree86-devel bzip2 ncurses-devel -BuildRequires: zlib-devel libpng-devel libjpeg-devel libungif-devel libtiff-devel -Obsoletes: emacs-nox emacs-X11 +Prereq: /sbin/install-info, dev +BuildRequires: glibc-devel, gcc, XFree86-devel, bzip2, ncurses-devel, zlib-devel, libpng-devel, libjpeg-devel, libungif-devel, libtiff-devel +Obsoletes: emacs-nox, emacs-X11 Conflicts: gettext < 0.10.40 -Prereq: dev %description Emacs is a powerful, customizable, self-documenting, modeless text @@ -69,133 +79,102 @@ non-English character set. Input methods for many different character sets are included in this package. %prep - %setup -q -b 1 - -%patch1 -p1 - -%ifarch s390 s390x -%patch50 -p1 -b .s390 -%endif +%patch1 -p1 -b .pop +%patch2 -p1 -b .s390 +%patch3 -p1 -b .hammer +%patch4 -p1 -b .sticky +%patch5 -p1 -b .s390x +# remove game we can't ship +%patch6 -p1 +rm lisp/finder-inf.el lisp/play/tetris.el* +# block input in `allocate_vectorlike' (alloc.c) +%patch7 -p1 -b .block +# make browse-url default to htmlview not netscape +%patch8 -p1 -b .htmlview +# patches 2 and 3 touch configure.in +autoconf-2.13 %build - export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS" -#to find installinfo -export PATH="$PATH:/sbin:/usr/sbin" %configure --with-gcc --with-pop --with-sound -make - - -%define recompile src/emacs -batch --no-init-file --no-site-file -f batch-byte-compile +make %{?_smp_mflags} +# remove versioned file so that we end up with .1 suffix and only one DOC file +rm src/emacs-%{version}.* +# make sure patched lisp files get byte-compiled +src/emacs -batch -f batch-byte-recompile-directory lisp +make %{?_smp_mflags} -C lisp updates -# recompile patched .el files -%{recompile} lisp/mail/mh-utils.el lisp/progmodes/make-mode.el +%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 %SOURCE14 . -%{recompile} python-mode.el rpm-spec-mode.el php-mode.el ssl.el po-mode.el - +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 %install rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/usr -mkdir -p $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/site-start.d - -mkdir -p $RPM_BUILD_ROOT/%{_infodir} %makeinstall -#install lisp files for Japanese and other Asian languages -pushd $RPM_BUILD_ROOT -tar --use-compress-program=bzip2 -xf %{SOURCE9} -popd +# make sure movemail isn't setgid +chmod 755 $RPM_BUILD_ROOT%{_libexecdir}/emacs/%{version}/*/movemail -rm -f $RPM_BUILD_ROOT/%{_infodir}/dir -gzip -9nf $RPM_BUILD_ROOT/%{_infodir}/* +# install lisp files for Japanese and other Asian languages +tar jxC $RPM_BUILD_ROOT -f %{SOURCE9} -install -m 644 %SOURCE6 $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/site-start.el +rm -f $RPM_BUILD_ROOT%{_infodir}/dir -mkdir -p $RPM_BUILD_ROOT/usr/share/emacs/site-lisp +mkdir -p $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp +install -m 0644 %SOURCE6 $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/site-start.el mv $RPM_BUILD_ROOT%{_mandir}/man1/ctags.1 $RPM_BUILD_ROOT%{_mandir}/man1/gctags.1 -mv $RPM_BUILD_ROOT/usr/bin/ctags $RPM_BUILD_ROOT/usr/bin/gctags - +mv $RPM_BUILD_ROOT%{_bindir}/ctags $RPM_BUILD_ROOT%{_bindir}/gctags # GNOME / KDE files -mkdir -p $RPM_BUILD_ROOT/usr/share/applications -install -c -m 0644 %SOURCE3 $RPM_BUILD_ROOT/usr/share/applications/gnu-emacs.desktop -mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps -install -c -m 0644 %SOURCE4 $RPM_BUILD_ROOT/usr/share/pixmaps/ - -mkdir -p $RPM_BUILD_ROOT/usr/share/emacs/%{version}/etc -install -c -m644 etc/DOC-* $RPM_BUILD_ROOT/usr/share/emacs/%{version}/etc +mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications +install -m 0644 %SOURCE3 $RPM_BUILD_ROOT%{_datadir}/applications/gnu-emacs.desktop +mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps +install -m 0644 %SOURCE4 $RPM_BUILD_ROOT%{_datadir}/pixmaps/ -# Python mode, php mode and rpm-spec mode +# install site-lisp files +install -m 0644 *.el *.elc $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/ -install -c -m0644 po-mode.el po-mode.elc php-mode.el php-mode.elc python-mode.el python-mode.elc rpm-spec-mode.el rpm-spec-mode.elc ssl.el ssl.elc $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/ -install -m0644 %SOURCE12 $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/site-start.d/php-mode-init.el -install -m0644 %SOURCE15 $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/site-start.d/po-mode-init.el +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 # default initialization file -mkdir -p $RPM_BUILD_ROOT/etc/skel -install -c -m0644 %SOURCE5 $RPM_BUILD_ROOT/etc/skel/.emacs +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/skel +install -m 0644 %SOURCE5 $RPM_BUILD_ROOT%{_sysconfdir}/skel/.emacs + +# elisp reference manual +tar jxf %{SOURCE10} +pushd elisp-manual-21-2.8 +install -m 644 elisp elisp-? elisp-?? $RPM_BUILD_ROOT%{_infodir} +popd # # create file lists # +SRC_TOP=$PWD +rm -f *-filelist {base,el,leim}-*-files +pushd $RPM_BUILD_ROOT -# Remove ctags +find .%{_datadir}/emacs/%{version}/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 \) \) -rm -f $RPM_BUILD_ROOT/usr/bin/ctags -rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/*ctags* -rm -f $RPM_BUILD_ROOT/usr/share/emacs/%{version}/etc/ctags* +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 \) \) -# The elisp reference manual -bzcat %{SOURCE10} | tar xf - -pushd elisp-manual-21-2.8 -install -m 644 elisp elisp-? elisp-?? $RPM_BUILD_ROOT/%{_infodir} popd -find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/lisp -type f\ - -not -name '*.el' -print | sed "s^$RPM_BUILD_ROOT^^" > core-filelist -find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/lisp \ - -type d -printf "%%%%dir %%p\n" | sed "s^$RPM_BUILD_ROOT^^" >> core-filelist - -# Include .el files which lack a corresponding byte compiled form -for I in `find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/lisp \ - -name '*.el'`; do - if [ ! -e `dirname $I`/`basename $I .el`.elc ]; then - echo $I | sed "s^$RPM_BUILD_ROOT^^" - fi -done >> core-filelist - -# Include all non elisp files which emacs installs -#find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/lisp -type f | \ -# sed "s^$RPM_BUILD_ROOT^^" | grep -v "\.el\(c\)\?$" >> core-filelist - - -find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/leim \ - -name '*.elc' -print | sed "s^$RPM_BUILD_ROOT^^" > leim-filelist -find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/leim \ - -mindepth 1 -type d -printf "%%%%dir %%p\n" | \ - sed "s^$RPM_BUILD_ROOT^^" >> leim-filelist - -# -# be sure to exclude some files which are needed in the core package -# -for I in `find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/lisp \ - -name '*.el'`; do - if [ -e `dirname $I`/`basename $I .el`.elc ]; then - echo $I | sed "s^$RPM_BUILD_ROOT^^" - fi -done >> el-filelist - -find $RPM_BUILD_ROOT/usr/share/emacs/%{version}/leim \ - -name '*.el' -print | sed "s^$RPM_BUILD_ROOT^^" |\ - grep -v "leim\/leim-list.el" >> el-filelist +# put the lists together filtering ./usr to /usr +cat base-*-files | sed "s|\.%{_prefix}|%{_prefix}|" > base-filelist +cat el-*-files | sed "s|\.%{_prefix}|%{_prefix}|" > el-filelist +cat leim-*-files | sed "s|\.%{_prefix}|%{_prefix}|" > leim-filelist %clean rm -rf $RPM_BUILD_ROOT @@ -215,51 +194,133 @@ done fi -%files -f core-filelist +%files -f base-filelist %defattr(-,root,root) -%config(noreplace) /etc/skel/.emacs +%config(noreplace) %{_sysconfdir}/skel/.emacs %doc etc/NEWS BUGS README -/usr/bin/* +%{_bindir}/* %{_mandir}/*/* %{_infodir}/* -/usr/share/emacs/site-lisp/python-mode.elc -/usr/share/emacs/site-lisp/php-mode.elc -/usr/share/emacs/site-lisp/po-mode.elc -/usr/share/emacs/site-lisp/rpm-spec-mode.elc -/usr/share/emacs/site-lisp/ssl.elc -/usr/share/emacs/site-lisp/subdirs.el -/usr/share/emacs/site-lisp/site-start.d/lang.emacs.el -/usr/share/emacs/site-lisp/site-start.d/php-mode-init.el -/usr/share/emacs/site-lisp/site-start.d/po-mode-init.el -/usr/share/emacs/site-lisp/lang -/usr/share/emacs/%{version}/site-lisp/subdirs.el - -%dir /usr/share/emacs -%dir /usr/share/emacs/site-lisp -%dir /usr/share/emacs/%{version} -%dir /usr/share/emacs/%{version}/* -/usr/share/emacs/%{version}/etc/* -/usr/libexec/emacs/%{version}/*/* -%attr(0755,root,root) /usr/libexec/emacs/%{version}/*/movemail -%attr(0644,root,root) %config /usr/share/emacs/site-lisp/site-start.el -%dir /usr/share/emacs/site-lisp/site-start.d -%config(noreplace) /usr/share/applications/gnu-emacs.desktop -/usr/share/pixmaps/emacs.png +%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 +# quieten startup when -leim and -el aren't installed +%dir %{_datadir}/emacs/%{version}/leim +%{_datadir}/emacs/%{version}/site-lisp +%{_libexecdir}/emacs +%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 +%{_datadir}/pixmaps/emacs.png %files -f el-filelist el %defattr(-,root,root) -/usr/share/emacs/site-lisp/python-mode.el -/usr/share/emacs/site-lisp/php-mode.el -/usr/share/emacs/site-lisp/po-mode.el -/usr/share/emacs/site-lisp/ssl.el -/usr/share/emacs/site-lisp/rpm-spec-mode.el +%{_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) -/usr/share/emacs/%{version}/leim/leim-list.el -%dir /usr/share/emacs/%{version}/leim %changelog +* Thu Feb 20 2003 Jens Petersen - 21.2-33 +- default browse-url to use htmlview (#84262) +- remove info dir file rather than excluding it + +* Sat Feb 8 2003 Jens Petersen - 21.2-32 +- set X copy'n'paste encoding to extended compound-text (#74100) + by default in .emacs file [suggested by olonho@hotmail.com] +- .emacs file cleanup (xemacs now has a separate init file) + +* Fri Feb 7 2003 Jens Petersen - 21.2-31 +- block input in allocate_vectorlike to prevent malloc hangs (#83600) + [thanks to Jim Blandy] +- set startup wmclass notify in desktop file + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Wed Jan 15 2003 Jens Petersen 21.2-29 +- update to newer po-mode.el and po-compat.el from gettext-0.11.4 +- patch po-mode's po-replace-revision-date for when + po-auto-replace-revision-date is nil (#71264) +- update po-mode-init.el +- examine LC_ALL before LC_CTYPE in site-start.el for utf-8 (#79535) +- don't install etc/DOC files explicitly by hand +- make sure all lisp .elc files are up to date +- pass _smp_mflags to make +- remove games that we shouldn't ship + +* Mon Jan 13 2003 Karsten Hopp 21.2-28 +- s390x lib64 fix + +* Fri Jan 3 2003 Jens Petersen 21.2-27 +- look at LANG after LC_CTYPE when checking for UTF-8 locale encoding + in site-start.el (#79535) +- don't set desktop file config(noreplace) + +* Fri Dec 20 2002 Jens Petersen 21.2-26 +- unset the sticky bit of emacs in bindir (#80049) + +* Wed Dec 18 2002 Jens Petersen 21.2-25 +- no need to patch config.{sub,guess} + +* Tue Dec 3 2002 Tim Waugh +- Fix python-mode-init.el (bug #78910). + +* Sun Dec 1 2002 Jens Petersen 21.2-24 +- rpm-spec-mode update fixes + - patch in XEmacs compat functions rather than defining them with apel + macros in init file (#78764) + - autoload "rpm-spec-mode" not "rpm-spec-mode.el" in same file +- let emacs base also own leim dir to avoid startup warning about missing dir + when -el and -leim aren't installed (#78764) + +* Thu Nov 28 2002 Jens Petersen +- use LC_CTYPE rather than LANG to determine default encoding (#78678) + [reported by starback@stp.ling.uu.se] + +* Wed Nov 27 2002 Jens Petersen 21.2-23 +- set transient-mark-mode in dotemacs for Emacs not XEmacs (#75440) +- update rpm-spec-mode.el to 0.12 + - define needed XEmacs compat functions in new rpm-spec-mode-init.el +- tidy site-start.el + - move python-mode setup to python-mode +- don't build with sbin in path +- use _libexecdir, _bindir and _sysconfdir +- don't gzip info files explicitly +- use tar's C and j options +- generate lisp file-lists in single find sweeps over lisp and leim dirs + - use -fprint and -fprintf + - correct more dir ownerships + +* Sun Nov 24 2002 Florian La Roche 21.2-22 +- add correct alloca defines for s390 + +* Wed Nov 6 2002 Jens Petersen 21.2-21 +- uses patches for x86_64 and s390 support and config.{guess,sub} updating + +* Tue Nov 5 2002 Jens Petersen 21.2-20 +- add support for x86_64 and merge in s390 support from cvs +- add alloca defines to amdx86-64.h (from SuSE) + +* Wed Oct 30 2002 Jens Petersen 21.2-19 +- own our libexec dir (#73984) +- only set transient-mark-mode in dotemacs for Emacs (#75440) +- update to latest config.{guess,sub} +- use _datadir macro + * Wed Aug 28 2002 Trond Eivind Glomsrød 21.2-18 - Desktop file fix - add Application to make it show up - DNS lookup fix for pop (#64802) @@ -271,7 +332,7 @@ fi - Handle UTF-8 input (#70855). * Tue Aug 6 2002 Trond Eivind Glomsrød 21.2-15 -- Don't use canna by default (# 70870) +- Don't use canna by default (#70870) * Thu Aug 1 2002 Trond Eivind Glomsrød 21.2-14 - Fixes to desktop file (add encoding, add missing a ";") diff --git a/php-mode-init.el b/php-mode-init.el index f98bb95..ba36d65 100644 --- a/php-mode-init.el +++ b/php-mode-init.el @@ -1,6 +1,6 @@ ;; Use php-mode for .php,.php3,.php4 and .phtml files (autoload 'php-mode "php-mode") -(setq auto-mode-alist (cons '("\\.php[34]\\'\\|\\.php\\'\\|\\.phtml\\'" . php-mode) - auto-mode-alist)) +(add-to-list 'auto-mode-alist + '("\\.php[34]\\'\\|\\.php\\'\\|\\.phtml\\'" . php-mode)) diff --git a/po-mode-auto-replace-date-71264.patch b/po-mode-auto-replace-date-71264.patch new file mode 100644 index 0000000..d2cfb4b --- /dev/null +++ b/po-mode-auto-replace-date-71264.patch @@ -0,0 +1,13 @@ +diff -u po-mode.el~ po-mode.el +--- po-mode.el~ 2003-01-16 01:44:50.000000000 +0900 ++++ po-mode.el 2003-01-16 01:44:50.000000000 +0900 +@@ -1267,8 +1267,7 @@ + (concat "\"PO-Revision-Date: " + (format-time-string "%Y-%m-%d %H:%M" time) + zone "\\n\"") +- t t)))) +- (message "")) ++ t t))))) + (message (_"PO-Revision-Date should be adjusted...")))) + + ;;; Handling span of entry, entry type and entry attributes. diff --git a/po-mode-init.el b/po-mode-init.el index 63db02f..73e38dc 100644 --- a/po-mode-init.el +++ b/po-mode-init.el @@ -1,12 +1,9 @@ ;; Use po-mode for translation files -(autoload 'po-mode "po-mode") -(setq auto-mode-alist (cons '("\\.po[tx]?\\'\\|\\.po\\." . po-mode) - auto-mode-alist)) - -;;; To automatically use proper fonts under Emacs 20, also add: - -(autoload 'po-find-file-coding-system "po-mode") -(modify-coding-system-alist 'file "\\.po[tx]?\\'\\|\\.po\\." - 'po-find-file-coding-system) +(autoload 'po-mode "po-mode" + "Major mode for translators to edit PO files" t) +(add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode)) +(autoload 'po-find-file-coding-system "po-compat") +(modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\." + 'po-find-file-coding-system) diff --git a/po-mode.el b/po-mode.el index 4858320..4e8565b 100644 --- a/po-mode.el +++ b/po-mode.el @@ -38,9 +38,10 @@ ;; (setq auto-mode-alist (cons '("\\.po\\'\\|\\.po\\." . po-mode) ;; auto-mode-alist)) ;; -;; To use the right coding system automatically under Emacs 20, also add: +;; To use the right coding system automatically under Emacs 20 or newer, +;; also add: ;; -;; (autoload 'po-find-file-coding-system "po-mode") +;; (autoload 'po-find-file-coding-system "po-compat") ;; (modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\." ;; 'po-find-file-coding-system) ;; @@ -49,6 +50,9 @@ ;;; Code: +(defconst po-mode-version-string "2.01" "\ +Version number of this version of po-mode.el.") + ;;; Emacs portability matters - part I. ;;; Here is the minimum for customization to work. See part II. @@ -133,6 +137,23 @@ msgstr \"\" :type 'string :group 'po) +(defcustom po-translation-project-address + "translation@iro.umontreal.ca" + "*Electronic mail address of the Translation Project. +Typing \\[po-send-mail] (normally bound to `M') the user will send the PO file +to this email address." + :type 'string + :group 'po) + +(defcustom po-translation-project-mail-label "TP-Robot" + "*Subject label when sending the PO file to `po-translation-project-address'. +Don't change it when you send PO files to \"translation@iro.umontreal.ca\", the +Translation Project Robot at http://www.iro.umontreal.ca/contrib/po/HTML/. If +the label is different, your submission will be consiedered as a regular mail +and not stored at the TP site and also not forwarded to the package maintainer." + :type 'string + :group 'po) + (defcustom po-highlighting (or po-EMACS20 po-XEMACS) "*Highlight text whenever appropriate, when non-nil. However, on older Emacses, a yet unexplained highlighting bug causes files @@ -160,6 +181,7 @@ slightly different." ("Albanian" . "sq") ("Amharic" . "am") ("Arabic" . "ar") + ("Argentinian" . "es_AR") ("Armenian" . "hy") ("Assamese" . "as") ("Avestan" . "ae") @@ -180,6 +202,8 @@ slightly different." ("Chamorro" . "ch") ("Chechen" . "ce") ("Chinese" . "zh") + ("Chinese (simplified)" . "zh_CN") + ("Chinese (traditional)" . "zh_TW") ("Church Slavic" . "cu") ("Chuvash" . "cv") ("Cornish" . "kw") @@ -210,6 +234,7 @@ slightly different." ("Hiri Motu" . "ho") ("Hungarian" . "hu") ("Icelandic" . "is") + ("Ido" . "io") ("Indonesian" . "id") ("Interlingua" . "ia") ("Interlingue" . "ie") @@ -218,7 +243,7 @@ slightly different." ("Irish" . "ga") ("Italian" . "it") ("Japanese" . "ja") - ("Javanese" . "jw") + ("Javanese" . "jv") ("Kalaallisut" . "kl") ("Kannada" . "kn") ("Kashmiri" . "ks") @@ -315,6 +340,7 @@ slightly different." ("Uzbek" . "uz") ("Vietnamese" . "vi") ("Volapuk" . "vo") + ("Walloon" . "wa") ("Welsh" . "cy") ("Wolof" . "wo") ("Xhosa" . "xh") @@ -618,8 +644,7 @@ No doubt that highlighting, when Emacs does not allow it, is a kludge." (defun po-mode-version () "Show Emacs PO mode version." (interactive) - (message (_"Emacs PO mode, version %s") - (substring "$Revision: 1.1.1.1 $" 11 -2))) + (message (_"Emacs PO mode, version %s") po-mode-version-string)) (defconst po-help-display-string (_"\ @@ -650,55 +675,122 @@ M-S Ignore path M-A Ignore PO file *M-L Ignore lexicon "Help page for PO mode.") (defconst po-mode-menu-layout - '("PO" + `("PO" ("Moving around" - ["Auto select" po-auto-select-entry t] + ["Auto select" po-auto-select-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to next interesting entry"))] "---" "Forward" - ["Any next" po-next-entry t] - ["Next translated" po-next-translated-entry t] - ["Next fuzzy" po-next-fuzzy-entry t] - ["Next obsolete" po-next-obsolete-entry t] - ["Next untranslated" po-next-untranslated-entry t] - ["Last file entry" po-last-entry t] + ["Any next" po-next-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to next entry"))] + ["Next translated" po-next-translated-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to next translated entry"))] + ["Next fuzzy" po-next-fuzzy-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to next fuzzy entry"))] + ["Next obsolete" po-next-obsolete-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to next obsolete entry"))] + ["Next untranslated" po-next-untranslated-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to next untranslated entry"))] + ["Last file entry" po-last-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to last entry"))] "---" "Backward" - ["Any previous" po-previous-entry t] - ["Previous translated" po-previous-translated-entry t] - ["Previous fuzzy" po-previous-fuzzy-entry t] - ["Previous obsolete" po-previous-obsolete-entry t] - ["Previous untranslated" po-previous-untranslated-entry t] - ["First file entry" po-first-entry t] + ["Any previous" po-previous-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to previous entry"))] + ["Previous translated" po-previous-translated-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to previous translated entry"))] + ["Previous fuzzy" po-previous-fuzzy-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to previous fuzzy entry"))] + ["Previous obsolete" po-previous-obsolete-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to previous obsolete entry"))] + ["Previous untranslated" po-previous-untranslated-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to previous untranslated entry"))] + ["First file entry" po-first-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to first entry"))] "---" "Position stack" - ["Mark and push current" po-push-location t] - ["Pop and return" po-pop-location t] - ["Exchange current/top" po-exchange-location t] + ["Mark and push current" po-push-location + ,@(if (featurep 'xemacs) '(t) + '(:help "Remember current location"))] + ["Pop and return" po-pop-location + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to last remembered location and forget about it"))] + ["Exchange current/top" po-exchange-location + ,@(if (featurep 'xemacs) '(t) + '(:help "Jump to last remembered location and remember current location"))] "---" - ["Redisplay" po-current-entry t] - ["Current index" po-statistics t]) + ["Redisplay" po-current-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Make current entry properly visible"))] + ["Current index" po-statistics + ,@(if (featurep 'xemacs) '(t) + '(:help "Statistical info on current translation file"))]) ("Modifying entries" - ["Undo" po-undo t] + ["Undo" po-undo + ,@(if (featurep 'xemacs) '(t) + '(:help "Revoke last changed entry"))] "---" "Msgstr" - ["Edit msgstr" po-edit-msgstr t] - ["Ediff and merge msgstr" po-edit-msgstr-and-ediff t] - ["Kill msgstr" po-kill-msgstr t] - ["Save msgstr" po-kill-ring-save-msgstr t] - ["Yank msgstr" po-yank-msgstr t] + ["Edit msgstr" po-edit-msgstr + ,@(if (featurep 'xemacs) '(t) + '(:help "Edit current translation"))] + ["Ediff and merge msgstr" po-edit-msgstr-and-ediff + ,@(if (featurep 'xemacs) '(t) + '(:help "Call `ediff' on current translation for merging"))] + ["Cut msgstr" po-kill-msgstr + ,@(if (featurep 'xemacs) '(t) + '(:help "Cut (kill) current translation"))] + ["Copy msgstr" po-kill-ring-save-msgstr + ,@(if (featurep 'xemacs) '(t) + '(:help "Copy current translation"))] + ["Paste msgstr" po-yank-msgstr + ,@(if (featurep 'xemacs) '(t) + '(:help "Paste (yank) text most recently cut/copied translation"))] "---" "Comments" - ["Edit comment" po-edit-comment t] - ["Ediff and merge comment" po-edit-comment-and-ediff t] - ["Kill comment" po-kill-comment t] - ["Save comment" po-kill-ring-save-comment t] - ["Yank comment" po-yank-comment t] + ["Edit comment" po-edit-comment + ,@(if (featurep 'xemacs) '(t) + '(:help "Edit current comment"))] + ["Ediff and merge comment" po-edit-comment-and-ediff + ,@(if (featurep 'xemacs) '(t) + '(:help "Call `ediff' on current comment for merging"))] + ["Cut comment" po-kill-comment + ,@(if (featurep 'xemacs) '(t) + '(:help "Cut (kill) current comment"))] + ["Copy comment" po-kill-ring-save-comment + ,@(if (featurep 'xemacs) '(t) + '(:help "Copy current translation"))] + ["Paste comment" po-yank-comment + ,@(if (featurep 'xemacs) '(t) + '(:help "Paste (yank) text most recently cut/copied"))] "---" - ["Remove fuzzy mark" po-unfuzzy t] - ["Fuzzy or fade out" po-fade-out-entry t] - ["Init with msgid" po-msgid-to-msgstr t]) + ["Remove fuzzy mark" po-unfuzzy + ,@(if (featurep 'xemacs) '(t) + '(:help "Remove \"#, fuzzy\""))] + ["Fuzzy or fade out" po-fade-out-entry + ,@(if (featurep 'xemacs) '(t) + '(:help "Set current entry fuzzy, or if already fuzzy delete it"))] + ["Init with msgid" po-msgid-to-msgstr + ,@(if (featurep 'xemacs) '(t) + '(:help "\ +Initialize or replace current translation with the original message"))]) ("Other files" - ["Other window" po-other-window t] + ["Other window" po-other-window + ,@(if (featurep 'xemacs) '(t) + '(:help "Select other window; if necessay split current frame"))] "---" "Program sources" ["Cycle reference" po-cycle-source-reference t] @@ -729,120 +821,55 @@ M-S Ignore path M-A Ignore PO file *M-L Ignore lexicon ["Mark preferred" po-mark-translatable t] ["Mark with keyword" po-select-mark-and-mark t] "---" - ["Version info" po-mode-version t] - ["Help page" po-help t] - ["Validate" po-validate t] - ["Mail officially" po-send-mail t] - ["Edit out full" po-edit-out-full t] + ["Version info" po-mode-version + ,@(if (featurep 'xemacs) '(t) + '(:help "Display version number of PO mode"))] + ["Help page" po-help + ,@(if (featurep 'xemacs) '(t) + '(:help "Show the PO mode help screen"))] + ["Validate" po-validate + ,@(if (featurep 'xemacs) '(t) + '(:help "Check validity of current translation file using `msgfmt'"))] + ["Mail officially" po-send-mail + ,@(if (featurep 'xemacs) '(t) + '(:help "Send current translation file to the Translation Robot by mail"))] + ["Edit out full" po-edit-out-full + ,@(if (featurep 'xemacs) '(t) + '(:help "Leave PO mode to edit translation file using fundamental mode"))] "---" - ["Forceful quit" po-quit t] - ["Soft quit" po-confirm-and-quit t]) + ["Forceful quit" po-quit + ,@(if (featurep 'xemacs) '(t) + '(:help "Close (kill) current translation file without saving"))] + ["Soft quit" po-confirm-and-quit + ,@(if (featurep 'xemacs) '(t) + '(:help "Save current translation file, than close (kill) it"))]) "Menu layout for PO mode.") (defconst po-subedit-mode-menu-layout - '("PO-Edit" - ["Ediff and merge translation variants" po-subedit-ediff t] + `("PO-Edit" + ["Ediff and merge translation variants" po-subedit-ediff + ,@(if (featurep 'xemacs) '(t) + '(:help "Call `ediff' for merging variants"))] ["Cycle through auxiliary files" po-subedit-cycle-auxiliary t] "---" - ["Abort edit" po-subedit-abort t] - ["Exit edit" po-subedit-exit t]) + ["Abort edit" po-subedit-abort + ,@(if (featurep 'xemacs) '(t) + '(:help "Don't change the translation"))] + ["Exit edit" po-subedit-exit + ,@(if (featurep 'xemacs) '(t) + '(:help "Use this text as the translation and close current edit buffer"))]) "Menu layout for PO subedit mode.") (defconst po-subedit-message (_"Type 'C-c C-c' once done, or 'C-c C-k' to abort edit") "Message to post in the minibuffer when an edit buffer is displayed.") -; Make the cpnnn codesets available. -(if po-EMACS20 - (mapc #'codepage-setup (mapcar #'car (cp-supported-codepages)))) - -(defconst po-content-type-charset-alist - '(; Note: Emacs 21 doesn't support all encodings, thus the missing entries. - (ASCII . undecided) - (ANSI_X3.4-1968 . undecided) - (US-ASCII . undecided) - (ISO-8859-1 . iso-8859-1) - (ISO_8859-1 . iso-8859-1) - (ISO-8859-2 . iso-8859-2) - (ISO_8859-2 . iso-8859-2) - (ISO-8859-3 . iso-8859-3) - (ISO_8859-3 . iso-8859-3) - (ISO-8859-4 . iso-8859-4) - (ISO_8859-4 . iso-8859-4) - (ISO-8859-5 . iso-8859-5) - (ISO_8859-5 . iso-8859-5) - ;(ISO-8859-6 . ??) - ;(ISO_8859-6 . ??) - (ISO-8859-7 . iso-8859-7) - (ISO_8859-7 . iso-8859-7) - (ISO-8859-8 . iso-8859-8) - (ISO_8859-8 . iso-8859-8) - (ISO-8859-9 . iso-8859-9) - (ISO_8859-9 . iso-8859-9) - ;(ISO-8859-13 . ??) - ;(ISO_8859-13 . ??) - (ISO-8859-15 . iso-8859-15) ; requires Emacs 21 - (ISO_8859-15 . iso-8859-15) ; requires Emacs 21 - (KOI8-R . koi8-r) - ;(KOI8-U . ??) - (CP437 . cp437) ; requires Emacs 20 - (CP775 . cp775) ; requires Emacs 20 - (CP850 . cp850) ; requires Emacs 20 - (CP852 . cp852) ; requires Emacs 20 - (CP855 . cp855) ; requires Emacs 20 - ;(CP856 . ??) - (CP857 . cp857) ; requires Emacs 20 - (CP861 . cp861) ; requires Emacs 20 - (CP862 . cp862) ; requires Emacs 20 - (CP864 . cp864) ; requires Emacs 20 - (CP865 . cp865) ; requires Emacs 20 - (CP866 . cp866) ; requires Emacs 21 - (CP869 . cp869) ; requires Emacs 20 - ;(CP874 . ??) - ;(CP922 . ??) - ;(CP932 . ??) - ;(CP943 . ??) - ;(CP949 . ??) - ;(CP950 . ??) - ;(CP1046 . ??) - ;(CP1124 . ??) - ;(CP1129 . ??) - (CP1250 . cp1250) ; requires Emacs 20 - (CP1251 . cp1251) ; requires Emacs 20 - (CP1252 . iso-8859-1) ; approximation - (CP1253 . cp1253) ; requires Emacs 20 - (CP1254 . iso-8859-9) ; approximation - (CP1255 . iso-8859-8) ; approximation - ;(CP1256 . ??) - (CP1257 . cp1257) ; requires Emacs 20 - (GB2312 . cn-gb-2312) ; also named 'gb2312' in XEmacs 21 or Emacs 21 - ; also named 'euc-cn' in Emacs 20 or Emacs 21 - (EUC-JP . euc-jp) - (EUC-KR . euc-kr) - ;(EUC-TW . ??) - (BIG5 . big5) - ;(BIG5-HKSCS . ??) - ;(GBK . ??) - ;(GB18030 . ??) - (SHIFT_JIS . shift_jis) - ;(JOHAB . ??) - (TIS-620 . tis-620) ; requires Emacs 20 or Emacs 21 - (VISCII . viscii) ; requires Emacs 20 or Emacs 21 - (UTF-8 . utf-8) ; requires Mule-UCS in Emacs 20, or Emacs 21 - ) - "How to convert a GNU libc/libiconv canonical charset name as seen in -Content-Type into a Mule coding system.") - (defvar po-auxiliary-list nil "List of auxiliary PO files, in completing read format.") (defvar po-auxiliary-cursor nil "Cursor into the 'po-auxiliary-list'.") -(defvar po-translation-project-address - "translation@iro.umontreal.ca" - "Electronic mail address of the Translation Project.") - (defvar po-compose-mail-function (let ((functions '(compose-mail-other-window message-mail-other-window @@ -913,70 +940,10 @@ Content-Type into a Mule coding system.") ;;; Mode activation. -(defun po-find-charset (filename) - "Return PO file charset value." - (interactive) - (let ((charset-regexp - "^\"Content-Type: text/plain;[ \t]*charset=\\(.*\\)\\\\n\"") - (short-read nil)) - ;; Try the first 4096 bytes. In case we cannot find the charset value - ;; within the first 4096 bytes (the PO file might start with a long - ;; comment) try the next 4096 bytes repeatedly until we'll know for sure - ;; we've checked the empty header entry entirely. - (while (not (or short-read (re-search-forward "^msgid" nil t))) - (save-excursion - (goto-char (point-max)) - (let ((pair (insert-file-contents-literally filename nil - (1- (point)) - (1- (+ (point) 4096))))) - (setq short-read (< (nth 1 pair) 4096))))) - (cond (short-read nil) - ((re-search-forward charset-regexp nil t) (match-string 1)) - ;; We've found the first msgid; maybe, only a part of the msgstr - ;; value was loaded. Load the next 1024 bytes; if charset still - ;; isn't available, give up. - (t (save-excursion - (goto-char (point-max)) - (insert-file-contents-literally filename nil - (1- (point)) - (1- (+ (point) 1024)))) - (if (re-search-forward charset-regexp nil t) - (match-string 1)))))) - -(eval-and-compile - (if (or po-EMACS20 po-XEMACS) - (defun po-find-file-coding-system-guts (operation filename) - "\ -Return a Mule (DECODING . ENCODING) pair, according to PO file charset. -Called through file-coding-system-alist, before the file is visited for real." - (and (eq operation 'insert-file-contents) - (po-with-temp-buffer - (let ((coding-system-for-read 'no-conversion)) - (let* ((charset (or (po-find-charset filename) - "ascii")) - (charset-upper (intern (upcase charset))) - (charset-lower (intern (downcase charset)))) - (list (or (cdr (assq charset-upper - po-content-type-charset-alist)) - (if (memq charset-lower (coding-system-list)) - charset-lower - 'no-conversion))))))))) - - (if po-EMACS20 - (defun po-find-file-coding-system (arg-list) - "\ -Return a Mule (DECODING . ENCODING) pair, according to PO file charset. -Called through file-coding-system-alist, before the file is visited for real." - (po-find-file-coding-system-guts (car arg-list) (car (cdr arg-list))))) - - (if po-XEMACS - (defun po-find-file-coding-system (operation filename) - "\ -Return a Mule (DECODING . ENCODING) pair, according to PO file charset. -Called through file-coding-system-alist, before the file is visited for real." - (po-find-file-coding-system-guts operation filename))) - - ) +;; Emacs 21.2 comes with po-find-file-coding-system. We give preference +;; to the version shipped with Emacs. +(if (not (fboundp 'po-find-file-coding-system)) + (require 'po-compat)) (defvar po-mode-abbrev-table nil "Abbrev table used while in PO mode.") @@ -1127,8 +1094,12 @@ all reachable through 'M-x customize', in group 'Emacs.Editing.I18n.Po'." ;; Insert MODE-LINE-ENTRY in mode line, but on first load only. (or (member po-mode-line-entry mode-line-format) - (let ((entry (member 'global-mode-string mode-line-format))) - (setcdr entry (cons po-mode-line-entry (cdr entry))))) + ;; mode-line-format usually contains global-mode-string, but some + ;; people customize this variable. As a last resort, append at the end. + (let ((prev-entry (or (member 'global-mode-string mode-line-format) + (member " " mode-line-format) + (last mode-line-format)))) + (setcdr prev-entry (cons po-mode-line-entry (cdr prev-entry))))) (defun po-update-mode-line-string () "Compute a new statistics string to display in mode line." @@ -1182,33 +1153,34 @@ Then, update the mode line counters." ;; While counting, skip the header entry, for consistency with msgfmt. (po-find-span-of-entry) (if (string-equal (po-get-msgid nil) "") - (if (po-next-entry) - (progn - ;; Start counting - (while (re-search-forward po-any-msgstr-regexp nil t) - (and (= (% total 20) 0) - (if flag - (message (_"Position %d/%d") position total) - (message (_"Position %d") total))) - (setq here (point)) - (goto-char (match-beginning 0)) - (setq total (1+ total)) - (and flag (eq (point) current) (setq position total)) - (cond ((eq (following-char) ?#) - (setq po-obsolete-counter (1+ po-obsolete-counter))) - ((looking-at po-untranslated-regexp) - (setq po-untranslated-counter (1+ po-untranslated-counter))) - (t (setq po-translated-counter (1+ po-translated-counter)))) - (goto-char here)) - - ;; Make another pass just for the fuzzy entries, kind of kludgey. - ;; FIXME: Counts will be wrong if untranslated entries are fuzzy, yet - ;; this should not normally happen. - (goto-char (point-min)) - (while (re-search-forward po-fuzzy-regexp nil t) - (setq po-fuzzy-counter (1+ po-fuzzy-counter))) - (setq po-translated-counter (- po-translated-counter po-fuzzy-counter))) - '()))) + (goto-char po-end-of-entry)) + (if (re-search-forward "^msgid" (point-max) t) + (progn + ;; Start counting + (while (re-search-forward po-any-msgstr-regexp nil t) + (and (= (% total 20) 0) + (if flag + (message (_"Position %d/%d") position total) + (message (_"Position %d") total))) + (setq here (point)) + (goto-char (match-beginning 0)) + (setq total (1+ total)) + (and flag (eq (point) current) (setq position total)) + (cond ((eq (following-char) ?#) + (setq po-obsolete-counter (1+ po-obsolete-counter))) + ((looking-at po-untranslated-regexp) + (setq po-untranslated-counter (1+ po-untranslated-counter))) + (t (setq po-translated-counter (1+ po-translated-counter)))) + (goto-char here)) + + ;; Make another pass just for the fuzzy entries, kind of kludgey. + ;; FIXME: Counts will be wrong if untranslated entries are fuzzy, yet + ;; this should not normally happen. + (goto-char (point-min)) + (while (re-search-forward po-fuzzy-regexp nil t) + (setq po-fuzzy-counter (1+ po-fuzzy-counter))) + (setq po-translated-counter (- po-translated-counter po-fuzzy-counter))) + '())) ;; Push the results out. (if flag @@ -2078,8 +2050,10 @@ For more info cf. `po-subedit-ediff'." (defun po-subedit-ediff () "Edit the subedit buffer using `ediff'. `po-subedit-ediff' calls `po-ediff-buffers-exit-recursive' to edit translation -variants side by side. `msgcat' is able to produce those variants; every -variant is marked with: +variants side by side if they are actually different; if variants are equal just +delete the first one. + +`msgcat' is able to produce those variants; every variant is marked with: #-#-#-#-# file name reference #-#-#-#-# @@ -2124,7 +2098,12 @@ When done with the `ediff' session press \\[exit-recursive-edit] exit to (erase-buffer) (insert-buffer-substring oldbuf start-2 end-2)) - (po-ediff-buffers-exit-recursive buf1 buf2 oldbuf end-2))))) + (if (not (string-equal (buffer-substring-no-properties start-1 end-1) + (buffer-substring-no-properties start-2 end-2))) + (po-ediff-buffers-exit-recursive buf1 buf2 oldbuf end-2) + (message "Variants are equal; delete %s" buf1) + (forward-line -1) + (delete-region (point-min) (point))))))) (defun po-subedit-abort () "Exit the subedit buffer, merely discarding its contents." @@ -3260,11 +3239,13 @@ Write to your team? ('n' if writing to the Translation Project robot) "))) po-obsolete-counter)))) (let ((buffer (current-buffer)) (name (po-guess-archive-name)) - (transient-mark-mode nil)) + (transient-mark-mode nil) + (coding-system-for-read buffer-file-coding-system) + (coding-system-for-write buffer-file-coding-system)) (apply po-compose-mail-function address (if team-flag (read-string (_"Subject? ")) - (format "TP-Robot %s" name)) + (format "%s %s" po-translation-project-mail-label name)) nil) (goto-char (point-min)) (re-search-forward @@ -3328,4 +3309,6 @@ strings remain." (save-buffer) (kill-buffer (current-buffer))))))) +(provide 'po-mode) + ;;; po-mode.el ends here diff --git a/python-mode-init.el b/python-mode-init.el new file mode 100644 index 0000000..3bdfed9 --- /dev/null +++ b/python-mode-init.el @@ -0,0 +1,6 @@ +;; setup python support + +(autoload 'python-mode "python-mode" "Python mode." t) +(autoload 'py-shell "python-mode" "Python shell mode." t) +(add-to-list 'auto-mode-alist '("\\.py$" . python-mode)) +(add-to-list 'interpreter-mode-alist '("python" . python-mode)) diff --git a/rpm-spec-mode-init.el b/rpm-spec-mode-init.el new file mode 100644 index 0000000..b56b834 --- /dev/null +++ b/rpm-spec-mode-init.el @@ -0,0 +1,4 @@ +;; rpm-spec-mode for spec files + +(autoload 'rpm-spec-mode "rpm-spec-mode" "RPM spec mode." t) +(add-to-list 'auto-mode-alist '("\\.spec$" . rpm-spec-mode)) diff --git a/rpm-spec-mode.el b/rpm-spec-mode.el index ae123f7..bc147b4 100644 --- a/rpm-spec-mode.el +++ b/rpm-spec-mode.el @@ -1,45 +1,48 @@ ;;; rpm-spec-mode.el --- RPM spec file editing commands for Emacs/XEmacs -;; Copyright (C) 1997,1998,1999,2000,2001 Stig Bj�rlykke, +;; Copyright (C) 1997-2002 Stig Bj�rlykke, ;; Author: Stig Bj�rlykke, ;; Keywords: unix, languages -;; Version: 0.11h +;; Version: 0.12 -;; This file is not yet part of FSF Emacs or XEmacs. +;; This file is part of XEmacs. -;; Emacs/XEmacs is free software; you can redistribute it and/or modify +;; XEmacs 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, or (at your option) ;; any later version. -;; Emacs/XEmacs is distributed in the hope that it will be useful, +;; XEmacs 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 Emacs/XEmacs; see the file COPYING. If not, write to the +;; along with XEmacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. -;;; Synched up with: both in FSF Emacs and XEmacs. +;;; Synched up with: not in GNU Emacs. ;;; Thanx to: -;; Tore Olsen for some general fixes. +;; Tore Olsen for some general fixes. ;; Steve Sanbeg for navigation functions and ;; some Emacs fixes. +;; Tim Powers and Trond Eivind Glomsr�d +;; for Red Hat adaptions and some fixes. +;; Chmouel Boudjnah for Mandrake fixes. ;;; ToDo: -;; - rewrite function names and shortcuts. +;; - rewrite function names. ;; - autofill changelog entries. ;; - customize rpm-tags-list and rpm-group-tags-list. ;; - get values from `rpm --showrc'. ;; - ssh/rsh for compile. -;; - finish integrating the new navigation functions in with existing stuff. -;; - use a single prefix conistently (internal) +;; - finish integrating the new navigation functions in with existing stuff. +;; - use a single prefix consistently (internal) ;;; Commentary: @@ -56,20 +59,23 @@ ;; auto-mode-alist)) ;;------------------------------------------------------------ ;; -;; Adapted for Red Hat and some fixes made by Tim Powers -;; and Trond Eivind Glomsr�d . -;; -;; Adapted by Chmouel Boudjnah for Mandrake ;;; Code: +(defconst rpm-spec-mode-version "0.12" "Version of `rpm-spec-mode'.") + (defgroup rpm-spec nil - "RPM Spec mode with Emacs/XEmacs enhancements." - :prefix "rpm-spec" + "RPM spec mode with Emacs/XEmacs enhancements." + :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 filelistings or not." + "Add \"%attr\" entry for file listings or not." :type 'boolean :group 'rpm-spec) @@ -99,7 +105,10 @@ Set the macros _target, _target_arch and _target_os accordingly" :type 'string :group 'rpm-spec) -(defcustom rpm-completion-ignore-case t +(define-obsolete-variable-alias + 'rpm-completion-ignore-case 'rpm-spec-completion-ignore-case) + +(defcustom rpm-spec-completion-ignore-case t "*Non-nil means that case differences are ignored during completion. A value of nil means that case is significant. This is used during Tempo template completion." @@ -116,7 +125,7 @@ This is used during Tempo template completion." :type 'boolean :group 'rpm-spec) -(defcustom rpm-spec-test nil +(defcustom rpm-spec-nobuild nil "Do not execute any build stages. Useful for testing out spec files." :type 'boolean :group 'rpm-spec) @@ -128,131 +137,202 @@ the package." :type 'boolean :group 'rpm-spec) -(defcustom rpm-initialize-sections t +(defcustom rpm-spec-nodeps nil + "Do not verify build dependencies." + :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) + +(defcustom rpm-spec-initialize-sections t "Automatically add empty section headings to new spec files." :type 'boolean :group 'rpm-spec) -(defcustom rpm-insert-version t - "Automatically add version in a new changelog entry." +(define-obsolete-variable-alias + 'rpm-insert-version 'rpm-spec-insert-changelog-version) + +(defcustom rpm-spec-insert-changelog-version t + "Automatically add version in a new change log entry." :type 'boolean :group 'rpm-spec) +(defcustom rpm-spec-user-full-name nil + "*Full name of the user. +This is used in the change log and the Packager tag. It defaults to the +value returned by function `user-full-name'." + :type '(choice (const :tag "Use `user-full-name'" nil) + string) + :group 'rpm-spec) + +(defcustom rpm-spec-user-mail-address nil + "*Email address of the user. +This is used in the change log and the Packager tag. It defaults to the +value returned by function `user-mail-address'." + :type '(choice (const :tag "Use `user-mail-address'" nil) + string) + :group 'rpm-spec) + (defgroup rpm-spec-faces nil - "Font lock faces for RPM Spec mode." + "Font lock faces for `rpm-spec-mode'." :group 'rpm-spec :group 'faces) ;;------------------------------------------------------------ ;; variables used by navigation functions. -(defconst rpm-sections +(defconst rpm-sections '("preamble" "description" "prep" "setup" "build" "install" "clean" "changelog" "files") "Partial list of section names.") (defvar rpm-section-list '(("preamble") ("description") ("prep") ("setup") ("build") ("install") - ("clean") ("changelog") ("files")) + ("clean") ("changelog") ("files")) "Partial list of section names.") -(defconst rpm-scripts - '("pre" "post" "preun" "postun" "trigger" "triggerun" "triggerpostun") - "List of rpm scripts") +(defconst rpm-scripts + '("pre" "post" "preun" "postun" + "trigger" "triggerin" "triggerun" "triggerpostun") + "List of rpm scripts.") (defconst rpm-section-seperate "^%\\(\\w+\\)\\s-") -(defconst rpm-section-regexp - "^%\\(\\(description\\)\\|\\(prep\\)\\|\\(changelog\\)\\|\\(build\\)\\|\\(install\\)\\|\\(files\\)\\|\\(clean\\)\\|\\(package\\)\\|\\(pre\\|post\\(un\\)?\\)\\|\\(trigger\\(post\\)?\\([iu]n\\)?\\)\\)\\b" +(defconst rpm-section-regexp + (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) + "\\b")) "Regular expression to match beginning of a section.") ;;------------------------------------------------------------ (defface rpm-spec-tag-face - '(( ((class color) (background light)) (:foreground "blue") ) - ( ((class color) (background dark)) (:foreground "blue") )) + '(( ((class color) (background light)) (:foreground "blue") ) + ( ((class color) (background dark)) (:foreground "blue") )) "*The face used for tags." :group 'rpm-spec-faces) (defface rpm-spec-macro-face - '(( ((class color) (background light)) (:foreground "purple") ) - ( ((class color) (background dark)) (:foreground "yellow") )) + '(( ((class color) (background light)) (:foreground "purple") ) + ( ((class color) (background dark)) (:foreground "yellow") )) "*The face used for macros." :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." + :group 'rpm-spec-faces) + (defface rpm-spec-doc-face - '(( ((class color) (background light)) (:foreground "magenta") ) - ( ((class color) (background dark)) (:foreground "magenta") )) + '(( ((class color) (background light)) (:foreground "magenta") ) + ( ((class color) (background dark)) (:foreground "magenta") )) "*The face used for document files." :group 'rpm-spec-faces) (defface rpm-spec-dir-face - '(( ((class color) (background light)) (:foreground "green") ) - ( ((class color) (background dark)) (:foreground "green") )) + '(( ((class color) (background light)) (:foreground "green") ) + ( ((class color) (background dark)) (:foreground "green") )) "*The face used for directories." :group 'rpm-spec-faces) (defface rpm-spec-package-face - '(( ((class color) (background light)) (:foreground "red") ) - ( ((class color) (background dark)) (:foreground "red") )) + '(( ((class color) (background light)) (:foreground "red") ) + ( ((class color) (background dark)) (:foreground "red") )) "*The face used for files." :group 'rpm-spec-faces) (defface rpm-spec-ghost-face - '(( ((class color) (background light)) (:foreground "red") ) - ( ((class color) (background dark)) (:foreground "red") )) + '(( ((class color) (background light)) (:foreground "red") ) + ( ((class color) (background dark)) (:foreground "red") )) "*The face used for ghost tags." :group 'rpm-spec-faces) ;;; GNU emacs font-lock needs these... -(defvar rpm-spec-macro-face 'rpm-spec-macro-face "*Face for macros") -(defvar rpm-spec-tag-face 'rpm-spec-tag-face "*Face for tags") -(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") -(defvar rpm-spec-doc-face 'rpm-spec-doc-face "*Face for documentation entries") -(defvar rpm-spec-ghost-face 'rpm-spec-ghost-face "*Face for %ghost files") +(defvar rpm-spec-macro-face + 'rpm-spec-macro-face "*Face for macros.") +(defvar rpm-spec-var-face + 'rpm-spec-var-face "*Face for environment variables.") +(defvar rpm-spec-tag-face + 'rpm-spec-tag-face "*Face for tags.") +(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.") +(defvar rpm-spec-doc-face + 'rpm-spec-doc-face "*Face for documentation entries.") +(defvar rpm-spec-ghost-face + 'rpm-spec-ghost-face "*Face for \"%ghost\" files.") (defvar rpm-default-umask "-" - "*Default umask for files, specified with %attr") -(defvar rpm-default-owner "root" - "*Default owner for files, specified with %attr") -(defvar rpm-default-group "root" - "*Default group for files, specified with %attr") + "*Default umask for files, specified with \"%attr\".") +(defvar rpm-default-owner "root" + "*Default owner for files, specified with \"%attr\".") +(defvar rpm-default-group "root" + "*Default group for files, specified with \"%attr\".") ;;------------------------------------------------------------ (defvar rpm-no-gpg nil "Tell rpm not to sign package.") (defvar rpm-tags-list - '(("Autoreqprov") - ("Buildroot") + ;; From RPM 4.1 sources, file build/parsePreamble.c: preambleList[].") + '(("AutoProv") + ("AutoReq") + ("AutoReqProv") + ("BuildArch") + ("BuildArchitectures") + ("BuildConflicts") + ("BuildPreReq") + ("BuildRequires") + ("BuildRoot") ("Conflicts") ("Copyright") ("%description") ("Distribution") - ("Excludearch") - ("Excludeos") - ("Exclusivearch") - ("Exclusiveos") + ("DistURL") + ("DocDir") + ("Epoch") + ("ExcludeArch") + ("ExcludeOS") + ("ExclusiveArch") + ("ExclusiveOS") ("%files") ("Group") ("Icon") ("%ifarch") + ("License") ("Name") - ("Nopatch") - ("Nosource") + ("NoPatch") + ("NoSource") + ("Obsoletes") ("%package") ("Packager") ("Patch") ("Prefix") + ("Prefixes") + ("PreReq") ("Provides") ("Release") ("Requires") + ("RHNPlatform") ("Serial") ("Source") ("Summary") - ("Url") + ("URL") ("Vendor") ("Version")) - "List which elements are valid tags.") + "List of elements that are valid tags.") (defvar rpm-group-tags-list + ;; From RPM 4.1 sources, file GROUPS. '(("Amusements/Games") ("Amusements/Graphics") ("Applications/Archiving") @@ -283,10 +363,10 @@ the package." ("User Interface/X") ("User Interface/X Hardware Support") ) - "List which elements is valid group tags.") + "List of elements that are valid group tags.") (defvar rpm-spec-mode-syntax-table nil - "Syntax table in use in RPM-Spec-mode buffers.") + "Syntax table in use in `rpm-spec-mode' buffers.") (unless rpm-spec-mode-syntax-table (setq rpm-spec-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?\\ "\\" rpm-spec-mode-syntax-table) @@ -306,103 +386,106 @@ the package." (modify-syntax-entry ?\' "." rpm-spec-mode-syntax-table)) (defvar rpm-spec-mode-map nil - "Keymap used in RPM Spec mode.") + "Keymap used in `rpm-spec-mode'.") (unless rpm-spec-mode-map (setq rpm-spec-mode-map (make-sparse-keymap)) (and (functionp 'set-keymap-name) (set-keymap-name rpm-spec-mode-map 'rpm-spec-mode-map)) - (define-key rpm-spec-mode-map "\C-ca" 'rpm-build-ba) - (define-key rpm-spec-mode-map "\C-cb" 'rpm-build-bb) - (define-key rpm-spec-mode-map "\C-cc" 'rpm-build-bc) - (define-key rpm-spec-mode-map "\C-ce" 'rpm-add-change-log-entry) - (define-key rpm-spec-mode-map "\C-cg" 'rpm-goto-section) - (define-key rpm-spec-mode-map "\C-ci" 'rpm-build-bi) - (define-key rpm-spec-mode-map "\C-cl" 'rpm-build-bl) - (define-key rpm-spec-mode-map "\C-cp" 'rpm-build-bp) - (define-key rpm-spec-mode-map "\C-cr" 'rpm-increase-release-tag) - (define-key rpm-spec-mode-map "\C-cs" 'rpm-build-bs) - (define-key rpm-spec-mode-map "\C-cxa" 'rpm-toggle-add-attr) - (define-key rpm-spec-mode-map "\C-cxb" 'rpm-change-buildroot-option) - (define-key rpm-spec-mode-map "\C-cxc" 'rpm-toggle-clean) - (define-key rpm-spec-mode-map "\C-cxg" 'rpm-toggle-sign-gpg) - (define-key rpm-spec-mode-map "\C-cxi" 'rpm-change-timecheck-option) - (define-key rpm-spec-mode-map "\C-cxp" 'rpm-change-target-option) - (define-key rpm-spec-mode-map "\C-cxr" 'rpm-toggle-rmsource) - (define-key rpm-spec-mode-map "\C-cxs" 'rpm-toggle-short-circuit) - (define-key rpm-spec-mode-map "\C-cxt" 'rpm-toggle-test) - ;;May be better to have movement commands on \C-ck, and build on \C-c\C-k - (define-key rpm-spec-mode-map "\C-c\C-i" 'rpm-insert-tag) - (define-key rpm-spec-mode-map "\C-c\C-n" 'rpm-forward-section) - (define-key rpm-spec-mode-map "\C-c\C-p" 'rpm-backward-section) - (define-key rpm-spec-mode-map "\C-c\C-t" 'rpm-insert-true-prefix) - (define-key rpm-spec-mode-map "\C-c\C-cg" 'rpm-files-group) - (define-key rpm-spec-mode-map "\C-c\C-co" 'rpm-files-owner) - (define-key rpm-spec-mode-map "\C-c\C-cu" 'rpm-files-umask) + (define-key rpm-spec-mode-map "\C-c\C-c" 'rpm-change-tag) + (define-key rpm-spec-mode-map "\C-c\C-e" 'rpm-add-change-log-entry) + (define-key rpm-spec-mode-map "\C-c\C-i" 'rpm-insert-tag) + (define-key rpm-spec-mode-map "\C-c\C-n" 'rpm-forward-section) + (define-key rpm-spec-mode-map "\C-c\C-o" 'rpm-goto-section) + (define-key rpm-spec-mode-map "\C-c\C-p" 'rpm-backward-section) + (define-key rpm-spec-mode-map "\C-c\C-r" 'rpm-increase-release-tag) + (define-key rpm-spec-mode-map "\C-c\C-u" 'rpm-insert-true-prefix) + (define-key rpm-spec-mode-map "\C-c\C-ba" 'rpm-build-all) + (define-key rpm-spec-mode-map "\C-c\C-bb" 'rpm-build-binary) + (define-key rpm-spec-mode-map "\C-c\C-bc" 'rpm-build-compile) + (define-key rpm-spec-mode-map "\C-c\C-bi" 'rpm-build-install) + (define-key rpm-spec-mode-map "\C-c\C-bl" 'rpm-list-check) + (define-key rpm-spec-mode-map "\C-c\C-bp" 'rpm-build-prepare) + (define-key rpm-spec-mode-map "\C-c\C-bs" 'rpm-build-source) (define-key rpm-spec-mode-map "\C-c\C-dd" 'rpm-insert-dir) (define-key rpm-spec-mode-map "\C-c\C-do" 'rpm-insert-docdir) (define-key rpm-spec-mode-map "\C-c\C-fc" 'rpm-insert-config) (define-key rpm-spec-mode-map "\C-c\C-fd" 'rpm-insert-doc) (define-key rpm-spec-mode-map "\C-c\C-ff" 'rpm-insert-file) (define-key rpm-spec-mode-map "\C-c\C-fg" 'rpm-insert-ghost) - ;(define-key rpm-spec-mode-map "\C-q" 'indent-spec-exp) - ;(define-key rpm-spec-mode-map "\t" 'sh-indent-line) + (define-key rpm-spec-mode-map "\C-c\C-xa" 'rpm-toggle-add-attr) + (define-key rpm-spec-mode-map "\C-c\C-xb" 'rpm-change-buildroot-option) + (define-key rpm-spec-mode-map "\C-c\C-xc" 'rpm-toggle-clean) + (define-key rpm-spec-mode-map "\C-c\C-xd" 'rpm-toggle-nodeps) + (define-key rpm-spec-mode-map "\C-c\C-xf" 'rpm-files-group) + (define-key rpm-spec-mode-map "\C-c\C-xg" 'rpm-toggle-sign-gpg) + (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-xs" 'rpm-toggle-short-circuit) + (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) ) (defconst rpm-spec-mode-menu - (purecopy '("RPM-Spec" - ["Insert Tag" rpm-insert-tag t] - ["Change Tag" rpm-change-tag t] - "---" - ["Go to section..." rpm-mouse-goto-section :keys "C-c g"] - ["Forward section" rpm-forward-section t] - ["Backward section" rpm-backward-section t] - "---" - ["Add changelog entry..." rpm-add-change-log-entry t] - ["Increase release-tag" rpm-increase-release-tag t] - "---" - ("Add file entry" - ["Regular file..." rpm-insert-file t] - ["Config file..." rpm-insert-config t] - ["Document file..." rpm-insert-doc t] - ["Ghost file..." rpm-insert-ghost t] - "---" - ["Directory..." rpm-insert-dir t] - ["Document directory..." rpm-insert-docdir t] - "---" - ["Insert %{prefix}" rpm-insert-true-prefix t] - "---" - ["Default add \"%attr\" entry" rpm-toggle-add-attr - :style toggle :selected rpm-spec-add-attr] - ["Change default umask for files..." rpm-files-umask t] - ["Change default owner for files..." rpm-files-owner t] - ["Change default group for files..." rpm-files-group t]) - ("Build Options" - ["Short Circuit" rpm-toggle-short-circuit - :style toggle :selected rpm-spec-short-circuit] - ["Remove source" rpm-toggle-rmsource - :style toggle :selected rpm-spec-rmsource] - ["Clean" rpm-toggle-clean - :style toggle :selected rpm-spec-clean] - ["Testing only" rpm-toggle-test - :style toggle :selected rpm-spec-test] - ["GPG Sign" rpm-toggle-sign-gpg - :style toggle :selected rpm-spec-sign-gpg] - "---" - ["Change timecheck value..." rpm-change-timecheck-option t] - ["Change buildroot value..." rpm-change-buildroot-option t] - ["Change target value..." rpm-change-target-option t]) - ("RPM Build" - ["Execute \"%prep\" stage" rpm-build-bp t] - ["Do a \"list check\"" rpm-build-bl t] - ["Do the \"%build\" stage" rpm-build-bc t] - ["Do the \"%install\" stage" rpm-build-bi t] - "---" - ["Build binary package" rpm-build-bb t] - ["Build source package" rpm-build-bs t] - ["Build binary and source" rpm-build-ba t]) - "---" - ["About rpm-spec-mode" rpm-about-rpm-spec-mode t] - ))) + (purecopy '("RPM spec" + ["Insert Tag..." rpm-insert-tag t] + ["Change Tag..." rpm-change-tag t] + "---" + ["Go to section..." rpm-mouse-goto-section :keys "C-c C-o"] + ["Forward section" rpm-forward-section t] + ["Backward section" rpm-backward-section t] + "---" + ["Add change log entry..." rpm-add-change-log-entry t] + ["Increase release tag" rpm-increase-release-tag t] + "---" + ("Add file entry" + ["Regular file..." rpm-insert-file t] + ["Config file..." rpm-insert-config t] + ["Document file..." rpm-insert-doc t] + ["Ghost file..." rpm-insert-ghost t] + "---" + ["Directory..." rpm-insert-dir t] + ["Document directory..." rpm-insert-docdir t] + "---" + ["Insert %{prefix}" rpm-insert-true-prefix t] + "---" + ["Default add \"%attr\" entry" rpm-toggle-add-attr + :style toggle :selected rpm-spec-add-attr] + ["Change default umask for files..." rpm-files-umask t] + ["Change default owner for files..." rpm-files-owner t] + ["Change default group for files..." rpm-files-group t]) + ("Build Options" + ["Short circuit" rpm-toggle-short-circuit + :style toggle :selected rpm-spec-short-circuit] + ["Remove source" rpm-toggle-rmsource + :style toggle :selected rpm-spec-rmsource] + ["Clean" rpm-toggle-clean + :style toggle :selected rpm-spec-clean] + ["No build" rpm-toggle-nobuild + :style toggle :selected rpm-spec-nobuild] + ["GPG sign" rpm-toggle-sign-gpg + :style toggle :selected rpm-spec-sign-gpg] + ["Ignore dependencies" rpm-toggle-nodeps + :style toggle :selected rpm-spec-nodeps] + "---" + ["Change timecheck value..." rpm-change-timecheck-option t] + ["Change buildroot value..." rpm-change-buildroot-option t] + ["Change target value..." rpm-change-target-option t]) + ("RPM Build" + ["Execute \"%prep\" stage" rpm-build-prepare t] + ["Do a \"list check\"" rpm-list-check t] + ["Do the \"%build\" stage" rpm-build-compile t] + ["Do the \"%install\" stage" rpm-build-install t] + "---" + ["Build binary package" rpm-build-binary t] + ["Build source package" rpm-build-source t] + ["Build binary and source" rpm-build-all t]) + "---" + ["About rpm-spec-mode" rpm-about-rpm-spec-mode t] + ))) (defvar rpm-spec-font-lock-keywords '( @@ -411,14 +494,16 @@ the package." (1 rpm-spec-tag-face) (2 rpm-spec-ghost-face)) ("^\\([a-zA-Z0-9]+\\):" 1 rpm-spec-tag-face) - ("%\\(define\\|files\\|package\\|description\\)[ \t]+\\([^ \t\n-]+\\)" - (2 rpm-spec-package-face)) + ("%\\(de\\(fine\\|scription\\)\\|files\\|package\\)[ \t]+\\([^-][^ \t\n]*\\)" + (3 rpm-spec-package-face)) + ("%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) + ("%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\\}\\)):" + ("^\\(.+\\)(\\([a-zA-Z]\\{2,2\\}\\)):" (1 rpm-spec-tag-face) (2 rpm-spec-doc-face)) ("^\\*\\(.*[0-9] \\)\\(.*\\)\\(<.*>\\)\\(.*\\)\n" @@ -427,26 +512,28 @@ the package." (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) ) - "Additional expressions to highlight in RPM Spec mode.") + "Additional expressions to highlight in `rpm-spec-mode'.") ;;Initialize font lock for xemacs (put 'rpm-spec-mode 'font-lock-defaults '(rpm-spec-font-lock-keywords)) (defvar rpm-spec-mode-abbrev-table nil - "Abbrev table in use in RPM-Spec-mode buffers.") + "Abbrev table in use in `rpm-spec-mode' buffers.") (define-abbrev-table 'rpm-spec-mode-abbrev-table ()) ;;------------------------------------------------------------ ;;;###autoload (defun rpm-spec-mode () - "Major mode for editing spec files. + "Major mode for editing RPM spec files. This is much like C mode except for the syntax of comments. It uses the same keymap as C mode and has the same variables for customizing indentation. It has its own abbrev table and its own syntax table. -Turning on RPM Spec mode calls the value of the variable `rpm-spec-mode-hook' +Turning on RPM spec mode calls the value of the variable `rpm-spec-mode-hook' with no args, if that value is non-nil." (interactive) (kill-all-local-variables) @@ -457,18 +544,23 @@ with no args, if that value is non-nil." (require 'cc-mode) (use-local-map rpm-spec-mode-map) (setq major-mode 'rpm-spec-mode) - (setq mode-name "RPM-SPEC") + (rpm-update-mode-name) (setq local-abbrev-table rpm-spec-mode-abbrev-table) (set-syntax-table rpm-spec-mode-syntax-table) (require 'easymenu) - (easy-menu-define rpm-spec-call-menu rpm-spec-mode-map - "Post menu for rpm-spec-mode" rpm-spec-mode-menu) + (easy-menu-define rpm-spec-call-menu rpm-spec-mode-map + "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 (executable-find "rpmbuild") + (setq rpm-spec-build-command "rpmbuild") + (setq rpm-spec-old-rpm t) + (setq rpm-spec-build-command "rpm")) + (make-local-variable 'paragraph-start) (setq paragraph-start (concat "$\\|" page-delimiter)) (make-local-variable 'paragraph-separate) @@ -507,21 +599,25 @@ with no args, if that value is non-nil." (defun rpm-add-change-log-entry (&optional change-log-entry) "Find change log and add an entry for today." - (interactive "sChangelog entry: ") + (interactive "sChange log entry: ") (save-excursion (rpm-goto-section "changelog") - (let ((string (concat "* " (substring (current-time-string) 0 11) - (substring (current-time-string) -4) " " - (user-full-name) " <" user-mail-address ">"))) + (let* ((address (or rpm-spec-user-mail-address (user-mail-address))) + (fullname (or rpm-spec-user-full-name (user-full-name))) + (string (concat "* " (substring (current-time-string) 0 11) + (substring (current-time-string) -4) " " + fullname " <" address ">" + (and rpm-spec-insert-changelog-version + (concat " " (rpm-find-spec-version t)))))) (if (not (search-forward string nil t)) - (insert "\n" string "\n") - (forward-line 2)) + (insert "\n" string "\n") + (forward-line 2)) (insert "- " change-log-entry "\n")))) ;;------------------------------------------------------------ (defun rpm-insert-f (&optional filetype filename) - "Insert new %files entry." + "Insert new \"%files\" entry." (save-excursion (and (rpm-goto-section "files") (rpm-end-of-section)) (if (or (eq filename 1) (not filename)) @@ -539,7 +635,7 @@ with no args, if that value is non-nil." "Insert regular file." (interactive "p") (rpm-insert-f "" filename)) - + (defun rpm-insert-config (&optional filename) "Insert config file." (interactive "p") @@ -568,9 +664,9 @@ with no args, if that value is non-nil." ;;------------------------------------------------------------ (defun rpm-completing-read (prompt table &optional pred require init hist) "Read from the minibuffer, with completion. -Like `completing-read', but the variable `rpm-completion-ignore-case' +Like `completing-read', but the variable `rpm-spec-completion-ignore-case' controls whether case is significant." - (let ((completion-ignore-case rpm-completion-ignore-case)) + (let ((completion-ignore-case rpm-spec-completion-ignore-case)) (completing-read prompt table pred require init hist))) (defun rpm-insert (&optional what file-completion) @@ -601,7 +697,7 @@ controls whether case is significant." (getenv "rpm") (if (file-directory-p "~/rpm") "~/rpm/") (if (file-directory-p "~/RPM") "~/RPM/") - (if (file-directory-p "/usr/src/redhat/")"/usr/src/redhat/") + (if (file-directory-p "/usr/src/redhat/") "/usr/src/redhat/") "/usr/src/RPM")) (defun rpm-insert-n (what &optional arg) @@ -667,7 +763,7 @@ controls whether case is significant." (replace-match (concat "Group: " (insert (rpm-completing-read "Group: " rpm-group-tags-list - nil nil (match-string 1))))) + nil nil (match-string 1))))) (message "Group tag not found...")))) (defun rpm-insert-tag (&optional arg) @@ -686,7 +782,8 @@ controls whether case is significant." "Insert Packager tag." (interactive "p") (beginning-of-line) - (insert "Packager: " (user-full-name) " <" user-mail-address ">\n")) + (insert "Packager: " (or rpm-spec-user-full-name (user-full-name)) + " <" (or rpm-spec-user-mail-address (user-mail-address)) ">\n")) (defun rpm-change-packager (&optional arg) "Update Packager tag." @@ -700,7 +797,7 @@ controls whether case is significant." (save-excursion (rpm-forward-section) (rpm-backward-section) - (if (bobp) "preamble" + (if (bobp) "preamble" (buffer-substring (match-beginning 1) (match-end 1))))) (defun rpm-backward-section nil @@ -740,12 +837,12 @@ Go to beginning of current section." (point)) (defun rpm-goto-section (section) - "Move point to the beginning of the specified section; + "Move point to the beginning of the specified section; leave point at previous location." (interactive (list (rpm-completing-read "Section: " rpm-section-list))) (push-mark) (goto-char (point-min)) - (or + (or (equal section "preamble") (re-search-forward (concat "^%" section "\\b") nil t) (let ((s (cdr rpm-sections))) @@ -757,13 +854,15 @@ leave point at previous location." (insert "\n%" section "\n")))) (defun rpm-mouse-goto-section (&optional section) - (interactive - (x-popup-menu nil - (list "sections" + (interactive + (x-popup-menu + nil + (list "sections" (cons "Sections" (mapcar (lambda (e) (list e e)) rpm-sections)) (cons "Scripts" (mapcar (lambda (e) (list e e)) rpm-scripts)) ))) - (and section ;if user doesn't pick a section, exit quietly. + ;; If user doesn't pick a section, exit quietly. + (and section (if (member section rpm-sections) (rpm-goto-section section) (goto-char (point-min)) @@ -771,17 +870,16 @@ leave point at previous location." (and (re-search-forward "^%files\\b" nil t) (forward-line -1)) (goto-char (point-max)))))) -(defun rpm-insert-true-prefix () +(defun rpm-insert-true-prefix () (interactive) (insert "%{prefix}")) - ;;------------------------------------------------------------ (defun rpm-build (buildoptions) - "Build this rpm-package." + "Build this RPM package." (setq rpm-buffer-name - (concat "*rpmbuild " buildoptions " " + (concat "*" rpm-spec-build-command " " buildoptions " " (file-name-nondirectory buffer-file-name) "*")) (rpm-process-check rpm-buffer-name) (if (get-buffer rpm-buffer-name) @@ -789,7 +887,7 @@ leave point at previous location." (create-file-buffer rpm-buffer-name) (display-buffer rpm-buffer-name) (setq buildoptions (list buildoptions buffer-file-name)) - (if (or rpm-spec-short-circuit rpm-spec-test) + (if (or rpm-spec-short-circuit rpm-spec-nobuild) (setq rpm-no-gpg t)) (if rpm-spec-rmsource (setq buildoptions (cons "--rmsource" buildoptions))) @@ -807,70 +905,78 @@ leave point at previous location." (if (not (equal rpm-spec-target "")) (setq buildoptions (cons "--target" (cons rpm-spec-target buildoptions)))) - (if rpm-spec-test - (setq buildoptions (cons "--test" buildoptions))) + (if rpm-spec-nobuild + (setq buildoptions (cons (if rpm-spec-old-rpm "--test" "--nobuild") + 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)) (goto-char (point-max))) (let ((process - (apply 'start-process "rpmbuild" rpm-buffer-name "rpmbuild" - buildoptions))) + (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")))) (set-process-filter process 'rpm-command-filter))) -(defun rpm-build-bp (&optional arg) +(defun rpm-build-prepare (&optional arg) "Run a `rpmbuild -bp'." (interactive "p") (if rpm-spec-short-circuit - (message "Cannot run `rpmbuild -bp' with --short-circuit") + (message (concat "Cannot run `" rpm-spec-build-command + " -bp' with --short-circuit")) (setq rpm-no-gpg t) (rpm-build "-bp"))) -(defun rpm-build-bl (&optional arg) +(defun rpm-list-check (&optional arg) "Run a `rpmbuild -bl'." (interactive "p") (if rpm-spec-short-circuit - (message "Cannot run `rpmbuild -bl' with --short-circuit") + (message (concat "Cannot run `" rpm-spec-build-command + " -bl' with --short-circuit")) (setq rpm-no-gpg t) (rpm-build "-bl"))) -(defun rpm-build-bc (&optional arg) +(defun rpm-build-compile (&optional arg) "Run a `rpmbuild -bc'." (interactive "p") (setq rpm-no-gpg t) (rpm-build "-bc")) -(defun rpm-build-bi (&optional arg) +(defun rpm-build-install (&optional arg) "Run a `rpmbuild -bi'." (interactive "p") (setq rpm-no-gpg t) (rpm-build "-bi")) -(defun rpm-build-bb (&optional arg) +(defun rpm-build-binary (&optional arg) "Run a `rpmbuild -bb'." (interactive "p") (if rpm-spec-short-circuit - (message "Cannot run `rpmbuild -bb' with --short-circuit") + (message (concat "Cannot run `" rpm-spec-build-command + " -bb' with --short-circuit")) (setq rpm-no-gpg nil) (rpm-build "-bb"))) -(defun rpm-build-bs (&optional arg) +(defun rpm-build-source (&optional arg) "Run a `rpmbuild -bs'." (interactive "p") (if rpm-spec-short-circuit - (message "Cannot run `rpmbuild -bs' with --short-circuit") + (message (concat "Cannot run `" rpm-spec-build-command + " -bs' with --short-circuit")) (setq rpm-no-gpg nil) (rpm-build "-bs"))) -(defun rpm-build-ba (&optional arg) +(defun rpm-build-all (&optional arg) "Run a `rpmbuild -ba'." (interactive "p") (if rpm-spec-short-circuit - (message "Cannot run `rpmbuild -ba' with --short-circuit") + (message (concat "Cannot run `" rpm-spec-build-command + " -ba' with --short-circuit")) (setq rpm-no-gpg nil) (rpm-build "-ba"))) @@ -888,7 +994,7 @@ command." ;;------------------------------------------------------------ (defun rpm-toggle-short-circuit (&optional arg) - "Toggle rpm-spec-short-circuit." + "Toggle `rpm-spec-short-circuit'." (interactive "p") (setq rpm-spec-short-circuit (not rpm-spec-short-circuit)) (rpm-update-mode-name) @@ -896,7 +1002,7 @@ command." (if rpm-spec-short-circuit "on" "off") "."))) (defun rpm-toggle-rmsource (&optional arg) - "Toggle rpm-spec-rmsource." + "Toggle `rpm-spec-rmsource'." (interactive "p") (setq rpm-spec-rmsource (not rpm-spec-rmsource)) (rpm-update-mode-name) @@ -904,23 +1010,23 @@ command." (if rpm-spec-rmsource "on" "off") "."))) (defun rpm-toggle-clean (&optional arg) - "Toggle rpm-spec-clean." + "Toggle `rpm-spec-clean'." (interactive "p") (setq rpm-spec-clean (not rpm-spec-clean)) (rpm-update-mode-name) (message (concat "Turned `--clean' " (if rpm-spec-clean "on" "off") "."))) -(defun rpm-toggle-test (&optional arg) - "Toggle rpm-spec-test." +(defun rpm-toggle-nobuild (&optional arg) + "Toggle `rpm-spec-nobuild'." (interactive "p") - (setq rpm-spec-test (not rpm-spec-test)) + (setq rpm-spec-nobuild (not rpm-spec-nobuild)) (rpm-update-mode-name) - (message (concat "Turned `--test' " - (if rpm-spec-test "on" "off") "."))) + (message (concat "Turned `" (if rpm-spec-old-rpm "--test" "--nobuild") "' " + (if rpm-spec-nobuild "on" "off") "."))) (defun rpm-toggle-sign-gpg (&optional arg) - "Toggle rpm-spec-sign-gpg." + "Toggle `rpm-spec-sign-gpg'." (interactive "p") (setq rpm-spec-sign-gpg (not rpm-spec-sign-gpg)) (rpm-update-mode-name) @@ -928,25 +1034,34 @@ command." (if rpm-spec-sign-gpg "on" "off") "."))) (defun rpm-toggle-add-attr (&optional arg) - "Toggle rpm-spec-add-attr." + "Toggle `rpm-spec-add-attr'." (interactive "p") (setq rpm-spec-add-attr (not rpm-spec-add-attr)) (rpm-update-mode-name) (message (concat "Default add \"attr\" entry turned " (if rpm-spec-add-attr "on" "off") "."))) +(defun rpm-toggle-nodeps (&optional arg) + "Toggle `rpm-spec-nodeps'." + (interactive "p") + (setq rpm-spec-nodeps (not rpm-spec-nodeps)) + (rpm-update-mode-name) + (message (concat "Turned `--nodeps' " + (if rpm-spec-nodeps "on" "off") "."))) + (defun rpm-update-mode-name () - "Update mode-name according to values set." + "Update `mode-name' according to values set." (setq mode-name "RPM-SPEC") (setq modes (concat (if rpm-spec-add-attr "A") - (if rpm-spec-clean "C") - (if rpm-spec-sign-gpg "G") - (if rpm-spec-rmsource "R") - (if rpm-spec-short-circuit "S") - (if rpm-spec-test "T") - )) + (if rpm-spec-clean "C") + (if rpm-spec-nodeps "D") + (if rpm-spec-sign-gpg "G") + (if rpm-spec-nobuild "N") + (if rpm-spec-rmsource "R") + (if rpm-spec-short-circuit "S") + )) (if (not (equal modes "")) - (setq mode-name (concat mode-name ":" modes)))) + (setq mode-name (concat mode-name ":" modes)))) ;;------------------------------------------------------------ @@ -996,36 +1111,48 @@ command." (setq release (concat (int-to-string release) (match-string 2))) (replace-match (concat "Release: " release)) (message (concat "Release tag changed to " release "."))) - (if (search-forward-regexp "^Release:[ \t]*%{?\\([^}]*\\)}?$" nil t) - (rpm-increase-release-with-macros) - (message "No Release tag found..."))))) + (if (search-forward-regexp "^Release:[ \t]*%{?\\([^}]*\\)}?$" nil t) + (rpm-increase-release-with-macros) + (message "No Release tag found..."))))) ;;------------------------------------------------------------ (defun rpm-spec-field-value (field max) + "Get the value of FIELD, searching up to buffer position MAX. +See `search-forward-regexp'." (save-excursion - (let ((str - (progn - (goto-char (point-min)) - (search-forward-regexp (concat field ":[ \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)) - str)))) - -(defun rpm-find-spec-version () + (ignore-errors + (let ((str + (progn + (goto-char (point-min)) + (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)) + str))))) + +(defun rpm-find-spec-version (&optional with-epoch) + "Get the version string. +If WITH-EPOCH is non-nil, the string contains the Epoch/Serial value, +if one is present in the file." (save-excursion (goto-char (point-min)) (let* ((max (search-forward-regexp rpm-section-regexp)) (version (rpm-spec-field-value "Version" max)) - (release (rpm-spec-field-value "Release" max)) ) - (concat version "-" release)))) + (release (rpm-spec-field-value "Release" max)) + (epoch (rpm-spec-field-value "Epoch" max)) ) + (when (and version (< 0 (length version))) + (unless epoch (setq epoch (rpm-spec-field-value "Serial" max))) + (concat (and with-epoch epoch (concat epoch ":")) + version + (and release (concat "-" release))))))) (defun rpm-increase-release-with-macros () (save-excursion @@ -1069,16 +1196,17 @@ command." (setq version (match-string 2 file))) ((eq (string-match "\\(.*\\).spec" file) 0) (setq name (match-string 1 file)))) - + (insert "Summary: " "\nName: " (or name "") "\nVersion: " (or version "") "\nRelease: " (or release "") + "\nLicense: " + "\nGroup: " "\nURL: " "\nSource0: %{name}-%{version}.tar.gz" - "\nLicense: \nGroup: " - "\nBuildRoot: %{_tmppath}/%{name}-root" + "\nBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot" "\n\n%description\n" "\n%prep" "\n%setup -q" @@ -1088,17 +1216,24 @@ command." "\n\n%clean" "\nrm -rf $RPM_BUILD_ROOT" "\n\n%files" - "\n%defattr(-,root,root)\n" + "\n%defattr(-,root,root,-)" + "\n%doc\n" "\n\n%changelog\n") - + (rpm-add-change-log-entry "Initial build.\n"))) ;;------------------------------------------------------------ (defun rpm-about-rpm-spec-mode (&optional arg) - "About rpm-spec-mode." + "About `rpm-spec-mode'." (interactive "p") - (message "Made by Stig Bj�rlykke, ")) + (message + (concat "rpm-spec-mode version " + rpm-spec-mode-version + " by Stig Bj�rlykke, "))) + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.spec$" . rpm-spec-mode)) (provide 'rpm-spec-mode) diff --git a/rpm-spec-mode.el-0.14-xemacs-compat.patch b/rpm-spec-mode.el-0.14-xemacs-compat.patch new file mode 100644 index 0000000..49920e2 --- /dev/null +++ b/rpm-spec-mode.el-0.14-xemacs-compat.patch @@ -0,0 +1,43 @@ +diff -u rpm-spec-mode.el~ rpm-spec-mode.el +--- rpm-spec-mode.el~ 2002-12-02 12:00:38.000000000 +0900 ++++ rpm-spec-mode.el 2002-12-02 12:00:38.000000000 +0900 +@@ -105,6 +105,10 @@ + :type 'string + :group 'rpm-spec) + ++;; XEmacs compatibility function ++(unless (fboundp 'define-obsolete-variable-alias) ++ (defalias 'define-obsolete-variable-alias 'make-obsolete-variable)) ++ + (define-obsolete-variable-alias + 'rpm-completion-ignore-case 'rpm-spec-completion-ignore-case) + +@@ -597,6 +601,14 @@ + + ;;------------------------------------------------------------ + ++;; XEmacs compatibility function ++(unless (fboundp 'user-mail-address) ++ (defun user-mail-address () ++ "Return value of `user-mail-address'. ++ ++XEmacs sendmail compatibility function." ++ user-mail-address)) ++ + (defun rpm-add-change-log-entry (&optional change-log-entry) + "Find change log and add an entry for today." + (interactive "sChange log entry: ") +@@ -1117,6 +1129,13 @@ + + ;;------------------------------------------------------------ + ++;; XEmacs compatibility function ++(unless (fboundp 'ignore-errors) ++ (defmacro ignore-errors (&rest body) ++ "Execute FORMS; if an error occurs, return nil. ++Otherwise, return result of last FORM." ++ `(condition-case nil (progn ,@body) (error nil)))) ++ + (defun rpm-spec-field-value (field max) + "Get the value of FIELD, searching up to buffer position MAX. + See `search-forward-regexp'." diff --git a/site-start.el b/site-start.el index 5805b10..1210ba8 100644 --- a/site-start.el +++ b/site-start.el @@ -1,33 +1,20 @@ -;; Aspell is a replacement for ispell +;; aspell is a replacement for ispell (this duplicates of aspell-init.el) (setq-default ispell-program-name "aspell") -;; Add python support -(require 'python-mode) -(setq auto-mode-alist - (cons '("\\.py$" . python-mode) auto-mode-alist)) -(setq interpreter-mode-alist - (cons '("python" . python-mode) interpreter-mode-alist)) - -;; run functions from the /usr/share/emacs/site-lisp/site-start.d directory -;; Files in this directory ending with ".el" are run on startup - -(mapc 'load (directory-files "/usr/share/emacs/site-lisp/site-start.d" t "\\.el\\'")) - -;; Use the rpm-spec-mode for spec files -(require 'rpm-spec-mode) -(setq auto-mode-alist - (cons '("\\.spec$" . rpm-spec-mode) auto-mode-alist)) - -;; Enable utf-8 in locales using utf-8. In RHL, all of these end in .UTF-8 -;; The utf-8 support in emacs is limited, problems can be expected - especially -;; outside latin1 - -(cond ((equal (substring (concat " " (getenv "LANG")) -5) "UTF-8") - (setq locale-coding-system 'utf-8) - (set-terminal-coding-system 'utf-8) - (set-keyboard-coding-system 'utf-8) - (set-selection-coding-system 'utf-8) - (prefer-coding-system 'utf-8))) - - - +;; load ".el" files in "/usr/share/emacs/site-lisp/site-start.d/" on startup +(mapc 'load + (directory-files "/usr/share/emacs/site-lisp/site-start.d" t "\\.el\\'")) + +;; Enable utf-8 in locales using utf-8. In RHL, all of these end in ".UTF-8". +;; The utf-8 support in Emacs is limited, problems can be expected - especially +;; outside latin-1 +(cond ((equal (substring (concat " " (or (getenv "LC_ALL") + (getenv "LC_CTYPE") + (getenv "LANG"))) + -5) + "UTF-8") + (setq locale-coding-system 'utf-8) + (set-terminal-coding-system 'utf-8) + (set-keyboard-coding-system 'utf-8) + (set-selection-coding-system 'utf-8) + (prefer-coding-system 'utf-8)))