update-subdirs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. # Write into $1/subdirs.el a list of subdirs of directory $1.
  3. # Copyright (C) 1994-1995, 1997, 1999, 2001-2012
  4. # Free Software Foundation, Inc.
  5. # This file is part of GNU Emacs.
  6. # GNU Emacs is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. # GNU Emacs is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  16. cd $1
  17. for file in *; do
  18. case $file in
  19. *.elc | *.el | term | RCS | CVS | Old | . | .. | =* | *~ | *.orig | *.rej)
  20. ;;
  21. *)
  22. if [ -d $file ]; then
  23. if [ "$file" = "obsolete" ]; then
  24. subdirs="$subdirs \"$file\""
  25. else
  26. subdirs="\"$file\" $subdirs"
  27. fi
  28. fi
  29. ;;
  30. esac
  31. done
  32. if [ "x$subdirs" = x ]; then
  33. rm -f subdirs.el
  34. else
  35. rm -f subdirs.el~
  36. echo ";; In load-path, after this directory should come
  37. ;; certain of its subdirectories. Here we specify them.
  38. (normal-top-level-add-to-load-path '($subdirs))
  39. ;; Local" "Variables:
  40. ;; version-control: never
  41. ;; no-byte-compile: t
  42. ;; End:" > subdirs.el~
  43. if cmp "subdirs.el" "subdirs.el~" >/dev/null 2>&1; then
  44. :; # echo "subdirs.el unchanged";
  45. else
  46. mv subdirs.el~ subdirs.el
  47. fi
  48. fi