update-subdirs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # Write into $1/subdirs.el a list of subdirs of directory $1.
  3. # Copyright (C) 1994-1995, 1997, 1999, 2001-2017 Free Software
  4. # 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" || exit 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. ;; no-update-autoloads: t
  43. ;; End:" > subdirs.el~
  44. if cmp "subdirs.el" "subdirs.el~" >/dev/null 2>&1; then
  45. rm subdirs.el~
  46. else
  47. mv subdirs.el~ subdirs.el
  48. fi
  49. fi