update-subdirs 1.58 KB
Newer Older
Dave Love's avatar
#  
Dave Love committed
1 2
#!/bin/sh
# Write into $1/subdirs.el a list of subdirs of directory $1.
Gerd Moellmann's avatar
Gerd Moellmann committed
3

4 5
# Copyright (C) 1994-1995, 1997, 1999, 2001-2011
#   Free Software Foundation, Inc.
6

Gerd Moellmann's avatar
Gerd Moellmann committed
7
# This file is part of GNU Emacs.
8 9

# GNU Emacs is free software: you can redistribute it and/or modify
Gerd Moellmann's avatar
Gerd Moellmann committed
10
# it under the terms of the GNU General Public License as published by
11 12 13
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

Gerd Moellmann's avatar
Gerd Moellmann committed
14 15 16 17
# GNU Emacs 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.
18

Gerd Moellmann's avatar
Gerd Moellmann committed
19
# You should have received a copy of the GNU General Public License
20 21
# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

Gerd Moellmann's avatar
Gerd Moellmann committed
22

Dave Love's avatar
#  
Dave Love committed
23 24 25
cd $1
for file in *; do
    case $file in
Stefan Monnier's avatar
Stefan Monnier committed
26
	*.elc | *.el | term | RCS | CVS | Old | . | .. | =* | *~ | *.orig | *.rej)
27
	  ;;
Dave Love's avatar
#  
Dave Love committed
28 29
	*)
	    if [ -d $file ]; then
Chong Yidong's avatar
Chong Yidong committed
30 31 32 33 34
		if [ "$file" = "obsolete" ]; then
		    subdirs="$subdirs \"$file\""
		else
		    subdirs="\"$file\" $subdirs"
		fi
Dave Love's avatar
#  
Dave Love committed
35
	    fi
Chong Yidong's avatar
Chong Yidong committed
36
	    ;;
Dave Love's avatar
#  
Dave Love committed
37 38 39 40 41 42
    esac
done

if [ "x$subdirs" = x ]; then
  rm -f subdirs.el
else
Andreas Schwab's avatar
Andreas Schwab committed
43 44 45 46 47
  rm -f subdirs.el~
  echo ";; -*- no-byte-compile: t -*-
;; In load-path, after this directory should come
;; certain of its subdirectories.  Here we specify them.
(normal-top-level-add-to-load-path '($subdirs))
48 49 50
;; Local" "Variables:
;; version-control: never
;; no-byte-compile: t
Andreas Schwab's avatar
Andreas Schwab committed
51
;; End:" > subdirs.el~
52 53 54
  if cmp "subdirs.el" "subdirs.el~" >/dev/null 2>&1; then
    :; # echo "subdirs.el unchanged";
  else
Andreas Schwab's avatar
Andreas Schwab committed
55
  mv subdirs.el~ subdirs.el
56
  fi
Dave Love's avatar
#  
Dave Love committed
57
fi