annotate lisp/blessmail.el @ 5075:868a9ffcc37b

Normally return a compiled function if one argument, #'constantly. 2010-02-24 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (constantly): Normally return a compiled function from #'constantly if we are handed a single argument. Shouldn't actually matter, the overhead for returning a single constant in a lambda form vs. in a compiled function is minuscule, but using compiled functions as much as possible is good style in XEmacs, our interpreter is not stellar (nor indeed should it need to be).
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 24 Feb 2010 17:17:13 +0000
parents d44af0c54775
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1 ;;; blessmail.el --- Decide whether movemail needs special privileges.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
4
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
6 ;; Keywords: internal
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
7
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
9
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
13 ;; any later version.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
14
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
18 ;; General Public License for more details.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
19
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
23 ;; 02111-1307, USA.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
24
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
25 ;;; Synched up with: FSF 19.34.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
26
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
27 ;;; Commentary:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
28
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
29 ;; This is loaded into a bare Emacs to create the blessmail script,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
30 ;; which (on systems that need it) is used during installation
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
31 ;; to give appropriate permissions to movemail.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
32 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
33 ;; It has to be done from lisp in order to be sure of getting the
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
34 ;; correct value of rmail-spool-directory.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
35
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
36 ;;; Code:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
37
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
38 ;; These are no longer needed because we run this in emacs instead of temacs.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
39 ;; (message "Using load-path %s" load-path)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
40 ;; (load "paths.el")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
41 ;; It is not safe to load site-init.el here, because it might have things in it
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
42 ;; that won't load properly unless all the rest of Emacs is loaded.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
43
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
44 (let ((dirname (directory-file-name rmail-spool-directory))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
45 linkname attr modes)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
46 ;; Check for symbolic link
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
47 (while (setq linkname (file-symlink-p dirname))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
48 (setq dirname (if (file-name-absolute-p linkname)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
49 linkname
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
50 (concat (file-name-directory dirname) linkname))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
51 (insert "#!/bin/sh\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
52 (setq attr (file-attributes dirname))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
53 (if (not (eq t (car attr)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
54 (insert (format "echo %s is not a directory\n" rmail-spool-directory))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
55 (setq modes (nth 8 attr))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
56 (cond ((= ?w (aref modes 8))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
57 ;; Nothing needs to be done.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
58 )
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
59 ((= ?w (aref modes 5))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
60 (insert "chgrp " (number-to-string (nth 3 attr))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
61 " $* && chmod g+s $*\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
62 ((= ?w (aref modes 2))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
63 (insert "chown " (number-to-string (nth 2 attr))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
64 " $* && chmod u+s $*\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
65 (t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
66 (insert "chown root $* && chmod u+s $*\n"))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
67 (insert "echo mail directory = " dirname "\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
68 (write-region (point-min) (point-max) "blessmail")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
69 (kill-emacs)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
70
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
71 ;;; blessmail.el ends here